@@ -5,8 +5,13 @@ import 'package:airqo/src/app/auth/widgets/know_your_air.dart';
5
5
import 'package:airqo/src/app/auth/widgets/welcome_widget.dart' ;
6
6
import 'package:airqo/src/meta/utils/colors.dart' ;
7
7
import 'package:flutter/material.dart' ;
8
+ import 'package:flutter_bloc/flutter_bloc.dart' ;
9
+ import 'package:flutter_svg/flutter_svg.dart' ;
8
10
import 'package:smooth_page_indicator/smooth_page_indicator.dart' ;
9
11
12
+ import '../../shared/pages/nav_page.dart' ;
13
+ import '../bloc/auth_bloc.dart' ;
14
+
10
15
class WelcomeScreen extends StatefulWidget {
11
16
const WelcomeScreen ({super .key});
12
17
@@ -38,101 +43,126 @@ class _WelcomeScreenState extends State<WelcomeScreen> {
38
43
39
44
@override
40
45
Widget build (BuildContext context) {
41
- return Scaffold (
42
- body: Column (
43
- children: [
44
- Stack (
45
- children: [
46
- SizedBox (
47
- height: MediaQuery .of (context).size.height * 0.6 ,
48
- child: PageView (
49
- controller: controller,
50
- onPageChanged: changeIndex,
51
- children: [
52
- WelcomeWidget (),
53
- BreatheClean (),
54
- KnowYourAir (),
55
- ],
46
+ return BlocListener <AuthBloc , AuthState >(
47
+ listener: (context, state) {
48
+ if (state is GuestUser ) {
49
+ Future .microtask (() => Navigator .of (context).pushReplacement (
50
+ MaterialPageRoute (builder: (context) => NavPage ()),
51
+ ));
52
+ }
53
+ },
54
+ child: Scaffold (
55
+ body: Column (
56
+ children: [
57
+ Stack (
58
+ children: [
59
+ SizedBox (
60
+ height: MediaQuery .of (context).size.height * 0.6 ,
61
+ child: PageView (
62
+ controller: controller,
63
+ onPageChanged: changeIndex,
64
+ children: [
65
+ WelcomeWidget (),
66
+ BreatheClean (),
67
+ KnowYourAir (),
68
+ ],
69
+ ),
56
70
),
57
- ),
58
- Container (
59
- width : double .infinity ,
60
- height : MediaQuery . of (context).size.height * 0.6 ,
61
- child : Column (
62
- mainAxisAlignment : MainAxisAlignment .end,
63
- children : [
64
- AnimatedSmoothIndicator (
65
- activeIndex : currentIndex ,
66
- count : 3 ,
67
- effect : ExpandingDotsEffect (
68
- dotWidth : 7 ,
69
- radius : 7 ,
70
- dotColor : Color (0xff60646C ),
71
- // activeDotColor: Color(0xffF6F6F7) ,
72
- activeDotColor : AppColors .primaryColor ,
73
- dotHeight : 7 ),
74
- ),
75
- SizedBox (height : 16 )
76
- ] ,
71
+ Container (
72
+ width : double .infinity,
73
+ height : MediaQuery . of (context).size.height * 0.6 ,
74
+ child : Column (
75
+ mainAxisAlignment : MainAxisAlignment .end,
76
+ children : [
77
+ AnimatedSmoothIndicator (
78
+ activeIndex : currentIndex,
79
+ count : 3 ,
80
+ effect : ExpandingDotsEffect (
81
+ dotWidth : 7 ,
82
+ radius : 7 ,
83
+ dotColor : Color ( 0xff60646C ) ,
84
+ // activeDotColor : Color(0xffF6F6F7 ),
85
+ activeDotColor: AppColors .primaryColor ,
86
+ dotHeight : 7 ) ,
87
+ ),
88
+ SizedBox (height : 16 )
89
+ ],
90
+ ) ,
77
91
),
78
- ),
79
- ],
80
- ),
81
- SizedBox (
82
- height: MediaQuery .of (context).size.height * 0.4 ,
83
- child: Padding (
84
- padding: const EdgeInsets .symmetric (horizontal: 16 * 2 ),
85
- child: Column (
86
- mainAxisAlignment: MainAxisAlignment .center,
87
- children: [
88
- InkWell (
89
- onTap: () => Navigator .of (context).push (MaterialPageRoute (
90
- builder: (context) => CreateAccountScreen ())),
91
- child: Container (
92
- height: 56 ,
93
- decoration: BoxDecoration (
94
- color: AppColors .primaryColor,
95
- borderRadius: BorderRadius .circular (4 )),
96
- child: Center (
97
- child: Text (
98
- "Create Account" ,
99
- style: TextStyle (
100
- fontWeight: FontWeight .w500,
101
- color: Colors .white,
92
+ ],
93
+ ),
94
+ SizedBox (
95
+ height: MediaQuery .of (context).size.height * 0.4 ,
96
+ child: Padding (
97
+ padding: const EdgeInsets .symmetric (horizontal: 16 * 2 ),
98
+ child: Column (
99
+ mainAxisAlignment: MainAxisAlignment .center,
100
+ children: [
101
+ InkWell (
102
+ onTap: () => Navigator .of (context).push (MaterialPageRoute (
103
+ builder: (context) => CreateAccountScreen ())),
104
+ child: Container (
105
+ height: 56 ,
106
+ decoration: BoxDecoration (
107
+ color: AppColors .primaryColor,
108
+ borderRadius: BorderRadius .circular (4 )),
109
+ child: Center (
110
+ child: Text (
111
+ "Create Account" ,
112
+ style: TextStyle (
113
+ fontWeight: FontWeight .w500,
114
+ color: Colors .white,
115
+ ),
116
+ ),
117
+ ),
118
+ ),
119
+ ),
120
+ SizedBox (height: 18 ),
121
+ InkWell (
122
+ onTap: () => Navigator .of (context).push (
123
+ MaterialPageRoute (builder: (context) => LoginPage ())),
124
+ child: Container (
125
+ height: 56 ,
126
+ decoration: BoxDecoration (
127
+ color: Theme .of (context).brightness == Brightness .dark
128
+ ? Colors .white
129
+ : Theme .of (context).highlightColor,
130
+ borderRadius: BorderRadius .circular (4 )),
131
+ child: Center (
132
+ child: Text (
133
+ "Login Here" ,
134
+ style: TextStyle (
135
+ fontWeight: FontWeight .w500, color: Colors .black),
102
136
),
103
137
),
104
138
),
105
139
),
106
- ),
107
- SizedBox (height: 16 ),
108
- InkWell (
109
- onTap: () => Navigator .of (context).push (
110
- MaterialPageRoute (builder: (context) => LoginPage ())),
111
- child: Container (
112
- height: 56 ,
113
- decoration: BoxDecoration (
114
- color: Theme .of (context).brightness == Brightness .dark
115
- ? Colors .white
116
- : Theme .of (context).highlightColor,
117
- borderRadius: BorderRadius .circular (4 )),
140
+ SizedBox (height: 18 ),
141
+
142
+ InkWell (
143
+ onTap: () => context.read <AuthBloc >().add (UseAsGuest ()),
118
144
child: Center (
119
- child: Text (
120
- "Login Here" ,
121
- style: TextStyle (
122
- fontWeight: FontWeight .w500, color: Colors .black),
145
+ child: Row (
146
+ mainAxisAlignment: MainAxisAlignment .center,
147
+ children: [
148
+ Text ("Continue as guest " ,
149
+ style: TextStyle (
150
+ color: AppColors .boldHeadlineColor2,
151
+ fontWeight: FontWeight .w500)),
152
+ SvgPicture .asset ('assets/icons/chevron-right.svg' ,
153
+ height: 16.0 ,
154
+ width: 16.0 ,
155
+ color: AppColors .boldHeadlineColor2,)
156
+ ],
123
157
),
124
158
),
125
159
),
126
- ),
127
- SizedBox (height: 16 ),
128
- Text (
129
- "" ,
130
- style: TextStyle (color: AppColors .boldHeadlineColor),
131
- )
132
- ],
133
- ),
134
- ))
135
- ],
136
- ));
160
+
161
+ ],
162
+ ),
163
+ ))
164
+ ],
165
+ )),
166
+ );
137
167
}
138
168
}
0 commit comments