From 067fa7455f1846eb7ccb89d85c27791091c62250 Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Sun, 16 Nov 2025 15:57:07 +0100 Subject: [PATCH] Revert to showDialog The modal sheet was causing problems when using the autocompleter, there were overflows and even if we fixed that, there wasn't enough space to comfortably use it --- lib/widgets/routines/gym_mode/gym_mode.dart | 12 ++-- lib/widgets/routines/gym_mode/navigation.dart | 4 +- .../routines/gym_mode/workout_menu.dart | 63 ++++++++++--------- 3 files changed, 38 insertions(+), 41 deletions(-) diff --git a/lib/widgets/routines/gym_mode/gym_mode.dart b/lib/widgets/routines/gym_mode/gym_mode.dart index a4e2be38..941175e2 100644 --- a/lib/widgets/routines/gym_mode/gym_mode.dart +++ b/lib/widgets/routines/gym_mode/gym_mode.dart @@ -90,9 +90,7 @@ class _GymModeState extends ConsumerState { out.add(ExerciseOverview(_controller, config.exercise)); } - out.add( - LogPage(_controller), - ); + out.add(LogPage(_controller)); if (state.showTimerPages) { if (config.restTime != null) { @@ -107,9 +105,7 @@ class _GymModeState extends ConsumerState { } // End (session) - out.add( - SessionPage(_controller), - ); + out.add(SessionPage(_controller)); return out; } @@ -125,6 +121,7 @@ class _GymModeState extends ConsumerState { return Center(child: Text('Error: ${snapshot.error}: ${snapshot.stackTrace}')); } else if (snapshot.connectionState == ConnectionState.done) { final initialPage = snapshot.data!; + WidgetsBinding.instance.addPostFrameCallback((_) { if (!_initialPageJumped && _controller.hasClients) { _controller.jumpToPage(initialPage); @@ -133,8 +130,7 @@ class _GymModeState extends ConsumerState { }); final state = ref.watch(gymStateProvider); - - final List children = [ + final children = [ ..._getContent(state), ]; diff --git a/lib/widgets/routines/gym_mode/navigation.dart b/lib/widgets/routines/gym_mode/navigation.dart index d8981405..d2572b52 100644 --- a/lib/widgets/routines/gym_mode/navigation.dart +++ b/lib/widgets/routines/gym_mode/navigation.dart @@ -53,7 +53,7 @@ class NavigationHeader extends StatelessWidget { IconButton( icon: const Icon(Icons.menu), onPressed: () { - showModalBottomSheet( + showDialog( context: context, builder: (ctx) => WorkoutMenuDialog(_controller), ); @@ -95,7 +95,7 @@ class NavigationFooter extends ConsumerWidget { const SizedBox(width: 48), Expanded( child: GestureDetector( - onTap: () => showModalBottomSheet( + onTap: () => showDialog( context: context, builder: (ctx) => WorkoutMenuDialog(_controller, initialIndex: 1), ), diff --git a/lib/widgets/routines/gym_mode/workout_menu.dart b/lib/widgets/routines/gym_mode/workout_menu.dart index dd64a6e3..84bcb191 100644 --- a/lib/widgets/routines/gym_mode/workout_menu.dart +++ b/lib/widgets/routines/gym_mode/workout_menu.dart @@ -66,35 +66,38 @@ class NavigationTab extends ConsumerWidget { Widget build(BuildContext context, WidgetRef ref) { final state = ref.watch(gymStateProvider); - return Column( - children: [ - ...state.pages.where((pageEntry) => pageEntry.type == PageType.set).map((page) { - return ListTile( - leading: page.allLogsDone ? const Icon(Icons.check) : null, - title: Text( - page.exercises - .map( - (exercise) => - exercise.getTranslation(Localizations.localeOf(context).languageCode).name, - ) - .toList() - .join('\n'), - style: TextStyle( - decoration: page.allLogsDone ? TextDecoration.lineThrough : TextDecoration.none, + return SingleChildScrollView( + child: Column( + children: [ + ...state.pages.where((pageEntry) => pageEntry.type == PageType.set).map((page) { + return ListTile( + leading: page.allLogsDone ? const Icon(Icons.check) : null, + title: Text( + page.exercises + .map( + (exercise) => exercise + .getTranslation(Localizations.localeOf(context).languageCode) + .name, + ) + .toList() + .join('\n'), + style: TextStyle( + decoration: page.allLogsDone ? TextDecoration.lineThrough : TextDecoration.none, + ), ), - ), - trailing: const Icon(Icons.chevron_right), - onTap: () { - _controller.animateToPage( - page.pageIndex, - duration: DEFAULT_ANIMATION_DURATION, - curve: DEFAULT_ANIMATION_CURVE, - ); - Navigator.of(context).pop(); - }, - ); - }), - ], + trailing: const Icon(Icons.chevron_right), + onTap: () { + _controller.animateToPage( + page.pageIndex, + duration: DEFAULT_ANIMATION_DURATION, + curve: DEFAULT_ANIMATION_CURVE, + ); + Navigator.of(context).pop(); + }, + ); + }), + ], + ), ); } } @@ -328,7 +331,7 @@ class ExerciseSwapWidget extends ConsumerWidget { mainAxisSize: MainAxisSize.max, children: [ Text( - e.getTranslation('en').name, + e.getTranslation(Localizations.localeOf(context).languageCode).name, style: Theme.of(context).textTheme.bodyLarge, ), const Icon(Icons.swap_vert), @@ -433,9 +436,7 @@ class WorkoutMenuDialog extends ConsumerWidget { textAlign: TextAlign.center, ), contentPadding: EdgeInsets.zero, - insetPadding: EdgeInsets.zero, content: SizedBox( - height: double.maxFinite, width: double.maxFinite, child: WorkoutMenu(controller, initialIndex: initialIndex), ),