From de2791a60d3063b105dfb03f88606c361a7f7608 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maty=C3=A1=C5=A1=20Caras?= Date: Fri, 9 Feb 2024 17:07:50 +0100 Subject: [PATCH] fix: graph bad state error --- lib/util/graphs.dart | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/lib/util/graphs.dart b/lib/util/graphs.dart index 89696e7..77e5c27 100644 --- a/lib/util/graphs.dart +++ b/lib/util/graphs.dart @@ -186,14 +186,16 @@ class ExpensesLineChart extends StatelessWidget { topTitles: const AxisTitles(), leftTitles: AxisTitles( sideTitles: SideTitles( - reservedSize: (NumberFormat.compact() - .format(expenseDataSorted.last) - .length >= - 5 || - NumberFormat.compact() - .format(incomeDataSorted.last) - .length >= - 5) + reservedSize: ((expenseDataSorted.isNotEmpty && + NumberFormat.compact(locale: locale) + .format(expenseDataSorted.last) + .length >= + 5) || + (incomeDataSorted.isNotEmpty && + NumberFormat.compact(locale: locale) + .format(incomeDataSorted.last) + .length >= + 5)) ? 50 : 25, showTitles: true,