mirror of
https://github.com/wger-project/flutter.git
synced 2026-02-18 00:17:48 +01:00
Update the routine test data
This commit is contained in:
@@ -69,10 +69,6 @@
|
||||
"@registerInstead": {},
|
||||
"loginInstead": "Already have an account? Login",
|
||||
"@loginInstead": {},
|
||||
"labelWorkoutPlans": "Workout plans",
|
||||
"@labelWorkoutPlans": {
|
||||
"description": "Title for screen workout plans"
|
||||
},
|
||||
"labelBottomNavWorkout": "Workout",
|
||||
"@labelBottomNavWorkout": {
|
||||
"description": "Label used in bottom navigation, use a short word"
|
||||
@@ -144,6 +140,7 @@
|
||||
"@category": {
|
||||
"description": "Category for an exercise, ingredient, etc."
|
||||
},
|
||||
"routines": "Routines",
|
||||
"newRoutine": "New routine",
|
||||
"noRoutines": "You have no routines",
|
||||
"reps": "Reps",
|
||||
|
||||
@@ -47,6 +47,9 @@ class BaseConfig {
|
||||
@JsonKey(required: true, name: 'need_log_to_apply')
|
||||
late bool needLogToApply;
|
||||
|
||||
@JsonKey(required: true, name: 'repeat')
|
||||
late bool repeat;
|
||||
|
||||
@JsonKey(required: true, name: 'requirements')
|
||||
late dynamic requirements;
|
||||
|
||||
@@ -54,12 +57,13 @@ class BaseConfig {
|
||||
required this.id,
|
||||
required this.slotEntryId,
|
||||
required this.iteration,
|
||||
this.repeat = false,
|
||||
// required this.trigger,
|
||||
required this.value,
|
||||
required this.operation,
|
||||
required this.step,
|
||||
required this.needLogToApply,
|
||||
required this.requirements,
|
||||
this.operation = 'r',
|
||||
this.step = 'abs',
|
||||
this.needLogToApply = false,
|
||||
this.requirements = null,
|
||||
});
|
||||
|
||||
BaseConfig.firstIteration(this.value, this.slotEntryId) {
|
||||
@@ -68,6 +72,7 @@ class BaseConfig {
|
||||
step = 'abs';
|
||||
needLogToApply = false;
|
||||
requirements = null;
|
||||
repeat = false;
|
||||
}
|
||||
|
||||
// Boilerplate
|
||||
|
||||
@@ -85,11 +85,13 @@ class Routine {
|
||||
required this.end,
|
||||
this.fitInWeek = false,
|
||||
String? description,
|
||||
List<Day>? days,
|
||||
List<Log>? logs,
|
||||
this.days = const [],
|
||||
this.dayData = const [],
|
||||
this.dayDataGym = const [],
|
||||
this.dayDataCurrentIteration = const [],
|
||||
this.dayDataCurrentIterationGym = const [],
|
||||
this.logs = const [],
|
||||
}) {
|
||||
this.days = days ?? [];
|
||||
this.logs = logs ?? [];
|
||||
this.description = description ?? '';
|
||||
}
|
||||
|
||||
|
||||
@@ -20,8 +20,9 @@ Routine _$RoutineFromJson(Map<String, dynamic> json) {
|
||||
fitInWeek: json['fit_in_week'] as bool? ?? false,
|
||||
description: json['description'] as String?,
|
||||
days: (json['days'] as List<dynamic>?)
|
||||
?.map((e) => Day.fromJson(e as Map<String, dynamic>))
|
||||
.toList(),
|
||||
?.map((e) => Day.fromJson(e as Map<String, dynamic>))
|
||||
.toList() ??
|
||||
const [],
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -129,7 +129,30 @@ class SlotEntry {
|
||||
required this.weightUnitId,
|
||||
required this.weightRounding,
|
||||
required this.comment,
|
||||
});
|
||||
this.weightConfigs = const [],
|
||||
this.maxWeightConfigs = const [],
|
||||
this.nrOfSetsConfigs = const [],
|
||||
this.maxNrOfSetsConfigs = const [],
|
||||
this.rirConfigs = const [],
|
||||
this.maxRirConfigs = const [],
|
||||
this.restTimeConfigs = const [],
|
||||
this.maxRestTimeConfigs = const [],
|
||||
this.repsConfigs = const [],
|
||||
this.maxRepsConfigs = const [],
|
||||
RepetitionUnit? repetitionUnit,
|
||||
WeightUnit? weightUnit,
|
||||
Exercise? exercise,
|
||||
}) {
|
||||
if (repetitionUnit != null) {
|
||||
repetitionUnitObj = repetitionUnit;
|
||||
}
|
||||
if (weightUnit != null) {
|
||||
weightUnitObj = weightUnit;
|
||||
}
|
||||
if (exercise != null) {
|
||||
exerciseObj = exercise;
|
||||
}
|
||||
}
|
||||
|
||||
SlotEntry.empty();
|
||||
|
||||
|
||||
@@ -34,48 +34,47 @@ SlotEntry _$SlotEntryFromJson(Map<String, dynamic> json) {
|
||||
weightUnitId: (json['weight_unit'] as num).toInt(),
|
||||
weightRounding: stringToNum(json['weight_rounding'] as String?),
|
||||
comment: json['comment'] as String,
|
||||
)
|
||||
..repsConfigs = (json['reps_configs'] as List<dynamic>?)
|
||||
weightConfigs: (json['weight_configs'] as List<dynamic>?)
|
||||
?.map((e) => BaseConfig.fromJson(e as Map<String, dynamic>))
|
||||
.toList() ??
|
||||
[]
|
||||
..maxRepsConfigs = (json['max_reps_configs'] as List<dynamic>?)
|
||||
[],
|
||||
maxWeightConfigs: (json['max_weight_configs'] as List<dynamic>?)
|
||||
?.map((e) => BaseConfig.fromJson(e as Map<String, dynamic>))
|
||||
.toList() ??
|
||||
[]
|
||||
..weightConfigs = (json['weight_configs'] as List<dynamic>?)
|
||||
[],
|
||||
nrOfSetsConfigs: (json['set_nr_configs'] as List<dynamic>?)
|
||||
?.map((e) => BaseConfig.fromJson(e as Map<String, dynamic>))
|
||||
.toList() ??
|
||||
[]
|
||||
..maxWeightConfigs = (json['max_weight_configs'] as List<dynamic>?)
|
||||
[],
|
||||
maxNrOfSetsConfigs: (json['max_set_nr_configs'] as List<dynamic>?)
|
||||
?.map((e) => BaseConfig.fromJson(e as Map<String, dynamic>))
|
||||
.toList() ??
|
||||
[]
|
||||
..nrOfSetsConfigs = (json['set_nr_configs'] as List<dynamic>?)
|
||||
[],
|
||||
rirConfigs: (json['rir_configs'] as List<dynamic>?)
|
||||
?.map((e) => BaseConfig.fromJson(e as Map<String, dynamic>))
|
||||
.toList() ??
|
||||
[]
|
||||
..maxNrOfSetsConfigs = (json['max_set_nr_configs'] as List<dynamic>?)
|
||||
[],
|
||||
maxRirConfigs: (json['max_rir_configs'] as List<dynamic>?)
|
||||
?.map((e) => BaseConfig.fromJson(e as Map<String, dynamic>))
|
||||
.toList() ??
|
||||
[]
|
||||
..rirConfigs = (json['rir_configs'] as List<dynamic>?)
|
||||
[],
|
||||
restTimeConfigs: (json['rest_configs'] as List<dynamic>?)
|
||||
?.map((e) => BaseConfig.fromJson(e as Map<String, dynamic>))
|
||||
.toList() ??
|
||||
[]
|
||||
..maxRirConfigs = (json['max_rir_configs'] as List<dynamic>?)
|
||||
[],
|
||||
maxRestTimeConfigs: (json['max_rest_configs'] as List<dynamic>?)
|
||||
?.map((e) => BaseConfig.fromJson(e as Map<String, dynamic>))
|
||||
.toList() ??
|
||||
[]
|
||||
..restTimeConfigs = (json['rest_configs'] as List<dynamic>?)
|
||||
[],
|
||||
repsConfigs: (json['reps_configs'] as List<dynamic>?)
|
||||
?.map((e) => BaseConfig.fromJson(e as Map<String, dynamic>))
|
||||
.toList() ??
|
||||
[]
|
||||
..maxRestTimeConfigs = (json['max_rest_configs'] as List<dynamic>?)
|
||||
[],
|
||||
maxRepsConfigs: (json['max_reps_configs'] as List<dynamic>?)
|
||||
?.map((e) => BaseConfig.fromJson(e as Map<String, dynamic>))
|
||||
.toList() ??
|
||||
[]
|
||||
..config = json['config'];
|
||||
[],
|
||||
)..config = json['config'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$SlotEntryToJson(SlotEntry instance) => <String, dynamic>{
|
||||
|
||||
@@ -46,7 +46,7 @@ class RoutineListAppBar extends StatelessWidget implements PreferredSizeWidget {
|
||||
final i18n = AppLocalizations.of(context);
|
||||
|
||||
return AppBar(
|
||||
title: Text(i18n.labelWorkoutPlans),
|
||||
title: Text(i18n.routines),
|
||||
actions: [
|
||||
PopupMenuButton(
|
||||
itemBuilder: (context) {
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
*/
|
||||
|
||||
import 'package:wger/models/exercises/exercise.dart';
|
||||
import 'package:wger/models/workouts/base_config.dart';
|
||||
import 'package:wger/models/workouts/day.dart';
|
||||
import 'package:wger/models/workouts/log.dart';
|
||||
import 'package:wger/models/workouts/repetition_unit.dart';
|
||||
@@ -75,14 +76,34 @@ Routine getRoutine({List<Exercise>? exercises}) {
|
||||
order: 1,
|
||||
exerciseId: 1,
|
||||
repetitionUnitId: 1,
|
||||
repetitionRounding: 0.25,
|
||||
repetitionRounding: 1,
|
||||
weightUnitId: 1,
|
||||
weightRounding: 0.25,
|
||||
weightRounding: 1.25,
|
||||
comment: 'ddd',
|
||||
repetitionUnit: testRepetitionUnit1,
|
||||
weightUnit: testWeightUnit1,
|
||||
exercise: testExercise[0],
|
||||
weightConfigs: [
|
||||
BaseConfig.firstIteration(100, 1),
|
||||
BaseConfig(
|
||||
id: 1,
|
||||
slotEntryId: 1,
|
||||
iteration: 2,
|
||||
value: 5,
|
||||
operation: '+',
|
||||
step: 'abs',
|
||||
needLogToApply: false,
|
||||
requirements: null,
|
||||
repeat: true,
|
||||
),
|
||||
],
|
||||
repsConfigs: [
|
||||
BaseConfig.firstIteration(3, 1),
|
||||
],
|
||||
nrOfSetsConfigs: [
|
||||
BaseConfig.firstIteration(4, 1),
|
||||
],
|
||||
);
|
||||
slotEntryBenchPress.repetitionUnit = testRepetitionUnit1;
|
||||
slotEntryBenchPress.weightUnit = testWeightUnit1;
|
||||
slotEntryBenchPress.exercise = testExercise[0];
|
||||
|
||||
final slotBenchPress = Slot.withData(
|
||||
id: 1,
|
||||
@@ -103,10 +124,19 @@ Routine getRoutine({List<Exercise>? exercises}) {
|
||||
weightUnitId: 1,
|
||||
weightRounding: 0.25,
|
||||
comment: 'ddd',
|
||||
repetitionUnit: testRepetitionUnit1,
|
||||
weightUnit: testWeightUnit1,
|
||||
exercise: testExercise[4],
|
||||
weightConfigs: [
|
||||
BaseConfig.firstIteration(80, 1),
|
||||
],
|
||||
repsConfigs: [
|
||||
BaseConfig.firstIteration(5, 1),
|
||||
],
|
||||
nrOfSetsConfigs: [
|
||||
BaseConfig.firstIteration(3, 1),
|
||||
],
|
||||
);
|
||||
slotEntrySquat.repetitionUnit = testRepetitionUnit1;
|
||||
slotEntrySquat.weightUnit = testWeightUnit1;
|
||||
slotEntrySquat.exercise = testExercise[4];
|
||||
|
||||
final slotSquat = Slot.withData(id: 2, day: 1, order: 1);
|
||||
slotSquat.addExerciseBase(testExercise[4]);
|
||||
@@ -122,10 +152,19 @@ Routine getRoutine({List<Exercise>? exercises}) {
|
||||
weightUnitId: 1,
|
||||
weightRounding: 0.25,
|
||||
comment: 'ddd',
|
||||
repetitionUnit: testRepetitionUnit1,
|
||||
weightUnit: testWeightUnit1,
|
||||
exercise: testExercise[5],
|
||||
weightConfigs: [
|
||||
BaseConfig.firstIteration(10, 1),
|
||||
],
|
||||
repsConfigs: [
|
||||
BaseConfig.firstIteration(12, 1),
|
||||
],
|
||||
nrOfSetsConfigs: [
|
||||
BaseConfig.firstIteration(4, 1),
|
||||
],
|
||||
);
|
||||
slotEntrySideRaises.repetitionUnit = testRepetitionUnit1;
|
||||
slotEntrySideRaises.weightUnit = testWeightUnit1;
|
||||
slotEntrySideRaises.exercise = testExercise[5];
|
||||
// settingSideRaises.weight = 6;
|
||||
|
||||
final slotSideRaises = Slot.withData(id: 3, day: 1, order: 1);
|
||||
|
||||
Reference in New Issue
Block a user