@@ -8,6 +8,7 @@ import '../../../configs/theme/app_theme.dart';
8
8
import '../../../data/view/auth/widgets/saved_users_bottom_sheet.dart' ;
9
9
import '../../../data/view/auth/widgets/save_user_bottom_sheet.dart' ;
10
10
import '../../../data/services/shared_prefs_service.dart' ;
11
+ import '../../providers/theme_settings_provider.dart' ;
11
12
12
13
class LoginScreen extends ConsumerStatefulWidget {
13
14
const LoginScreen ({super .key});
@@ -32,17 +33,26 @@ class _LoginScreenState extends ConsumerState<LoginScreen> {
32
33
33
34
@override
34
35
Widget build (BuildContext context) {
36
+ final themeSettings = ref.watch (themeSettingsProvider);
37
+
35
38
return Scaffold (
36
39
body: Stack (
37
40
children: [
38
41
// Background Image
39
42
Positioned .fill (
40
- child: CachedNetworkImage (
41
- imageUrl: '${AppImages .aiBackground }?auto=format&fit=crop&w=800&q=80' ,
42
- fit: BoxFit .cover,
43
- color: Colors .black.withOpacity (0.7 ),
44
- colorBlendMode: BlendMode .darken,
45
- ),
43
+ child: themeSettings.backgroundImage != null
44
+ ? Image .asset (
45
+ themeSettings.backgroundImage! ,
46
+ fit: BoxFit .cover,
47
+ // color: Colors.black.withOpacity(0.7),
48
+ // colorBlendMode: BlendMode.darken,
49
+ )
50
+ : CachedNetworkImage (
51
+ imageUrl: '${AppImages .aiBackground }?auto=format&fit=crop&w=800&q=80' ,
52
+ fit: BoxFit .cover,
53
+ color: Colors .black.withOpacity (0.7 ),
54
+ colorBlendMode: BlendMode .darken,
55
+ ),
46
56
),
47
57
// Content
48
58
SafeArea (
@@ -61,15 +71,15 @@ class _LoginScreenState extends ConsumerState<LoginScreen> {
61
71
Text (
62
72
'Welcome Back' ,
63
73
style: Theme .of (context).textTheme.headlineMedium? .copyWith (
64
- color: Colors .white ,
74
+ color: themeSettings.textColor ,
65
75
fontWeight: FontWeight .bold,
66
76
),
67
77
),
68
78
const SizedBox (height: 8 ),
69
79
Text (
70
80
'Login to continue your AI journey' ,
71
81
style: Theme .of (context).textTheme.titleMedium? .copyWith (
72
- color: Colors .white70 ,
82
+ color: themeSettings.textColorSecondary ,
73
83
),
74
84
),
75
85
const SizedBox (height: 48 ),
@@ -85,21 +95,21 @@ class _LoginScreenState extends ConsumerState<LoginScreen> {
85
95
// Email Field
86
96
TextFormField (
87
97
controller: _emailController,
88
- style: const TextStyle (color: Colors .white ),
98
+ style: TextStyle (color: themeSettings.textColor ),
89
99
decoration: InputDecoration (
90
100
labelText: 'Email' ,
91
- labelStyle: const TextStyle (color: Colors .white70 ),
92
- prefixIcon: const Icon (Icons .email, color: Colors .white70 ),
101
+ labelStyle: TextStyle (color: themeSettings.textColorSecondary ),
102
+ prefixIcon: Icon (Icons .email, color: themeSettings.textColorSecondary ),
93
103
border: OutlineInputBorder (
94
104
borderRadius: BorderRadius .circular (12 ),
95
105
),
96
106
enabledBorder: OutlineInputBorder (
97
107
borderRadius: BorderRadius .circular (12 ),
98
- borderSide: const BorderSide (color: Colors .white30 ),
108
+ borderSide: BorderSide (color: themeSettings.textColorSecondary. withOpacity ( 0.3 ) ),
99
109
),
100
110
focusedBorder: OutlineInputBorder (
101
111
borderRadius: BorderRadius .circular (12 ),
102
- borderSide: BorderSide (color: AppTheme .primaryColor),
112
+ borderSide: BorderSide (color: themeSettings .primaryColor),
103
113
),
104
114
),
105
115
keyboardType: TextInputType .emailAddress,
@@ -129,32 +139,28 @@ class _LoginScreenState extends ConsumerState<LoginScreen> {
129
139
// Password Field
130
140
TextFormField (
131
141
controller: _passwordController,
132
- style: const TextStyle (color: Colors .white ),
142
+ style: TextStyle (color: themeSettings.textColor ),
133
143
decoration: InputDecoration (
134
144
labelText: 'Password' ,
135
- labelStyle: const TextStyle (color: Colors .white70 ),
136
- prefixIcon: const Icon (Icons .lock, color: Colors .white70 ),
145
+ labelStyle: TextStyle (color: themeSettings.textColorSecondary ),
146
+ prefixIcon: Icon (Icons .lock, color: themeSettings.textColorSecondary ),
137
147
border: OutlineInputBorder (
138
148
borderRadius: BorderRadius .circular (12 ),
139
149
),
140
150
enabledBorder: OutlineInputBorder (
141
151
borderRadius: BorderRadius .circular (12 ),
142
- borderSide: const BorderSide (color: Colors .white30 ),
152
+ borderSide: BorderSide (color: themeSettings.textColorSecondary. withOpacity ( 0.3 ) ),
143
153
),
144
154
focusedBorder: OutlineInputBorder (
145
155
borderRadius: BorderRadius .circular (12 ),
146
- borderSide: BorderSide (color: AppTheme .primaryColor),
156
+ borderSide: BorderSide (color: themeSettings .primaryColor),
147
157
),
148
158
suffixIcon: IconButton (
149
159
icon: Icon (
150
160
_isPasswordVisible ? Icons .visibility : Icons .visibility_off,
151
- color: Colors .white70 ,
161
+ color: themeSettings.textColorSecondary ,
152
162
),
153
- onPressed: () {
154
- setState (() {
155
- _isPasswordVisible = ! _isPasswordVisible;
156
- });
157
- },
163
+ onPressed: () => setState (() => _isPasswordVisible = ! _isPasswordVisible),
158
164
),
159
165
),
160
166
obscureText: ! _isPasswordVisible,
@@ -174,26 +180,28 @@ class _LoginScreenState extends ConsumerState<LoginScreen> {
174
180
ElevatedButton (
175
181
onPressed: _isLoading ? null : _handleLogin,
176
182
style: ElevatedButton .styleFrom (
177
- backgroundColor: AppTheme .primaryColor,
183
+ backgroundColor: themeSettings.primaryColor,
184
+ foregroundColor: themeSettings.textColor,
178
185
padding: const EdgeInsets .symmetric (vertical: 16 ),
179
186
shape: RoundedRectangleBorder (
180
187
borderRadius: BorderRadius .circular (12 ),
181
188
),
182
189
),
183
190
child: _isLoading
184
- ? const SizedBox (
191
+ ? SizedBox (
185
192
height: 20 ,
186
193
width: 20 ,
187
194
child: CircularProgressIndicator (
188
195
strokeWidth: 2 ,
189
- valueColor: AlwaysStoppedAnimation <Color >(Colors .white ),
196
+ valueColor: AlwaysStoppedAnimation <Color >(themeSettings.textColor ),
190
197
),
191
198
)
192
- : const Text (
199
+ : Text (
193
200
'Login' ,
194
201
style: TextStyle (
195
202
fontSize: 18 ,
196
203
fontWeight: FontWeight .bold,
204
+ color: themeSettings.textColor,
197
205
),
198
206
),
199
207
),
@@ -204,9 +212,9 @@ class _LoginScreenState extends ConsumerState<LoginScreen> {
204
212
onPressed: () {
205
213
Navigator .pushNamedAndRemoveUntil (context, RoutesName .signup, (route) => false );
206
214
},
207
- child: const Text (
215
+ child: Text (
208
216
"Don't have an account? Sign up" ,
209
- style: TextStyle (color: Colors .white70 ),
217
+ style: TextStyle (color: themeSettings.textColorSecondary ),
210
218
),
211
219
),
212
220
],
0 commit comments