feat: add graphs #16

Merged
hernik merged 9 commits from dev into main 2023-12-25 21:43:25 +01:00
Showing only changes of commit 512de4deff - Show all commits

View file

@ -51,10 +51,27 @@ class ExpensesLineChart extends StatelessWidget {
getTooltipItems: (spots) => List<LineTooltipItem>.generate( getTooltipItems: (spots) => List<LineTooltipItem>.generate(
spots.length, spots.length,
(index) => LineTooltipItem( (index) => LineTooltipItem(
(yearly) (spots[index].barIndex == 0)
? (yearly
? AppLocalizations.of(context).incomeForMonth(
DateFormat.MMMM(locale).format(DateTime(
date.year, spots[index].x.toInt() + 1, 1)),
NumberFormat.compactCurrency(
locale: locale,
symbol: currency.symbol,
name: currency.name)
.format(spots[index].y))
: AppLocalizations.of(context).incomeForDay(
NumberFormat.compactCurrency(
locale: locale,
symbol: currency.symbol,
name: currency.name)
.format(spots[index].y),
))
: (yearly
? AppLocalizations.of(context).expensesForMonth( ? AppLocalizations.of(context).expensesForMonth(
DateFormat.MMMM(locale).format( DateFormat.MMMM(locale).format(DateTime(
DateTime(date.year, spots[index].x.toInt() + 1, 1)), date.year, spots[index].x.toInt() + 1, 1)),
NumberFormat.compactCurrency( NumberFormat.compactCurrency(
locale: locale, locale: locale,
symbol: currency.symbol, symbol: currency.symbol,
@ -66,7 +83,7 @@ class ExpensesLineChart extends StatelessWidget {
symbol: currency.symbol, symbol: currency.symbol,
name: currency.name) name: currency.name)
.format(spots[index].y), .format(spots[index].y),
), )),
TextStyle(color: spots[index].bar.color), TextStyle(color: spots[index].bar.color),
), ),
), ),