Skip to content

Commit 2a401b1

Browse files
committed
fix: black theme in statistics screen
1 parent 4b0e584 commit 2a401b1

3 files changed

Lines changed: 153 additions & 68 deletions

File tree

src/lib/features/note/view/focus_screen.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,7 @@ class FocusScreen extends StatelessWidget {
256256
),
257257
),
258258
),
259+
)
259260
);
260261
}
261262
}

src/lib/features/statistics/view/screens/statistics_screen.dart

Lines changed: 81 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -28,25 +28,24 @@ class _StatisticsScreenState extends State<StatisticsScreen> {
2828
}
2929

3030

31-
Icon _getIconForCategory(BuildContext context, String category) {
32-
switch (category) {
33-
case 'Design':
34-
return Icon(
35-
Icons.checklist_rtl_rounded,
36-
color: Theme.of(context).colorScheme.primary,
37-
);
38-
case 'Research': return const Icon(Icons.timer_outlined, color: Color(0xFFE67E22));
39-
case 'Development': return const Icon(Icons.calendar_month_outlined, color: Color(0xFF9B59B6));
40-
default: return const Icon(Icons.task_alt_rounded, color: Colors.green);
41-
}
42-
}
43-
4431
@override
4532
Widget build(BuildContext context) {
33+
final isDark = Theme.of(context).brightness == Brightness.dark;
34+
4635
return Scaffold(
4736
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
48-
body: Consumer<StatisticsViewmodel>(
49-
builder: (context, viewModel, child) {
37+
body: Container(
38+
decoration: BoxDecoration(
39+
gradient: isDark
40+
? const LinearGradient(
41+
begin: Alignment.topCenter,
42+
end: Alignment.bottomCenter,
43+
colors: [Color(0xFF08142D), Color(0xFF0B1A38), Color(0xFF0A1834)],
44+
)
45+
: null,
46+
),
47+
child: Consumer<StatisticsViewmodel>(
48+
builder: (context, viewModel, child) {
5049

5150
if (viewModel.isLoading) {
5251
return const Center(child: CircularProgressIndicator());
@@ -66,37 +65,51 @@ class _StatisticsScreenState extends State<StatisticsScreen> {
6665

6766
final currentTasks = data.recentTasks;
6867

69-
return SafeArea(
70-
child: SingleChildScrollView(
71-
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 20),
72-
child: Column(
73-
crossAxisAlignment: CrossAxisAlignment.start,
74-
children: [
68+
return SafeArea(
69+
child: SingleChildScrollView(
70+
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 20),
71+
child: Column(
72+
crossAxisAlignment: CrossAxisAlignment.start,
73+
children: [
7574
// --- Header ---
76-
Row(
77-
mainAxisAlignment: MainAxisAlignment.spaceBetween,
78-
children: [
79-
const Row(
80-
children: [
81-
CircleAvatar(
75+
Row(
76+
mainAxisAlignment: MainAxisAlignment.spaceBetween,
77+
children: [
78+
Row(
79+
children: [
80+
const CircleAvatar(
8281
radius: 22,
83-
backgroundImage: NetworkImage('https://i.pravatar.cc/150?u=a042581f4e29026704d')
84-
),
85-
SizedBox(width: 15),
86-
Text('Thống kê', style: TextStyle(fontSize: 24, fontWeight: FontWeight.bold, color: Color(0xFF2C3E50))),
87-
],
88-
),
82+
backgroundImage: NetworkImage(
83+
'https://i.pravatar.cc/150?u=a042581f4e29026704d',
84+
),
85+
),
86+
const SizedBox(width: 15),
87+
Text(
88+
'Thống kê',
89+
style: TextStyle(
90+
fontSize: 24,
91+
fontWeight: FontWeight.bold,
92+
color: Theme.of(context).colorScheme.onSurface,
93+
),
94+
),
95+
],
96+
),
8997
Container(
9098
padding: const EdgeInsets.all(10),
91-
decoration: const BoxDecoration(color: Colors.white, shape: BoxShape.circle),
99+
decoration: BoxDecoration(
100+
color: isDark
101+
? const Color(0xFF172744)
102+
: Theme.of(context).colorScheme.surface,
103+
shape: BoxShape.circle,
104+
),
92105
child: Icon(
93106
Icons.notifications_none_rounded,
94107
color: Theme.of(context).colorScheme.primary,
95108
),
96109
)
97-
],
98-
),
99-
const SizedBox(height: 30),
110+
],
111+
),
112+
const SizedBox(height: 30),
100113

101114

102115
DailyProgressCard(
@@ -120,10 +133,17 @@ class _StatisticsScreenState extends State<StatisticsScreen> {
120133
const SizedBox(height: 30),
121134

122135

123-
Row(
124-
mainAxisAlignment: MainAxisAlignment.spaceBetween,
125-
children: [
126-
const Text('Hoàn thành gần đây', style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold, color: Color(0xFF2C3E50))),
136+
Row(
137+
mainAxisAlignment: MainAxisAlignment.spaceBetween,
138+
children: [
139+
Text(
140+
'Hoàn thành gần đây',
141+
style: TextStyle(
142+
fontSize: 18,
143+
fontWeight: FontWeight.bold,
144+
color: Theme.of(context).colorScheme.onSurface,
145+
),
146+
),
127147
Text(
128148
'Xem tất cả',
129149
style: TextStyle(
@@ -132,20 +152,25 @@ class _StatisticsScreenState extends State<StatisticsScreen> {
132152
color: Theme.of(context).colorScheme.primary,
133153
),
134154
),
135-
],
136-
),
137-
const SizedBox(height: 15),
155+
],
156+
),
157+
const SizedBox(height: 15),
138158

139159
AnimatedSwitcher(
140160
duration: const Duration(milliseconds: 300),
141161
child: currentTasks.isEmpty
142162
? Container(
143-
key: const ValueKey('empty_state'),
144-
padding: const EdgeInsets.all(30),
145-
alignment: Alignment.center,
146-
child: Text('Chưa có công việc nào hoàn thành gần đây.',
147-
style: TextStyle(color: Colors.grey.shade500), textAlign: TextAlign.center),
148-
)
163+
key: const ValueKey('empty_state'),
164+
padding: const EdgeInsets.all(30),
165+
alignment: Alignment.center,
166+
child: Text(
167+
'Chưa có công việc nào hoàn thành gần đây.',
168+
style: TextStyle(
169+
color: Theme.of(context).colorScheme.onSurfaceVariant,
170+
),
171+
textAlign: TextAlign.center,
172+
),
173+
)
149174
: Column(
150175
key: ValueKey('list_$_selectedDayIndex'),
151176
children: currentTasks.map((task) {
@@ -161,12 +186,13 @@ class _StatisticsScreenState extends State<StatisticsScreen> {
161186
),
162187
),
163188

164-
const SizedBox(height: 80),
165-
],
189+
const SizedBox(height: 80),
190+
],
191+
),
166192
),
167-
),
168-
);
169-
},
193+
);
194+
},
195+
),
170196
),
171197
);
172198
}

src/lib/features/statistics/view/widgets/statistics_widgets.dart

Lines changed: 71 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,17 @@ class DailyProgressCard extends StatelessWidget {
1111

1212
@override
1313
Widget build(BuildContext context) {
14+
final isDark = Theme.of(context).brightness == Brightness.dark;
15+
1416
return Container(
1517
width: double.infinity,
1618
padding: const EdgeInsets.symmetric(vertical: 30, horizontal: 20),
1719
decoration: BoxDecoration(
18-
color: Colors.white,
20+
color: isDark ? const Color(0xFF1A2945) : Theme.of(context).colorScheme.surface,
1921
borderRadius: BorderRadius.circular(30),
22+
border: isDark
23+
? Border.all(color: const Color(0xFF2A3E62), width: 1)
24+
: null,
2025
),
2126
child: Column(
2227
children: [
@@ -47,8 +52,21 @@ class DailyProgressCard extends StatelessWidget {
4752
Column(
4853
mainAxisAlignment: MainAxisAlignment.center,
4954
children: [
50-
Text('$completed/$total', style: const TextStyle(fontSize: 32, fontWeight: FontWeight.bold, color: Color(0xFF2C3E50))),
51-
Text('Công việc', style: TextStyle(fontSize: 12, color: Colors.grey.shade500)),
55+
Text(
56+
'$completed/$total',
57+
style: TextStyle(
58+
fontSize: 32,
59+
fontWeight: FontWeight.bold,
60+
color: Theme.of(context).colorScheme.onSurface,
61+
),
62+
),
63+
Text(
64+
'Công việc',
65+
style: TextStyle(
66+
fontSize: 12,
67+
color: Theme.of(context).colorScheme.onSurfaceVariant,
68+
),
69+
),
5270
],
5371
),
5472
],
@@ -58,7 +76,10 @@ class DailyProgressCard extends StatelessWidget {
5876
RichText(
5977
textAlign: TextAlign.center,
6078
text: TextSpan(
61-
style: const TextStyle(fontSize: 16, color: Colors.black87),
79+
style: TextStyle(
80+
fontSize: 16,
81+
color: Theme.of(context).colorScheme.onSurface,
82+
),
6283
children: [
6384
const TextSpan(text: 'Tuyệt vời! Bạn đã hoàn thành '),
6485
TextSpan(
@@ -97,18 +118,24 @@ class WeeklyChartCard extends StatelessWidget {
97118

98119
@override
99120
Widget build(BuildContext context) {
121+
final isDark = Theme.of(context).brightness == Brightness.dark;
100122

101123
final bool isPositive = growthPercentage >= 0;
102-
final Color trendColor = isPositive ? const Color(0xFF2ECC71) : Colors.redAccent;
103-
final Color trendBgColor = isPositive ? const Color(0xFFE9F7EF) : const Color(0xFFFFEBEE);
124+
final Color trendColor = isPositive ? const Color(0xFF3DDC84) : Colors.redAccent;
125+
final Color trendBgColor = isPositive
126+
? (isDark ? const Color(0xFF173B3D) : const Color(0xFFE9F7EF))
127+
: (isDark ? const Color(0xFF402129) : const Color(0xFFFFEBEE));
104128
final String trendText = "${isPositive ? '+' : ''}$growthPercentage% vs tuần trước";
105129

106130
return Container(
107131
width: double.infinity,
108132
padding: const EdgeInsets.all(25),
109133
decoration: BoxDecoration(
110-
color: Colors.white,
134+
color: isDark ? const Color(0xFF1A2945) : Theme.of(context).colorScheme.surface,
111135
borderRadius: BorderRadius.circular(30),
136+
border: isDark
137+
? Border.all(color: const Color(0xFF2A3E62), width: 1)
138+
: null,
112139
),
113140
child: Column(
114141
crossAxisAlignment: CrossAxisAlignment.start,
@@ -129,7 +156,14 @@ class WeeklyChartCard extends StatelessWidget {
129156
),
130157
),
131158
const SizedBox(height: 5),
132-
Text('$thisWeekTotal Tasks', style: const TextStyle(fontSize: 22, fontWeight: FontWeight.bold, color: Color(0xFF2C3E50))),
159+
Text(
160+
'$thisWeekTotal Tasks',
161+
style: TextStyle(
162+
fontSize: 22,
163+
fontWeight: FontWeight.bold,
164+
color: Theme.of(context).colorScheme.onSurface,
165+
),
166+
),
133167
],
134168
),
135169
Container(
@@ -173,7 +207,9 @@ class WeeklyChartCard extends StatelessWidget {
173207
decoration: BoxDecoration(
174208
color: isActive
175209
? Theme.of(context).colorScheme.primary
176-
: const Color(0xFFF5F7FA),
210+
: (Theme.of(context).brightness == Brightness.dark
211+
? const Color(0xFF334764)
212+
: const Color(0xFFF5F7FA)),
177213
borderRadius: BorderRadius.circular(8),
178214
),
179215
),
@@ -203,6 +239,7 @@ class CompletedTaskCard extends StatelessWidget {
203239

204240
@override
205241
Widget build(BuildContext context) {
242+
final isDark = Theme.of(context).brightness == Brightness.dark;
206243

207244
final time = task.updatedAt;
208245
final hour = time.hour > 12 ? time.hour - 12 : (time.hour == 0 ? 12 : time.hour);
@@ -239,24 +276,45 @@ class CompletedTaskCard extends StatelessWidget {
239276
margin: const EdgeInsets.only(bottom: 15),
240277
padding: const EdgeInsets.all(20),
241278
decoration: BoxDecoration(
242-
color: Colors.white,
279+
color: isDark ? const Color(0xFF1A2945) : Theme.of(context).colorScheme.surface,
243280
borderRadius: BorderRadius.circular(25),
281+
border: isDark
282+
? Border.all(color: const Color(0xFF2A3E62), width: 1)
283+
: null,
244284
),
245285
child: Row(
246286
children: [
247287
Container(
248288
padding: const EdgeInsets.all(12),
249-
decoration: BoxDecoration(color: const Color(0xFFF1F7FD), borderRadius: BorderRadius.circular(15)),
289+
decoration: BoxDecoration(
290+
color: isDark
291+
? const Color(0xFF23395D)
292+
: const Color(0xFFF1F7FD),
293+
borderRadius: BorderRadius.circular(15),
294+
),
250295
child: icon,
251296
),
252297
const SizedBox(width: 15),
253298
Expanded(
254299
child: Column(
255300
crossAxisAlignment: CrossAxisAlignment.start,
256301
children: [
257-
Text(task.title, style: const TextStyle(fontSize: 16, fontWeight: FontWeight.bold, color: Color(0xFF2C3E50))),
302+
Text(
303+
task.title,
304+
style: TextStyle(
305+
fontSize: 16,
306+
fontWeight: FontWeight.bold,
307+
color: Theme.of(context).colorScheme.onSurface,
308+
),
309+
),
258310
const SizedBox(height: 4),
259-
Text(timeString, style: TextStyle(fontSize: 12, color: Colors.grey.shade500)),
311+
Text(
312+
timeString,
313+
style: TextStyle(
314+
fontSize: 12,
315+
color: Theme.of(context).colorScheme.onSurfaceVariant,
316+
),
317+
),
260318
],
261319
),
262320
),

0 commit comments

Comments
 (0)