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 'package:awesome_dialog/awesome_dialog.dart';
import 'package:circular_seek_bar/circular_seek_bar.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter_neumorphic/flutter_neumorphic.dart';
@ -469,29 +470,78 @@ class AccountDetailPageState extends State<AccountDetailPage>
}
Widget _buildTransactionsList(List<Transaction> transactionsList) {
return ListView.builder(
return ListView.separated(
physics: const BouncingScrollPhysics(),
itemCount: transactionsList.length,
itemBuilder: (context, index) {
return ListTile(
title: Text(transactionsList[index].title),
subtitle: Text(transactionsList[index].title),
final transaction = transactionsList[index];
final formattedDate = DateFormat.yMMMMd().add_Hm().format(transaction.date);
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(
transactionsList[index].isExpense
? '-$_selectedCurrency${transactionsList[index].amount.toStringAsFixed(2)}'
: '+$_selectedCurrency${transactionsList[index].amount.toStringAsFixed(2)}',
style: TextStyle(
color:
transactionsList[index].isExpense ? Colors.red : Colors.green,
color: transactionsList[index].isExpense
? Colors.red
: Colors.green,
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 total = 0;
for (var transaction in expenseTransactions) {

View File

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

View File

@ -1,7 +1,7 @@
{
"title": "My Finance Planner",
"delete": "Löschen",
"deleteaccount": "Account löschen",
"deleteaccount": "Account löschen?",
"sure": "Sind Sie sicher, dass Sie dieses Konto löschen möchten?",
"balance": "Bilanz",
"addaccount": "Konto hinzufügen",
@ -42,5 +42,7 @@
"tip15": "Nutze kostenlose Online-Ressourcen für Weiterbildung und Hobbys.",
"hint": "Spartipps gefällig? \nDrücke auf den Info-Button",
"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",
"delete": "Delete",
"deleteaccount": "Delete account",
"deleteaccount": "Delete account?",
"sure": "Are you sure you want to delete this account?",
"balance": "Balance",
"addaccount": "Add account",
@ -42,5 +42,7 @@
"tip15":"Use free online resources for continuing education and hobbies.",
"hint": "Need saving tips? \nPress the info button",
"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,
elevation: 0,
leading: Padding(
padding: EdgeInsets.only(left: 5),
padding: const EdgeInsets.only(left: 5),
child: Image.asset(
'lib/assets/mfa_logo.png',
width: 32,
@ -207,9 +207,16 @@ class HomePageState extends State<HomePage> {
return GestureDetector(
onLongPress: () {
AwesomeDialog(
dialogBackgroundColor:
Theme.of(context).brightness == Brightness.dark
? Colors.grey[800]
: Colors.grey[200],
btnOkText: "Delete".tr(),
btnOkColor: Colors.lightGreen,
btnCancelColor: Theme.of(context).shadowColor,
btnOkColor: Colors.red,
btnCancelColor:
Theme.of(context).brightness == Brightness.dark
? Colors.grey[500]
: Colors.grey[500],
context: context,
animType: AnimType.bottomSlide,
dialogType: DialogType.info,

View File

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

View File

@ -211,6 +211,14 @@ packages:
url: "https://pub.dev"
source: hosted
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:
dependency: "direct main"
description:

View File

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