Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Meizzosama committed Apr 23, 2024
1 parent af5093e commit c9539bc
Show file tree
Hide file tree
Showing 7 changed files with 555 additions and 317 deletions.
2 changes: 1 addition & 1 deletion lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// @dart=2.9
//// @dart=2.9

import 'package:money_assistant_2608/project/real_main.dart';
Expand Down
2 changes: 1 addition & 1 deletion lib/project/app_pages/calendar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ class _CalendarBodyState extends State<CalendarBody> {
},
child: SwipeActionCell(
key: ObjectKey(transactions[int]),
performsFirstActionWithFullSwipe: true,
// performsFirstActionWithFullSwipe: true,
trailingActions: <SwipeAction>[
SwipeAction(
title: getTranslated(context, 'Delete') ?? 'Delete',
Expand Down
46 changes: 29 additions & 17 deletions lib/project/app_pages/input.dart
Original file line number Diff line number Diff line change
Expand Up @@ -647,9 +647,8 @@ class _DateCardState extends State<DateCard> {
),
),
Text(
DateFormat(sharedPrefs.dateFormat).format(
DateFormat('dd/MM/yyyy').parse(
model.date!)),
DateFormat(sharedPrefs.dateFormat)
.format(DateFormat('dd/MM/yyyy').parse(model.date!)),
style: GoogleFonts.aBeeZee(
fontSize: 21.5.sp,
),
Expand All @@ -666,19 +665,22 @@ class _DateCardState extends State<DateCard> {
}
Navigator.of(context).push(
showPicker(
cancelText: getTranslated(context, 'Cancel') ?? 'Cancel',
okText: getTranslated(context, 'Ok') ?? 'Ok',
unselectedColor: grey,
dialogInsetPadding: EdgeInsets.symmetric(
horizontal: 50.w, vertical: 30.0.h),
elevation: 12,
context: context,
value: selectedTime,
is24HrFormat: true,
onChange: (value) => setState(() {
selectedTime = value;
model.time = value.format(context);
})),
cancelText: getTranslated(context, 'Cancel') ?? 'Cancel',
okText: getTranslated(context, 'Ok') ?? 'Ok',
unselectedColor: grey,
dialogInsetPadding:
EdgeInsets.symmetric(horizontal: 50.w, vertical: 30.0.h),
elevation: 12,
context: context,
value: timeOfDayToTime(
selectedTime), // Convert TimeOfDay to Time
is24HrFormat: true,
onChange: (value) => setState(() {
selectedTime =
TimeOfDay(hour: value.hour, minute: value.minute);
model.time = selectedTime.format(context);
}),
),
);
},
child: Text(
Expand All @@ -694,6 +696,13 @@ class _DateCardState extends State<DateCard> {
}
}

Time timeOfDayToTime(TimeOfDay timeOfDay) {
return Time(
hour: timeOfDay.hour,
minute: timeOfDay.minute,
);
}

void saveInputFunc(BuildContext context, bool saveFunction) {
model.amount = _amountController.text.isEmpty
? 0
Expand All @@ -709,7 +718,10 @@ void saveInputFunc(BuildContext context, bool saveFunction) {
} else {
DB.update(model);
Navigator.pop(context);
customToast(context, getTranslated(context, 'Transaction has been updated') ?? 'Transaction has been updated');
customToast(
context,
getTranslated(context, 'Transaction has been updated') ??
'Transaction has been updated');
}
}

Expand Down
32 changes: 24 additions & 8 deletions lib/project/app_pages/report.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import 'dart:io' show Platform;
import 'package:syncfusion_flutter_charts/charts.dart';

import 'edit.dart';

import 'dart:io';
var year = todayDT.year;

class Report extends StatefulWidget {
Expand All @@ -36,6 +36,7 @@ class Report extends StatefulWidget {
required this.icon,
});


@override
_ReportState createState() => _ReportState();
}
Expand Down Expand Up @@ -93,13 +94,26 @@ class ReportBody extends StatefulWidget {
final String selectedDate;
final Color color;
final IconData icon;
ReportBody(
this.type, this.category, this.selectedDate, this.color, this.icon);

ReportBody(this.type, this.category, this.selectedDate, this.color,
this.icon);

@override
_ReportBodyState createState() => _ReportBodyState();

List<CartesianSeries<dynamic, dynamic>> _getGradientAreaSeries(String type,
List<MonthAmount> monthAmountList) {
return <CartesianSeries<dynamic, dynamic>>[
SplineAreaSeries<MonthAmount, String>(
dataSource: monthAmountList,
xValueMapper: (MonthAmount monthAmount, _) => monthAmount.month,
yValueMapper: (MonthAmount monthAmount, _) => monthAmount.amount,
),
];
}
}

class _ReportBodyState extends State<ReportBody> {
class _ReportBodyState extends State<ReportBody> {
@override
Widget build(BuildContext context) {
return ChangeNotifierProvider(
Expand Down Expand Up @@ -211,6 +225,8 @@ class _ReportBodyState extends State<ReportBody> {
}
}



return Column(
children: [
Padding(
Expand Down Expand Up @@ -240,8 +256,8 @@ class _ReportBodyState extends State<ReportBody> {
width: 4.h,
),
majorTickLines: MajorTickLines(size: 5.sp)),
series: _getGradientAreaSeries(
this.widget.type, monthBasedTransactionList),
// series: _getGradientAreaSeries(
// this.widget.type, monthBasedTransactionList),
onMarkerRender: (MarkerRenderArgs args) {
if (this.widget.type == 'Income') {
if (args.pointIndex == 0) {
Expand Down Expand Up @@ -432,8 +448,8 @@ class _ReportBodyState extends State<ReportBody> {
key: ObjectKey(
selectedTransactions[
int]),
performsFirstActionWithFullSwipe:
true,
// performsFirstActionWithFullSwipe:
// true,
trailingActions: <
SwipeAction>[
SwipeAction(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,10 @@ class SharedPrefs {
categoryItem(MdiIcons.dogService, 'Pets'),
categoryItem(MdiIcons.tableChair, 'Furnishings'),
categoryItem(MdiIcons.autoFix, 'Home Services'),
categoryItem(MdiIcons.homeCurrencyUsd, 'Mortgage & Rent'),
categoryItem(MdiIcons.currencyUsd, 'Mortgage & Rent'),
]);


saveItems('Utility Bills', [
categoryItem(FontAwesomeIcons.fileInvoiceDollar, 'Utility Bills'),
categoryItem(IcoFontIcons.lightBulb, 'Electricity'),
Expand Down
Loading

0 comments on commit c9539bc

Please sign in to comment.