Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#510] [NF] Exclude Account from Summary. Add skip option #511

Merged
merged 1 commit into from
Oct 21, 2024
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
2 changes: 1 addition & 1 deletion lib/_classes/math/total_recalculation.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class TotalRecalculation extends AbstractRecalculation {

double updateTotalMap(AppDataType type, String uuid, HashMap<String, dynamic> hashTable) {
final item = hashTable[uuid];
if (item == null || item.hidden) {
if (item == null || item.hidden || item.skip) {
return 0.0;
}
double total = exchange.reform(item.details, item.currency, Exchange.defaultCurrency);
Expand Down
4 changes: 4 additions & 0 deletions lib/_classes/structure/abstract_app_data.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ abstract class AbstractAppData implements InterfaceAppData {
double progress;
@override
bool hidden;
@override
bool skip;
String? description;
@override
MaterialColor? color;
Expand All @@ -40,6 +42,7 @@ abstract class AbstractAppData implements InterfaceAppData {
details = 0.0,
this.progress = 1.0,
this.hidden = false,
this.skip = false,
}) : _createdAt = createdAt ?? (createdAtFormatted != null ? DateTime.parse(createdAtFormatted) : DateTime.now()),
_updatedAt = updatedAt ?? DateTime.now(),
_amount = 0.0 + (details ?? 0.0);
Expand All @@ -65,6 +68,7 @@ abstract class AbstractAppData implements InterfaceAppData {
'details': details,
'progress': progress,
'hidden': hidden,
'skip': skip,
};

Map<String, Map<String, dynamic>> toFile() {
Expand Down
3 changes: 3 additions & 0 deletions lib/_classes/structure/account_app_data.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class AccountAppData extends AbstractAppData {
DateTime? closedAt,
String? closedAtFormatted,
super.hidden,
super.skip,
}) : _closedAt = closedAt ?? (closedAtFormatted != null ? DateTime.parse(closedAtFormatted) : DateTime.now());

@override
Expand All @@ -53,6 +54,7 @@ class AccountAppData extends AbstractAppData {
createdAt: super.createdAt,
closedAt: closedAt,
hidden: super.hidden,
skip: super.skip,
);
}

Expand All @@ -71,6 +73,7 @@ class AccountAppData extends AbstractAppData {
updatedAt: DateTime.parse(json['updatedAt']),
closedAt: DateTime.parse(json['closedAt']),
hidden: json['hidden'],
skip: json['skip'] ?? false,
);
}

Expand Down
3 changes: 3 additions & 0 deletions lib/_classes/structure/budget_app_data.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class BudgetAppData extends AbstractAppData with StorageMixin {
this.amount = 0.0,
this.type = '',
super.hidden,
super.skip,
}) : super(
details: amountLimit,
);
Expand All @@ -62,6 +63,7 @@ class BudgetAppData extends AbstractAppData with StorageMixin {
amountSet: amountSet,
amount: amount,
hidden: super.hidden,
skip: super.skip,
);
}

Expand All @@ -79,6 +81,7 @@ class BudgetAppData extends AbstractAppData with StorageMixin {
amountLimit: 0.0 + json['amountLimit'],
amountSet: json['amountSet'] != null ? json['amountSet'].toString().toMap<int, double>() : {},
hidden: json['hidden'],
skip: json['skip'] ?? false,
);
}

Expand Down
1 change: 1 addition & 0 deletions lib/_classes/structure/interface_app_data.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ abstract interface class InterfaceAppData {
IconData? icon;
MaterialColor? color;
bool hidden = false;
bool skip = false;

String get title;

Expand Down
1 change: 1 addition & 0 deletions lib/components/widgets/account_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ class AccountWidget extends BaseWidget {
color: item.color ?? Colors.transparent,
icon: item.icon ?? Icons.radio_button_unchecked_sharp,
hidden: item.hidden,
skip: item.skip,
width: width,
route: routeList,
error: item.error,
Expand Down
1 change: 1 addition & 0 deletions lib/components/widgets/budget_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ class BudgetWidget extends AccountWidget {
color: item.color ?? Colors.transparent,
icon: item.icon ?? Icons.radio_button_unchecked_sharp,
hidden: item.hidden,
skip: item.skip,
width: width,
route: routeList,
),
Expand Down
2 changes: 2 additions & 0 deletions lib/design/form/list_account_selector.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class ListAccountSelectorItem extends ListSelectorItem {
color: item.color ?? Colors.transparent,
icon: item.icon ?? Icons.radio_button_unchecked_sharp,
hidden: item.hidden ?? false,
skip: item.skip ?? false,
width: constraints.maxWidth,
showDivider: false,
);
Expand All @@ -37,6 +38,7 @@ class ListAccountSelectorItem extends ListSelectorItem {
color: item.color ?? Colors.transparent,
icon: item.icon ?? Icons.radio_button_unchecked_sharp,
hidden: item.hidden ?? false,
skip: item.skip ?? false,
width: constraints.maxWidth,
showDivider: false,
);
Expand Down
6 changes: 5 additions & 1 deletion lib/design/generic/base_line_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class BaseLineWidget extends StatelessWidget {
final double width;
final String route;
final bool hidden;
final bool skip;
final bool showDivider;
final Widget? error;

Expand All @@ -38,6 +39,7 @@ class BaseLineWidget extends StatelessWidget {
this.icon = Icons.question_mark,
this.error,
this.hidden = false,
this.skip = false,
this.progress = 1,
this.route = '',
this.showDivider = true,
Expand Down Expand Up @@ -82,7 +84,9 @@ class BaseLineWidget extends StatelessWidget {
children: [
TextWrapper(
title,
style: textTheme.headlineMedium,
style: textTheme.headlineMedium?.copyWith(
fontStyle: skip ? FontStyle.italic : FontStyle.normal,
),
),
TextWrapper(
description,
Expand Down
1 change: 1 addition & 0 deletions lib/design/generic/base_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ class BaseWidget extends StatelessWidget {
color: item.color ?? Colors.transparent,
icon: item.icon ?? Icons.radio_button_unchecked_sharp,
hidden: item.hidden,
skip: item.skip,
width: width,
route: routeList,
),
Expand Down
1 change: 1 addition & 0 deletions lib/l10n/app_ar.arb
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,7 @@
},
"settingsBaseHeadline": "الأساسيات",
"settingsHeadline": "الإعدادات",
"skipFromTotals": "الاستبعاد من المجاميع",
"skipTooltip": "تخطي الخطوة (الخطوات)",
"spent": "المستهلكة",
"splitCancelTooltip": "إلغاء التقسيم في الشهر",
Expand Down
1 change: 1 addition & 0 deletions lib/l10n/app_az.arb
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,7 @@
},
"settingsBaseHeadline": "Əsaslar",
"settingsHeadline": "Parametrlər",
"skipFromTotals": "Cəmilərdən xaric edin",
"skipTooltip": "Addım(lar)ı atlayın",
"spent": "sərf etdi",
"splitCancelTooltip": "Ayda bölünməni ləğv edin",
Expand Down
1 change: 1 addition & 0 deletions lib/l10n/app_be.arb
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,7 @@
},
"settingsBaseHeadline": "Асновы",
"settingsHeadline": "Налады",
"skipFromTotals": "Выключыць з агульных вынікаў",
"skipTooltip": "Прапусьціць крок(і)",
"spent": "патр.",
"splitCancelTooltip": "Адмяніць падьзел па месяцы",
Expand Down
1 change: 1 addition & 0 deletions lib/l10n/app_be_EU.arb
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,7 @@
},
"settingsBaseHeadline": "Asnovy",
"settingsHeadline": "Nalady",
"skipFromTotals": "Vykliučyć z ahuĺnych vynikaŭ",
"skipTooltip": "Prapuścić Krok(i)",
"spent": "patr.",
"splitCancelTooltip": "Admianić Pad́ziel pa Miesiacy",
Expand Down
1 change: 1 addition & 0 deletions lib/l10n/app_de.arb
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,7 @@
},
"settingsBaseHeadline": "Grundlagen",
"settingsHeadline": "Einstellungen",
"skipFromTotals": "Aus den Gesamtwerten ausschließen",
"skipTooltip": "Schritt(e) überspringen",
"spent": "ausgegeben",
"splitCancelTooltip": "Aufteilung pro Monat aufheben",
Expand Down
1 change: 1 addition & 0 deletions lib/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,7 @@
},
"settingsBaseHeadline": "Basics",
"settingsHeadline": "Settings",
"skipFromTotals": "Exclude from Totals",
"skipTooltip": "Skip Step(s)",
"spent": "spent",
"splitCancelTooltip": "Cancel Split per Month",
Expand Down
1 change: 1 addition & 0 deletions lib/l10n/app_es.arb
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,7 @@
},
"settingsBaseHeadline": "Básico",
"settingsHeadline": "Configuración",
"skipFromTotals": "Excluir de los totales",
"skipTooltip": "Saltar Paso(s)",
"spent": "gastado",
"splitCancelTooltip": "Anular división por mes",
Expand Down
1 change: 1 addition & 0 deletions lib/l10n/app_fa.arb
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,7 @@
},
"settingsBaseHeadline": "مبانی",
"settingsHeadline": "تنظیمات",
"skipFromTotals": "حذف از مجموع",
"skipTooltip": "رد شدن از مرحله(های)",
"spent": "صرف کرد",
"splitCancelTooltip": "لغو تقسیم در ماه",
Expand Down
1 change: 1 addition & 0 deletions lib/l10n/app_fr.arb
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,7 @@
},
"settingsBaseHeadline": "Principes de base",
"settingsHeadline": "Paramètres",
"skipFromTotals": "Exclure des totaux",
"skipTooltip": "Sauter étape(s)",
"spent": "dépensé",
"splitCancelTooltip": "Annuler le fractionnement par mois",
Expand Down
1 change: 1 addition & 0 deletions lib/l10n/app_hi.arb
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,7 @@
},
"settingsBaseHeadline": "मूल बातें",
"settingsHeadline": "समायोजन",
"skipFromTotals": "कुल से बाहर रखें",
"skipTooltip": "चरण छोड़ें",
"spent": "खर्च किया",
"splitCancelTooltip": "प्रति माह विभाजन रद्द करें",
Expand Down
1 change: 1 addition & 0 deletions lib/l10n/app_it.arb
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,7 @@
},
"settingsBaseHeadline": "Nozioni di base",
"settingsHeadline": "Impostazioni",
"skipFromTotals": "Escludere dai totali",
"skipTooltip": "Salta i passi",
"spent": "speso",
"splitCancelTooltip": "Annullare la suddivisione per mese",
Expand Down
1 change: 1 addition & 0 deletions lib/l10n/app_ja.arb
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,7 @@
},
"settingsBaseHeadline": "基本設定",
"settingsHeadline": "設定",
"skipFromTotals": "合計から除外する",
"skipTooltip": "ステップをスキップする",
"spent": "使用済み",
"splitCancelTooltip": "月ごとの分割を取り消す",
Expand Down
1 change: 1 addition & 0 deletions lib/l10n/app_ko.arb
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,7 @@
},
"settingsBaseHeadline": "기본 사항",
"settingsHeadline": "설정",
"skipFromTotals": "합계에서 제외",
"skipTooltip": "단계 건너뛰기",
"spent": "지출",
"splitCancelTooltip": "월별 분할 취소",
Expand Down
1 change: 1 addition & 0 deletions lib/l10n/app_nl.arb
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,7 @@
},
"settingsBaseHeadline": "Basis",
"settingsHeadline": "Instellingen",
"skipFromTotals": "Niet opnemen in totalen",
"skipTooltip": "Stap(pen) overslaan",
"spent": "uitgegeven",
"splitCancelTooltip": "Splitsen per maand annuleren",
Expand Down
1 change: 1 addition & 0 deletions lib/l10n/app_pl.arb
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,7 @@
},
"settingsBaseHeadline": "Podstawy",
"settingsHeadline": "Ustawienia",
"skipFromTotals": "Wyklucz z sumy",
"skipTooltip": "Pomiń kroki",
"spent": "zużyty",
"splitCancelTooltip": "Anuluj podział na miesiąc",
Expand Down
1 change: 1 addition & 0 deletions lib/l10n/app_pt.arb
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,7 @@
},
"settingsBaseHeadline": "Noções básicas",
"settingsHeadline": "Definições",
"skipFromTotals": "Excluir dos totais",
"skipTooltip": "Saltar passo(s)",
"spent": "gasto",
"splitCancelTooltip": "Cancelar divisão por mês",
Expand Down
1 change: 1 addition & 0 deletions lib/l10n/app_pt_BR.arb
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,7 @@
},
"settingsBaseHeadline": "Noções básicas",
"settingsHeadline": "Configurações",
"skipFromTotals": "Excluir dos totais",
"skipTooltip": "Pular etapa(s)",
"spent": "gasto",
"splitCancelTooltip": "Cancelar divisão por mês",
Expand Down
1 change: 1 addition & 0 deletions lib/l10n/app_tr.arb
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,7 @@
},
"settingsBaseHeadline": "Temel Bilgiler",
"settingsHeadline": "Ayarlar",
"skipFromTotals": "Toplamlardan hariç tut",
"skipTooltip": "Adım(lar)ı Atla",
"spent": "harcandı",
"splitCancelTooltip": "Ay Başına Bölünmeyi İptal Et",
Expand Down
1 change: 1 addition & 0 deletions lib/l10n/app_uk.arb
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,7 @@
},
"settingsBaseHeadline": "Основи",
"settingsHeadline": "Налаштування",
"skipFromTotals": "Виключити із загальної кількості",
"skipTooltip": "Пропустити крок(і)",
"spent": "патр.",
"splitCancelTooltip": "Скасувати розподіл на місяць",
Expand Down
1 change: 1 addition & 0 deletions lib/l10n/app_uz.arb
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,7 @@
},
"settingsBaseHeadline": "Asoslar",
"settingsHeadline": "Sozlamalar",
"skipFromTotals": "Jami hisobdan chiqarib tashlang",
"skipTooltip": "Qadam(lar)ni o‘tkazib yuborish",
"spent": "sarflangan",
"splitCancelTooltip": "Oyiga Splitni bekor qilish",
Expand Down
1 change: 1 addition & 0 deletions lib/l10n/app_zh.arb
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,7 @@
},
"settingsBaseHeadline": "基础知识",
"settingsHeadline": "设置",
"skipFromTotals": "不计入总数",
"skipTooltip": "跳过步骤",
"spent": "已花费",
"splitCancelTooltip": "取消每月拆分",
Expand Down
1 change: 1 addition & 0 deletions lib/l10n/app_zh_TW.arb
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,7 @@
},
"settingsBaseHeadline": "基本知識",
"settingsHeadline": "設定",
"skipFromTotals": "總計不包括",
"skipTooltip": "跳過步驟",
"spent": "花費",
"splitCancelTooltip": "取消每月分割",
Expand Down
38 changes: 28 additions & 10 deletions lib/pages/account/account_add_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ class AccountAddPageState<T extends AccountAddPage> extends AbstractAddPageState
late TextEditingController balance;
IconData? icon;
MaterialColor? color;
bool skip = false;

