minor changes

main
Arlind 2023-06-18 03:00:17 +02:00
parent ec00e2ed5f
commit 85148378a6
8 changed files with 96 additions and 27 deletions

View File

@ -1,4 +1,5 @@
import 'dart:convert'; import 'dart:convert';
import 'package:awesome_dialog/awesome_dialog.dart';
import 'package:circular_seek_bar/circular_seek_bar.dart'; import 'package:circular_seek_bar/circular_seek_bar.dart';
import 'package:easy_localization/easy_localization.dart'; import 'package:easy_localization/easy_localization.dart';
import 'package:flutter_neumorphic/flutter_neumorphic.dart'; import 'package:flutter_neumorphic/flutter_neumorphic.dart';
@ -469,29 +470,78 @@ class AccountDetailPageState extends State<AccountDetailPage>
} }
Widget _buildTransactionsList(List<Transaction> transactionsList) { Widget _buildTransactionsList(List<Transaction> transactionsList) {
return ListView.builder(
return ListView.separated(
physics: const BouncingScrollPhysics(), physics: const BouncingScrollPhysics(),
itemCount: transactionsList.length, itemCount: transactionsList.length,
itemBuilder: (context, index) { itemBuilder: (context, index) {
return ListTile( final transaction = transactionsList[index];
title: Text(transactionsList[index].title), final formattedDate = DateFormat.yMMMMd().add_Hm().format(transaction.date);
subtitle: Text(transactionsList[index].title), return GestureDetector(
onLongPress: () =>
_showDeleteConfirmationDialog(transactionsList[index]),
child: ListTile(
title: Text(
transactionsList[index].title,
style: TextStyle(
color: Theme.of(context).brightness == Brightness.dark
? Colors.white54
: Colors.black87),
),
subtitle:Text(
formattedDate,
style: TextStyle(
fontSize: 12,
color: Theme.of(context).brightness == Brightness.dark ? Colors.grey[600] : Colors.grey[400],
),
),
trailing: Text( trailing: Text(
transactionsList[index].isExpense transactionsList[index].isExpense
? '-$_selectedCurrency${transactionsList[index].amount.toStringAsFixed(2)}' ? '-$_selectedCurrency${transactionsList[index].amount.toStringAsFixed(2)}'
: '+$_selectedCurrency${transactionsList[index].amount.toStringAsFixed(2)}', : '+$_selectedCurrency${transactionsList[index].amount.toStringAsFixed(2)}',
style: TextStyle( style: TextStyle(
color: color: transactionsList[index].isExpense
transactionsList[index].isExpense ? Colors.red : Colors.green, ? Colors.red
: Colors.green,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
), ),
onLongPress: () => deleteTransaction(transactionsList[index]), ),
); );
}, },
separatorBuilder: (context, index) => Divider(
indent: MediaQuery.of(context).size.width * 0.03,
endIndent: MediaQuery.of(context).size.width * 0.03,
color: Colors.grey,
height: 0.05,
),
); );
} }
Future _showDeleteConfirmationDialog(Transaction transaction) {
return AwesomeDialog(
dialogBackgroundColor: Theme.of(context).brightness == Brightness.dark
? Colors.grey[800]
: Colors.grey[200],
btnOkText: "Delete".tr(),
btnOkColor: Colors.red,
btnCancelColor: Theme.of(context).brightness == Brightness.dark
? Colors.grey[500]
: Colors.grey[500],
context: context,
animType: AnimType.bottomSlide,
dialogType: DialogType.info,
title: 'deletetransaction'.tr(),
headerAnimationLoop: false,
desc: 'suretransaction'.tr(),
btnCancelOnPress: () {},
btnOkOnPress: () {
deleteTransaction(transaction);
},
).show();
}
double calculateMonthlyExpensesTotal() { double calculateMonthlyExpensesTotal() {
double total = 0; double total = 0;
for (var transaction in expenseTransactions) { for (var transaction in expenseTransactions) {

View File

@ -46,9 +46,11 @@ class AddAccountDialogState extends State<AddAccountDialog> {
), ),
title: Text( title: Text(
'addaccount'.tr(), 'addaccount'.tr(),
textAlign: TextAlign.center,
), ),
titleTextStyle: const TextStyle( titleTextStyle: TextStyle(
fontSize: 20, fontSize: 20,
color: Theme.of(context).brightness==Brightness.dark?Colors.white70:Colors.black87,
), ),
content: Form( content: Form(
key: _formKey, key: _formKey,
@ -131,7 +133,6 @@ class AddAccountDialogState extends State<AddAccountDialog> {
), ),
actions: [ actions: [
NeumorphicButton( NeumorphicButton(
margin: const EdgeInsets.fromLTRB(0, 0, 4, 4),
onPressed: () { onPressed: () {
Navigator.of(context).pop(); Navigator.of(context).pop();
}, },

View File

@ -1,7 +1,7 @@
{ {
"title": "My Finance Planner", "title": "My Finance Planner",
"delete": "Löschen", "delete": "Löschen",
"deleteaccount": "Account löschen", "deleteaccount": "Account löschen?",
"sure": "Sind Sie sicher, dass Sie dieses Konto löschen möchten?", "sure": "Sind Sie sicher, dass Sie dieses Konto löschen möchten?",
"balance": "Bilanz", "balance": "Bilanz",
"addaccount": "Konto hinzufügen", "addaccount": "Konto hinzufügen",
@ -42,5 +42,7 @@
"tip15": "Nutze kostenlose Online-Ressourcen für Weiterbildung und Hobbys.", "tip15": "Nutze kostenlose Online-Ressourcen für Weiterbildung und Hobbys.",
"hint": "Spartipps gefällig? \nDrücke auf den Info-Button", "hint": "Spartipps gefällig? \nDrücke auf den Info-Button",
"budgetmax": "Budget verbraucht!", "budgetmax": "Budget verbraucht!",
"enterbudget": "Budget eingeben" "enterbudget": "Budget eingeben",
"deletetransaction":"Transaktion löschen?",
"suretransaction": "Sind Sie sicher, dass Sie die Transaktion löschen möchten?"
} }

View File

@ -1,7 +1,7 @@
{ {
"title": "My Finance Planner", "title": "My Finance Planner",
"delete": "Delete", "delete": "Delete",
"deleteaccount": "Delete account", "deleteaccount": "Delete account?",
"sure": "Are you sure you want to delete this account?", "sure": "Are you sure you want to delete this account?",
"balance": "Balance", "balance": "Balance",
"addaccount": "Add account", "addaccount": "Add account",
@ -42,5 +42,7 @@
"tip15":"Use free online resources for continuing education and hobbies.", "tip15":"Use free online resources for continuing education and hobbies.",
"hint": "Need saving tips? \nPress the info button", "hint": "Need saving tips? \nPress the info button",
"budgetmax": "Budget spent!", "budgetmax": "Budget spent!",
"enterbudget": "Enter budget" "enterbudget": "Enter budget",
"deletetransaction":"Delete transaction?",
"suretransaction": "Are you sure you want to delete this transaction?"
} }

View File

@ -149,7 +149,7 @@ class HomePageState extends State<HomePage> {
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,
elevation: 0, elevation: 0,
leading: Padding( leading: Padding(
padding: EdgeInsets.only(left: 5), padding: const EdgeInsets.only(left: 5),
child: Image.asset( child: Image.asset(
'lib/assets/mfa_logo.png', 'lib/assets/mfa_logo.png',
width: 32, width: 32,
@ -207,9 +207,16 @@ class HomePageState extends State<HomePage> {
return GestureDetector( return GestureDetector(
onLongPress: () { onLongPress: () {
AwesomeDialog( AwesomeDialog(
dialogBackgroundColor:
Theme.of(context).brightness == Brightness.dark
? Colors.grey[800]
: Colors.grey[200],
btnOkText: "Delete".tr(), btnOkText: "Delete".tr(),
btnOkColor: Colors.lightGreen, btnOkColor: Colors.red,
btnCancelColor: Theme.of(context).shadowColor, btnCancelColor:
Theme.of(context).brightness == Brightness.dark
? Colors.grey[500]
: Colors.grey[500],
context: context, context: context,
animType: AnimType.bottomSlide, animType: AnimType.bottomSlide,
dialogType: DialogType.info, dialogType: DialogType.info,

View File

@ -147,7 +147,7 @@ class AddTransactionDialogState extends State<AddTransactionDialog> {
? grey200 ? grey200
: grey800, : grey800,
selectedDepth: -10, selectedDepth: -10,
unselectedDepth: 8), unselectedDepth: 6),
value: _isExpense, value: _isExpense,
onChanged: (value) { onChanged: (value) {
setState(() { setState(() {
@ -155,7 +155,7 @@ class AddTransactionDialogState extends State<AddTransactionDialog> {
}); });
}, },
), ),
const SizedBox(width: 8), const SizedBox(width: 9),
Text( Text(
'expense'.tr(), 'expense'.tr(),
), ),
@ -195,7 +195,6 @@ class AddTransactionDialogState extends State<AddTransactionDialog> {
), ),
), ),
NeumorphicButton( NeumorphicButton(
margin: const EdgeInsets.fromLTRB(0, 0, 4, 4),
onPressed: _submitForm, onPressed: _submitForm,
style: NeumorphicStyle( style: NeumorphicStyle(
shape: NeumorphicShape.concave, shape: NeumorphicShape.concave,

View File

@ -211,6 +211,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "3.2.0" version: "3.2.0"
flutter_slidable:
dependency: "direct main"
description:
name: flutter_slidable
sha256: "6c68e1fad129b4b807b2218ef4cf7f7f6f61c5ec8861c990dc2278d9d03cb09f"
url: "https://pub.dev"
source: hosted
version: "2.0.0"
flutter_svg: flutter_svg:
dependency: "direct main" dependency: "direct main"
description: description:

View File

@ -38,6 +38,7 @@ dependencies:
circular_seek_bar: ^1.1.0 circular_seek_bar: ^1.1.0
tab_indicator_styler: ^2.0.0 tab_indicator_styler: ^2.0.0
provider: ^6.0.5 provider: ^6.0.5
flutter_slidable: ^2.0.0
dev_dependencies: dev_dependencies:
flutter_test: flutter_test:
@ -79,5 +80,4 @@ flutter:
weight: 600 weight: 600
- asset: lib/fonts/Montserrat-Thin.ttf - asset: lib/fonts/Montserrat-Thin.ttf
weight: 100 weight: 100
# For details regarding fonts from package dependencies,
# see https://flutter.dev/custom-fonts/#from-packages