@@ -9,6 +9,7 @@ import '../../../configs/routes/routes_name.dart';
9
9
import '../../services/shared_prefs_service.dart' ;
10
10
import '../../providers/chat_provider.dart' ;
11
11
import '../../../data/view/settings/theme_settings_screen.dart' ;
12
+ import '../../providers/theme_settings_provider.dart' ;
12
13
13
14
class ProfileScreen extends ConsumerStatefulWidget {
14
15
const ProfileScreen ({super .key});
@@ -20,7 +21,8 @@ class ProfileScreen extends ConsumerStatefulWidget {
20
21
class _ProfileScreenState extends ConsumerState <ProfileScreen > {
21
22
@override
22
23
Widget build (BuildContext context) {
23
- final chats = ref.watch (chatProvider); // Get chats from provider
24
+ final chats = ref.watch (chatProvider);
25
+ final themeSettings = ref.watch (themeSettingsProvider);
24
26
25
27
// Calculate stats
26
28
final totalChats = chats.length;
@@ -39,20 +41,33 @@ class _ProfileScreenState extends ConsumerState<ProfileScreen> {
39
41
),
40
42
body: Stack (
41
43
children: [
42
- // Background Image with error handling
44
+ // Updated Background Image
43
45
Positioned .fill (
44
- child: CachedNetworkImage (
45
- imageUrl: '${AppImages .profileBg }?auto=format&fit=crop&w=800&q=80' ,
46
- fit: BoxFit .cover,
47
- color: Colors .black.withOpacity (0.7 ),
48
- colorBlendMode: BlendMode .darken,
49
- errorWidget: (context, url, error) => Container (
50
- color: Theme .of (context).scaffoldBackgroundColor,
51
- ),
52
- placeholder: (context, url) => Container (
53
- color: Theme .of (context).scaffoldBackgroundColor,
54
- ),
55
- ),
46
+ child: themeSettings.backgroundImage.startsWith ('assets/' )
47
+ ? Container (
48
+ decoration: BoxDecoration (
49
+ image: DecorationImage (
50
+ image: AssetImage (themeSettings.backgroundImage),
51
+ fit: BoxFit .cover,
52
+ colorFilter: ColorFilter .mode (
53
+ Colors .black.withOpacity (0.7 ),
54
+ BlendMode .darken,
55
+ ),
56
+ ),
57
+ ),
58
+ )
59
+ : CachedNetworkImage (
60
+ imageUrl: themeSettings.backgroundImage,
61
+ fit: BoxFit .cover,
62
+ color: Colors .black.withOpacity (0.7 ),
63
+ colorBlendMode: BlendMode .darken,
64
+ errorWidget: (context, url, error) => Container (
65
+ color: Theme .of (context).scaffoldBackgroundColor,
66
+ ),
67
+ placeholder: (context, url) => Container (
68
+ color: Theme .of (context).scaffoldBackgroundColor,
69
+ ),
70
+ ),
56
71
),
57
72
// Content
58
73
SafeArea (
@@ -70,7 +85,7 @@ class _ProfileScreenState extends ConsumerState<ProfileScreen> {
70
85
decoration: BoxDecoration (
71
86
shape: BoxShape .circle,
72
87
border: Border .all (
73
- color: AppTheme .primaryColor,
88
+ color: themeSettings .primaryColor,
74
89
width: 3 ,
75
90
),
76
91
),
@@ -89,8 +104,8 @@ class _ProfileScreenState extends ConsumerState<ProfileScreen> {
89
104
bottom: 0 ,
90
105
child: Container (
91
106
padding: const EdgeInsets .all (4 ),
92
- decoration: const BoxDecoration (
93
- color: AppTheme .primaryColor,
107
+ decoration: BoxDecoration (
108
+ color: themeSettings .primaryColor,
94
109
shape: BoxShape .circle,
95
110
),
96
111
child: const Icon (
@@ -155,10 +170,11 @@ class _ProfileScreenState extends ConsumerState<ProfileScreen> {
155
170
}
156
171
157
172
Widget _buildStatItem (String label, String value) {
173
+ final themeSettings = ref.watch (themeSettingsProvider);
158
174
return Container (
159
175
padding: const EdgeInsets .symmetric (horizontal: 24 , vertical: 16 ),
160
176
decoration: BoxDecoration (
161
- color: Colors .white .withOpacity (0.1 ),
177
+ color: themeSettings.systemBubbleColor .withOpacity (0.1 ),
162
178
borderRadius: BorderRadius .circular (16 ),
163
179
),
164
180
child: Column (
@@ -306,13 +322,15 @@ class _ProfileScreenState extends ConsumerState<ProfileScreen> {
306
322
required String title,
307
323
required VoidCallback onTap,
308
324
}) {
325
+ final themeSettings = ref.watch (themeSettingsProvider);
309
326
return ListTile (
310
- leading: Icon (icon, color: Colors .white70),
327
+ tileColor: themeSettings.systemBubbleColor.withOpacity (0.1 ),
328
+ leading: Icon (icon, color: themeSettings.primaryColor),
311
329
title: Text (
312
330
title,
313
- style: const TextStyle (color: Colors .white ),
331
+ style: TextStyle (color: themeSettings.primaryColor ),
314
332
),
315
- trailing: const Icon (Icons .chevron_right, color: Colors .white70 ),
333
+ trailing: Icon (Icons .chevron_right, color: themeSettings.primaryColor ),
316
334
onTap: onTap,
317
335
);
318
336
}
0 commit comments