Skip to content

Commit 4ae73c1

Browse files
Merge pull request #127 from PennyPilot/fix/ui-bugs
Fix/UI bugs
2 parents 8148cba + b0a5464 commit 4ae73c1

13 files changed

Lines changed: 109 additions & 45 deletions

File tree

assets/icons/ic_celebrate.svg

Lines changed: 14 additions & 0 deletions
Loading

lib/core/l10n/app_ar.arb

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,5 +167,14 @@
167167
"system": "النظام",
168168
"home": "الرئيسية",
169169
"top_spending_category": "أكثر فئات الإنفاق",
170-
"spend": "إنفاق"
170+
"spend": "إنفاق",
171+
"selectMonthYear": "اختر الشهر والسنة",
172+
"addIncome": "إضافة دخل",
173+
"saving": "ادخار",
174+
"spending": "إنفاق",
175+
"incomeAddedSuccessfully": "تم إضافة الدخل بنجاح!",
176+
"failedToAddIncome": "فشل في إضافة الدخل",
177+
"whereDoYouUsuallySpendYourMoney": "أين تنفق أموالك عادة؟",
178+
"suggestions": "اقتراحات",
179+
"selectedCategories": "التصنيفات المختارة"
171180
}

lib/core/l10n/app_en.arb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,5 +185,6 @@
185185
"system": "System",
186186
"home": "Home",
187187
"top_spending_category": "Top spending category",
188-
"spend": "Spend"
188+
"spend": "Spend",
189+
"selectMonthYear": "Select month & year"
189190
}

lib/design_system/assets/app_assets.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,4 +82,5 @@ class AppAssets {
8282
static const String icEmptyRadioButton = '$_icons/ic_circle.svg';
8383
static const String icSelectedRadioButton = '$_icons/ic_check_circle.svg';
8484
static const String glowBackground = '$_images/money_background.png';
85+
static const String icCelebrate = '$_images/ic_celebrate.svg';
8586
}

lib/design_system/widgets/app_bar.dart

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,14 @@
7171
width: 40,
7272
height: 40,
7373
decoration: BoxDecoration(
74-
color: context.colors.surfaceHigh,
74+
color: context.colors.surface,
7575
shape: BoxShape.circle,
7676
),
7777
alignment: Alignment.center,
78-
child: SvgPicture.asset(assetPath, width: 20, height: 20),
78+
child: SvgPicture.asset(assetPath,
79+
matchTextDirection: true,
80+
colorFilter: ColorFilter.mode(context.colors.title,BlendMode.srcIn),
81+
width: 20, height: 20),
7982
),
8083
);
8184
}
@@ -103,7 +106,9 @@
103106
spacing: 4,
104107
children: [
105108
Text(date, style: typo.label.small.copyWith(color: contentColor)),
106-
SvgPicture.asset(AppAssets.icNormalArrowDown, width: 20, height: 20),
109+
SvgPicture.asset(AppAssets.icNormalArrowDown,
110+
colorFilter: ColorFilter.mode(contentColor,BlendMode.srcIn),
111+
width: 20, height: 20),
107112
],
108113
),
109114
),

