Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Video in gym mode #301

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions AUTHORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
- Adam Bujdoš - <https://github.com/bujdy>
- Aman Negi - <https://github.com/AmanNegi>
- Sandi Milohanic - <https://github.com/sandimilohanic>
- Mohammad Rafigh - <https://github.com/mohammadrafigh>
- Miroslav Mazel - <https://gitlab.com/12people>

## Translators
Expand Down Expand Up @@ -53,7 +54,7 @@
- Norwegian Bokmål

- Allan Nordhøy <[email protected]> (98)

- Japanese

- Kosei TANAKA <[email protected]> (97)
Expand All @@ -63,5 +64,5 @@
- Nenza Nurfirmansyah <[email protected]> (73)

- Croatian

- Sandi Milohaic <[email protected]>
8 changes: 8 additions & 0 deletions lib/providers/exercises.dart
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,14 @@ class ExercisesProvider with ChangeNotifier {
);
}

/// Find exercise base by UUID
ExerciseBase findExerciseBaseByUuid(String uuid) {
return _exerciseBases.firstWhere(
(base) => base.uuid == uuid,
orElse: () => throw NoSuchEntryException(),
);
}

/// Find exercise bases by variation IDs
///
/// exerciseIdToExclude: the ID of the exercise to exclude from the list of
Expand Down
20 changes: 19 additions & 1 deletion lib/widgets/workouts/gym_mode.dart
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import 'package:wger/providers/workout_plans.dart';
import 'package:wger/theme/theme.dart';
import 'package:wger/widgets/core/core.dart';
import 'package:wger/widgets/exercises/images.dart';
import 'package:wger/widgets/exercises/videos.dart';
import 'package:wger/widgets/workouts/forms.dart';

class GymMode extends StatefulWidget {
Expand Down Expand Up @@ -698,6 +699,17 @@ class ExerciseOverview extends StatelessWidget {
textAlign: TextAlign.center,
))
.toList(),
if (_exerciseBase.videos.isNotEmpty)
SizedBox(
width: double.infinity,
height: 200,
child: ListView(
scrollDirection: Axis.horizontal,
children: [
..._exerciseBase.videos.map((e) => ExerciseVideoWidget(video: e)).toList(),
],
),
),
if (_exerciseBase.images.isNotEmpty)
SizedBox(
width: double.infinity,
Expand Down Expand Up @@ -1063,6 +1075,8 @@ class NavigationHeader extends StatelessWidget {
});

Widget getDialog(BuildContext context) {
final exerciseProvider = Provider.of<ExercisesProvider>(context, listen: false);

return AlertDialog(
title: Text(
AppLocalizations.of(context).jumpTo,
Expand All @@ -1074,7 +1088,11 @@ class NavigationHeader extends StatelessWidget {
children: [
...exercisePages.keys.map((e) {
return ListTile(
title: Text(e),
title: Text(
exerciseProvider.findExerciseBaseByUuid(e).getExercise(
Localizations.localeOf(context).languageCode
).name
),
trailing: const Icon(Icons.chevron_right),
onTap: () {
_controller.animateToPage(
Expand Down