@override
void initState() {
Expand Down Expand Up @@ -108,6 +109,7 @@ class AccountAddPageState<T extends AccountAddPage> extends AbstractAddPageState
icon: icon,
closedAt: validTillDate,
createdAt: balanceUpdateDate,
skip: skip,
));
}

Expand Down Expand Up @@ -207,17 +209,33 @@ class AccountAddPageState<T extends AccountAddPage> extends AbstractAddPageState
SimpleInputFormatter.filterDouble,
],
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
RowWidget(
indent: indent,
maxWidth: width + indent,
chunk: const [20, null],
children: [
TextWrapper(
AppLocale.labels.balanceDate,
style: textTheme.bodyLarge,
),
Tooltip(
message: AppLocale.labels.balanceDateTooltip,
child: const Icon(Icons.info_outline),
),
[Checkbox(value: skip, onChanged: (value) => setState(() => skip = value!))],
[TextWrapper(AppLocale.labels.skipFromTotals)],
],
),
ThemeHelper.hIndent2x,
RowWidget(
indent: indent,
maxWidth: width + indent,
chunk: const [null, 20],
children: [
[
TextWrapper(
AppLocale.labels.balanceDate,
style: textTheme.bodyLarge,
),
],
[
Tooltip(
message: AppLocale.labels.balanceDateTooltip,
child: const Icon(Icons.info_outline),
),
]
],
),
DateTimeInput(
Expand Down
Loading
Loading