lib/design_system/widgets/custom_date_picker.dart

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,31 @@ Future<DateTime?> showMonthYearDialog(
99
}) {
1010
int selectedMonth = initialMonth;
1111
int selectedYear = initialYear;
12+
final localization = context.localizations;
13+
final colors = context.colors;
14+
final typography = context.typography;
1215

1316
return showDialog<DateTime>(
1417
context: context,
1518
builder: (_) {
1619
return StatefulBuilder(
1720
builder: (context, setState) {
1821
return AlertDialog(
19-
backgroundColor: context.colors.surface,
22+
backgroundColor: colors.surface,
23+
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(24)),
2024
title: Text(
21-
"Select month & year",
22-
style: context.typography.title.medium,
25+
localization.selectMonthYear,
26+
style: typography.title.medium.copyWith(color: colors.title),
2327
),
2428
content: Row(
2529
children: [
2630
Expanded(
2731
child: DropdownButton<int>(
2832
value: selectedMonth,
2933
isExpanded: true,
34+
dropdownColor: colors.surface,
35+
style: typography.body.medium.copyWith(color: colors.title),
36+
underline: Container(height: 1, color: colors.primary),
3037
items: List.generate(12, (i) => i + 1)
3138
.map(
3239
(m) => DropdownMenuItem(
@@ -47,6 +54,9 @@ Future<DateTime?> showMonthYearDialog(
4754
child: DropdownButton<int>(
4855
value: selectedYear,
4956
isExpanded: true,
57+
dropdownColor: colors.surface,
58+
style: typography.body.medium.copyWith(color: colors.title),
59+
underline: Container(height: 1, color: colors.primary),
5060
items: List.generate(50, (i) => 2000 + i)
5161
.map(
5262
(y) => DropdownMenuItem(
@@ -67,14 +77,20 @@ Future<DateTime?> showMonthYearDialog(
6777
actions: [
6878
TextButton(
6979
onPressed: () => Navigator.pop(context),
70-
child: const Text("Cancel"),
80+
child: Text(
81+
localization.cancel,
82+
style: typography.label.large.copyWith(color: colors.primary),
83+
),
7184
),
7285
TextButton(
7386
onPressed: () => Navigator.pop(
7487
context,
7588
DateTime(selectedYear, selectedMonth),
7689
),
77-
child: const Text("OK"),
90+
child: Text(
91+
localization.select,
92+
style: typography.label.large.copyWith(color: colors.primary),
93+
),
7894
),
7995
],
8096
);

lib/design_system/widgets/nav_bar.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ enum NavBarTab {
3232
case NavBarTab.home:
3333
return l10n.home;
3434
case NavBarTab.transaction:
35-
return l10n.transaction;
35+
return l10n.transactions;
3636
case NavBarTab.statistics:
3737
return l10n.statistics;
3838
case NavBarTab.account:

lib/design_system/widgets/text_field_date_Picker.dart

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,9 @@ class _TextFieldDatePickerState extends State<TextFieldDatePicker> {
7373
child: Row(
7474
crossAxisAlignment: CrossAxisAlignment.center,
7575
children: [
76-
SvgPicture.asset(AppAssets.icCalender, width: 24, height: 24),
76+
SvgPicture.asset(AppAssets.icCalender,
77+
colorFilter: ColorFilter.mode(colors.body,BlendMode.srcIn),
78+
width: 24, height: 24),
7779
SizedBox(width: 8),
7880
Expanded(
7981
child: TextField(
@@ -99,7 +101,7 @@ class _TextFieldDatePickerState extends State<TextFieldDatePicker> {
99101
builder: (context, child) {
100102
return Theme(
101103
data: Theme.of(context).copyWith(
102-
colorScheme: ColorScheme.light(
104+
colorScheme: Theme.of(context).colorScheme.copyWith(
103105
primary: colors.primary,
104106
onPrimary: colors.onPrimary,
105107
onSurface: colors.title,
@@ -128,6 +130,7 @@ class _TextFieldDatePickerState extends State<TextFieldDatePicker> {
128130
),
129131
SvgPicture.asset(
130132
AppAssets.icArrowDownRound,
133+
colorFilter: ColorFilter.mode(colors.body,BlendMode.srcIn),
131134
width: 24,
132135
height: 24,
133136
),

lib/presentation/login/widget/login_form.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
22
import 'package:flutter_svg/svg.dart';
33
import '../../../core/l10n/app_localizations.dart';
44
import '../../../design_system/assets/app_assets.dart';
5+
import '../../../design_system/theme/money_extension_context.dart';
56
import '../../../design_system/widgets/text_field.dart';
67

78
class LoginForm extends StatefulWidget {
@@ -28,6 +29,7 @@ class _LoginFormState extends State<LoginForm> {
2829
@override
2930
Widget build(BuildContext context) {
3031
final localizations = AppLocalizations.of(context)!;
32+
final colors = context.colors;
3133
return Column(
3234
children: [
3335
MTextField(
@@ -58,6 +60,8 @@ class _LoginFormState extends State<LoginForm> {
5860
child: Padding(
5961
padding: const EdgeInsets.symmetric(vertical: 14),
6062
child: SvgPicture.asset(
63+
width: 20,height: 20,
64+
colorFilter: ColorFilter.mode(colors.hint, BlendMode.srcIn),
6165
_isPasswordVisible ? AppAssets.eyeOpen : AppAssets.eyeClose,
6266
),
6367
),

lib/presentation/statistics/statistics_screen.dart

Lines changed: 33 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ import 'package:moneyplus/design_system/widgets/app_empty_view.dart';
88
import 'package:moneyplus/design_system/widgets/app_error_view.dart';
99
import 'package:moneyplus/design_system/widgets/app_loading_indicator.dart';
1010
import 'package:moneyplus/presentation/statistics/widgets/CategoryBreakdown.dart';
11+
import 'package:moneyplus/presentation/transactions/screen/transactions_screen.dart';
1112

13+
import '../transactions/widget/add_transaction_bottom_sheet.dart';
1214
import '../widgets/drop_down_date_dialog.dart';
1315
import 'cubit/statistics_cubit.dart';
1416
import 'cubit/statistics_state.dart';
@@ -35,7 +37,7 @@ class StatisticsView extends StatefulWidget {
3537

3638
class _StatisticsViewState extends State<StatisticsView> {
3739
void _onAddTransaction() {
38-
// Navigate to add transaction
40+
showAddTransactionBottomSheet(context);
3941
}
4042

4143
void _onRetry() {
@@ -44,22 +46,32 @@ class _StatisticsViewState extends State<StatisticsView> {
4446

4547
@override
4648
Widget build(BuildContext context) {
49+
final state = context.watch<StatisticsCubit>().state;
50+
final l10n = context.localizations;
51+
4752
return Scaffold(
4853
backgroundColor: context.colors.surface,
54+
appBar: CustomAppBar(
55+
title: l10n.statistics,
56+
trailing: switch (state) {
57+
StatisticsSuccess(:final selectedMonth) => DropDownDateDialog(
58+
onDatePick: (date) => context.read<StatisticsCubit>().changeMonth(date),
59+
year: selectedMonth.year,
60+
month: selectedMonth.month,
61+
),
62+
_ => null,
63+
},
64+
),
4965
body: SafeArea(
50-
child: BlocBuilder<StatisticsCubit, StatisticsState>(
51-
builder: (context, state) {
52-
return switch (state) {
53-
StatisticsIdle() => const SizedBox.shrink(),
54-
StatisticsLoading() => const AppLoadingIndicator(),
55-
StatisticsSuccess() => _buildSuccess(context, state),
56-
StatisticsFailure(:final message) => AppErrorView(
57-
message: message,
58-
onRetry: _onRetry,
59-
),
60-
};
61-
},
62-
),
66+
child: switch (state) {
67+
StatisticsIdle() => const SizedBox.shrink(),
68+
StatisticsLoading() => const AppLoadingIndicator(),
69+
StatisticsSuccess() => _buildSuccess(context, state),
70+
StatisticsFailure(:final message) => AppErrorView(
71+
message: message,
72+
onRetry: _onRetry,
73+
),
74+
},
6375
),
6476
);
6577
}
@@ -77,24 +89,17 @@ class _StatisticsViewState extends State<StatisticsView> {
7789
}
7890

7991
return SingleChildScrollView(
80-
padding: const EdgeInsets.all(16),
81-
child: Column(
82-
children: [
83-
CustomAppBar(
84-
title: l10n.statistics,
85-
trailing: DropDownDateDialog(
86-
onDatePick: (date) => {
87-
context.read<StatisticsCubit>().changeMonth(date),
88-
},
89-
year: state.selectedMonth.year,
90-
month: state.selectedMonth.month,
91-
),
92-
),
92+
child: Padding(
93+
padding: const EdgeInsets.all(16.0),
94+
child: Column(
95+
children: [
9396
MonthlyOverviewSection(overview: state.monthlyOverview),
97+
const SizedBox(height: 16),
9498
CategoryBreakdownWidget(
9599
categoriesBreakdown: state.categoriesBreakdown,
96100
),
97-
],
101+
],
102+
),
98103
),
99104
);
100105
}

0 commit comments

Comments
 (0)