From 9953635ad353373900c04eb6f704469c2bb1e000 Mon Sep 17 00:00:00 2001 From: Marco Date: Tue, 11 Jun 2024 19:11:23 +0200 Subject: [PATCH] round numbers to next integer --- lib/food_entry_widget.dart | 6 +++--- lib/sum_widget.dart | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/food_entry_widget.dart b/lib/food_entry_widget.dart index 97e3071..f9f7dbf 100644 --- a/lib/food_entry_widget.dart +++ b/lib/food_entry_widget.dart @@ -16,9 +16,9 @@ class FoodEntryWidget extends StatelessWidget { padding: const EdgeInsets.only(left: 4.0), child: RowWidget( Text(entry.name), - Text(entry.mass.toString()), - Text(entry.kcalPerMass.toString()), - Text((entry.mass * entry.kcalPerMass / 100).toString()), + Text(entry.mass.ceil().toString()), + Text(entry.kcalPerMass.ceil().toString()), + Text((entry.mass * entry.kcalPerMass / 100).ceil().toString()), IconButton( style: IconButton.styleFrom(padding: EdgeInsets.zero), onPressed: () { diff --git a/lib/sum_widget.dart b/lib/sum_widget.dart index dac3137..4ee58e7 100644 --- a/lib/sum_widget.dart +++ b/lib/sum_widget.dart @@ -26,7 +26,7 @@ class _SumWidgetState extends State { null, null, const Text("kcal heute:"), - Text('${sum.toString()}/${state.kcalLimit}'), + Text('${sum.ceil().toString()}/${state.kcalLimit.ceil()}'), null, ); },