mirror of
https://github.com/wger-project/flutter.git
synced 2026-12-03 02:24:30 +01:00
Start rendering the new routines
This commit is contained in:
@@ -57,12 +57,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 {
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
import 'package:wger/helpers/json.dart';
|
||||
import 'package:wger/models/exercises/exercise.dart';
|
||||
import 'package:wger/models/workouts/repetition_unit.dart';
|
||||
import 'package:wger/models/workouts/weight_unit.dart';
|
||||
|
||||
part 'set_config_data.g.dart';
|
||||
|
||||
@@ -48,6 +50,9 @@ class SetConfigData {
|
||||
@JsonKey(required: true, name: 'weight_unit')
|
||||
late int? weightUnitId;
|
||||
|
||||
@JsonKey(includeToJson: false, includeFromJson: false)
|
||||
late WeightUnit weightUnit;
|
||||
|
||||
@JsonKey(required: true, name: 'weight_rounding', fromJson: stringToNumNull)
|
||||
late num? weightRounding;
|
||||
|
||||
@@ -60,6 +65,9 @@ class SetConfigData {
|
||||
@JsonKey(required: true, name: 'reps_unit')
|
||||
late int? repsUnitId;
|
||||
|
||||
@JsonKey(includeToJson: false, includeFromJson: false)
|
||||
late RepetitionUnit repsUnit;
|
||||
|
||||
@JsonKey(required: true, name: 'reps_rounding', fromJson: stringToNumNull)
|
||||
late num? repsRounding;
|
||||
|
||||
|
||||
@@ -153,8 +153,6 @@ class ExercisesProvider with ChangeNotifier {
|
||||
if (filters!.searchTerm.length > 1) {
|
||||
filteredItems = await searchExercise(filters!.searchTerm);
|
||||
}
|
||||
|
||||
// Filter by exercise category and equipment (REPLACE WITH HTTP REQUEST)
|
||||
filteredExercises = filteredItems.where((exercise) {
|
||||
final bool isInAnyCategory = filters!.exerciseCategories.selected.contains(exercise.category);
|
||||
|
||||
@@ -181,7 +179,7 @@ class ExercisesProvider with ChangeNotifier {
|
||||
/// Note: prefer using the async `fetchAndSetExercise` method
|
||||
Exercise findExerciseById(int id) {
|
||||
return exercises.firstWhere(
|
||||
(base) => base.id == id,
|
||||
(exercise) => exercise.id == id,
|
||||
orElse: () => throw const NoSuchEntryException(),
|
||||
);
|
||||
}
|
||||
@@ -270,14 +268,14 @@ class ExercisesProvider with ChangeNotifier {
|
||||
/// Returns the exercise with the given ID
|
||||
///
|
||||
/// If the exercise is not known locally, it is fetched from the server.
|
||||
Future<Exercise> fetchAndSetExercise(int exerciseId) async {
|
||||
Future<Exercise?> fetchAndSetExercise(int exerciseId) async {
|
||||
try {
|
||||
final exercise = findExerciseById(exerciseId);
|
||||
|
||||
// Note: no await since we don't care for the updated data right now. It
|
||||
// will be written to the db whenever the request finishes and we will get
|
||||
// the updated exercise the next time
|
||||
handleUpdateExerciseFromApi(database, exerciseId);
|
||||
await handleUpdateExerciseFromApi(database, exerciseId);
|
||||
|
||||
return exercise;
|
||||
} on NoSuchEntryException {
|
||||
@@ -297,6 +295,10 @@ class ExercisesProvider with ChangeNotifier {
|
||||
ExerciseDatabase database,
|
||||
int exerciseId,
|
||||
) async {
|
||||
// if (exerciseId == 76) {
|
||||
// print('76!!!!');
|
||||
// }
|
||||
|
||||
Exercise exercise;
|
||||
final exerciseDb = await (database.select(database.exercises)
|
||||
..where((e) => e.id.equals(exerciseId)))
|
||||
@@ -334,16 +336,16 @@ class ExercisesProvider with ChangeNotifier {
|
||||
}
|
||||
// New exercise, fetch and insert to DB
|
||||
} else {
|
||||
final baseData = await baseProvider.fetch(
|
||||
final exerciseData = await baseProvider.fetch(
|
||||
baseProvider.makeUrl(exerciseInfoUrlPath, id: exerciseId),
|
||||
);
|
||||
exercise = Exercise.fromApiDataJson(baseData, _languages);
|
||||
exercise = Exercise.fromApiDataJson(exerciseData, _languages);
|
||||
|
||||
if (exerciseDb == null) {
|
||||
await database.into(database.exercises).insert(
|
||||
ExercisesCompanion.insert(
|
||||
id: exercise.id!,
|
||||
data: jsonEncode(baseData),
|
||||
data: jsonEncode(exerciseData),
|
||||
lastUpdate: exercise.lastUpdateGlobal!,
|
||||
lastFetched: DateTime.now(),
|
||||
),
|
||||
@@ -630,11 +632,21 @@ class ExercisesProvider with ChangeNotifier {
|
||||
),
|
||||
);
|
||||
|
||||
// Load the ingredients
|
||||
// Load the exercises
|
||||
final results = ExerciseApiSearch.fromJson(result);
|
||||
return Future.wait(
|
||||
results.suggestions.map((e) => fetchAndSetExercise(e.data.exerciseId)),
|
||||
);
|
||||
|
||||
final List<Exercise> out = [];
|
||||
for (final result in results.suggestions) {
|
||||
final exercise = await fetchAndSetExercise(result.data.exerciseId);
|
||||
if (exercise != null) {
|
||||
out.add(exercise);
|
||||
}
|
||||
}
|
||||
// return Future.wait(
|
||||
// results.suggestions.map((e) => fetchAndSetExercise(e.data.exerciseId)),
|
||||
// );
|
||||
|
||||
return out;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -162,21 +162,22 @@ class RoutinesProvider with ChangeNotifier {
|
||||
_workoutPlans.add(plan);
|
||||
}
|
||||
|
||||
_workoutPlans.sort((a, b) => b.created.compareTo(a.created));
|
||||
// _workoutPlans.sort((a, b) => b.created.compareTo(a.created));
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
void setExerciseAndUnits(List<DayData> entries) async {
|
||||
void setExercisesAndUnits(List<DayData> entries) async {
|
||||
for (final entry in entries) {
|
||||
for (final slot in entry.slots) {
|
||||
for (final setConfig in slot.setConfigs) {
|
||||
setConfig.exercise = await _exercises.fetchAndSetExercise(setConfig.exerciseId);
|
||||
// slotEntry.exerciseObj = await _exercises.fetchAndSetExercise(slotEntry.exerciseId);
|
||||
// slotEntry.repetitionUnitObj = _repetitionUnit.firstWhere(
|
||||
// (e) => e.id == slotEntry.repetitionUnitId,
|
||||
setConfig.exercise = (await _exercises.fetchAndSetExercise(setConfig.exerciseId))!;
|
||||
|
||||
// setConfig.repsUnit = _repetitionUnit.firstWhere(
|
||||
// (e) => e.id == setConfig.repsUnitId,
|
||||
// );
|
||||
// slotEntry.weightUnitObj = _weightUnits.firstWhere(
|
||||
// (e) => e.id == slotEntry.weightUnitId,
|
||||
//
|
||||
// setConfig.weightUnit = _weightUnits.firstWhere(
|
||||
// (e) => e.id == setConfig.weightUnitId,
|
||||
// );
|
||||
}
|
||||
}
|
||||
@@ -233,16 +234,16 @@ class RoutinesProvider with ChangeNotifier {
|
||||
* Set exercise, repetition and weight unit objects
|
||||
*/
|
||||
final dayDataEntries = dayData.map((entry) => DayData.fromJson(entry)).toList();
|
||||
setExerciseAndUnits(dayDataEntries);
|
||||
setExercisesAndUnits(dayDataEntries); // in-place update
|
||||
|
||||
final currentIterationDayDataEntries =
|
||||
currentIterationData.map((entry) => DayData.fromJson(entry)).toList();
|
||||
setExerciseAndUnits(currentIterationDayDataEntries);
|
||||
setExercisesAndUnits(currentIterationDayDataEntries); // in-place update
|
||||
|
||||
for (final day in routine.days) {
|
||||
for (final slot in day.slots) {
|
||||
for (final slotEntry in slot.entries) {
|
||||
slotEntry.exerciseObj = await _exercises.fetchAndSetExercise(slotEntry.exerciseId);
|
||||
slotEntry.exerciseObj = (await _exercises.fetchAndSetExercise(slotEntry.exerciseId))!;
|
||||
slotEntry.repetitionUnitObj = _repetitionUnit.firstWhere(
|
||||
(e) => e.id == slotEntry.repetitionUnitId,
|
||||
);
|
||||
@@ -268,15 +269,18 @@ class RoutinesProvider with ChangeNotifier {
|
||||
final log = Log.fromJson(logEntry);
|
||||
log.weightUnit = _weightUnits.firstWhere((e) => e.id == log.weightUnitId);
|
||||
log.repetitionUnit = _repetitionUnit.firstWhere((e) => e.id == log.weightUnitId);
|
||||
log.exerciseBase = await _exercises.fetchAndSetExercise(log.exerciseId);
|
||||
log.exerciseBase = (await _exercises.fetchAndSetExercise(log.exerciseId))!;
|
||||
routine.logs.add(log);
|
||||
} catch (e) {
|
||||
dev.log('fire! fire!');
|
||||
dev.log('Error while processing the logs for a routine!');
|
||||
dev.log(e.toString());
|
||||
}
|
||||
}
|
||||
|
||||
// ... and done
|
||||
final routineIndex = _workoutPlans.indexWhere((r) => r.id == routineId);
|
||||
_workoutPlans.replaceRange(routineIndex, routineIndex + 1, [routine]);
|
||||
|
||||
notifyListeners();
|
||||
return routine;
|
||||
}
|
||||
@@ -545,7 +549,7 @@ class RoutinesProvider with ChangeNotifier {
|
||||
log.id = newLog.id;
|
||||
log.weightUnit = _weightUnits.firstWhere((e) => e.id == log.weightUnitId);
|
||||
log.repetitionUnit = _repetitionUnit.firstWhere((e) => e.id == log.weightUnitId);
|
||||
log.exerciseBase = await _exercises.fetchAndSetExercise(log.exerciseId);
|
||||
log.exerciseBase = (await _exercises.fetchAndSetExercise(log.exerciseId))!;
|
||||
|
||||
final plan = findById(log.routineId);
|
||||
plan.logs.add(log);
|
||||
|
||||
@@ -73,12 +73,10 @@ class _AddExerciseStepperState extends State<AddExerciseStepper> {
|
||||
final addExerciseProvider = context.read<AddExerciseProvider>();
|
||||
final exerciseProvider = context.read<ExercisesProvider>();
|
||||
|
||||
final baseId = await addExerciseProvider.addExercise();
|
||||
final base = await exerciseProvider.fetchAndSetExercise(baseId);
|
||||
final name = base
|
||||
.getExercise(
|
||||
Localizations.localeOf(context).languageCode,
|
||||
)
|
||||
final exerciseId = await addExerciseProvider.addExercise();
|
||||
final exercise = await exerciseProvider.fetchAndSetExercise(exerciseId);
|
||||
final name = exercise!
|
||||
.getExercise(Localizations.localeOf(context).languageCode)
|
||||
.name;
|
||||
|
||||
setState(() {
|
||||
@@ -102,7 +100,7 @@ class _AddExerciseStepperState extends State<AddExerciseStepper> {
|
||||
Navigator.pushReplacementNamed(
|
||||
context,
|
||||
ExerciseDetailScreen.routeName,
|
||||
arguments: base,
|
||||
arguments: exercise,
|
||||
);
|
||||
},
|
||||
),
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:wger/models/workouts/day.dart';
|
||||
import 'package:wger/models/workouts/day_data.dart';
|
||||
import 'package:wger/providers/workout_plans.dart';
|
||||
import 'package:wger/widgets/workouts/gym_mode.dart';
|
||||
|
||||
@@ -29,7 +29,7 @@ class GymModeScreen extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final day = ModalRoute.of(context)!.settings.arguments as Day;
|
||||
final day = ModalRoute.of(context)!.settings.arguments as DayData;
|
||||
|
||||
return Scaffold(
|
||||
body: SafeArea(
|
||||
|
||||
@@ -106,6 +106,7 @@ class _HomeTabsScreenState extends State<HomeTabsScreen> with SingleTickerProvid
|
||||
galleryProvider.fetchAndSetGallery(),
|
||||
nutritionPlansProvider.fetchAndSetAllPlansSparse(),
|
||||
workoutPlansProvider.fetchAndSetAllPlansSparse(),
|
||||
// workoutPlansProvider.fetchAndSetAllPlansFull(),
|
||||
weightProvider.fetchAndSetEntries(),
|
||||
measurementProvider.fetchAndSetAllCategoriesAndEntries(),
|
||||
]);
|
||||
|
||||
@@ -55,24 +55,25 @@ class _WorkoutPlanScreenState extends State<WorkoutPlanScreen> {
|
||||
});
|
||||
}
|
||||
|
||||
Future<Routine> _loadFullWorkout(BuildContext context, int planId) {
|
||||
return Provider.of<RoutinesProvider>(context, listen: false).fetchAndSetWorkoutPlanFull(planId);
|
||||
Future<Routine> _loadFullWorkout(BuildContext context, int routineId) {
|
||||
return Provider.of<RoutinesProvider>(context, listen: false)
|
||||
.fetchAndSetWorkoutPlanFull(routineId);
|
||||
}
|
||||
|
||||
Widget getBody(Routine plan) {
|
||||
Widget getBody(Routine routine) {
|
||||
switch (_mode) {
|
||||
case WorkoutScreenMode.workout:
|
||||
return WorkoutPlanDetail(plan, _changeMode);
|
||||
return WorkoutPlanDetail(routine, _changeMode);
|
||||
|
||||
case WorkoutScreenMode.log:
|
||||
return WorkoutLogs(plan, _changeMode);
|
||||
return WorkoutLogs(routine, _changeMode);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
const appBarForeground = Colors.white;
|
||||
final workoutPlan = ModalRoute.of(context)!.settings.arguments as Routine;
|
||||
final routine = ModalRoute.of(context)!.settings.arguments as Routine;
|
||||
|
||||
return Scaffold(
|
||||
body: CustomScrollView(
|
||||
@@ -84,7 +85,7 @@ class _WorkoutPlanScreenState extends State<WorkoutPlanScreen> {
|
||||
flexibleSpace: FlexibleSpaceBar(
|
||||
titlePadding: const EdgeInsets.fromLTRB(56, 0, 56, 16),
|
||||
title: Text(
|
||||
workoutPlan.name,
|
||||
routine.name,
|
||||
style: Theme.of(context).textTheme.titleLarge?.copyWith(color: appBarForeground),
|
||||
),
|
||||
),
|
||||
@@ -99,14 +100,14 @@ class _WorkoutPlanScreenState extends State<WorkoutPlanScreen> {
|
||||
FormScreen.routeName,
|
||||
arguments: FormScreenArguments(
|
||||
AppLocalizations.of(context).edit,
|
||||
WorkoutForm(workoutPlan),
|
||||
WorkoutForm(routine),
|
||||
),
|
||||
);
|
||||
|
||||
// Delete
|
||||
} else if (value == WorkoutOptions.delete) {
|
||||
Provider.of<RoutinesProvider>(context, listen: false)
|
||||
.deleteWorkout(workoutPlan.id!);
|
||||
.deleteWorkout(routine.id!);
|
||||
Navigator.of(context).pop();
|
||||
|
||||
// Toggle Mode
|
||||
@@ -129,7 +130,7 @@ class _WorkoutPlanScreenState extends State<WorkoutPlanScreen> {
|
||||
],
|
||||
),
|
||||
FutureBuilder(
|
||||
future: _loadFullWorkout(context, workoutPlan.id!),
|
||||
future: _loadFullWorkout(context, routine.id!),
|
||||
builder: (context, AsyncSnapshot<Routine> snapshot) => SliverList(
|
||||
delegate: SliverChildListDelegate(
|
||||
[
|
||||
@@ -140,7 +141,7 @@ class _WorkoutPlanScreenState extends State<WorkoutPlanScreen> {
|
||||
)
|
||||
else
|
||||
Consumer<RoutinesProvider>(
|
||||
builder: (context, value, child) => getBody(workoutPlan),
|
||||
builder: (context, value, child) => getBody(routine),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -116,9 +116,9 @@ class _WorkoutDayWidgetState extends State<WorkoutDayWidget> {
|
||||
});
|
||||
}
|
||||
|
||||
Widget getSetRow(SlotData set, int index) {
|
||||
Widget getSetRow(SlotData slotData, int index) {
|
||||
return Row(
|
||||
// key: ValueKey(set.id),
|
||||
key: ValueKey(index),
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
if (_editing)
|
||||
@@ -134,7 +134,8 @@ class _WorkoutDayWidgetState extends State<WorkoutDayWidget> {
|
||||
Expanded(
|
||||
child: Column(
|
||||
children: [
|
||||
if (set.comment != '') MutedText(set.comment),
|
||||
if (slotData.comment != '') MutedText(slotData.comment),
|
||||
Text('AAAAAAAA'),
|
||||
// ...set.settingsFiltered.map(
|
||||
// (setting) => SettingWidget(
|
||||
// set: set,
|
||||
@@ -277,33 +278,46 @@ class DayHeader extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ListTile(
|
||||
contentPadding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||
title: Text(
|
||||
_dayData.day.name,
|
||||
style: Theme.of(context).textTheme.headlineSmall,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
subtitle: Text(_dayData.day.description),
|
||||
leading: const Icon(Icons.play_arrow),
|
||||
minLeadingWidth: 8,
|
||||
trailing: Row(mainAxisSize: MainAxisSize.min, children: [
|
||||
const SizedBox(height: 40, width: 1, child: VerticalDivider()),
|
||||
const SizedBox(width: 10),
|
||||
IconButton(
|
||||
icon: _editing ? const Icon(Icons.done) : const Icon(Icons.edit),
|
||||
tooltip: _editing ? AppLocalizations.of(context).done : AppLocalizations.of(context).edit,
|
||||
onPressed: () {
|
||||
_toggle();
|
||||
},
|
||||
),
|
||||
]),
|
||||
onTap: () {
|
||||
Navigator.of(context).pushNamed(
|
||||
GymModeScreen.routeName,
|
||||
arguments: _dayData,
|
||||
);
|
||||
},
|
||||
);
|
||||
return _dayData.day.isRest
|
||||
? ListTile(
|
||||
contentPadding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||
title: Text(
|
||||
'REST DAY',
|
||||
style: Theme.of(context).textTheme.headlineSmall,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
leading: const Icon(Icons.hotel),
|
||||
minLeadingWidth: 8,
|
||||
)
|
||||
: ListTile(
|
||||
contentPadding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||
title: Text(
|
||||
_dayData.day.name,
|
||||
style: Theme.of(context).textTheme.headlineSmall,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
subtitle: Text(_dayData.day.description),
|
||||
leading: const Icon(Icons.play_arrow),
|
||||
minLeadingWidth: 8,
|
||||
trailing: Row(mainAxisSize: MainAxisSize.min, children: [
|
||||
const SizedBox(height: 40, width: 1, child: VerticalDivider()),
|
||||
const SizedBox(width: 10),
|
||||
IconButton(
|
||||
icon: _editing ? const Icon(Icons.done) : const Icon(Icons.edit),
|
||||
tooltip: _editing
|
||||
? AppLocalizations.of(context).done
|
||||
: AppLocalizations.of(context).edit,
|
||||
onPressed: () {
|
||||
_toggle();
|
||||
},
|
||||
),
|
||||
]),
|
||||
onTap: () {
|
||||
Navigator.of(context).pushNamed(
|
||||
GymModeScreen.routeName,
|
||||
arguments: _dayData,
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,6 +31,7 @@ import 'package:wger/helpers/misc.dart';
|
||||
import 'package:wger/helpers/ui.dart';
|
||||
import 'package:wger/models/exercises/exercise.dart';
|
||||
import 'package:wger/models/workouts/day.dart';
|
||||
import 'package:wger/models/workouts/day_data.dart';
|
||||
import 'package:wger/models/workouts/log.dart';
|
||||
import 'package:wger/models/workouts/routine.dart';
|
||||
import 'package:wger/models/workouts/session.dart';
|
||||
@@ -44,10 +45,10 @@ import 'package:wger/widgets/exercises/images.dart';
|
||||
import 'package:wger/widgets/workouts/forms.dart';
|
||||
|
||||
class GymMode extends StatefulWidget {
|
||||
final Day _workoutDay;
|
||||
final DayData _DayData;
|
||||
late final TimeOfDay _start;
|
||||
|
||||
GymMode(this._workoutDay) {
|
||||
GymMode(this._DayData) {
|
||||
_start = TimeOfDay.now();
|
||||
}
|
||||
|
||||
@@ -72,7 +73,7 @@ class _GymModeState extends State<GymMode> {
|
||||
void initState() {
|
||||
super.initState();
|
||||
// Calculate amount of elements for progress indicator
|
||||
for (final set in widget._workoutDay.slots) {
|
||||
for (final set in widget._DayData.day.slots) {
|
||||
_totalElements = _totalElements + set.settingsComputed.length;
|
||||
}
|
||||
// Calculate the pages for the navigation
|
||||
@@ -80,9 +81,10 @@ class _GymModeState extends State<GymMode> {
|
||||
// This duplicates the code below in the getContent method, but it seems to
|
||||
// be the easiest way
|
||||
var currentPage = 1;
|
||||
for (final set in widget._workoutDay.slots) {
|
||||
for (final set in widget._DayData.slots) {
|
||||
var firstPage = true;
|
||||
for (final setting in set.settingsComputed) {
|
||||
for (final setting in []) {
|
||||
// for (final setting in set.settingsComputed) {
|
||||
final exerciseBase = Provider.of<ExercisesProvider>(context, listen: false)
|
||||
.findExerciseById(setting.exerciseId);
|
||||
|
||||
@@ -108,9 +110,10 @@ class _GymModeState extends State<GymMode> {
|
||||
var currentElement = 1;
|
||||
final List<Widget> out = [];
|
||||
|
||||
for (final set in widget._workoutDay.slots) {
|
||||
for (final set in widget._DayData.day.slots) {
|
||||
var firstPage = true;
|
||||
for (final setting in set.settingsComputed) {
|
||||
for (final setting in []) {
|
||||
// for (final setting in set.settingsComputed) {
|
||||
final ratioCompleted = currentElement / _totalElements;
|
||||
final exerciseBase = exerciseProvider.findExerciseById(setting.exerciseId);
|
||||
currentElement++;
|
||||
@@ -129,7 +132,7 @@ class _GymModeState extends State<GymMode> {
|
||||
setting,
|
||||
set,
|
||||
exerciseBase,
|
||||
workoutProvider.findById(widget._workoutDay.routineId),
|
||||
workoutProvider.findById(widget._DayData.day.routineId),
|
||||
ratioCompleted,
|
||||
_exercisePages,
|
||||
));
|
||||
@@ -146,11 +149,11 @@ class _GymModeState extends State<GymMode> {
|
||||
return PageView(
|
||||
controller: _controller,
|
||||
children: [
|
||||
StartPage(_controller, widget._workoutDay, _exercisePages),
|
||||
StartPage(_controller, widget._DayData.day, _exercisePages),
|
||||
...getContent(),
|
||||
SessionPage(
|
||||
Provider.of<RoutinesProvider>(context, listen: false)
|
||||
.findById(widget._workoutDay.routineId),
|
||||
.findById(widget._DayData.day.routineId),
|
||||
_controller,
|
||||
widget._start,
|
||||
_exercisePages,
|
||||
|
||||
@@ -32,7 +32,8 @@ class WorkoutPlansList extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return RefreshIndicator(
|
||||
onRefresh: () => _workoutProvider.fetchAndSetAllPlansSparse(),
|
||||
onRefresh: () => _workoutProvider.fetchAndSetAllPlansFull(),
|
||||
// onRefresh: () => _workoutProvider.fetchAndSetAllPlansSparse(),
|
||||
child: _workoutProvider.items.isEmpty
|
||||
? const TextPrompt()
|
||||
: ListView.builder(
|
||||
|
||||
@@ -434,19 +434,13 @@ class MockExercisesProvider extends _i1.Mock implements _i14.ExercisesProvider {
|
||||
) as _i15.Future<void>);
|
||||
|
||||
@override
|
||||
_i15.Future<_i4.Exercise> fetchAndSetExercise(int? exerciseId) => (super.noSuchMethod(
|
||||
_i15.Future<_i4.Exercise?> fetchAndSetExercise(int? exerciseId) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#fetchAndSetExercise,
|
||||
[exerciseId],
|
||||
),
|
||||
returnValue: _i15.Future<_i4.Exercise>.value(_FakeExercise_2(
|
||||
this,
|
||||
Invocation.method(
|
||||
#fetchAndSetExercise,
|
||||
[exerciseId],
|
||||
),
|
||||
)),
|
||||
) as _i15.Future<_i4.Exercise>);
|
||||
returnValue: _i15.Future<_i4.Exercise?>.value(),
|
||||
) as _i15.Future<_i4.Exercise?>);
|
||||
|
||||
@override
|
||||
_i15.Future<_i4.Exercise> handleUpdateExerciseFromApi(
|
||||
|
||||
@@ -580,19 +580,13 @@ class MockExercisesProvider extends _i1.Mock implements _i12.ExercisesProvider {
|
||||
) as _i11.Future<void>);
|
||||
|
||||
@override
|
||||
_i11.Future<_i6.Exercise> fetchAndSetExercise(int? exerciseId) => (super.noSuchMethod(
|
||||
_i11.Future<_i6.Exercise?> fetchAndSetExercise(int? exerciseId) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#fetchAndSetExercise,
|
||||
[exerciseId],
|
||||
),
|
||||
returnValue: _i11.Future<_i6.Exercise>.value(_FakeExercise_6(
|
||||
this,
|
||||
Invocation.method(
|
||||
#fetchAndSetExercise,
|
||||
[exerciseId],
|
||||
),
|
||||
)),
|
||||
) as _i11.Future<_i6.Exercise>);
|
||||
returnValue: _i11.Future<_i6.Exercise?>.value(),
|
||||
) as _i11.Future<_i6.Exercise?>);
|
||||
|
||||
@override
|
||||
_i11.Future<_i6.Exercise> handleUpdateExerciseFromApi(
|
||||
|
||||
@@ -265,9 +265,9 @@ class MockRoutinesProvider extends _i1.Mock implements _i11.RoutinesProvider {
|
||||
) as _i12.Future<void>);
|
||||
|
||||
@override
|
||||
void setExerciseAndUnits(List<_i13.DayData>? entries) => super.noSuchMethod(
|
||||
void setExercisesAndUnits(List<_i13.DayData>? entries) => super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#setExerciseAndUnits,
|
||||
#setExercisesAndUnits,
|
||||
[entries],
|
||||
),
|
||||
returnValueForMissingStub: null,
|
||||
|
||||
@@ -265,9 +265,9 @@ class MockRoutinesProvider extends _i1.Mock implements _i11.RoutinesProvider {
|
||||
) as _i12.Future<void>);
|
||||
|
||||
@override
|
||||
void setExerciseAndUnits(List<_i13.DayData>? entries) => super.noSuchMethod(
|
||||
void setExercisesAndUnits(List<_i13.DayData>? entries) => super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#setExerciseAndUnits,
|
||||
#setExercisesAndUnits,
|
||||
[entries],
|
||||
),
|
||||
returnValueForMissingStub: null,
|
||||
|
||||
@@ -265,9 +265,9 @@ class MockRoutinesProvider extends _i1.Mock implements _i11.RoutinesProvider {
|
||||
) as _i12.Future<void>);
|
||||
|
||||
@override
|
||||
void setExerciseAndUnits(List<_i13.DayData>? entries) => super.noSuchMethod(
|
||||
void setExercisesAndUnits(List<_i13.DayData>? entries) => super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#setExerciseAndUnits,
|
||||
#setExercisesAndUnits,
|
||||
[entries],
|
||||
),
|
||||
returnValueForMissingStub: null,
|
||||
|
||||
@@ -511,19 +511,13 @@ class MockExercisesProvider extends _i1.Mock implements _i19.ExercisesProvider {
|
||||
) as _i20.Future<void>);
|
||||
|
||||
@override
|
||||
_i20.Future<_i4.Exercise> fetchAndSetExercise(int? exerciseId) => (super.noSuchMethod(
|
||||
_i20.Future<_i4.Exercise?> fetchAndSetExercise(int? exerciseId) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#fetchAndSetExercise,
|
||||
[exerciseId],
|
||||
),
|
||||
returnValue: _i20.Future<_i4.Exercise>.value(_FakeExercise_2(
|
||||
this,
|
||||
Invocation.method(
|
||||
#fetchAndSetExercise,
|
||||
[exerciseId],
|
||||
),
|
||||
)),
|
||||
) as _i20.Future<_i4.Exercise>);
|
||||
returnValue: _i20.Future<_i4.Exercise?>.value(),
|
||||
) as _i20.Future<_i4.Exercise?>);
|
||||
|
||||
@override
|
||||
_i20.Future<_i4.Exercise> handleUpdateExerciseFromApi(
|
||||
@@ -1002,9 +996,9 @@ class MockRoutinesProvider extends _i1.Mock implements _i22.RoutinesProvider {
|
||||
) as _i20.Future<void>);
|
||||
|
||||
@override
|
||||
void setExerciseAndUnits(List<_i23.DayData>? entries) => super.noSuchMethod(
|
||||
void setExercisesAndUnits(List<_i23.DayData>? entries) => super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#setExerciseAndUnits,
|
||||
#setExercisesAndUnits,
|
||||
[entries],
|
||||
),
|
||||
returnValueForMissingStub: null,
|
||||
|
||||
Reference in New Issue
Block a user