diff --git a/lib/util/graphs.dart b/lib/util/graphs.dart index 06f0305..b4a2bef 100644 --- a/lib/util/graphs.dart +++ b/lib/util/graphs.dart @@ -51,22 +51,39 @@ class ExpensesLineChart extends StatelessWidget { getTooltipItems: (spots) => List.generate( spots.length, (index) => LineTooltipItem( - (yearly) - ? AppLocalizations.of(context).expensesForMonth( - 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).expensesForDay( - NumberFormat.compactCurrency( - locale: locale, - symbol: currency.symbol, - name: currency.name) - .format(spots[index].y), - ), + (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( + 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).expensesForDay( + NumberFormat.compactCurrency( + locale: locale, + symbol: currency.symbol, + name: currency.name) + .format(spots[index].y), + )), TextStyle(color: spots[index].bar.color), ), ),