Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions assets/icons/ic_celebrate.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 10 additions & 1 deletion lib/core/l10n/app_ar.arb
Original file line number Diff line number Diff line change
Expand Up @@ -167,5 +167,14 @@
"system": "النظام",
"home": "الرئيسية",
"top_spending_category": "أكثر فئات الإنفاق",
"spend": "إنفاق"
"spend": "إنفاق",
"selectMonthYear": "اختر الشهر والسنة",
"addIncome": "إضافة دخل",
"saving": "ادخار",
"spending": "إنفاق",
"incomeAddedSuccessfully": "تم إضافة الدخل بنجاح!",
"failedToAddIncome": "فشل في إضافة الدخل",
"whereDoYouUsuallySpendYourMoney": "أين تنفق أموالك عادة؟",
"suggestions": "اقتراحات",
"selectedCategories": "التصنيفات المختارة"
}
3 changes: 2 additions & 1 deletion lib/core/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -185,5 +185,6 @@
"system": "System",
"home": "Home",
"top_spending_category": "Top spending category",
"spend": "Spend"
"spend": "Spend",
"selectMonthYear": "Select month & year"
}
1 change: 1 addition & 0 deletions lib/design_system/assets/app_assets.dart
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,5 @@ class AppAssets {
static const String icEmptyRadioButton = '$_icons/ic_circle.svg';
static const String icSelectedRadioButton = '$_icons/ic_check_circle.svg';
static const String glowBackground = '$_images/money_background.png';
static const String icCelebrate = '$_images/ic_celebrate.svg';
}
11 changes: 8 additions & 3 deletions lib/design_system/widgets/app_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,14 @@
width: 40,
height: 40,
decoration: BoxDecoration(
color: context.colors.surfaceHigh,
color: context.colors.surface,
shape: BoxShape.circle,
),
alignment: Alignment.center,
child: SvgPicture.asset(assetPath, width: 20, height: 20),
child: SvgPicture.asset(assetPath,
matchTextDirection: true,
colorFilter: ColorFilter.mode(context.colors.title,BlendMode.srcIn),
width: 20, height: 20),
),
);
}
Expand Down Expand Up @@ -103,7 +106,9 @@
spacing: 4,
children: [
Text(date, style: typo.label.small.copyWith(color: contentColor)),
SvgPicture.asset(AppAssets.icNormalArrowDown, width: 20, height: 20),
SvgPicture.asset(AppAssets.icNormalArrowDown,
colorFilter: ColorFilter.mode(contentColor,BlendMode.srcIn),
width: 20, height: 20),
],
),
),
Expand Down
26 changes: 21 additions & 5 deletions lib/design_system/widgets/custom_date_picker.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,31 @@ Future<DateTime?> showMonthYearDialog(
}) {
int selectedMonth = initialMonth;
int selectedYear = initialYear;
final localization = context.localizations;
final colors = context.colors;
final typography = context.typography;

return showDialog<DateTime>(
context: context,
builder: (_) {
return StatefulBuilder(
builder: (context, setState) {
return AlertDialog(
backgroundColor: context.colors.surface,
backgroundColor: colors.surface,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(24)),
title: Text(
"Select month & year",
style: context.typography.title.medium,
localization.selectMonthYear,
style: typography.title.medium.copyWith(color: colors.title),
),
content: Row(
children: [
Expanded(
child: DropdownButton<int>(
value: selectedMonth,
isExpanded: true,
dropdownColor: colors.surface,
style: typography.body.medium.copyWith(color: colors.title),
underline: Container(height: 1, color: colors.primary),
items: List.generate(12, (i) => i + 1)
.map(
(m) => DropdownMenuItem(
Expand All @@ -47,6 +54,9 @@ Future<DateTime?> showMonthYearDialog(
child: DropdownButton<int>(
value: selectedYear,
isExpanded: true,
dropdownColor: colors.surface,
style: typography.body.medium.copyWith(color: colors.title),
underline: Container(height: 1, color: colors.primary),
items: List.generate(50, (i) => 2000 + i)
.map(
(y) => DropdownMenuItem(
Expand All @@ -67,14 +77,20 @@ Future<DateTime?> showMonthYearDialog(
actions: [
TextButton(
onPressed: () => Navigator.pop(context),
child: const Text("Cancel"),
child: Text(
localization.cancel,
style: typography.label.large.copyWith(color: colors.primary),
),
),
TextButton(
onPressed: () => Navigator.pop(
context,
DateTime(selectedYear, selectedMonth),
),
child: const Text("OK"),
child: Text(
localization.select,
style: typography.label.large.copyWith(color: colors.primary),
),
),
],
);
Expand Down
2 changes: 1 addition & 1 deletion lib/design_system/widgets/nav_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ enum NavBarTab {
case NavBarTab.home:
return l10n.home;
case NavBarTab.transaction:
return l10n.transaction;
return l10n.transactions;
case NavBarTab.statistics:
return l10n.statistics;
case NavBarTab.account:
Expand Down
7 changes: 5 additions & 2 deletions lib/design_system/widgets/text_field_date_Picker.dart
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@ class _TextFieldDatePickerState extends State<TextFieldDatePicker> {
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
SvgPicture.asset(AppAssets.icCalender, width: 24, height: 24),
SvgPicture.asset(AppAssets.icCalender,
colorFilter: ColorFilter.mode(colors.body,BlendMode.srcIn),
width: 24, height: 24),
SizedBox(width: 8),
Expanded(
child: TextField(
Expand All @@ -99,7 +101,7 @@ class _TextFieldDatePickerState extends State<TextFieldDatePicker> {
builder: (context, child) {
return Theme(
data: Theme.of(context).copyWith(
colorScheme: ColorScheme.light(
colorScheme: Theme.of(context).colorScheme.copyWith(
primary: colors.primary,
onPrimary: colors.onPrimary,
onSurface: colors.title,
Expand Down Expand Up @@ -128,6 +130,7 @@ class _TextFieldDatePickerState extends State<TextFieldDatePicker> {
),
SvgPicture.asset(
AppAssets.icArrowDownRound,
colorFilter: ColorFilter.mode(colors.body,BlendMode.srcIn),
width: 24,
height: 24,
),
Expand Down
4 changes: 4 additions & 0 deletions lib/presentation/login/widget/login_form.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import '../../../core/l10n/app_localizations.dart';
import '../../../design_system/assets/app_assets.dart';
import '../../../design_system/theme/money_extension_context.dart';
import '../../../design_system/widgets/text_field.dart';

class LoginForm extends StatefulWidget {
Expand All @@ -28,6 +29,7 @@ class _LoginFormState extends State<LoginForm> {
@override
Widget build(BuildContext context) {
final localizations = AppLocalizations.of(context)!;
final colors = context.colors;
return Column(
children: [
MTextField(
Expand Down Expand Up @@ -58,6 +60,8 @@ class _LoginFormState extends State<LoginForm> {
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 14),
child: SvgPicture.asset(
width: 20,height: 20,
colorFilter: ColorFilter.mode(colors.hint, BlendMode.srcIn),
_isPasswordVisible ? AppAssets.eyeOpen : AppAssets.eyeClose,
),
),
Expand Down
61 changes: 33 additions & 28 deletions lib/presentation/statistics/statistics_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ import 'package:moneyplus/design_system/widgets/app_empty_view.dart';
import 'package:moneyplus/design_system/widgets/app_error_view.dart';
import 'package:moneyplus/design_system/widgets/app_loading_indicator.dart';
import 'package:moneyplus/presentation/statistics/widgets/CategoryBreakdown.dart';
import 'package:moneyplus/presentation/transactions/screen/transactions_screen.dart';

import '../transactions/widget/add_transaction_bottom_sheet.dart';
import '../widgets/drop_down_date_dialog.dart';
import 'cubit/statistics_cubit.dart';
import 'cubit/statistics_state.dart';
Expand All @@ -35,7 +37,7 @@ class StatisticsView extends StatefulWidget {

class _StatisticsViewState extends State<StatisticsView> {
void _onAddTransaction() {
// Navigate to add transaction
showAddTransactionBottomSheet(context);
}

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

@override
Widget build(BuildContext context) {
final state = context.watch<StatisticsCubit>().state;
final l10n = context.localizations;

return Scaffold(
backgroundColor: context.colors.surface,
appBar: CustomAppBar(
title: l10n.statistics,
trailing: switch (state) {
StatisticsSuccess(:final selectedMonth) => DropDownDateDialog(
onDatePick: (date) => context.read<StatisticsCubit>().changeMonth(date),
year: selectedMonth.year,
month: selectedMonth.month,
),
_ => null,
},
),
body: SafeArea(
child: BlocBuilder<StatisticsCubit, StatisticsState>(
builder: (context, state) {
return switch (state) {
StatisticsIdle() => const SizedBox.shrink(),
StatisticsLoading() => const AppLoadingIndicator(),
StatisticsSuccess() => _buildSuccess(context, state),
StatisticsFailure(:final message) => AppErrorView(
message: message,
onRetry: _onRetry,
),
};
},
),
child: switch (state) {
StatisticsIdle() => const SizedBox.shrink(),
StatisticsLoading() => const AppLoadingIndicator(),
StatisticsSuccess() => _buildSuccess(context, state),
StatisticsFailure(:final message) => AppErrorView(
message: message,
onRetry: _onRetry,
),
},
),
);
}
Expand All @@ -77,24 +89,17 @@ class _StatisticsViewState extends State<StatisticsView> {
}

return SingleChildScrollView(
padding: const EdgeInsets.all(16),
child: Column(
children: [
CustomAppBar(
title: l10n.statistics,
trailing: DropDownDateDialog(
onDatePick: (date) => {
context.read<StatisticsCubit>().changeMonth(date),
},
year: state.selectedMonth.year,
month: state.selectedMonth.month,
),
),
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
children: [
MonthlyOverviewSection(overview: state.monthlyOverview),
const SizedBox(height: 16),
CategoryBreakdownWidget(
categoriesBreakdown: state.categoriesBreakdown,
),
],
],
),
),
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class OverviewSavingsBanner extends StatelessWidget {
mainAxisSize: MainAxisSize.min,
children: [
SvgPicture.asset(
AppAssets.icWalletAdd,
AppAssets.icCelebrate,
width: DesignConstants.iconSizeSmall,
height: DesignConstants.iconSizeSmall,
colorFilter: ColorFilter.mode(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ class TransactionAppBar extends StatelessWidget {
borderRadius: BorderRadius.circular(100),
),
child: SvgPicture.asset(
AppAssets.icFilter, height: 20, width: 20,),
AppAssets.icFilter,
colorFilter: ColorFilter.mode(colors.title,BlendMode.srcIn),
height: 20, width: 20,),
),
),
],
Expand Down
8 changes: 6 additions & 2 deletions lib/presentation/widgets/drop_down_date_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,17 @@ class DropDownDateDialog extends StatelessWidget {
borderRadius: BorderRadius.circular(100),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
spacing: 4,
children: [
Text(
"${getMonthNameFromNumber(month, context)}, $year",
style: typography.label.small.copyWith(color: colors.title),
),
SvgPicture.asset(AppAssets.arrowDownV2),
SvgPicture.asset(AppAssets.arrowDownV2,
colorFilter: ColorFilter.mode(colors.title,BlendMode.srcIn),
width: 16,
height: 16,
),
],
),
),
Expand Down
Loading