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

Flexible routines #682

Draft
wants to merge 32 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
7db93f0
Start implementing new flexible routines
rolandgeider Oct 30, 2024
a79b6d6
Start implementing new flexible routines
rolandgeider Oct 30, 2024
9ff2bba
Load the new DayData entries and the regular data objects from struct…
rolandgeider Oct 30, 2024
abf9413
Start rendering the new routines
rolandgeider Nov 2, 2024
05b13d8
Further work on rendering the new routines
rolandgeider Nov 7, 2024
415daf1
Workaround for duplicate exercises in the DB
rolandgeider Nov 10, 2024
5c94737
Rename provider
rolandgeider Nov 10, 2024
12f22d2
Rename widget folder
rolandgeider Nov 10, 2024
47e36ef
More refactoring of routine screens and widgets
rolandgeider Nov 10, 2024
cd4a848
Remove the CustomScrollView
rolandgeider Nov 10, 2024
a35336f
Allow editing the fit in week toggle as well as start and end dates
rolandgeider Nov 12, 2024
1d93b2f
Refactor forms into individual files
rolandgeider Nov 12, 2024
9e9fa6b
Allow setting the day order per drag and drop
rolandgeider Nov 12, 2024
d76fcdc
Allow editing the currently selected day
rolandgeider Nov 12, 2024
4d4120c
Select newly created day for editing
rolandgeider Nov 12, 2024
bf73afd
Allow deleting days from a routine
rolandgeider Nov 12, 2024
056ed2b
Allow day objects to load slots
rolandgeider Nov 12, 2024
aa8c344
Allow reordering of slots
rolandgeider Nov 12, 2024
4b5ce9b
Remove reorderable from routine view widget
rolandgeider Nov 13, 2024
277628f
Merge branch 'master' into feature/flexible-routines
rolandgeider Nov 14, 2024
23119e6
Allow users to reorder the days and the slots within the days
rolandgeider Nov 15, 2024
04c6d6c
Save values to server
rolandgeider Nov 15, 2024
ffa87f6
Refactor update logic
rolandgeider Nov 16, 2024
c5f4eec
Extract exercise autocompleter to its own widget
rolandgeider Nov 16, 2024
e6e0ed3
Properly set or remove newly created objects
rolandgeider Nov 16, 2024
a4f334e
Allow deleting slots
rolandgeider Nov 16, 2024
f7461ab
Polish the crud workflow
rolandgeider Nov 16, 2024
7499033
Remove unused strings
rolandgeider Nov 16, 2024
8020bd2
More polish and i18n work
rolandgeider Nov 16, 2024
be28c27
Give feedback to the user when the form is being saved
rolandgeider Nov 16, 2024
aa6468e
Use a slider to select the number of sets
rolandgeider Nov 16, 2024
7794948
Cleanup
rolandgeider Nov 17, 2024
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
6 changes: 3 additions & 3 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ android {
ndkVersion "25.1.8937393"

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}

kotlinOptions {
jvmTarget = '1.8'
jvmTarget = JavaVersion.VERSION_17
}

