Skip to content

Commit

Permalink
feat(ux/ui): UI improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
enrique-lozano committed Nov 1, 2023
1 parent 80dd0a6 commit 5728094
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 42 deletions.
14 changes: 6 additions & 8 deletions lib/app/stats/stats_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -184,14 +184,12 @@ class _StatsPageState extends State<StatsPage> {
const SizedBox(height: 16),
CardWithHeader(
title: t.stats.by_periods,
body: Padding(
padding: const EdgeInsets.only(bottom: 10, top: 16),
child: BalanceBarChart(
startDate: currentStartDate,
endDate: currentEndDate,
dateRange: currentDateRange,
filters: filters,
),
bodyPadding: const EdgeInsets.only(bottom: 12, top: 16),
body: BalanceBarChart(
startDate: currentStartDate,
endDate: currentEndDate,
dateRange: currentDateRange,
filters: filters,
),
)
]),
Expand Down
91 changes: 57 additions & 34 deletions lib/app/stats/widgets/income_expense_comparason.dart
Original file line number Diff line number Diff line change
Expand Up @@ -81,44 +81,67 @@ class IncomeExpenseComparason extends StatelessWidget {
final expense = snapshot.data![1].abs();

return Column(children: [
ListTile(
title: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(t.transaction.types.income(n: 1)),
CurrencyDisplayer(amountToConvert: income)
],
),
AnimatedProgressBar(
value: income + expense > 0
? (income / (income + expense))
: 0,
color: CustomColors.of(context).success),
])),
ListTile(
title: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(t.transaction.types.expense(n: 1)),
CurrencyDisplayer(amountToConvert: expense)
],
),
AnimatedProgressBar(
value: income + expense > 0
? (expense / (income + expense))
: 0,
color: CustomColors.of(context).danger),
]))
IncomeExpenseTile(
type: TransactionType.income,
value: income,
total: income + expense,
),
IncomeExpenseTile(
type: TransactionType.expense,
value: expense,
total: income + expense,
),
]);
},
),
],
);
}
}

class IncomeExpenseTile extends StatelessWidget {
const IncomeExpenseTile({
super.key,
required this.value,
required this.total,
required this.type,
});

final TransactionType type;
final double value;
final double total;

@override
Widget build(BuildContext context) {
final t = Translations.of(context);

return ListTile(
leading: Container(
padding: const EdgeInsets.all(4),
decoration: BoxDecoration(
color: appColorScheme(context).surfaceVariant,
borderRadius: BorderRadius.circular(4),
),
child: Icon(
type.icon,
color: type.color(context),
),
),
title: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(type == TransactionType.expense
? t.transaction.types.expense(n: 1)
: t.transaction.types.income(n: 1)),
CurrencyDisplayer(amountToConvert: value)
],
),
]),
subtitle: AnimatedProgressBar(
value: total > 0 ? (value / total) : 0,
color: type.color(context),
),
);
}
}

0 comments on commit 5728094

Please sign in to comment.