Skip to content

Conversation

@rolandgeider
Copy link
Member

@rolandgeider rolandgeider commented Nov 16, 2025

Proposed Changes

Improvements to the gym mode. The code has been split up so that the business logic lives in the gym provider.

New features:

  • allow users to remove the exercise overview and timers
  • track workout progress and show it in a new overview menu
  • show progress within a set (e.g. 1/4)
  • allow to swap or add exercises, this allows to make more ad-hoc workouts
  • don't force users to save a time in the session form
Screenshot_20251116_155719 Screenshot_20251116_152123

Related Issue(s)

Closes #990
Closes #958
Closes #802
Closes #16
Closes wger-project/wger#2033
Helps somewhat with wger-project/wger#1949

Please check that the PR fulfills these requirements

  • Tests for the changes have been added (for bug fixes / features)
  • Set a 100 character limit in your editor/IDE to avoid white space diffs in the PR
    (run dart format .)
  • Updated/added relevant documentation (doc comments with ///).
  • Added relevant reviewers.

Needed to downgrade build_runner and mockito for now
This makes the widgets in the gym mode smaller and we can remove
a lot of prop drilling that was necessary
The tests should mirror the structure of the regular application
This is easier to open with the thumbs and also makes logical sense. When
opening the workout menu from here, the default tab is the progress one, not
the overview.
While these are not real ad-hoc workouts, at least it's a first step
Now, the LogPage gets all it's info from the state.
Exercise names are not repeated anymore (again) and we use a bottom sheet now
instead of a modal dialog
Note that this shouldn't actually happen, we should find a proper solution
This keeps the progression saved as well as any changed exercises
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
@rolandgeider rolandgeider linked an issue Nov 16, 2025 that may be closed by this pull request
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request implements significant improvements to the gym mode functionality by refactoring the business logic into a centralized gym state provider. The changes enable more flexible workout tracking with options to customize the workout experience.

Key Changes:

  • Refactored gym mode to use Riverpod state management, centralizing business logic in GymStateProvider
  • Added user controls to hide/show exercise overviews and timer pages during workouts
  • Implemented workout progress tracking with visual indicators and a new progress menu
  • Added functionality to swap or add exercises during workouts for more ad-hoc adjustments
  • Made time fields optional in the session form

Reviewed Changes

Copilot reviewed 75 out of 78 changed files in this pull request and generated no comments.

Show a summary per file
File Description
pubspec.yaml Upgraded flutter_riverpod to 3.0.3 and added riverpod_annotation/riverpod_generator dependencies
pubspec.lock Updated dependency lock file with new package versions including build_runner downgrade to 2.7.0
test/widgets/routines/plate_calculator_test.dart Refactored test to use ProviderContainer for improved test isolation
test/providers/plate_calculator_test.dart Updated test to use ProviderContainer pattern
test/providers/gym_state_test.dart Added comprehensive tests for new GymStateNotifier functionality
test/routine/gym_mode/*.dart Restructured gym mode tests with updated mock files and new test structure
lib/widgets/routines/gym_mode/workout_menu.dart New widget implementing workout navigation and progress tracking menus
lib/widgets/routines/gym_mode/timer.dart Simplified timer widgets by removing redundant parameters
lib/widgets/routines/gym_mode/start_page.dart Added gym mode options and refactored to use GymStateProvider
lib/widgets/routines/gym_mode/session_page.dart Converted to ConsumerWidget using GymStateProvider
lib/widgets/routines/gym_mode/navigation.dart Simplified navigation components with state management integration
lib/widgets/routines/gym_mode/log_page.dart Refactored to use GymStateProvider for log management
lib/widgets/routines/gym_mode/exercise_overview.dart Converted to ConsumerWidget with simplified interface
lib/widgets/routines/forms/session.dart Added clear buttons to time input fields
Multiple .mocks.dart files Removed deprecated invalid_use_of_internal_member ignore directive

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

# Conflicts:
#	lib/widgets/routines/gym_mode/navigation.dart
#	pubspec.lock
#	test/exercises/contribute_exercise_image_test.mocks.dart
#	test/exercises/contribute_exercise_test.mocks.dart
#	test/nutrition/nutritional_meal_form_test.mocks.dart
#	test/nutrition/nutritional_plan_form_test.mocks.dart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants