From f2fae3d888ae227580c2e97a67de1d15c0c71122 Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Wed, 26 Nov 2025 12:35:36 +0100 Subject: [PATCH] Handle case where the reps and weight forms are empty --- lib/widgets/routines/gym_mode/log_page.dart | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/widgets/routines/gym_mode/log_page.dart b/lib/widgets/routines/gym_mode/log_page.dart index a7ec9c39..8b22a326 100644 --- a/lib/widgets/routines/gym_mode/log_page.dart +++ b/lib/widgets/routines/gym_mode/log_page.dart @@ -313,8 +313,10 @@ class LogsRepsWidget extends StatelessWidget { IconButton( icon: const Icon(Icons.add, color: Colors.black), onPressed: () { + final value = controller.text.isNotEmpty ? controller.text : '0'; + try { - final newValue = numberFormat.parse(controller.text) + repsValueChange; + final newValue = numberFormat.parse(value) + repsValueChange; setStateCallback(() { log.repetitions = newValue; controller.text = numberFormat.format(newValue); @@ -412,8 +414,10 @@ class LogsWeightWidget extends ConsumerWidget { IconButton( icon: const Icon(Icons.add, color: Colors.black), onPressed: () { + final value = controller.text.isNotEmpty ? controller.text : '0'; + try { - final newValue = numberFormat.parse(controller.text) + weightValueChange; + final newValue = numberFormat.parse(value) + weightValueChange; setStateCallback(() { log.weight = newValue; controller.text = numberFormat.format(newValue);