Skip to content

Commit 4537def

Browse files
authored
Merge pull request #29 from swarno-tech/rewrite
dashboard theme
2 parents 5f6d141 + 3883c8c commit 4537def

File tree

9 files changed

+166
-71
lines changed

9 files changed

+166
-71
lines changed

lib/features/dashboard/pages/dashboard.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class DashboardPage extends StatelessWidget {
2727
return Consumer<SupabaseService>(
2828
builder: (context, supa, child) {
2929
return Scaffold(
30-
backgroundColor: Color.fromRGBO(248, 248, 248, 1),
30+
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
3131
// backgroundColor: Colors.black,
3232
body: Padding(
3333
padding: EdgeInsets.symmetric(horizontal: 20.w, vertical: 50.h),

lib/features/dashboard/pages/desktop/dashboard_desktop.dart

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11

2+
import 'package:cookethflow/core/providers/supabase_provider.dart';
23
import 'package:cookethflow/features/dashboard/providers/dashboard_provider.dart';
34
import 'package:cookethflow/features/dashboard/widgets/dashboard_drawer.dart';
45
import 'package:cookethflow/features/dashboard/widgets/project_card.dart';
@@ -14,8 +15,8 @@ class DashboardDesktop extends StatelessWidget {
1415
@override
1516
Widget build(BuildContext context) {
1617
rh.DeviceType deviceType = rh.ResponsiveLayoutHelper.getDeviceType(context);
17-
return Consumer<DashboardProvider>(
18-
builder: (context, provider, child) {
18+
return Consumer2<DashboardProvider,SupabaseService>(
19+
builder: (context, provider,supabaseprovider, child) {
1920
return LayoutBuilder(
2021
builder:
2122
(context, constraints) => Row(
@@ -48,7 +49,7 @@ class DashboardDesktop extends StatelessWidget {
4849
const SizedBox(height: 32),
4950
Expanded(
5051
// NEW: Conditionally build the main content area
51-
child: _buildMainContent(provider,context),
52+
child: _buildMainContent(provider,context,supabaseprovider),
5253
),
5354
],
5455
),
@@ -62,7 +63,7 @@ class DashboardDesktop extends StatelessWidget {
6263
}
6364

6465
// NEW: Helper widget to build content based on the selected tab
65-
Widget _buildMainContent(DashboardProvider provider,BuildContext context) {
66+
Widget _buildMainContent(DashboardProvider provider,BuildContext context,SupabaseService su) {
6667
switch (provider.tabIndex) {
6768
case 2: // Trash Tab
6869
return Center(
@@ -72,7 +73,7 @@ class DashboardDesktop extends StatelessWidget {
7273
fontFamily: 'Fredrik',
7374
fontSize: 24.sp,
7475
fontWeight: FontWeight.w600,
75-
color: Colors.grey[600],
76+
color: su.isDark?Colors.white: Colors.grey[600],
7677
),
7778
),
7879
);
@@ -86,7 +87,7 @@ class DashboardDesktop extends StatelessWidget {
8687
fontFamily: 'Fredrik',
8788
fontSize: 18.sp,
8889
height: 1.6,
89-
color: Colors.black.withOpacity(0.75),
90+
color: su.isDark?Colors.white: Colors.black.withOpacity(0.75),
9091
),
9192
),
9293
);
@@ -102,7 +103,7 @@ class DashboardDesktop extends StatelessWidget {
102103
fontFamily: 'Fredrik',
103104
fontSize: 24.sp,
104105
fontWeight: FontWeight.w600,
105-
color: Colors.grey[600],
106+
color:su.isDark?Colors.white: Colors.grey[600],
106107
),
107108
),
108109
);
@@ -120,7 +121,7 @@ class DashboardDesktop extends StatelessWidget {
120121
),
121122
itemBuilder: (context, index) {
122123
final workspace = displayedWorkspaces[index];
123-
return ProjectCard(workspaceId: workspace.id);
124+
return ProjectCard(workspaceId: workspace.id,su: su,);
124125
},
125126
);
126127
}

lib/features/dashboard/pages/mobile/dashboard_mobile.dart

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import 'package:cookethflow/core/providers/supabase_provider.dart';
12
import 'package:cookethflow/features/dashboard/pages/mobile/drawer_mobile.dart';
23
import 'package:cookethflow/features/dashboard/providers/dashboard_provider.dart';
34
import 'package:cookethflow/features/dashboard/widgets/dashboard_drawer.dart';
@@ -21,8 +22,8 @@ class _DashboardMobileState extends State<DashboardMobile> {
2122
@override
2223
Widget build(BuildContext context) {
2324
rh.DeviceType deviceType = rh.ResponsiveLayoutHelper.getDeviceType(context);
24-
return Consumer<DashboardProvider>(
25-
builder: (context, provider, child) {
25+
return Consumer2<DashboardProvider,SupabaseService>(
26+
builder: (context, provider,suprovider,child) {
2627
return LayoutBuilder(
2728
builder: (context, constraints) {
2829
return Container(
@@ -38,7 +39,7 @@ class _DashboardMobileState extends State<DashboardMobile> {
3839
Container(
3940
padding: EdgeInsets.all(10),
4041
decoration: BoxDecoration(
41-
border: Border.all(color: Colors.black),
42+
border: Border.all(color:suprovider.isDark?Colors.white: Colors.black),
4243
borderRadius: BorderRadius.circular(8),
4344
),
4445
child: InkWell(
@@ -56,7 +57,7 @@ class _DashboardMobileState extends State<DashboardMobile> {
5657
const SizedBox(height: 34),
5758
Expanded(
5859
// NEW: Conditionally build the main content area
59-
child: _buildMainContent(provider),
60+
child: _buildMainContent(provider,suprovider),
6061
),
6162
],
6263
),
@@ -86,7 +87,7 @@ class _DashboardMobileState extends State<DashboardMobile> {
8687

8788

8889
// NEW: Helper widget to build content based on the selected tab
89-
Widget _buildMainContent(DashboardProvider provider) {
90+
Widget _buildMainContent(DashboardProvider provider,SupabaseService su) {
9091
switch (provider.tabIndex) {
9192
case 2: // Trash Tab
9293
return Center(
@@ -96,7 +97,7 @@ class _DashboardMobileState extends State<DashboardMobile> {
9697
fontFamily: 'Fredrik',
9798
fontSize: 45.sp,
9899
fontWeight: FontWeight.w600,
99-
color: Colors.grey[600],
100+
color: su.isDark? Colors.white: Colors.grey[600],
100101
),
101102
),
102103
);
@@ -110,7 +111,7 @@ class _DashboardMobileState extends State<DashboardMobile> {
110111
fontFamily: 'Fredrik',
111112
fontSize: 40.sp,
112113
height: 1.6,
113-
color: Colors.black.withOpacity(0.75),
114+
color:su.isDark? Colors.white: Colors.black.withOpacity(0.75),
114115
),
115116
),
116117
);
@@ -126,7 +127,7 @@ class _DashboardMobileState extends State<DashboardMobile> {
126127
fontFamily: 'Fredrik',
127128
fontSize: 45.sp,
128129
fontWeight: FontWeight.w600,
129-
color: Colors.grey[600],
130+
color: su.isDark?Colors.white: Colors.grey[600],
130131
),
131132
),
132133
);
@@ -144,7 +145,7 @@ class _DashboardMobileState extends State<DashboardMobile> {
144145
),
145146
itemBuilder: (context, index) {
146147
final workspace = displayedWorkspaces[index];
147-
return ProjectCard(workspaceId: workspace.id);
148+
return ProjectCard(workspaceId: workspace.id,su: su,);
148149
},
149150
);
150151
}

lib/features/dashboard/pages/mobile/drawer_mobile.dart

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ class DashboardDrawerMob extends StatelessWidget {
3131

3232
return Container(
3333
decoration: BoxDecoration(
34-
color: Colors.white,
35-
border: Border.all(color: const Color(0xFFD9D9D9), width: 1.2),
34+
color: Theme.of(context).cardColor,
35+
border: Border.all(color:supabaseService.isDark?Colors.grey.shade700: const Color(0xFFD9D9D9), width: 1.2),
3636
borderRadius: BorderRadius.circular(12.r),
3737
),
3838
child: Padding(
@@ -138,7 +138,7 @@ class DashboardDrawerMob extends StatelessWidget {
138138
shape: RoundedRectangleBorder(
139139
borderRadius: BorderRadius.circular(20.r),
140140
),
141-
backgroundColor: Colors.white,
141+
backgroundColor: Theme.of(context).cardColor,
142142
side: BorderSide(color: primaryColor),
143143
minimumSize: Size(
144144
0,
@@ -240,7 +240,7 @@ class DashboardDrawerMob extends StatelessWidget {
240240
color:
241241
isSelected
242242
? secondaryColors[6]
243-
: Colors.black,
243+
: supabaseService.isDark?Colors.white: Colors.black,
244244
size:
245245
device == rh.DeviceType.desktop
246246
? 26.sp
@@ -264,7 +264,7 @@ class DashboardDrawerMob extends StatelessWidget {
264264
? 18.sp
265265
: 55.sp,
266266
color:
267-
isSelected ? Colors.blue : Colors.black,
267+
isSelected ? Colors.blue : supabaseService.isDark?Colors.white: Colors.black,
268268
fontWeight:
269269
isSelected
270270
? FontWeight.w800
@@ -280,7 +280,7 @@ class DashboardDrawerMob extends StatelessWidget {
280280
),
281281
Spacer(),
282282
Spacer(),
283-
const UpgradeCard(),
283+
UpgradeCard(sv: supabaseService,),
284284
],
285285
),
286286
),

lib/features/dashboard/widgets/add_project_dialogue.dart

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import 'package:cookethflow/core/providers/supabase_provider.dart';
12
import 'package:cookethflow/features/dashboard/providers/dashboard_provider.dart';
23
import 'package:cookethflow/features/dashboard/widgets/build_project.dart';
34
import 'package:flutter/material.dart';
@@ -11,7 +12,7 @@ class AddProject extends StatelessWidget {
1112

1213
@override
1314
Widget build(BuildContext context) {
14-
return Consumer<DashboardProvider>(builder: (context, provider, child) {
15+
return Consumer2<DashboardProvider,SupabaseService>(builder: (context, provider,suprovider, child) {
1516
return AlertDialog(
1617
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
1718
title: Text(
@@ -28,6 +29,8 @@ class AddProject extends StatelessWidget {
2829
context.pop();
2930
provider.createNewProject(context);
3031
},
32+
txtColor: suprovider.isDark?Colors.white:Colors.black,
33+
borderColor: suprovider.isDark?Colors.white:Colors.black,
3134
),
3235
SizedBox(height: 16),
3336
BuildProject(
@@ -37,6 +40,8 @@ class AddProject extends StatelessWidget {
3740
context.pop();
3841
provider.importExistingProject(context);
3942
},
43+
txtColor: suprovider.isDark?Colors.white:Colors.black,
44+
borderColor: suprovider.isDark?Colors.white:Colors.black,
4045
),
4146
],
4247
),

lib/features/dashboard/widgets/build_project.dart

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,15 @@ class BuildProject extends StatelessWidget {
44
final IconData icon;
55
final String label;
66
final VoidCallback onTap;
7+
final Color txtColor;
8+
final Color borderColor;
79
const BuildProject({
810
super.key,
911
required this.icon,
1012
required this.label,
1113
required this.onTap,
14+
required this.txtColor,
15+
required this.borderColor
1216
});
1317

1418
@override
@@ -19,7 +23,7 @@ class BuildProject extends StatelessWidget {
1923
child: Container(
2024
padding: EdgeInsets.symmetric(vertical: 16, horizontal: 16),
2125
decoration: BoxDecoration(
22-
border: Border.all(color: Colors.black, width: 1),
26+
border: Border.all(color: borderColor, width: 1),
2327
borderRadius: BorderRadius.circular(8),
2428
),
2529
child: Row(
@@ -31,11 +35,12 @@ class BuildProject extends StatelessWidget {
3135
style: TextStyle(
3236
fontFamily: 'Frederik',
3337
fontSize: 16,
38+
color: txtColor,
3439
),
3540
),
3641
],
3742
),
3843
),
3944
);
4045
}
41-
}
46+
}

lib/features/dashboard/widgets/dashboard_drawer.dart

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,9 @@ class DashboardDrawer extends StatelessWidget {
3232
return IntrinsicWidth(
3333
child: Container(
3434
decoration: BoxDecoration(
35-
color: Colors.white,
36-
border: Border.all(color: const Color(0xFFD9D9D9), width: 1.2),
35+
color: Theme.of(context).cardColor,
36+
//const Color(0xFFD9D9D9)
37+
border: Border.all(color: supabaseService.isDark? Colors.grey.shade700: Color(0xFFD9D9D9), width: 1.2),
3738
borderRadius: BorderRadius.circular(12.r),
3839
),
3940
child: Padding(
@@ -148,7 +149,7 @@ class DashboardDrawer extends StatelessWidget {
148149
shape: RoundedRectangleBorder(
149150
borderRadius: BorderRadius.circular(8.r),
150151
),
151-
backgroundColor: Colors.white,
152+
backgroundColor: Theme.of(context).cardColor,
152153
side: BorderSide(color: primaryColor),
153154
minimumSize: Size(
154155
0,
@@ -256,7 +257,7 @@ class DashboardDrawer extends StatelessWidget {
256257
color:
257258
isSelected
258259
? secondaryColors[6]
259-
: Colors.black,
260+
: supabaseService.isDark? Colors.white : Colors.black,
260261
size:
261262
device == rh.DeviceType.desktop
262263
? 26.sp
@@ -280,7 +281,7 @@ class DashboardDrawer extends StatelessWidget {
280281
? 18.sp
281282
: device == rh.DeviceType.tab ? 25.sp : 16.sp,
282283
color:
283-
isSelected ? Colors.blue : Colors.black,
284+
isSelected ? Colors.blue : supabaseService.isDark? Colors.white :Colors.black,
284285
fontWeight:
285286
isSelected
286287
? FontWeight.w600
@@ -295,7 +296,7 @@ class DashboardDrawer extends StatelessWidget {
295296
),
296297
),
297298
Spacer(),
298-
const UpgradeCard(),
299+
UpgradeCard(sv: supabaseService,),
299300
],
300301
),
301302
),

0 commit comments

Comments
 (0)