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
This commit is contained in:
Roland Geider
2025-11-16 15:57:07 +01:00
parent bd727c949b
commit 067fa7455f
3 changed files with 38 additions and 41 deletions

View File

@@ -90,9 +90,7 @@ class _GymModeState extends ConsumerState<GymMode> {
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<GymMode> {
}
// End (session)
out.add(
SessionPage(_controller),
);
out.add(SessionPage(_controller));
return out;
}
@@ -125,6 +121,7 @@ class _GymModeState extends ConsumerState<GymMode> {
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<GymMode> {
});
final state = ref.watch(gymStateProvider);
final List<Widget> children = [
final children = [
..._getContent(state),
];

View File

@@ -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),
),

View File

@@ -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),
),