sourceSets {
Expand Down
8 changes: 4 additions & 4 deletions integration_test/1_dashboard.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import 'package:provider/provider.dart';
import 'package:wger/providers/body_weight.dart';
import 'package:wger/providers/measurement.dart';
import 'package:wger/providers/nutrition.dart';
import 'package:wger/providers/routines.dart';
import 'package:wger/providers/user.dart';
import 'package:wger/providers/workout_plans.dart';
import 'package:wger/screens/dashboard.dart';
import 'package:wger/theme/theme.dart';

Expand All @@ -20,10 +20,10 @@ import '../test_data/exercises.dart';
import '../test_data/measurements.dart';
import '../test_data/nutritional_plans.dart';
import '../test_data/profile.dart';
import '../test_data/workouts.dart';
import '../test_data/routines.dart';

Widget createDashboardScreen({locale = 'en'}) {
final mockWorkoutProvider = MockWorkoutPlansProvider();
final mockWorkoutProvider = MockRoutinesProvider();
when(mockWorkoutProvider.activePlan).thenReturn(getWorkout(exercises: getScreenshotExercises()));

final Map<String, dynamic> logs = {
Expand Down Expand Up @@ -60,7 +60,7 @@ Widget createDashboardScreen({locale = 'en'}) {
ChangeNotifierProvider<UserProvider>(
create: (context) => mockUserProvider,
),
ChangeNotifierProvider<WorkoutPlansProvider>(
ChangeNotifierProvider<RoutinesProvider>(
create: (context) => mockWorkoutProvider,
),
ChangeNotifierProvider<NutritionPlansProvider>(
Expand Down
14 changes: 7 additions & 7 deletions integration_test/2_workout.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,25 @@ import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:mockito/mockito.dart';
import 'package:provider/provider.dart';
import 'package:wger/providers/workout_plans.dart';
import 'package:wger/screens/workout_plan_screen.dart';
import 'package:wger/providers/routines.dart';
import 'package:wger/screens/routine_screen.dart';
import 'package:wger/theme/theme.dart';

import '../test/workout/workout_form_test.mocks.dart';
import '../test_data/exercises.dart';
import '../test_data/workouts.dart';
import '../test_data/routines.dart';

Widget createWorkoutDetailScreen({locale = 'en'}) {
final key = GlobalKey<NavigatorState>();

final mockWorkoutProvider = MockWorkoutPlansProvider();
final mockWorkoutProvider = MockRoutinesProvider();
final workout = getWorkout(exercises: getScreenshotExercises());
when(mockWorkoutProvider.activePlan).thenReturn(workout);
when(mockWorkoutProvider.fetchAndSetWorkoutPlanFull(1)).thenAnswer((_) => Future.value(workout));
when(mockWorkoutProvider.fetchAndSetRoutineFull(1)).thenAnswer((_) => Future.value(workout));

return MultiProvider(
providers: [
ChangeNotifierProvider<WorkoutPlansProvider>(
ChangeNotifierProvider<RoutinesProvider>(
create: (context) => mockWorkoutProvider,
),
],
Expand All @@ -35,7 +35,7 @@ Widget createWorkoutDetailScreen({locale = 'en'}) {
onPressed: () => key.currentState!.push(
MaterialPageRoute<void>(
settings: RouteSettings(arguments: workout),
builder: (_) => const WorkoutPlanScreen(),
builder: (_) => const RoutineScreen(),
),
),
child: const SizedBox(),
Expand Down
12 changes: 6 additions & 6 deletions integration_test/3_gym_mode.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:mockito/mockito.dart';
import 'package:provider/provider.dart';
import 'package:wger/providers/exercises.dart';
import 'package:wger/providers/workout_plans.dart';
import 'package:wger/providers/routines.dart';
import 'package:wger/screens/gym_mode.dart';
import 'package:wger/screens/workout_plan_screen.dart';
import 'package:wger/screens/routine_screen.dart';
import 'package:wger/theme/theme.dart';

import '../test/utils.dart';
import '../test/workout/gym_mode_screen_test.mocks.dart';
import '../test_data/exercises.dart';
import '../test_data/workouts.dart';
import '../test_data/routines.dart';

Widget createGymModeScreen({locale = 'en'}) {
final key = GlobalKey<NavigatorState>();
Expand All @@ -25,8 +25,8 @@ Widget createGymModeScreen({locale = 'en'}) {
//when(mockExerciseProvider.findExerciseBaseById(2)).thenReturn(bases[1]); // crunches
//when(mockExerciseProvider.findExerciseBaseById(3)).thenReturn(bases[2]); // dead lift

return ChangeNotifierProvider<WorkoutPlansProvider>(
create: (context) => WorkoutPlansProvider(
return ChangeNotifierProvider<RoutinesProvider>(
create: (context) => RoutinesProvider(
mockBaseProvider,
mockExerciseProvider,
[workout],
Expand All @@ -50,7 +50,7 @@ Widget createGymModeScreen({locale = 'en'}) {
child: const SizedBox(),
),
routes: {
WorkoutPlanScreen.routeName: (ctx) => const WorkoutPlanScreen(),
RoutineScreen.routeName: (ctx) => const RoutineScreen(),
},
),
),
Expand Down
Loading
Loading