mirror of
https://github.com/wger-project/flutter.git
synced 2026-02-18 00:17:48 +01:00
Refresh the whole routine after modifying further objects.
This makes sure that all the structures are present and have the correct content (dayData, etc.). Also, add more feedback to the user for some operations that take a bit longer due to loading the whole routine.
This commit is contained in:
@@ -35,7 +35,7 @@ class ExerciseApiData with _$ExerciseApiData {
|
||||
// ignore: invalid_annotation_target
|
||||
required List<Equipment> equipment,
|
||||
// ignore: invalid_annotation_target
|
||||
@JsonKey(name: 'translations') required List<Translation> translations,
|
||||
@JsonKey(name: 'translations', defaultValue: []) required List<Translation> translations,
|
||||
required List<ExerciseImage> images,
|
||||
required List<Video> videos,
|
||||
// ignore: invalid_annotation_target
|
||||
|
||||
@@ -39,7 +39,7 @@ mixin _$ExerciseApiData {
|
||||
throw _privateConstructorUsedError; // ignore: invalid_annotation_target
|
||||
List<Equipment> get equipment =>
|
||||
throw _privateConstructorUsedError; // ignore: invalid_annotation_target
|
||||
@JsonKey(name: 'translations')
|
||||
@JsonKey(name: 'translations', defaultValue: [])
|
||||
List<Translation> get translations => throw _privateConstructorUsedError;
|
||||
List<ExerciseImage> get images => throw _privateConstructorUsedError;
|
||||
List<Video> get videos => throw _privateConstructorUsedError; // ignore: invalid_annotation_target
|
||||
@@ -74,7 +74,7 @@ abstract class $ExerciseApiDataCopyWith<$Res> {
|
||||
List<Muscle> muscles,
|
||||
@JsonKey(name: 'muscles_secondary') List<Muscle> musclesSecondary,
|
||||
List<Equipment> equipment,
|
||||
@JsonKey(name: 'translations') List<Translation> translations,
|
||||
@JsonKey(name: 'translations', defaultValue: []) List<Translation> translations,
|
||||
List<ExerciseImage> images,
|
||||
List<Video> videos,
|
||||
@JsonKey(name: 'author_history') List<String> authors,
|
||||
@@ -195,7 +195,7 @@ abstract class _$$ExerciseBaseDataImplCopyWith<$Res> implements $ExerciseApiData
|
||||
List<Muscle> muscles,
|
||||
@JsonKey(name: 'muscles_secondary') List<Muscle> musclesSecondary,
|
||||
List<Equipment> equipment,
|
||||
@JsonKey(name: 'translations') List<Translation> translations,
|
||||
@JsonKey(name: 'translations', defaultValue: []) List<Translation> translations,
|
||||
List<ExerciseImage> images,
|
||||
List<Video> videos,
|
||||
@JsonKey(name: 'author_history') List<String> authors,
|
||||
@@ -310,7 +310,8 @@ class _$ExerciseBaseDataImpl implements _ExerciseBaseData {
|
||||
required final List<Muscle> muscles,
|
||||
@JsonKey(name: 'muscles_secondary') required final List<Muscle> musclesSecondary,
|
||||
required final List<Equipment> equipment,
|
||||
@JsonKey(name: 'translations') required final List<Translation> translations,
|
||||
@JsonKey(name: 'translations', defaultValue: [])
|
||||
required final List<Translation> translations,
|
||||
required final List<ExerciseImage> images,
|
||||
required final List<Video> videos,
|
||||
@JsonKey(name: 'author_history') required final List<String> authors,
|
||||
@@ -382,7 +383,7 @@ class _$ExerciseBaseDataImpl implements _ExerciseBaseData {
|
||||
final List<Translation> _translations;
|
||||
// ignore: invalid_annotation_target
|
||||
@override
|
||||
@JsonKey(name: 'translations')
|
||||
@JsonKey(name: 'translations', defaultValue: [])
|
||||
List<Translation> get translations {
|
||||
if (_translations is EqualUnmodifiableListView) return _translations;
|
||||
// ignore: implicit_dynamic_type
|
||||
@@ -503,7 +504,8 @@ abstract class _ExerciseBaseData implements ExerciseApiData {
|
||||
required final List<Muscle> muscles,
|
||||
@JsonKey(name: 'muscles_secondary') required final List<Muscle> musclesSecondary,
|
||||
required final List<Equipment> equipment,
|
||||
@JsonKey(name: 'translations') required final List<Translation> translations,
|
||||
@JsonKey(name: 'translations', defaultValue: [])
|
||||
required final List<Translation> translations,
|
||||
required final List<ExerciseImage> images,
|
||||
required final List<Video> videos,
|
||||
@JsonKey(name: 'author_history') required final List<String> authors,
|
||||
@@ -538,7 +540,7 @@ abstract class _ExerciseBaseData implements ExerciseApiData {
|
||||
@override
|
||||
List<Equipment> get equipment; // ignore: invalid_annotation_target
|
||||
@override
|
||||
@JsonKey(name: 'translations')
|
||||
@JsonKey(name: 'translations', defaultValue: [])
|
||||
List<Translation> get translations;
|
||||
@override
|
||||
List<ExerciseImage> get images;
|
||||
|
||||
@@ -24,9 +24,10 @@ _$ExerciseBaseDataImpl _$$ExerciseBaseDataImplFromJson(Map<String, dynamic> json
|
||||
equipment: (json['equipment'] as List<dynamic>)
|
||||
.map((e) => Equipment.fromJson(e as Map<String, dynamic>))
|
||||
.toList(),
|
||||
translations: (json['translations'] as List<dynamic>)
|
||||
.map((e) => Translation.fromJson(e as Map<String, dynamic>))
|
||||
.toList(),
|
||||
translations: (json['translations'] as List<dynamic>?)
|
||||
?.map((e) => Translation.fromJson(e as Map<String, dynamic>))
|
||||
.toList() ??
|
||||
[],
|
||||
images: (json['images'] as List<dynamic>)
|
||||
.map((e) => ExerciseImage.fromJson(e as Map<String, dynamic>))
|
||||
.toList(),
|
||||
|
||||
@@ -455,7 +455,7 @@ class RoutinesProvider with ChangeNotifier {
|
||||
}
|
||||
|
||||
if (refresh) {
|
||||
fetchAndSetRoutineFull(days.first.routineId);
|
||||
await fetchAndSetRoutineFull(days.first.routineId);
|
||||
}
|
||||
|
||||
notifyListeners();
|
||||
@@ -463,36 +463,40 @@ class RoutinesProvider with ChangeNotifier {
|
||||
|
||||
Future<void> deleteDay(int dayId) async {
|
||||
await baseProvider.deleteRequest(_daysUrlPath, dayId);
|
||||
for (final workout in _routines) {
|
||||
workout.days = List.of(workout.days)..removeWhere((element) => element.id == dayId);
|
||||
}
|
||||
|
||||
final routine = _routines.firstWhere((routine) => routine.days.any((day) => day.id == dayId));
|
||||
routine.days.removeWhere((day) => day.id == dayId);
|
||||
fetchAndSetRoutineFull(routine.id!);
|
||||
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
/*
|
||||
* Sets
|
||||
*/
|
||||
Future<Slot> addSlot(Slot slot) async {
|
||||
Future<Slot> addSlot(Slot slot, int routineId) async {
|
||||
final data = await baseProvider.post(
|
||||
slot.toJson(),
|
||||
baseProvider.makeUrl(_slotsUrlPath),
|
||||
);
|
||||
final set = Slot.fromJson(data);
|
||||
final newSlot = Slot.fromJson(data);
|
||||
|
||||
for (final routine in _routines) {
|
||||
for (final day in routine.days) {
|
||||
if (day.id == slot.day) {
|
||||
day.slots.add(set);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// for (final routine in _routines) {
|
||||
// for (final day in routine.days) {
|
||||
// if (day.id == slot.day) {
|
||||
// day.slots.add(newSlot);
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
await fetchAndSetRoutineFull(routineId);
|
||||
|
||||
notifyListeners();
|
||||
return set;
|
||||
return newSlot;
|
||||
}
|
||||
|
||||
Future<void> deleteSlot(int slotId) async {
|
||||
Future<void> deleteSlot(int slotId, int routineId) async {
|
||||
await baseProvider.deleteRequest(_slotsUrlPath, slotId);
|
||||
|
||||
for (final routine in _routines) {
|
||||
@@ -501,18 +505,23 @@ class RoutinesProvider with ChangeNotifier {
|
||||
}
|
||||
}
|
||||
|
||||
notifyListeners();
|
||||
await fetchAndSetRoutineFull(routineId);
|
||||
|
||||
// notifyListeners();
|
||||
}
|
||||
|
||||
Future<void> editSlot(Slot slot) async {
|
||||
Future<void> editSlot(Slot slot, int routineId) async {
|
||||
await baseProvider.patch(
|
||||
slot.toJson(),
|
||||
baseProvider.makeUrl(_slotsUrlPath, id: slot.id),
|
||||
);
|
||||
notifyListeners();
|
||||
|
||||
await fetchAndSetRoutineFull(routineId);
|
||||
|
||||
// notifyListeners();
|
||||
}
|
||||
|
||||
Future<void> editSlots(List<Slot> slots) async {
|
||||
Future<void> editSlots(List<Slot> slots, int routineId) async {
|
||||
for (final slot in slots) {
|
||||
await baseProvider.patch(
|
||||
slot.toJson(),
|
||||
@@ -520,52 +529,60 @@ class RoutinesProvider with ChangeNotifier {
|
||||
);
|
||||
}
|
||||
|
||||
notifyListeners();
|
||||
await fetchAndSetRoutineFull(routineId);
|
||||
|
||||
// notifyListeners();
|
||||
}
|
||||
|
||||
Future<SlotEntry> addSlotEntry(SlotEntry entry) async {
|
||||
Future<SlotEntry> addSlotEntry(SlotEntry entry, int routineId) async {
|
||||
final data = await baseProvider.post(
|
||||
entry.toJson(),
|
||||
baseProvider.makeUrl(_slotEntriesUrlPath),
|
||||
);
|
||||
final newEntry = SlotEntry.fromJson(data);
|
||||
newEntry.exerciseObj = (await _exerciseProvider.fetchAndSetExercise(newEntry.exerciseId))!;
|
||||
// newEntry.exerciseObj = (await _exerciseProvider.fetchAndSetExercise(newEntry.exerciseId))!;
|
||||
//
|
||||
// for (final routine in _routines) {
|
||||
// for (final day in routine.days) {
|
||||
// for (final slot in day.slots) {
|
||||
// if (slot.id == entry.slotId) {
|
||||
// slot.entries.add(newEntry);
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
for (final routine in _routines) {
|
||||
for (final day in routine.days) {
|
||||
for (final slot in day.slots) {
|
||||
if (slot.id == entry.slotId) {
|
||||
slot.entries.add(newEntry);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
await fetchAndSetRoutineFull(routineId);
|
||||
|
||||
notifyListeners();
|
||||
// notifyListeners();
|
||||
return newEntry;
|
||||
}
|
||||
|
||||
Future<void> deleteSlotEntry(int id) async {
|
||||
Future<void> deleteSlotEntry(int id, int routineId) async {
|
||||
await baseProvider.deleteRequest(_slotEntriesUrlPath, id);
|
||||
for (final routine in _routines) {
|
||||
for (final day in routine.days) {
|
||||
for (final slot in day.slots) {
|
||||
slot.entries.removeWhere((e) => e.id == id);
|
||||
}
|
||||
}
|
||||
}
|
||||
// for (final routine in _routines) {
|
||||
// for (final day in routine.days) {
|
||||
// for (final slot in day.slots) {
|
||||
// slot.entries.removeWhere((e) => e.id == id);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
notifyListeners();
|
||||
await fetchAndSetRoutineFull(routineId);
|
||||
|
||||
// notifyListeners();
|
||||
}
|
||||
|
||||
Future<void> editSlotEntry(SlotEntry entry) async {
|
||||
Future<void> editSlotEntry(SlotEntry entry, int routineId) async {
|
||||
await baseProvider.patch(
|
||||
entry.toJson(),
|
||||
baseProvider.makeUrl(_slotEntriesUrlPath, id: entry.id),
|
||||
);
|
||||
|
||||
notifyListeners();
|
||||
await fetchAndSetRoutineFull(routineId);
|
||||
|
||||
// notifyListeners();
|
||||
}
|
||||
|
||||
String getConfigUrl(ConfigType type) {
|
||||
|
||||
@@ -4,6 +4,7 @@ import 'package:provider/provider.dart';
|
||||
import 'package:wger/helpers/consts.dart';
|
||||
import 'package:wger/models/workouts/day.dart';
|
||||
import 'package:wger/providers/routines.dart';
|
||||
import 'package:wger/widgets/core/progress_indicator.dart';
|
||||
import 'package:wger/widgets/routines/forms/slot.dart';
|
||||
|
||||
class ReorderableDaysList extends StatefulWidget {
|
||||
@@ -134,6 +135,7 @@ class _ReorderableDaysListState extends State<ReorderableDaysList> {
|
||||
final day = Day.empty();
|
||||
day.name = '${i18n.newDay} ${widget.days.length + 1}';
|
||||
day.routineId = widget.routineId;
|
||||
day.order = widget.days.length + 1;
|
||||
final newDay = await provider.addDay(day, refresh: true);
|
||||
|
||||
// final newSlot = await provider.addSlot(Slot.withData(
|
||||
@@ -166,6 +168,7 @@ class _DayFormWidgetState extends State<DayFormWidget> {
|
||||
final nameController = TextEditingController();
|
||||
late bool isRestDay;
|
||||
late bool needLogsToAdvance;
|
||||
bool isSaving = false;
|
||||
|
||||
final _form = GlobalKey<FormState>();
|
||||
|
||||
@@ -280,34 +283,40 @@ class _DayFormWidgetState extends State<DayFormWidget> {
|
||||
const SizedBox(height: 5),
|
||||
ElevatedButton(
|
||||
key: const Key(SUBMIT_BUTTON_KEY_NAME),
|
||||
child: Text(i18n.save),
|
||||
onPressed: () async {
|
||||
if (!_form.currentState!.validate()) {
|
||||
return;
|
||||
}
|
||||
_form.currentState!.save();
|
||||
onPressed: isSaving
|
||||
? null
|
||||
: () async {
|
||||
if (!_form.currentState!.validate()) {
|
||||
return;
|
||||
}
|
||||
_form.currentState!.save();
|
||||
setState(() => isSaving = true);
|
||||
|
||||
try {
|
||||
Provider.of<RoutinesProvider>(context, listen: false)
|
||||
.editDay(widget.day, refresh: true);
|
||||
} catch (error) {
|
||||
await showDialog(
|
||||
context: context,
|
||||
builder: (ctx) => AlertDialog(
|
||||
title: const Text('An error occurred!'),
|
||||
content: const Text('Something went wrong.'),
|
||||
actions: [
|
||||
TextButton(
|
||||
child: const Text('Okay'),
|
||||
onPressed: () {
|
||||
Navigator.of(ctx).pop();
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
},
|
||||
try {
|
||||
await Provider.of<RoutinesProvider>(context, listen: false)
|
||||
.editDay(widget.day, refresh: true);
|
||||
} catch (error) {
|
||||
await showDialog(
|
||||
context: context,
|
||||
builder: (ctx) => AlertDialog(
|
||||
title: const Text('An error occurred!'),
|
||||
content: const Text('Something went wrong.'),
|
||||
actions: [
|
||||
TextButton(
|
||||
child: const Text('Okay'),
|
||||
onPressed: () {
|
||||
Navigator.of(ctx).pop();
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
setState(() => isSaving = false);
|
||||
},
|
||||
child:
|
||||
isSaving ? const FormProgressIndicator() : Text(AppLocalizations.of(context).save),
|
||||
),
|
||||
const SizedBox(height: 5),
|
||||
ReorderableSlotList(widget.day.slots, widget.day),
|
||||
|
||||
@@ -25,6 +25,7 @@ import 'package:wger/models/workouts/day.dart';
|
||||
import 'package:wger/models/workouts/slot.dart';
|
||||
import 'package:wger/models/workouts/slot_entry.dart';
|
||||
import 'package:wger/providers/routines.dart';
|
||||
import 'package:wger/widgets/core/progress_indicator.dart';
|
||||
import 'package:wger/widgets/exercises/autocompleter.dart';
|
||||
import 'package:wger/widgets/routines/forms/reps_unit.dart';
|
||||
import 'package:wger/widgets/routines/forms/rir.dart';
|
||||
@@ -64,14 +65,18 @@ class ProgressionRulesInfoBox extends StatelessWidget {
|
||||
class SlotEntryForm extends StatefulWidget {
|
||||
final SlotEntry entry;
|
||||
final bool simpleMode;
|
||||
final int routineId;
|
||||
|
||||
const SlotEntryForm(this.entry, {this.simpleMode = true, super.key});
|
||||
const SlotEntryForm(this.entry, this.routineId, {this.simpleMode = true, super.key});
|
||||
|
||||
@override
|
||||
State<SlotEntryForm> createState() => _SlotEntryFormState();
|
||||
}
|
||||
|
||||
class _SlotEntryFormState extends State<SlotEntryForm> {
|
||||
bool isSaving = false;
|
||||
bool isDeleting = false;
|
||||
|
||||
final iconSize = 18.0;
|
||||
|
||||
double setsSliderValue = 1.0;
|
||||
@@ -143,6 +148,8 @@ class _SlotEntryFormState extends State<SlotEntryForm> {
|
||||
final i18n = AppLocalizations.of(context);
|
||||
final languageCode = Localizations.localeOf(context).languageCode;
|
||||
|
||||
final provider = context.read<RoutinesProvider>();
|
||||
|
||||
return Form(
|
||||
key: _form,
|
||||
child: Column(
|
||||
@@ -158,9 +165,7 @@ class _SlotEntryFormState extends State<SlotEntryForm> {
|
||||
children: [
|
||||
IconButton(
|
||||
onPressed: () {
|
||||
setState(() {
|
||||
_edit = !_edit;
|
||||
});
|
||||
setState(() => _edit = !_edit);
|
||||
},
|
||||
icon: _edit
|
||||
? Icon(Icons.edit_off, size: iconSize)
|
||||
@@ -168,20 +173,25 @@ class _SlotEntryFormState extends State<SlotEntryForm> {
|
||||
),
|
||||
IconButton(
|
||||
icon: Icon(Icons.delete, size: iconSize),
|
||||
onPressed: () {
|
||||
context.read<RoutinesProvider>().deleteSlotEntry(widget.entry.id!);
|
||||
},
|
||||
onPressed: isDeleting
|
||||
? null
|
||||
: () async {
|
||||
setState(() => isDeleting = true);
|
||||
await provider.deleteSlotEntry(widget.entry.id!, widget.routineId);
|
||||
if (mounted) {
|
||||
setState(() => isDeleting = false);
|
||||
}
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
if (_edit)
|
||||
ExerciseAutocompleter(
|
||||
onExerciseSelected: (exercise) => {
|
||||
setState(() {
|
||||
widget.entry.exercise = exercise;
|
||||
})
|
||||
},
|
||||
onExerciseSelected: (exercise) => setState(() {
|
||||
widget.entry.exercise = exercise;
|
||||
_edit = false;
|
||||
}),
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
@@ -194,9 +204,7 @@ class _SlotEntryFormState extends State<SlotEntryForm> {
|
||||
divisions: 20,
|
||||
label: setsSliderValue.round().toString(),
|
||||
onChanged: (double value) {
|
||||
setState(() {
|
||||
setsSliderValue = value;
|
||||
});
|
||||
setState(() => setsSliderValue = value);
|
||||
},
|
||||
),
|
||||
),
|
||||
@@ -320,63 +328,66 @@ class _SlotEntryFormState extends State<SlotEntryForm> {
|
||||
const SizedBox(height: 5),
|
||||
OutlinedButton(
|
||||
key: const Key(SUBMIT_BUTTON_KEY_NAME),
|
||||
child: Text(i18n.save),
|
||||
onPressed: () async {
|
||||
if (!_form.currentState!.validate()) {
|
||||
return;
|
||||
}
|
||||
_form.currentState!.save();
|
||||
onPressed: isSaving
|
||||
? null
|
||||
: () async {
|
||||
if (!_form.currentState!.validate()) {
|
||||
return;
|
||||
}
|
||||
_form.currentState!.save();
|
||||
setState(() => isSaving = true);
|
||||
|
||||
final provider = Provider.of<RoutinesProvider>(context, listen: false);
|
||||
// Process new, edited or entries to be deleted
|
||||
await Future.wait([
|
||||
provider.handleConfig(
|
||||
widget.entry,
|
||||
setsSliderValue == 0 ? '' : setsSliderValue.round().toString(),
|
||||
ConfigType.sets,
|
||||
),
|
||||
provider.handleConfig(
|
||||
widget.entry,
|
||||
weightController.text,
|
||||
ConfigType.weight,
|
||||
),
|
||||
provider.handleConfig(
|
||||
widget.entry,
|
||||
maxWeightController.text,
|
||||
ConfigType.maxWeight,
|
||||
),
|
||||
provider.handleConfig(
|
||||
widget.entry,
|
||||
repetitionsController.text,
|
||||
ConfigType.repetitions,
|
||||
),
|
||||
provider.handleConfig(
|
||||
widget.entry,
|
||||
maxRepetitionsController.text,
|
||||
ConfigType.maxRepetitions,
|
||||
),
|
||||
provider.handleConfig(
|
||||
widget.entry,
|
||||
restController.text,
|
||||
ConfigType.rest,
|
||||
),
|
||||
provider.handleConfig(
|
||||
widget.entry,
|
||||
maxRestController.text,
|
||||
ConfigType.maxRest,
|
||||
),
|
||||
provider.handleConfig(
|
||||
widget.entry,
|
||||
rirController.text,
|
||||
ConfigType.rir,
|
||||
),
|
||||
]);
|
||||
|
||||
// Process new, edited or entries to be deleted
|
||||
provider.handleConfig(
|
||||
widget.entry,
|
||||
setsSliderValue == 0 ? '' : setsSliderValue.round().toString(),
|
||||
ConfigType.sets,
|
||||
);
|
||||
|
||||
provider.handleConfig(
|
||||
widget.entry,
|
||||
weightController.text,
|
||||
ConfigType.weight,
|
||||
);
|
||||
provider.handleConfig(
|
||||
widget.entry,
|
||||
maxWeightController.text,
|
||||
ConfigType.maxWeight,
|
||||
);
|
||||
|
||||
provider.handleConfig(
|
||||
widget.entry,
|
||||
repetitionsController.text,
|
||||
ConfigType.repetitions,
|
||||
);
|
||||
provider.handleConfig(
|
||||
widget.entry,
|
||||
maxRepetitionsController.text,
|
||||
ConfigType.maxRepetitions,
|
||||
);
|
||||
|
||||
provider.handleConfig(
|
||||
widget.entry,
|
||||
restController.text,
|
||||
ConfigType.rest,
|
||||
);
|
||||
provider.handleConfig(
|
||||
widget.entry,
|
||||
maxRestController.text,
|
||||
ConfigType.maxRest,
|
||||
);
|
||||
|
||||
provider.handleConfig(
|
||||
widget.entry,
|
||||
rirController.text,
|
||||
ConfigType.rir,
|
||||
);
|
||||
|
||||
provider.editSlotEntry(widget.entry);
|
||||
},
|
||||
await provider.editSlotEntry(widget.entry, widget.routineId);
|
||||
if (mounted) {
|
||||
setState(() => isSaving = false);
|
||||
}
|
||||
},
|
||||
child:
|
||||
isSaving ? const FormProgressIndicator() : Text(AppLocalizations.of(context).save),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
],
|
||||
@@ -388,8 +399,9 @@ class _SlotEntryFormState extends State<SlotEntryForm> {
|
||||
class SlotDetailWidget extends StatefulWidget {
|
||||
final Slot slot;
|
||||
final bool simpleMode;
|
||||
final int routineId;
|
||||
|
||||
const SlotDetailWidget(this.slot, {this.simpleMode = true, super.key});
|
||||
const SlotDetailWidget(this.slot, this.routineId, {this.simpleMode = true, super.key});
|
||||
|
||||
@override
|
||||
State<SlotDetailWidget> createState() => _SlotDetailWidgetState();
|
||||
@@ -407,29 +419,26 @@ class _SlotDetailWidgetState extends State<SlotDetailWidget> {
|
||||
children: [
|
||||
...widget.slot.entries.map((entry) => entry.hasProgressionRules
|
||||
? ProgressionRulesInfoBox(entry.exerciseObj)
|
||||
: SlotEntryForm(entry, simpleMode: widget.simpleMode)),
|
||||
: SlotEntryForm(entry, widget.routineId, simpleMode: widget.simpleMode)),
|
||||
const SizedBox(height: 10),
|
||||
if (_showExerciseSearchBox || widget.slot.entries.isEmpty)
|
||||
ExerciseAutocompleter(
|
||||
onExerciseSelected: (exercise) async {
|
||||
setState(() => _showExerciseSearchBox = false);
|
||||
|
||||
final SlotEntry entry = SlotEntry.withData(
|
||||
slotId: widget.slot.id!,
|
||||
order: widget.slot.entries.length + 1,
|
||||
exercise: exercise,
|
||||
);
|
||||
|
||||
setState(() {
|
||||
_showExerciseSearchBox = false;
|
||||
});
|
||||
await provider.addSlotEntry(entry);
|
||||
await provider.addSlotEntry(entry, widget.routineId);
|
||||
},
|
||||
),
|
||||
if (widget.slot.entries.isNotEmpty)
|
||||
FilledButton(
|
||||
onPressed: () {
|
||||
setState(() {
|
||||
_showExerciseSearchBox = !_showExerciseSearchBox;
|
||||
});
|
||||
setState(() => _showExerciseSearchBox = !_showExerciseSearchBox);
|
||||
},
|
||||
child: Text(i18n.addSuperset),
|
||||
),
|
||||
@@ -452,6 +461,8 @@ class ReorderableSlotList extends StatefulWidget {
|
||||
class _SlotFormWidgetStateNg extends State<ReorderableSlotList> {
|
||||
int? selectedSlotId;
|
||||
bool simpleMode = true;
|
||||
bool isAddingSlot = false;
|
||||
int? isDeletingSlot;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -468,9 +479,7 @@ class _SlotFormWidgetStateNg extends State<ReorderableSlotList> {
|
||||
subtitle: Text(i18n.simpleModeHelp),
|
||||
contentPadding: const EdgeInsets.all(4),
|
||||
onChanged: (value) {
|
||||
setState(() {
|
||||
simpleMode = value;
|
||||
});
|
||||
setState(() => simpleMode = value);
|
||||
},
|
||||
),
|
||||
ReorderableListView.builder(
|
||||
@@ -527,15 +536,22 @@ class _SlotFormWidgetStateNg extends State<ReorderableSlotList> {
|
||||
),
|
||||
IconButton(
|
||||
icon: const Icon(Icons.delete),
|
||||
onPressed: () async {
|
||||
selectedSlotId = null;
|
||||
await provider.deleteSlot(slot.id!);
|
||||
},
|
||||
onPressed: isDeletingSlot == index
|
||||
? null
|
||||
: () async {
|
||||
selectedSlotId = null;
|
||||
setState(() => isDeletingSlot = index);
|
||||
await provider.deleteSlot(slot.id!, widget.day.routineId);
|
||||
if (mounted) {
|
||||
setState(() => isDeletingSlot = null);
|
||||
}
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
if (isCurrentSlotSelected) SlotDetailWidget(slot, simpleMode: simpleMode),
|
||||
if (isCurrentSlotSelected)
|
||||
SlotDetailWidget(slot, widget.day.routineId, simpleMode: simpleMode),
|
||||
],
|
||||
),
|
||||
);
|
||||
@@ -553,26 +569,34 @@ class _SlotFormWidgetStateNg extends State<ReorderableSlotList> {
|
||||
widget.slots[i].order = i + 1;
|
||||
}
|
||||
|
||||
provider.editSlots(widget.slots);
|
||||
provider.editSlots(widget.slots, widget.day.routineId);
|
||||
});
|
||||
},
|
||||
),
|
||||
if (!widget.day.isRest)
|
||||
ListTile(
|
||||
leading: const Icon(Icons.add),
|
||||
leading: isAddingSlot ? const FormProgressIndicator() : const Icon(Icons.add),
|
||||
title: Text(
|
||||
i18n.addExercise,
|
||||
style: Theme.of(context).textTheme.titleMedium,
|
||||
),
|
||||
onTap: () async {
|
||||
final newSlot = await provider.addSlot(Slot.withData(
|
||||
day: widget.day.id,
|
||||
order: widget.slots.length + 1,
|
||||
));
|
||||
setState(() {
|
||||
selectedSlotId = newSlot.id;
|
||||
});
|
||||
},
|
||||
onTap: isAddingSlot
|
||||
? null
|
||||
: () async {
|
||||
setState(() => isAddingSlot = true);
|
||||
|
||||
final newSlot = await provider.addSlot(
|
||||
Slot.withData(
|
||||
day: widget.day.id,
|
||||
order: widget.slots.length + 1,
|
||||
),
|
||||
widget.day.routineId,
|
||||
);
|
||||
if (mounted) {
|
||||
setState(() => isAddingSlot = false);
|
||||
setState(() => selectedSlotId = newSlot.id);
|
||||
}
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
|
||||
@@ -19,10 +19,8 @@
|
||||
import 'package:collection/collection.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:wger/models/workouts/day.dart';
|
||||
import 'package:wger/models/workouts/routine.dart';
|
||||
import 'package:wger/providers/routines.dart';
|
||||
import 'package:wger/widgets/routines/forms/day.dart';
|
||||
import 'package:wger/widgets/routines/forms/routine.dart';
|
||||
import 'package:wger/widgets/routines/routine_detail.dart';
|
||||
@@ -37,21 +35,12 @@ class RoutineEdit extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _RoutineEditState extends State<RoutineEdit> {
|
||||
late Future<Routine> _dataFuture;
|
||||
int? selectedDayId;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_dataFuture = context.read<RoutinesProvider>().fetchAndSetRoutineFull(widget._routine.id!);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final i18n = AppLocalizations.of(context);
|
||||
|
||||
final provider = context.read<RoutinesProvider>();
|
||||
|
||||
Day? selectedDay;
|
||||
if (selectedDayId != null) {
|
||||
selectedDay = widget._routine.days.firstWhereOrNull((day) => day.id == selectedDayId);
|
||||
@@ -93,33 +82,8 @@ class _RoutineEditState extends State<RoutineEdit> {
|
||||
i18n.resultingRoutine,
|
||||
style: Theme.of(context).textTheme.titleLarge,
|
||||
),
|
||||
IconButton(
|
||||
key: const ValueKey('refresh-routine'),
|
||||
onPressed: () {
|
||||
setState(() {
|
||||
_dataFuture = provider.fetchAndSetRoutineFull(widget._routine.id!);
|
||||
});
|
||||
},
|
||||
icon: const Icon(Icons.refresh),
|
||||
),
|
||||
const Divider(),
|
||||
FutureBuilder<Routine>(
|
||||
future: _dataFuture,
|
||||
builder: (BuildContext context, AsyncSnapshot<Routine> snapshot) {
|
||||
if (snapshot.connectionState == ConnectionState.waiting) {
|
||||
return const SizedBox(
|
||||
height: 200,
|
||||
child: Center(
|
||||
child: CircularProgressIndicator(),
|
||||
),
|
||||
);
|
||||
} else if (snapshot.hasData) {
|
||||
return RoutineDetail(snapshot.data!, viewMode: true);
|
||||
}
|
||||
return const Text('No data available');
|
||||
},
|
||||
),
|
||||
// RoutineDetail(widget._routine),
|
||||
RoutineDetail(widget._routine, viewMode: true),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@@ -99,6 +99,7 @@ void main() {
|
||||
.having((d) => d.name, 'name', 'Day 1')
|
||||
.having((d) => d.description, 'description', 'Day 1 description'),
|
||||
),
|
||||
refresh: true,
|
||||
),
|
||||
);
|
||||
});
|
||||
|
||||
@@ -322,52 +322,59 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider {
|
||||
) as _i13.Future<void>);
|
||||
|
||||
@override
|
||||
_i13.Future<_i7.Slot> addSlot(_i7.Slot? slot) => (super.noSuchMethod(
|
||||
Invocation.method(#addSlot, [slot]),
|
||||
_i13.Future<_i7.Slot> addSlot(_i7.Slot? slot, int? routineId) => (super.noSuchMethod(
|
||||
Invocation.method(#addSlot, [slot, routineId]),
|
||||
returnValue: _i13.Future<_i7.Slot>.value(
|
||||
_FakeSlot_5(this, Invocation.method(#addSlot, [slot])),
|
||||
_FakeSlot_5(this, Invocation.method(#addSlot, [slot, routineId])),
|
||||
),
|
||||
) as _i13.Future<_i7.Slot>);
|
||||
|
||||
@override
|
||||
_i13.Future<void> deleteSlot(int? slotId) => (super.noSuchMethod(
|
||||
Invocation.method(#deleteSlot, [slotId]),
|
||||
_i13.Future<void> deleteSlot(int? slotId, int? routineId) => (super.noSuchMethod(
|
||||
Invocation.method(#deleteSlot, [slotId, routineId]),
|
||||
returnValue: _i13.Future<void>.value(),
|
||||
returnValueForMissingStub: _i13.Future<void>.value(),
|
||||
) as _i13.Future<void>);
|
||||
|
||||
@override
|
||||
_i13.Future<void> editSlot(_i7.Slot? slot) => (super.noSuchMethod(
|
||||
Invocation.method(#editSlot, [slot]),
|
||||
_i13.Future<void> editSlot(_i7.Slot? slot, int? routineId) => (super.noSuchMethod(
|
||||
Invocation.method(#editSlot, [slot, routineId]),
|
||||
returnValue: _i13.Future<void>.value(),
|
||||
returnValueForMissingStub: _i13.Future<void>.value(),
|
||||
) as _i13.Future<void>);
|
||||
|
||||
@override
|
||||
_i13.Future<void> editSlots(List<_i7.Slot>? slots) => (super.noSuchMethod(
|
||||
Invocation.method(#editSlots, [slots]),
|
||||
_i13.Future<void> editSlots(List<_i7.Slot>? slots, int? routineId) => (super.noSuchMethod(
|
||||
Invocation.method(#editSlots, [slots, routineId]),
|
||||
returnValue: _i13.Future<void>.value(),
|
||||
returnValueForMissingStub: _i13.Future<void>.value(),
|
||||
) as _i13.Future<void>);
|
||||
|
||||
@override
|
||||
_i13.Future<_i8.SlotEntry> addSlotEntry(_i8.SlotEntry? entry) => (super.noSuchMethod(
|
||||
Invocation.method(#addSlotEntry, [entry]),
|
||||
_i13.Future<_i8.SlotEntry> addSlotEntry(
|
||||
_i8.SlotEntry? entry,
|
||||
int? routineId,
|
||||
) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#addSlotEntry, [entry, routineId]),
|
||||
returnValue: _i13.Future<_i8.SlotEntry>.value(
|
||||
_FakeSlotEntry_6(this, Invocation.method(#addSlotEntry, [entry])),
|
||||
_FakeSlotEntry_6(
|
||||
this,
|
||||
Invocation.method(#addSlotEntry, [entry, routineId]),
|
||||
),
|
||||
),
|
||||
) as _i13.Future<_i8.SlotEntry>);
|
||||
|
||||
@override
|
||||
_i13.Future<void> deleteSlotEntry(int? id) => (super.noSuchMethod(
|
||||
Invocation.method(#deleteSlotEntry, [id]),
|
||||
_i13.Future<void> deleteSlotEntry(int? id, int? routineId) => (super.noSuchMethod(
|
||||
Invocation.method(#deleteSlotEntry, [id, routineId]),
|
||||
returnValue: _i13.Future<void>.value(),
|
||||
returnValueForMissingStub: _i13.Future<void>.value(),
|
||||
) as _i13.Future<void>);
|
||||
|
||||
@override
|
||||
_i13.Future<void> editSlotEntry(_i8.SlotEntry? entry) => (super.noSuchMethod(
|
||||
Invocation.method(#editSlotEntry, [entry]),
|
||||
_i13.Future<void> editSlotEntry(_i8.SlotEntry? entry, int? routineId) => (super.noSuchMethod(
|
||||
Invocation.method(#editSlotEntry, [entry, routineId]),
|
||||
returnValue: _i13.Future<void>.value(),
|
||||
returnValueForMissingStub: _i13.Future<void>.value(),
|
||||
) as _i13.Future<void>);
|
||||
|
||||
@@ -322,52 +322,59 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider {
|
||||
) as _i13.Future<void>);
|
||||
|
||||
@override
|
||||
_i13.Future<_i7.Slot> addSlot(_i7.Slot? slot) => (super.noSuchMethod(
|
||||
Invocation.method(#addSlot, [slot]),
|
||||
_i13.Future<_i7.Slot> addSlot(_i7.Slot? slot, int? routineId) => (super.noSuchMethod(
|
||||
Invocation.method(#addSlot, [slot, routineId]),
|
||||
returnValue: _i13.Future<_i7.Slot>.value(
|
||||
_FakeSlot_5(this, Invocation.method(#addSlot, [slot])),
|
||||
_FakeSlot_5(this, Invocation.method(#addSlot, [slot, routineId])),
|
||||
),
|
||||
) as _i13.Future<_i7.Slot>);
|
||||
|
||||
@override
|
||||
_i13.Future<void> deleteSlot(int? slotId) => (super.noSuchMethod(
|
||||
Invocation.method(#deleteSlot, [slotId]),
|
||||
_i13.Future<void> deleteSlot(int? slotId, int? routineId) => (super.noSuchMethod(
|
||||
Invocation.method(#deleteSlot, [slotId, routineId]),
|
||||
returnValue: _i13.Future<void>.value(),
|
||||
returnValueForMissingStub: _i13.Future<void>.value(),
|
||||
) as _i13.Future<void>);
|
||||
|
||||
@override
|
||||
_i13.Future<void> editSlot(_i7.Slot? slot) => (super.noSuchMethod(
|
||||
Invocation.method(#editSlot, [slot]),
|
||||
_i13.Future<void> editSlot(_i7.Slot? slot, int? routineId) => (super.noSuchMethod(
|
||||
Invocation.method(#editSlot, [slot, routineId]),
|
||||
returnValue: _i13.Future<void>.value(),
|
||||
returnValueForMissingStub: _i13.Future<void>.value(),
|
||||
) as _i13.Future<void>);
|
||||
|
||||
@override
|
||||
_i13.Future<void> editSlots(List<_i7.Slot>? slots) => (super.noSuchMethod(
|
||||
Invocation.method(#editSlots, [slots]),
|
||||
_i13.Future<void> editSlots(List<_i7.Slot>? slots, int? routineId) => (super.noSuchMethod(
|
||||
Invocation.method(#editSlots, [slots, routineId]),
|
||||
returnValue: _i13.Future<void>.value(),
|
||||
returnValueForMissingStub: _i13.Future<void>.value(),
|
||||
) as _i13.Future<void>);
|
||||
|
||||
@override
|
||||
_i13.Future<_i8.SlotEntry> addSlotEntry(_i8.SlotEntry? entry) => (super.noSuchMethod(
|
||||
Invocation.method(#addSlotEntry, [entry]),
|
||||
_i13.Future<_i8.SlotEntry> addSlotEntry(
|
||||
_i8.SlotEntry? entry,
|
||||
int? routineId,
|
||||
) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#addSlotEntry, [entry, routineId]),
|
||||
returnValue: _i13.Future<_i8.SlotEntry>.value(
|
||||
_FakeSlotEntry_6(this, Invocation.method(#addSlotEntry, [entry])),
|
||||
_FakeSlotEntry_6(
|
||||
this,
|
||||
Invocation.method(#addSlotEntry, [entry, routineId]),
|
||||
),
|
||||
),
|
||||
) as _i13.Future<_i8.SlotEntry>);
|
||||
|
||||
@override
|
||||
_i13.Future<void> deleteSlotEntry(int? id) => (super.noSuchMethod(
|
||||
Invocation.method(#deleteSlotEntry, [id]),
|
||||
_i13.Future<void> deleteSlotEntry(int? id, int? routineId) => (super.noSuchMethod(
|
||||
Invocation.method(#deleteSlotEntry, [id, routineId]),
|
||||
returnValue: _i13.Future<void>.value(),
|
||||
returnValueForMissingStub: _i13.Future<void>.value(),
|
||||
) as _i13.Future<void>);
|
||||
|
||||
@override
|
||||
_i13.Future<void> editSlotEntry(_i8.SlotEntry? entry) => (super.noSuchMethod(
|
||||
Invocation.method(#editSlotEntry, [entry]),
|
||||
_i13.Future<void> editSlotEntry(_i8.SlotEntry? entry, int? routineId) => (super.noSuchMethod(
|
||||
Invocation.method(#editSlotEntry, [entry, routineId]),
|
||||
returnValue: _i13.Future<void>.value(),
|
||||
returnValueForMissingStub: _i13.Future<void>.value(),
|
||||
) as _i13.Future<void>);
|
||||
|
||||
@@ -322,52 +322,59 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider {
|
||||
) as _i13.Future<void>);
|
||||
|
||||
@override
|
||||
_i13.Future<_i7.Slot> addSlot(_i7.Slot? slot) => (super.noSuchMethod(
|
||||
Invocation.method(#addSlot, [slot]),
|
||||
_i13.Future<_i7.Slot> addSlot(_i7.Slot? slot, int? routineId) => (super.noSuchMethod(
|
||||
Invocation.method(#addSlot, [slot, routineId]),
|
||||
returnValue: _i13.Future<_i7.Slot>.value(
|
||||
_FakeSlot_5(this, Invocation.method(#addSlot, [slot])),
|
||||
_FakeSlot_5(this, Invocation.method(#addSlot, [slot, routineId])),
|
||||
),
|
||||
) as _i13.Future<_i7.Slot>);
|
||||
|
||||
@override
|
||||
_i13.Future<void> deleteSlot(int? slotId) => (super.noSuchMethod(
|
||||
Invocation.method(#deleteSlot, [slotId]),
|
||||
_i13.Future<void> deleteSlot(int? slotId, int? routineId) => (super.noSuchMethod(
|
||||
Invocation.method(#deleteSlot, [slotId, routineId]),
|
||||
returnValue: _i13.Future<void>.value(),
|
||||
returnValueForMissingStub: _i13.Future<void>.value(),
|
||||
) as _i13.Future<void>);
|
||||
|
||||
@override
|
||||
_i13.Future<void> editSlot(_i7.Slot? slot) => (super.noSuchMethod(
|
||||
Invocation.method(#editSlot, [slot]),
|
||||
_i13.Future<void> editSlot(_i7.Slot? slot, int? routineId) => (super.noSuchMethod(
|
||||
Invocation.method(#editSlot, [slot, routineId]),
|
||||
returnValue: _i13.Future<void>.value(),
|
||||
returnValueForMissingStub: _i13.Future<void>.value(),
|
||||
) as _i13.Future<void>);
|
||||
|
||||
@override
|
||||
_i13.Future<void> editSlots(List<_i7.Slot>? slots) => (super.noSuchMethod(
|
||||
Invocation.method(#editSlots, [slots]),
|
||||
_i13.Future<void> editSlots(List<_i7.Slot>? slots, int? routineId) => (super.noSuchMethod(
|
||||
Invocation.method(#editSlots, [slots, routineId]),
|
||||
returnValue: _i13.Future<void>.value(),
|
||||
returnValueForMissingStub: _i13.Future<void>.value(),
|
||||
) as _i13.Future<void>);
|
||||
|
||||
@override
|
||||
_i13.Future<_i8.SlotEntry> addSlotEntry(_i8.SlotEntry? entry) => (super.noSuchMethod(
|
||||
Invocation.method(#addSlotEntry, [entry]),
|
||||
_i13.Future<_i8.SlotEntry> addSlotEntry(
|
||||
_i8.SlotEntry? entry,
|
||||
int? routineId,
|
||||
) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#addSlotEntry, [entry, routineId]),
|
||||
returnValue: _i13.Future<_i8.SlotEntry>.value(
|
||||
_FakeSlotEntry_6(this, Invocation.method(#addSlotEntry, [entry])),
|
||||
_FakeSlotEntry_6(
|
||||
this,
|
||||
Invocation.method(#addSlotEntry, [entry, routineId]),
|
||||
),
|
||||
),
|
||||
) as _i13.Future<_i8.SlotEntry>);
|
||||
|
||||
@override
|
||||
_i13.Future<void> deleteSlotEntry(int? id) => (super.noSuchMethod(
|
||||
Invocation.method(#deleteSlotEntry, [id]),
|
||||
_i13.Future<void> deleteSlotEntry(int? id, int? routineId) => (super.noSuchMethod(
|
||||
Invocation.method(#deleteSlotEntry, [id, routineId]),
|
||||
returnValue: _i13.Future<void>.value(),
|
||||
returnValueForMissingStub: _i13.Future<void>.value(),
|
||||
) as _i13.Future<void>);
|
||||
|
||||
@override
|
||||
_i13.Future<void> editSlotEntry(_i8.SlotEntry? entry) => (super.noSuchMethod(
|
||||
Invocation.method(#editSlotEntry, [entry]),
|
||||
_i13.Future<void> editSlotEntry(_i8.SlotEntry? entry, int? routineId) => (super.noSuchMethod(
|
||||
Invocation.method(#editSlotEntry, [entry, routineId]),
|
||||
returnValue: _i13.Future<void>.value(),
|
||||
returnValueForMissingStub: _i13.Future<void>.value(),
|
||||
) as _i13.Future<void>);
|
||||
|
||||
@@ -322,52 +322,59 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider {
|
||||
) as _i13.Future<void>);
|
||||
|
||||
@override
|
||||
_i13.Future<_i7.Slot> addSlot(_i7.Slot? slot) => (super.noSuchMethod(
|
||||
Invocation.method(#addSlot, [slot]),
|
||||
_i13.Future<_i7.Slot> addSlot(_i7.Slot? slot, int? routineId) => (super.noSuchMethod(
|
||||
Invocation.method(#addSlot, [slot, routineId]),
|
||||
returnValue: _i13.Future<_i7.Slot>.value(
|
||||
_FakeSlot_5(this, Invocation.method(#addSlot, [slot])),
|
||||
_FakeSlot_5(this, Invocation.method(#addSlot, [slot, routineId])),
|
||||
),
|
||||
) as _i13.Future<_i7.Slot>);
|
||||
|
||||
@override
|
||||
_i13.Future<void> deleteSlot(int? slotId) => (super.noSuchMethod(
|
||||
Invocation.method(#deleteSlot, [slotId]),
|
||||
_i13.Future<void> deleteSlot(int? slotId, int? routineId) => (super.noSuchMethod(
|
||||
Invocation.method(#deleteSlot, [slotId, routineId]),
|
||||
returnValue: _i13.Future<void>.value(),
|
||||
returnValueForMissingStub: _i13.Future<void>.value(),
|
||||
) as _i13.Future<void>);
|
||||
|
||||
@override
|
||||
_i13.Future<void> editSlot(_i7.Slot? slot) => (super.noSuchMethod(
|
||||
Invocation.method(#editSlot, [slot]),
|
||||
_i13.Future<void> editSlot(_i7.Slot? slot, int? routineId) => (super.noSuchMethod(
|
||||
Invocation.method(#editSlot, [slot, routineId]),
|
||||
returnValue: _i13.Future<void>.value(),
|
||||
returnValueForMissingStub: _i13.Future<void>.value(),
|
||||
) as _i13.Future<void>);
|
||||
|
||||
@override
|
||||
_i13.Future<void> editSlots(List<_i7.Slot>? slots) => (super.noSuchMethod(
|
||||
Invocation.method(#editSlots, [slots]),
|
||||
_i13.Future<void> editSlots(List<_i7.Slot>? slots, int? routineId) => (super.noSuchMethod(
|
||||
Invocation.method(#editSlots, [slots, routineId]),
|
||||
returnValue: _i13.Future<void>.value(),
|
||||
returnValueForMissingStub: _i13.Future<void>.value(),
|
||||
) as _i13.Future<void>);
|
||||
|
||||
@override
|
||||
_i13.Future<_i8.SlotEntry> addSlotEntry(_i8.SlotEntry? entry) => (super.noSuchMethod(
|
||||
Invocation.method(#addSlotEntry, [entry]),
|
||||
_i13.Future<_i8.SlotEntry> addSlotEntry(
|
||||
_i8.SlotEntry? entry,
|
||||
int? routineId,
|
||||
) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#addSlotEntry, [entry, routineId]),
|
||||
returnValue: _i13.Future<_i8.SlotEntry>.value(
|
||||
_FakeSlotEntry_6(this, Invocation.method(#addSlotEntry, [entry])),
|
||||
_FakeSlotEntry_6(
|
||||
this,
|
||||
Invocation.method(#addSlotEntry, [entry, routineId]),
|
||||
),
|
||||
),
|
||||
) as _i13.Future<_i8.SlotEntry>);
|
||||
|
||||
@override
|
||||
_i13.Future<void> deleteSlotEntry(int? id) => (super.noSuchMethod(
|
||||
Invocation.method(#deleteSlotEntry, [id]),
|
||||
_i13.Future<void> deleteSlotEntry(int? id, int? routineId) => (super.noSuchMethod(
|
||||
Invocation.method(#deleteSlotEntry, [id, routineId]),
|
||||
returnValue: _i13.Future<void>.value(),
|
||||
returnValueForMissingStub: _i13.Future<void>.value(),
|
||||
) as _i13.Future<void>);
|
||||
|
||||
@override
|
||||
_i13.Future<void> editSlotEntry(_i8.SlotEntry? entry) => (super.noSuchMethod(
|
||||
Invocation.method(#editSlotEntry, [entry]),
|
||||
_i13.Future<void> editSlotEntry(_i8.SlotEntry? entry, int? routineId) => (super.noSuchMethod(
|
||||
Invocation.method(#editSlotEntry, [entry, routineId]),
|
||||
returnValue: _i13.Future<void>.value(),
|
||||
returnValueForMissingStub: _i13.Future<void>.value(),
|
||||
) as _i13.Future<void>);
|
||||
|
||||
@@ -25,6 +25,7 @@ import 'package:provider/provider.dart';
|
||||
import 'package:wger/helpers/consts.dart';
|
||||
import 'package:wger/models/workouts/routine.dart';
|
||||
import 'package:wger/providers/routines.dart';
|
||||
import 'package:wger/screens/routine_edit_screen.dart';
|
||||
import 'package:wger/screens/routine_screen.dart';
|
||||
import 'package:wger/widgets/routines/forms/routine.dart';
|
||||
|
||||
@@ -34,7 +35,7 @@ import './routine_form_test.mocks.dart';
|
||||
void main() {
|
||||
var mockRoutinesProvider = MockRoutinesProvider();
|
||||
|
||||
final existingPlan = Routine(
|
||||
final existingRoutine = Routine(
|
||||
id: 1,
|
||||
created: DateTime(2021, 1, 1),
|
||||
start: DateTime(2024, 11, 1),
|
||||
@@ -48,9 +49,10 @@ void main() {
|
||||
setUp(() {
|
||||
newRoutine = Routine.empty();
|
||||
mockRoutinesProvider = MockRoutinesProvider();
|
||||
when(mockRoutinesProvider.editRoutine(any)).thenAnswer((_) => Future.value(existingPlan));
|
||||
when(mockRoutinesProvider.findById(any)).thenAnswer((_) => existingRoutine);
|
||||
when(mockRoutinesProvider.editRoutine(any)).thenAnswer((_) => Future.value(existingRoutine));
|
||||
when(mockRoutinesProvider.fetchAndSetRoutineFull(any))
|
||||
.thenAnswer((_) => Future.value(existingPlan));
|
||||
.thenAnswer((_) => Future.value(existingRoutine));
|
||||
});
|
||||
|
||||
Widget renderWidget(Routine routine, {locale = 'en'}) {
|
||||
@@ -64,13 +66,16 @@ void main() {
|
||||
supportedLocales: AppLocalizations.supportedLocales,
|
||||
navigatorKey: key,
|
||||
home: Scaffold(body: RoutineForm(routine)),
|
||||
routes: {RoutineScreen.routeName: (ctx) => const RoutineScreen()},
|
||||
routes: {
|
||||
RoutineScreen.routeName: (ctx) => const RoutineScreen(),
|
||||
RoutineEditScreen.routeName: (ctx) => const RoutineEditScreen(),
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
testWidgets('Test the widgets on the workout form', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(renderWidget(existingPlan));
|
||||
await tester.pumpWidget(renderWidget(existingRoutine));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.byType(TextFormField), findsNWidgets(4));
|
||||
@@ -78,7 +83,7 @@ void main() {
|
||||
});
|
||||
|
||||
testWidgets('Test editing an existing workout', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(renderWidget(existingPlan));
|
||||
await tester.pumpWidget(renderWidget(existingRoutine));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(
|
||||
@@ -108,7 +113,7 @@ void main() {
|
||||
});
|
||||
|
||||
testWidgets('Test creating a new workout - only name', (WidgetTester tester) async {
|
||||
final editWorkout = Routine(
|
||||
final editRoutine = Routine(
|
||||
id: 2,
|
||||
created: newRoutine.created,
|
||||
start: DateTime(2024, 11, 1),
|
||||
@@ -116,13 +121,14 @@ void main() {
|
||||
name: 'New cool workout',
|
||||
);
|
||||
|
||||
when(mockRoutinesProvider.addRoutine(any)).thenAnswer((_) => Future.value(editWorkout));
|
||||
when(mockRoutinesProvider.addRoutine(any)).thenAnswer((_) => Future.value(editRoutine));
|
||||
when(mockRoutinesProvider.findById(any)).thenAnswer((_) => editRoutine);
|
||||
|
||||
await tester.pumpWidget(renderWidget(newRoutine));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.text(''), findsNWidgets(2), reason: 'New workout has no name or description');
|
||||
await tester.enterText(find.byKey(const Key('field-name')), editWorkout.name);
|
||||
await tester.enterText(find.byKey(const Key('field-name')), editRoutine.name);
|
||||
await tester.tap(find.byKey(const Key(SUBMIT_BUTTON_KEY_NAME)));
|
||||
|
||||
verifyNever(mockRoutinesProvider.editRoutine(any));
|
||||
@@ -130,11 +136,11 @@ void main() {
|
||||
|
||||
// Detail page
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text('New cool workout'), findsOneWidget, reason: 'Workout plan detail page');
|
||||
expect(find.text('New cool workout'), findsWidgets, reason: 'Workout plan detail page');
|
||||
});
|
||||
|
||||
testWidgets('Test creating a new workout - name and description', (WidgetTester tester) async {
|
||||
final editWorkout = Routine(
|
||||
final editRoutine = Routine(
|
||||
id: 2,
|
||||
created: newRoutine.created,
|
||||
start: DateTime(2024, 11, 1),
|
||||
@@ -142,14 +148,15 @@ void main() {
|
||||
name: 'My workout',
|
||||
description: 'Get yuuuge',
|
||||
);
|
||||
when(mockRoutinesProvider.addRoutine(any)).thenAnswer((_) => Future.value(editWorkout));
|
||||
when(mockRoutinesProvider.addRoutine(any)).thenAnswer((_) => Future.value(editRoutine));
|
||||
when(mockRoutinesProvider.findById(any)).thenAnswer((_) => editRoutine);
|
||||
|
||||
await tester.pumpWidget(renderWidget(newRoutine));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.text(''), findsNWidgets(2), reason: 'New workout has no name or description');
|
||||
await tester.enterText(find.byKey(const Key('field-name')), editWorkout.name);
|
||||
await tester.enterText(find.byKey(const Key('field-description')), editWorkout.description);
|
||||
await tester.enterText(find.byKey(const Key('field-name')), editRoutine.name);
|
||||
await tester.enterText(find.byKey(const Key('field-description')), editRoutine.description);
|
||||
await tester.tap(find.byKey(const Key(SUBMIT_BUTTON_KEY_NAME)));
|
||||
|
||||
verifyNever(mockRoutinesProvider.editRoutine(any));
|
||||
@@ -157,6 +164,6 @@ void main() {
|
||||
|
||||
// Detail page
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text('My workout'), findsOneWidget, reason: 'Workout plan detail page');
|
||||
expect(find.text('My workout'), findsWidgets, reason: 'Workout plan detail page');
|
||||
});
|
||||
}
|
||||
|
||||
@@ -322,52 +322,59 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider {
|
||||
) as _i13.Future<void>);
|
||||
|
||||
@override
|
||||
_i13.Future<_i7.Slot> addSlot(_i7.Slot? slot) => (super.noSuchMethod(
|
||||
Invocation.method(#addSlot, [slot]),
|
||||
_i13.Future<_i7.Slot> addSlot(_i7.Slot? slot, int? routineId) => (super.noSuchMethod(
|
||||
Invocation.method(#addSlot, [slot, routineId]),
|
||||
returnValue: _i13.Future<_i7.Slot>.value(
|
||||
_FakeSlot_5(this, Invocation.method(#addSlot, [slot])),
|
||||
_FakeSlot_5(this, Invocation.method(#addSlot, [slot, routineId])),
|
||||
),
|
||||
) as _i13.Future<_i7.Slot>);
|
||||
|
||||
@override
|
||||
_i13.Future<void> deleteSlot(int? slotId) => (super.noSuchMethod(
|
||||
Invocation.method(#deleteSlot, [slotId]),
|
||||
_i13.Future<void> deleteSlot(int? slotId, int? routineId) => (super.noSuchMethod(
|
||||
Invocation.method(#deleteSlot, [slotId, routineId]),
|
||||
returnValue: _i13.Future<void>.value(),
|
||||
returnValueForMissingStub: _i13.Future<void>.value(),
|
||||
) as _i13.Future<void>);
|
||||
|
||||
@override
|
||||
_i13.Future<void> editSlot(_i7.Slot? slot) => (super.noSuchMethod(
|
||||
Invocation.method(#editSlot, [slot]),
|
||||
_i13.Future<void> editSlot(_i7.Slot? slot, int? routineId) => (super.noSuchMethod(
|
||||
Invocation.method(#editSlot, [slot, routineId]),
|
||||
returnValue: _i13.Future<void>.value(),
|
||||
returnValueForMissingStub: _i13.Future<void>.value(),
|
||||
) as _i13.Future<void>);
|
||||
|
||||
@override
|
||||
_i13.Future<void> editSlots(List<_i7.Slot>? slots) => (super.noSuchMethod(
|
||||
Invocation.method(#editSlots, [slots]),
|
||||
_i13.Future<void> editSlots(List<_i7.Slot>? slots, int? routineId) => (super.noSuchMethod(
|
||||
Invocation.method(#editSlots, [slots, routineId]),
|
||||
returnValue: _i13.Future<void>.value(),
|
||||
returnValueForMissingStub: _i13.Future<void>.value(),
|
||||
) as _i13.Future<void>);
|
||||
|
||||
@override
|
||||
_i13.Future<_i8.SlotEntry> addSlotEntry(_i8.SlotEntry? entry) => (super.noSuchMethod(
|
||||
Invocation.method(#addSlotEntry, [entry]),
|
||||
_i13.Future<_i8.SlotEntry> addSlotEntry(
|
||||
_i8.SlotEntry? entry,
|
||||
int? routineId,
|
||||
) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#addSlotEntry, [entry, routineId]),
|
||||
returnValue: _i13.Future<_i8.SlotEntry>.value(
|
||||
_FakeSlotEntry_6(this, Invocation.method(#addSlotEntry, [entry])),
|
||||
_FakeSlotEntry_6(
|
||||
this,
|
||||
Invocation.method(#addSlotEntry, [entry, routineId]),
|
||||
),
|
||||
),
|
||||
) as _i13.Future<_i8.SlotEntry>);
|
||||
|
||||
@override
|
||||
_i13.Future<void> deleteSlotEntry(int? id) => (super.noSuchMethod(
|
||||
Invocation.method(#deleteSlotEntry, [id]),
|
||||
_i13.Future<void> deleteSlotEntry(int? id, int? routineId) => (super.noSuchMethod(
|
||||
Invocation.method(#deleteSlotEntry, [id, routineId]),
|
||||
returnValue: _i13.Future<void>.value(),
|
||||
returnValueForMissingStub: _i13.Future<void>.value(),
|
||||
) as _i13.Future<void>);
|
||||
|
||||
@override
|
||||
_i13.Future<void> editSlotEntry(_i8.SlotEntry? entry) => (super.noSuchMethod(
|
||||
Invocation.method(#editSlotEntry, [entry]),
|
||||
_i13.Future<void> editSlotEntry(_i8.SlotEntry? entry, int? routineId) => (super.noSuchMethod(
|
||||
Invocation.method(#editSlotEntry, [entry, routineId]),
|
||||
returnValue: _i13.Future<void>.value(),
|
||||
returnValueForMissingStub: _i13.Future<void>.value(),
|
||||
) as _i13.Future<void>);
|
||||
|
||||
@@ -322,52 +322,59 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider {
|
||||
) as _i13.Future<void>);
|
||||
|
||||
@override
|
||||
_i13.Future<_i7.Slot> addSlot(_i7.Slot? slot) => (super.noSuchMethod(
|
||||
Invocation.method(#addSlot, [slot]),
|
||||
_i13.Future<_i7.Slot> addSlot(_i7.Slot? slot, int? routineId) => (super.noSuchMethod(
|
||||
Invocation.method(#addSlot, [slot, routineId]),
|
||||
returnValue: _i13.Future<_i7.Slot>.value(
|
||||
_FakeSlot_5(this, Invocation.method(#addSlot, [slot])),
|
||||
_FakeSlot_5(this, Invocation.method(#addSlot, [slot, routineId])),
|
||||
),
|
||||
) as _i13.Future<_i7.Slot>);
|
||||
|
||||
@override
|
||||
_i13.Future<void> deleteSlot(int? slotId) => (super.noSuchMethod(
|
||||
Invocation.method(#deleteSlot, [slotId]),
|
||||
_i13.Future<void> deleteSlot(int? slotId, int? routineId) => (super.noSuchMethod(
|
||||
Invocation.method(#deleteSlot, [slotId, routineId]),
|
||||
returnValue: _i13.Future<void>.value(),
|
||||
returnValueForMissingStub: _i13.Future<void>.value(),
|
||||
) as _i13.Future<void>);
|
||||
|
||||
@override
|
||||
_i13.Future<void> editSlot(_i7.Slot? slot) => (super.noSuchMethod(
|
||||
Invocation.method(#editSlot, [slot]),
|
||||
_i13.Future<void> editSlot(_i7.Slot? slot, int? routineId) => (super.noSuchMethod(
|
||||
Invocation.method(#editSlot, [slot, routineId]),
|
||||
returnValue: _i13.Future<void>.value(),
|
||||
returnValueForMissingStub: _i13.Future<void>.value(),
|
||||
) as _i13.Future<void>);
|
||||
|
||||
@override
|
||||
_i13.Future<void> editSlots(List<_i7.Slot>? slots) => (super.noSuchMethod(
|
||||
Invocation.method(#editSlots, [slots]),
|
||||
_i13.Future<void> editSlots(List<_i7.Slot>? slots, int? routineId) => (super.noSuchMethod(
|
||||
Invocation.method(#editSlots, [slots, routineId]),
|
||||
returnValue: _i13.Future<void>.value(),
|
||||
returnValueForMissingStub: _i13.Future<void>.value(),
|
||||
) as _i13.Future<void>);
|
||||
|
||||
@override
|
||||
_i13.Future<_i8.SlotEntry> addSlotEntry(_i8.SlotEntry? entry) => (super.noSuchMethod(
|
||||
Invocation.method(#addSlotEntry, [entry]),
|
||||
_i13.Future<_i8.SlotEntry> addSlotEntry(
|
||||
_i8.SlotEntry? entry,
|
||||
int? routineId,
|
||||
) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#addSlotEntry, [entry, routineId]),
|
||||
returnValue: _i13.Future<_i8.SlotEntry>.value(
|
||||
_FakeSlotEntry_6(this, Invocation.method(#addSlotEntry, [entry])),
|
||||
_FakeSlotEntry_6(
|
||||
this,
|
||||
Invocation.method(#addSlotEntry, [entry, routineId]),
|
||||
),
|
||||
),
|
||||
) as _i13.Future<_i8.SlotEntry>);
|
||||
|
||||
@override
|
||||
_i13.Future<void> deleteSlotEntry(int? id) => (super.noSuchMethod(
|
||||
Invocation.method(#deleteSlotEntry, [id]),
|
||||
_i13.Future<void> deleteSlotEntry(int? id, int? routineId) => (super.noSuchMethod(
|
||||
Invocation.method(#deleteSlotEntry, [id, routineId]),
|
||||
returnValue: _i13.Future<void>.value(),
|
||||
returnValueForMissingStub: _i13.Future<void>.value(),
|
||||
) as _i13.Future<void>);
|
||||
|
||||
@override
|
||||
_i13.Future<void> editSlotEntry(_i8.SlotEntry? entry) => (super.noSuchMethod(
|
||||
Invocation.method(#editSlotEntry, [entry]),
|
||||
_i13.Future<void> editSlotEntry(_i8.SlotEntry? entry, int? routineId) => (super.noSuchMethod(
|
||||
Invocation.method(#editSlotEntry, [entry, routineId]),
|
||||
returnValue: _i13.Future<void>.value(),
|
||||
returnValueForMissingStub: _i13.Future<void>.value(),
|
||||
) as _i13.Future<void>);
|
||||
|
||||
@@ -322,52 +322,59 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider {
|
||||
) as _i13.Future<void>);
|
||||
|
||||
@override
|
||||
_i13.Future<_i7.Slot> addSlot(_i7.Slot? slot) => (super.noSuchMethod(
|
||||
Invocation.method(#addSlot, [slot]),
|
||||
_i13.Future<_i7.Slot> addSlot(_i7.Slot? slot, int? routineId) => (super.noSuchMethod(
|
||||
Invocation.method(#addSlot, [slot, routineId]),
|
||||
returnValue: _i13.Future<_i7.Slot>.value(
|
||||
_FakeSlot_5(this, Invocation.method(#addSlot, [slot])),
|
||||
_FakeSlot_5(this, Invocation.method(#addSlot, [slot, routineId])),
|
||||
),
|
||||
) as _i13.Future<_i7.Slot>);
|
||||
|
||||
@override
|
||||
_i13.Future<void> deleteSlot(int? slotId) => (super.noSuchMethod(
|
||||
Invocation.method(#deleteSlot, [slotId]),
|
||||
_i13.Future<void> deleteSlot(int? slotId, int? routineId) => (super.noSuchMethod(
|
||||
Invocation.method(#deleteSlot, [slotId, routineId]),
|
||||
returnValue: _i13.Future<void>.value(),
|
||||
returnValueForMissingStub: _i13.Future<void>.value(),
|
||||
) as _i13.Future<void>);
|
||||
|
||||
@override
|
||||
_i13.Future<void> editSlot(_i7.Slot? slot) => (super.noSuchMethod(
|
||||
Invocation.method(#editSlot, [slot]),
|
||||
_i13.Future<void> editSlot(_i7.Slot? slot, int? routineId) => (super.noSuchMethod(
|
||||
Invocation.method(#editSlot, [slot, routineId]),
|
||||
returnValue: _i13.Future<void>.value(),
|
||||
returnValueForMissingStub: _i13.Future<void>.value(),
|
||||
) as _i13.Future<void>);
|
||||
|
||||
@override
|
||||
_i13.Future<void> editSlots(List<_i7.Slot>? slots) => (super.noSuchMethod(
|
||||
Invocation.method(#editSlots, [slots]),
|
||||
_i13.Future<void> editSlots(List<_i7.Slot>? slots, int? routineId) => (super.noSuchMethod(
|
||||
Invocation.method(#editSlots, [slots, routineId]),
|
||||
returnValue: _i13.Future<void>.value(),
|
||||
returnValueForMissingStub: _i13.Future<void>.value(),
|
||||
) as _i13.Future<void>);
|
||||
|
||||
@override
|
||||
_i13.Future<_i8.SlotEntry> addSlotEntry(_i8.SlotEntry? entry) => (super.noSuchMethod(
|
||||
Invocation.method(#addSlotEntry, [entry]),
|
||||
_i13.Future<_i8.SlotEntry> addSlotEntry(
|
||||
_i8.SlotEntry? entry,
|
||||
int? routineId,
|
||||
) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#addSlotEntry, [entry, routineId]),
|
||||
returnValue: _i13.Future<_i8.SlotEntry>.value(
|
||||
_FakeSlotEntry_6(this, Invocation.method(#addSlotEntry, [entry])),
|
||||
_FakeSlotEntry_6(
|
||||
this,
|
||||
Invocation.method(#addSlotEntry, [entry, routineId]),
|
||||
),
|
||||
),
|
||||
) as _i13.Future<_i8.SlotEntry>);
|
||||
|
||||
@override
|
||||
_i13.Future<void> deleteSlotEntry(int? id) => (super.noSuchMethod(
|
||||
Invocation.method(#deleteSlotEntry, [id]),
|
||||
_i13.Future<void> deleteSlotEntry(int? id, int? routineId) => (super.noSuchMethod(
|
||||
Invocation.method(#deleteSlotEntry, [id, routineId]),
|
||||
returnValue: _i13.Future<void>.value(),
|
||||
returnValueForMissingStub: _i13.Future<void>.value(),
|
||||
) as _i13.Future<void>);
|
||||
|
||||
@override
|
||||
_i13.Future<void> editSlotEntry(_i8.SlotEntry? entry) => (super.noSuchMethod(
|
||||
Invocation.method(#editSlotEntry, [entry]),
|
||||
_i13.Future<void> editSlotEntry(_i8.SlotEntry? entry, int? routineId) => (super.noSuchMethod(
|
||||
Invocation.method(#editSlotEntry, [entry, routineId]),
|
||||
returnValue: _i13.Future<void>.value(),
|
||||
returnValueForMissingStub: _i13.Future<void>.value(),
|
||||
) as _i13.Future<void>);
|
||||
|
||||
@@ -322,52 +322,59 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider {
|
||||
) as _i13.Future<void>);
|
||||
|
||||
@override
|
||||
_i13.Future<_i7.Slot> addSlot(_i7.Slot? slot) => (super.noSuchMethod(
|
||||
Invocation.method(#addSlot, [slot]),
|
||||
_i13.Future<_i7.Slot> addSlot(_i7.Slot? slot, int? routineId) => (super.noSuchMethod(
|
||||
Invocation.method(#addSlot, [slot, routineId]),
|
||||
returnValue: _i13.Future<_i7.Slot>.value(
|
||||
_FakeSlot_5(this, Invocation.method(#addSlot, [slot])),
|
||||
_FakeSlot_5(this, Invocation.method(#addSlot, [slot, routineId])),
|
||||
),
|
||||
) as _i13.Future<_i7.Slot>);
|
||||
|
||||
@override
|
||||
_i13.Future<void> deleteSlot(int? slotId) => (super.noSuchMethod(
|
||||
Invocation.method(#deleteSlot, [slotId]),
|
||||
_i13.Future<void> deleteSlot(int? slotId, int? routineId) => (super.noSuchMethod(
|
||||
Invocation.method(#deleteSlot, [slotId, routineId]),
|
||||
returnValue: _i13.Future<void>.value(),
|
||||
returnValueForMissingStub: _i13.Future<void>.value(),
|
||||
) as _i13.Future<void>);
|
||||
|
||||
@override
|
||||
_i13.Future<void> editSlot(_i7.Slot? slot) => (super.noSuchMethod(
|
||||
Invocation.method(#editSlot, [slot]),
|
||||
_i13.Future<void> editSlot(_i7.Slot? slot, int? routineId) => (super.noSuchMethod(
|
||||
Invocation.method(#editSlot, [slot, routineId]),
|
||||
returnValue: _i13.Future<void>.value(),
|
||||
returnValueForMissingStub: _i13.Future<void>.value(),
|
||||
) as _i13.Future<void>);
|
||||
|
||||
@override
|
||||
_i13.Future<void> editSlots(List<_i7.Slot>? slots) => (super.noSuchMethod(
|
||||
Invocation.method(#editSlots, [slots]),
|
||||
_i13.Future<void> editSlots(List<_i7.Slot>? slots, int? routineId) => (super.noSuchMethod(
|
||||
Invocation.method(#editSlots, [slots, routineId]),
|
||||
returnValue: _i13.Future<void>.value(),
|
||||
returnValueForMissingStub: _i13.Future<void>.value(),
|
||||
) as _i13.Future<void>);
|
||||
|
||||
@override
|
||||
_i13.Future<_i8.SlotEntry> addSlotEntry(_i8.SlotEntry? entry) => (super.noSuchMethod(
|
||||
Invocation.method(#addSlotEntry, [entry]),
|
||||
_i13.Future<_i8.SlotEntry> addSlotEntry(
|
||||
_i8.SlotEntry? entry,
|
||||
int? routineId,
|
||||
) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#addSlotEntry, [entry, routineId]),
|
||||
returnValue: _i13.Future<_i8.SlotEntry>.value(
|
||||
_FakeSlotEntry_6(this, Invocation.method(#addSlotEntry, [entry])),
|
||||
_FakeSlotEntry_6(
|
||||
this,
|
||||
Invocation.method(#addSlotEntry, [entry, routineId]),
|
||||
),
|
||||
),
|
||||
) as _i13.Future<_i8.SlotEntry>);
|
||||
|
||||
@override
|
||||
_i13.Future<void> deleteSlotEntry(int? id) => (super.noSuchMethod(
|
||||
Invocation.method(#deleteSlotEntry, [id]),
|
||||
_i13.Future<void> deleteSlotEntry(int? id, int? routineId) => (super.noSuchMethod(
|
||||
Invocation.method(#deleteSlotEntry, [id, routineId]),
|
||||
returnValue: _i13.Future<void>.value(),
|
||||
returnValueForMissingStub: _i13.Future<void>.value(),
|
||||
) as _i13.Future<void>);
|
||||
|
||||
@override
|
||||
_i13.Future<void> editSlotEntry(_i8.SlotEntry? entry) => (super.noSuchMethod(
|
||||
Invocation.method(#editSlotEntry, [entry]),
|
||||
_i13.Future<void> editSlotEntry(_i8.SlotEntry? entry, int? routineId) => (super.noSuchMethod(
|
||||
Invocation.method(#editSlotEntry, [entry, routineId]),
|
||||
returnValue: _i13.Future<void>.value(),
|
||||
returnValueForMissingStub: _i13.Future<void>.value(),
|
||||
) as _i13.Future<void>);
|
||||
|
||||
Reference in New Issue
Block a user