Add overview page when a workout has been completed

This commit is contained in:
Roland Geider
2025-11-26 20:04:40 +01:00
parent f2fae3d888
commit ecd0b6c6b4
50 changed files with 887 additions and 371 deletions

View File

@@ -1259,7 +1259,10 @@ class $$ExercisesTableTableManager
$$ExercisesTableAnnotationComposer,
$$ExercisesTableCreateCompanionBuilder,
$$ExercisesTableUpdateCompanionBuilder,
(ExerciseTable, BaseReferences<_$ExerciseDatabase, $ExercisesTable, ExerciseTable>),
(
ExerciseTable,
BaseReferences<_$ExerciseDatabase, $ExercisesTable, ExerciseTable>,
),
ExerciseTable,
PrefetchHooks Function()
> {
@@ -1317,7 +1320,10 @@ typedef $$ExercisesTableProcessedTableManager =
$$ExercisesTableAnnotationComposer,
$$ExercisesTableCreateCompanionBuilder,
$$ExercisesTableUpdateCompanionBuilder,
(ExerciseTable, BaseReferences<_$ExerciseDatabase, $ExercisesTable, ExerciseTable>),
(
ExerciseTable,
BaseReferences<_$ExerciseDatabase, $ExercisesTable, ExerciseTable>,
),
ExerciseTable,
PrefetchHooks Function()
>;
@@ -1397,7 +1403,10 @@ class $$MusclesTableTableManager
$$MusclesTableAnnotationComposer,
$$MusclesTableCreateCompanionBuilder,
$$MusclesTableUpdateCompanionBuilder,
(MuscleTable, BaseReferences<_$ExerciseDatabase, $MusclesTable, MuscleTable>),
(
MuscleTable,
BaseReferences<_$ExerciseDatabase, $MusclesTable, MuscleTable>,
),
MuscleTable,
PrefetchHooks Function()
> {
@@ -1439,7 +1448,10 @@ typedef $$MusclesTableProcessedTableManager =
$$MusclesTableAnnotationComposer,
$$MusclesTableCreateCompanionBuilder,
$$MusclesTableUpdateCompanionBuilder,
(MuscleTable, BaseReferences<_$ExerciseDatabase, $MusclesTable, MuscleTable>),
(
MuscleTable,
BaseReferences<_$ExerciseDatabase, $MusclesTable, MuscleTable>,
),
MuscleTable,
PrefetchHooks Function()
>;
@@ -1519,7 +1531,10 @@ class $$EquipmentsTableTableManager
$$EquipmentsTableAnnotationComposer,
$$EquipmentsTableCreateCompanionBuilder,
$$EquipmentsTableUpdateCompanionBuilder,
(EquipmentTable, BaseReferences<_$ExerciseDatabase, $EquipmentsTable, EquipmentTable>),
(
EquipmentTable,
BaseReferences<_$ExerciseDatabase, $EquipmentsTable, EquipmentTable>,
),
EquipmentTable,
PrefetchHooks Function()
> {
@@ -1561,7 +1576,10 @@ typedef $$EquipmentsTableProcessedTableManager =
$$EquipmentsTableAnnotationComposer,
$$EquipmentsTableCreateCompanionBuilder,
$$EquipmentsTableUpdateCompanionBuilder,
(EquipmentTable, BaseReferences<_$ExerciseDatabase, $EquipmentsTable, EquipmentTable>),
(
EquipmentTable,
BaseReferences<_$ExerciseDatabase, $EquipmentsTable, EquipmentTable>,
),
EquipmentTable,
PrefetchHooks Function()
>;
@@ -1642,7 +1660,10 @@ class $$CategoriesTableTableManager
$$CategoriesTableAnnotationComposer,
$$CategoriesTableCreateCompanionBuilder,
$$CategoriesTableUpdateCompanionBuilder,
(CategoryTable, BaseReferences<_$ExerciseDatabase, $CategoriesTable, CategoryTable>),
(
CategoryTable,
BaseReferences<_$ExerciseDatabase, $CategoriesTable, CategoryTable>,
),
CategoryTable,
PrefetchHooks Function()
> {
@@ -1684,7 +1705,10 @@ typedef $$CategoriesTableProcessedTableManager =
$$CategoriesTableAnnotationComposer,
$$CategoriesTableCreateCompanionBuilder,
$$CategoriesTableUpdateCompanionBuilder,
(CategoryTable, BaseReferences<_$ExerciseDatabase, $CategoriesTable, CategoryTable>),
(
CategoryTable,
BaseReferences<_$ExerciseDatabase, $CategoriesTable, CategoryTable>,
),
CategoryTable,
PrefetchHooks Function()
>;
@@ -1764,7 +1788,10 @@ class $$LanguagesTableTableManager
$$LanguagesTableAnnotationComposer,
$$LanguagesTableCreateCompanionBuilder,
$$LanguagesTableUpdateCompanionBuilder,
(LanguagesTable, BaseReferences<_$ExerciseDatabase, $LanguagesTable, LanguagesTable>),
(
LanguagesTable,
BaseReferences<_$ExerciseDatabase, $LanguagesTable, LanguagesTable>,
),
LanguagesTable,
PrefetchHooks Function()
> {
@@ -1806,7 +1833,10 @@ typedef $$LanguagesTableProcessedTableManager =
$$LanguagesTableAnnotationComposer,
$$LanguagesTableCreateCompanionBuilder,
$$LanguagesTableUpdateCompanionBuilder,
(LanguagesTable, BaseReferences<_$ExerciseDatabase, $LanguagesTable, LanguagesTable>),
(
LanguagesTable,
BaseReferences<_$ExerciseDatabase, $LanguagesTable, LanguagesTable>,
),
LanguagesTable,
PrefetchHooks Function()
>;

View File

@@ -9,126 +9,124 @@ import 'package:flutter/widgets.dart';
import 'package:logging/logging.dart';
import 'package:wger/l10n/generated/app_localizations.dart';
String getTranslation(String value, BuildContext context) {
final logger = Logger('getTranslation');
String getServerStringTranslation(String value, BuildContext context) {
final logger = Logger('getServerStringTranslation');
final i18n = AppLocalizations.of(context);
switch (value) {
case 'Abs':
return AppLocalizations.of(context).abs;
return i18n.abs;
case 'Arms':
return AppLocalizations.of(context).arms;
return i18n.arms;
case 'Back':
return AppLocalizations.of(context).back;
return i18n.back;
case 'Barbell':
return AppLocalizations.of(context).barbell;
return i18n.barbell;
case 'Bench':
return AppLocalizations.of(context).bench;
return i18n.bench;
case 'Biceps':
return AppLocalizations.of(context).biceps;
return i18n.biceps;
case 'Body Weight':
return AppLocalizations.of(context).body_weight;
return i18n.body_weight;
case 'Calves':
return AppLocalizations.of(context).calves;
return i18n.calves;
case 'Cardio':
return AppLocalizations.of(context).cardio;
return i18n.cardio;
case 'Chest':
return AppLocalizations.of(context).chest;
return i18n.chest;
case 'Dumbbell':
return AppLocalizations.of(context).dumbbell;
return i18n.dumbbell;
case 'Glutes':
return AppLocalizations.of(context).glutes;
return i18n.glutes;
case 'Gym mat':
return AppLocalizations.of(context).gym_mat;
return i18n.gym_mat;
case 'Hamstrings':
return AppLocalizations.of(context).hamstrings;
return i18n.hamstrings;
case 'Incline bench':
return AppLocalizations.of(context).incline_bench;
return i18n.incline_bench;
case 'Kettlebell':
return AppLocalizations.of(context).kettlebell;
return i18n.kettlebell;
case 'Kilometers':
return AppLocalizations.of(context).kilometers;
return i18n.kilometers;
case 'Kilometers Per Hour':
return AppLocalizations.of(context).kilometers_per_hour;
return i18n.kilometers_per_hour;
case 'Lats':
return AppLocalizations.of(context).lats;
return i18n.lats;
case 'Legs':
return AppLocalizations.of(context).legs;
return i18n.legs;
case 'Lower back':
return AppLocalizations.of(context).lower_back;
case 'Max Reps':
return AppLocalizations.of(context).max_reps;
return i18n.lower_back;
case 'Miles':
return AppLocalizations.of(context).miles;
return i18n.miles;
case 'Miles Per Hour':
return AppLocalizations.of(context).miles_per_hour;
return i18n.miles_per_hour;
case 'Minutes':
return AppLocalizations.of(context).minutes;
return i18n.minutes;
case 'Plates':
return AppLocalizations.of(context).plates;
return i18n.plates;
case 'Pull-up bar':
return AppLocalizations.of(context).pull_up_bar;
return i18n.pull_up_bar;
case 'Quads':
return AppLocalizations.of(context).quads;
return i18n.quads;
case 'Repetitions':
return AppLocalizations.of(context).repetitions;
return i18n.repetitions;
case 'Resistance band':
return AppLocalizations.of(context).resistance_band;
return i18n.resistance_band;
case 'SZ-Bar':
return AppLocalizations.of(context).sz_bar;
return i18n.sz_bar;
case 'Seconds':
return AppLocalizations.of(context).seconds;
return i18n.seconds;
case 'Shoulders':
return AppLocalizations.of(context).shoulders;
return i18n.shoulders;
case 'Swiss Ball':
return AppLocalizations.of(context).swiss_ball;
return i18n.swiss_ball;
case 'Triceps':
return AppLocalizations.of(context).triceps;
return i18n.triceps;
case 'Until Failure':
return AppLocalizations.of(context).until_failure;
return i18n.until_failure;
case 'kg':
return AppLocalizations.of(context).kg;
return i18n.kg;
case 'lb':
return AppLocalizations.of(context).lb;
return i18n.lb;
case 'none (bodyweight exercise)':
return AppLocalizations.of(context).none__bodyweight_exercise_;
return i18n.none__bodyweight_exercise_;
default:
logger.warning('Could not translate the server string $value');

View File

@@ -23,6 +23,10 @@ num stringToNum(String? e) {
return e == null ? 0 : num.parse(e);
}
num? stringToNumNull(String? e) {
return e == null ? null : num.parse(e);
}
num stringOrIntToNum(dynamic e) {
if (e is int) {
return e.toDouble(); // Convert int to double (a type of num)
@@ -30,10 +34,6 @@ num stringOrIntToNum(dynamic e) {
return num.tryParse(e) ?? 0;
}
num? stringToNumNull(String? e) {
return e == null ? null : num.parse(e);
}
String? numToString(num? e) {
if (e == null) {
return null;

View File

@@ -18,50 +18,6 @@
import 'package:flutter/material.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:wger/helpers/consts.dart';
import 'package:wger/models/workouts/repetition_unit.dart';
import 'package:wger/models/workouts/weight_unit.dart';
/// Returns the text representation for a single setting, used in the gym mode
String repText(
num? repetitions,
RepetitionUnit? repetitionUnitObj,
num? weight,
WeightUnit? weightUnitObj,
num? rir,
) {
// TODO(x): how to (easily?) translate strings like the units or 'RiR'
final List<String> out = [];
if (repetitions != null) {
out.add(formatNum(repetitions).toString());
// The default repetition unit is 'reps', which we don't show unless there
// is no weight defined so that we don't just output something like "8" but
// rather "8 repetitions". If there is weight we want to output "8 x 50kg",
// since the repetitions are implied. If other units are used, we always
// print them
if (repetitionUnitObj != null && repetitionUnitObj.id != REP_UNIT_REPETITIONS_ID ||
weight == 0 ||
weight == null) {
out.add(repetitionUnitObj!.name);
}
}
if (weight != null && weight != 0) {
out.add('×');
out.add(formatNum(weight).toString());
out.add(weightUnitObj!.name);
}
if (rir != null && rir != '') {
out.add('\n');
out.add('($rir RiR)');
}
return out.join(' ');
}
void launchURL(String url, BuildContext context) async {
final scaffoldMessenger = ScaffoldMessenger.of(context);

View File

@@ -265,6 +265,21 @@
},
"gymModeShowExercises": "Show exercise overview pages",
"gymModeShowTimer": "Show timer between sets",
"duration": "Duration",
"durationHoursMinutes": "{hours}h {minutes}m",
"@durationHoursMinutes": {
"description": "A duration, in hours and minutes",
"type": "text",
"placeholders": {
"hours": {
"type": "int"
},
"minutes": {
"type": "int"
}
}
},
"finishWorkout": "Finish workout",
"plateCalculator": "Plates",
"@plateCalculator": {
"description": "Label used for the plate calculator in the gym mode"

View File

@@ -53,7 +53,7 @@ class Muscle extends Equatable {
List<Object?> get props => [id, name, isFront];
String nameTranslated(BuildContext context) {
return name + (nameEn.isNotEmpty ? ' (${getTranslation(nameEn, context)})' : '');
return name + (nameEn.isNotEmpty ? ' (${getServerStringTranslation(nameEn, context)})' : '');
}
@override

View File

@@ -16,8 +16,10 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import 'package:flutter/material.dart';
import 'package:json_annotation/json_annotation.dart';
import 'package:wger/helpers/consts.dart';
import 'package:wger/helpers/i18n.dart';
import 'package:wger/helpers/json.dart';
import 'package:wger/helpers/misc.dart';
import 'package:wger/models/exercises/exercise.dart';
@@ -27,6 +29,13 @@ import 'package:wger/models/workouts/weight_unit.dart';
part 'log.g.dart';
enum LogTargetStatus {
lessThanTarget,
atTarget,
moreThanTarget,
notSet,
}
@JsonSerializable()
class Log {
@JsonKey(required: true)
@@ -50,16 +59,16 @@ class Log {
@JsonKey(required: true, name: 'slot_entry')
int? slotEntryId;
@JsonKey(required: false, fromJson: stringToNum)
@JsonKey(required: false, fromJson: stringToNumNull)
num? rir;
@JsonKey(required: false, fromJson: stringToNum, name: 'rir_target')
@JsonKey(required: false, fromJson: stringToNumNull, name: 'rir_target')
num? rirTarget;
@JsonKey(required: true, fromJson: stringToNum, name: 'repetitions')
@JsonKey(required: true, fromJson: stringToNumNull, name: 'repetitions')
num? repetitions;
@JsonKey(required: true, fromJson: stringToNum, name: 'repetitions_target')
@JsonKey(required: true, fromJson: stringToNumNull, name: 'repetitions_target')
num? repetitionsTarget;
@JsonKey(required: true, name: 'repetitions_unit')
@@ -68,10 +77,10 @@ class Log {
@JsonKey(includeFromJson: false, includeToJson: false)
late RepetitionUnit? repetitionsUnitObj;
@JsonKey(required: true, fromJson: stringToNum, toJson: numToString)
@JsonKey(required: true, fromJson: stringToNumNull, toJson: numToString)
late num? weight;
@JsonKey(required: true, fromJson: stringToNum, toJson: numToString, name: 'weight_target')
@JsonKey(required: true, fromJson: stringToNumNull, toJson: numToString, name: 'weight_target')
num? weightTarget;
@JsonKey(required: true, name: 'weight_unit')
@@ -149,15 +158,80 @@ class Log {
repetitionsUnitId = repetitionUnit?.id;
}
/// Returns the text representation for a single setting, used in the gym mode
String get singleLogRepTextNoNl {
return repText(
repetitions,
repetitionsUnitObj,
weight,
weightUnitObj,
rir,
).replaceAll('\n', '');
/// Returns the text representation for a single setting, removes new lines
String repTextNoNl(BuildContext context) {
return repText(context).replaceAll('\n', '');
}
/// Returns the text representation for a single setting
String repText(BuildContext context) {
final List<String> out = [];
if (repetitions != null) {
out.add(formatNum(repetitions!).toString());
// The default repetition unit is 'reps', which we don't show unless there
// is no weight defined so that we don't just output something like "8" but
// rather "8 repetitions". If there is weight we want to output "8 x 50kg",
// since the repetitions are implied. If other units are used, we always
// print them
if (repetitionsUnitObj != null && repetitionsUnitObj!.id != REP_UNIT_REPETITIONS_ID ||
weight == 0 ||
weight == null) {
out.add(getServerStringTranslation(repetitionsUnitObj!.name, context));
}
}
if (weight != null && weight != 0) {
out.add('×');
out.add(formatNum(weight!).toString());
out.add(weightUnitObj!.name);
}
if (rir != null) {
out.add('\n($rir RiR)');
}
return out.join(' ');
}
/// Calculates the volume for this log entry
num volume({bool metric = true}) {
final unitId = metric ? WEIGHT_UNIT_KG : WEIGHT_UNIT_LB;
if (weight != null &&
weightUnitId == unitId &&
repetitions != null &&
repetitionsUnitId == REP_UNIT_REPETITIONS_ID) {
return weight! * repetitions!;
}
return 0;
}
LogTargetStatus get targetStatus {
if (weightTarget == null && repetitionsTarget == null && rirTarget == null) {
return LogTargetStatus.notSet;
}
final weightOk = weightTarget == null || (weight != null && weight! >= weightTarget!);
final repsOk =
repetitionsTarget == null || (repetitions != null && repetitions! >= repetitionsTarget!);
final rirOk = rirTarget == null || (rir != null && rir! <= rirTarget!);
if (weightOk && repsOk && rirOk) {
return LogTargetStatus.atTarget;
}
final weightMore = weightTarget != null && weight != null && weight! > weightTarget!;
final repsMore =
repetitionsTarget != null && repetitions != null && repetitions! > repetitionsTarget!;
final rirLess = rirTarget != null && rir != null && rir! < rirTarget!;
if (weightMore || repsMore || rirLess) {
return LogTargetStatus.moreThanTarget;
}
return LogTargetStatus.lessThanTarget;
}
/// Override the equals operator

View File

@@ -31,13 +31,13 @@ Log _$LogFromJson(Map<String, dynamic> json) {
iteration: (json['iteration'] as num?)?.toInt(),
slotEntryId: (json['slot_entry'] as num?)?.toInt(),
routineId: (json['routine'] as num).toInt(),
repetitions: stringToNum(json['repetitions'] as String?),
repetitionsTarget: stringToNum(json['repetitions_target'] as String?),
repetitions: stringToNumNull(json['repetitions'] as String?),
repetitionsTarget: stringToNumNull(json['repetitions_target'] as String?),
repetitionsUnitId: (json['repetitions_unit'] as num?)?.toInt() ?? REP_UNIT_REPETITIONS_ID,
rir: stringToNum(json['rir'] as String?),
rirTarget: stringToNum(json['rir_target'] as String?),
weight: stringToNum(json['weight'] as String?),
weightTarget: stringToNum(json['weight_target'] as String?),
rir: stringToNumNull(json['rir'] as String?),
rirTarget: stringToNumNull(json['rir_target'] as String?),
weight: stringToNumNull(json['weight'] as String?),
weightTarget: stringToNumNull(json['weight_target'] as String?),
weightUnitId: (json['weight_unit'] as num?)?.toInt() ?? WEIGHT_UNIT_KG,
date: utcIso8601ToLocalDate(json['date'] as String),
)..sessionId = (json['session'] as num?)?.toInt();

View File

@@ -68,6 +68,16 @@ class WorkoutSession {
this.date = date ?? DateTime.now();
}
Duration? get duration {
if (timeStart == null || timeEnd == null) {
return null;
}
final now = DateTime.now();
final startDate = DateTime(now.year, now.month, now.day, timeStart!.hour, timeStart!.minute);
final endDate = DateTime(now.year, now.month, now.day, timeEnd!.hour, timeEnd!.minute);
return endDate.difference(startDate);
}
// Boilerplate
factory WorkoutSession.fromJson(Map<String, dynamic> json) => _$WorkoutSessionFromJson(json);

View File

@@ -71,7 +71,7 @@ class Step1Basics extends StatelessWidget {
return AppLocalizations.of(context).selectEntry;
}
},
displayName: (ExerciseCategory c) => getTranslation(c.name, context),
displayName: (ExerciseCategory c) => getServerStringTranslation(c.name, context),
),
AddExerciseMultiselectButton<Equipment>(
key: const Key('equipment-multiselect'),
@@ -84,7 +84,7 @@ class Step1Basics extends StatelessWidget {
onSaved: (dynamic entries) {
addExerciseProvider.equipment = entries.cast<Equipment>();
},
displayName: (Equipment e) => getTranslation(e.name, context),
displayName: (Equipment e) => getServerStringTranslation(e.name, context),
),
AddExerciseMultiselectButton<Muscle>(
key: const Key('primary-muscles-multiselect'),
@@ -98,7 +98,10 @@ class Step1Basics extends StatelessWidget {
addExerciseProvider.primaryMuscles = muscles.cast<Muscle>();
},
displayName: (Muscle e) =>
e.name + (e.nameEn.isNotEmpty ? '\n(${getTranslation(e.nameEn, context)})' : ''),
e.name +
(e.nameEn.isNotEmpty
? '\n(${getServerStringTranslation(e.nameEn, context)})'
: ''),
),
AddExerciseMultiselectButton<Muscle>(
key: const Key('secondary-muscles-multiselect'),
@@ -112,7 +115,10 @@ class Step1Basics extends StatelessWidget {
addExerciseProvider.secondaryMuscles = muscles.cast<Muscle>();
},
displayName: (Muscle e) =>
e.name + (e.nameEn.isNotEmpty ? '\n(${getTranslation(e.nameEn, context)})' : ''),
e.name +
(e.nameEn.isNotEmpty
? '\n(${getServerStringTranslation(e.nameEn, context)})'
: ''),
),
MuscleRowWidget(
muscles: provider.primaryMuscles,

View File

@@ -229,7 +229,7 @@ class ExerciseDetail extends StatelessWidget {
Padding(
padding: const EdgeInsets.symmetric(horizontal: 4),
child: Chip(
label: Text(getTranslation(_exercise.category!.name, context)),
label: Text(getServerStringTranslation(_exercise.category!.name, context)),
padding: EdgeInsets.zero,
backgroundColor: theme.splashColor,
),
@@ -241,7 +241,7 @@ class ExerciseDetail extends StatelessWidget {
(e) => Padding(
padding: const EdgeInsets.symmetric(horizontal: 4),
child: Chip(
label: Text(getTranslation(e.name, context)),
label: Text(getServerStringTranslation(e.name, context)),
padding: EdgeInsets.zero,
backgroundColor: theme.splashColor,
),

View File

@@ -67,7 +67,7 @@ class _ExerciseFilterModalBodyState extends State<ExerciseFilterModalBody> {
body: Column(
children: filterCategory.items.entries.map((currentEntry) {
return SwitchListTile(
title: Text(getTranslation(currentEntry.key.name, context)),
title: Text(getServerStringTranslation(currentEntry.key.name, context)),
value: currentEntry.value,
onChanged: (_) {
setState(() {

View File

@@ -54,7 +54,7 @@ class ExerciseListTile extends StatelessWidget {
maxLines: 2,
),
subtitle: Text(
'${getTranslation(exercise.category!.name, context)} / ${exercise.equipment.map((e) => getTranslation(e.name, context)).toList().join(', ')}',
'${getServerStringTranslation(exercise.category!.name, context)} / ${exercise.equipment.map((e) => getServerStringTranslation(e.name, context)).toList().join(', ')}',
),
onTap: () {
Navigator.pushNamed(context, ExerciseDetailScreen.routeName, arguments: exercise);

View File

@@ -26,11 +26,13 @@ import 'package:wger/providers/gym_state.dart';
import 'package:wger/providers/routines.dart';
import 'package:wger/screens/gym_mode.dart';
import 'package:wger/widgets/core/progress_indicator.dart';
import 'package:wger/widgets/routines/gym_mode/exercise_overview.dart';
import 'package:wger/widgets/routines/gym_mode/log_page.dart';
import 'package:wger/widgets/routines/gym_mode/session_page.dart';
import 'package:wger/widgets/routines/gym_mode/start_page.dart';
import 'package:wger/widgets/routines/gym_mode/timer.dart';
import 'exercise_overview.dart';
import 'log_page.dart';
import 'result.dart';
import 'session_page.dart';
import 'start_page.dart';
import 'timer.dart';
class GymMode extends ConsumerStatefulWidget {
final GymModeArguments _args;
@@ -105,6 +107,7 @@ class _GymModeState extends ConsumerState<GymMode> {
// End (session)
out.add(SessionPage(_controller));
out.add(ResultsWidget(_controller));
return out;
}
@@ -141,7 +144,7 @@ class _GymModeState extends ConsumerState<GymMode> {
// Check if the last page is reached
if (page == children.length - 1) {
widget._logger.finer('Last page reached, clearing gym state');
ref.read(gymStateProvider.notifier).clear();
// ref.read(gymStateProvider.notifier).clear();
}
},
children: children,

View File

@@ -464,7 +464,8 @@ class LogsPastLogsWidget extends StatelessWidget {
),
...pastLogs.map((pastLog) {
return ListTile(
title: Text(pastLog.singleLogRepTextNoNl),
key: ValueKey('past-log-${pastLog.id}'),
title: Text(pastLog.repTextNoNl(context)),
subtitle: Text(
DateFormat.yMd(Localizations.localeOf(context).languageCode).format(pastLog.date),
),

View File

@@ -0,0 +1,385 @@
import 'package:collection/collection.dart';
import 'package:fl_chart/fl_chart.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:logging/logging.dart';
import 'package:provider/provider.dart';
import 'package:wger/helpers/date.dart';
import 'package:wger/helpers/i18n.dart';
import 'package:wger/l10n/generated/app_localizations.dart';
import 'package:wger/models/exercises/exercise.dart';
import 'package:wger/models/workouts/log.dart';
import 'package:wger/models/workouts/routine.dart';
import 'package:wger/models/workouts/session_api.dart';
import 'package:wger/providers/gym_state.dart';
import 'package:wger/providers/routines.dart';
import 'package:wger/widgets/core/progress_indicator.dart';
import 'package:wger/widgets/routines/gym_mode/navigation.dart';
class ResultsWidget extends ConsumerStatefulWidget {
final _logger = Logger('ResultsWidget');
final PageController _controller;
ResultsWidget(this._controller);
@override
ConsumerState<ResultsWidget> createState() => _ResultsWidgetState();
}
class _ResultsWidgetState extends ConsumerState<ResultsWidget> {
late Future<void> _initData;
late Routine _routine;
@override
void initState() {
super.initState();
_initData = _reloadRoutineData();
}
Future<void> _reloadRoutineData() async {
widget._logger.fine('Loading routine data');
final gymState = ref.read(gymStateProvider);
_routine = await context.read<RoutinesProvider>().fetchAndSetRoutineFull(
gymState.routine.id!,
);
}
@override
Widget build(BuildContext context) {
return Column(
children: [
NavigationHeader(
'Workout complete',
widget._controller,
showEndWorkoutButton: false,
),
Expanded(
child: FutureBuilder<void>(
future: _initData,
builder: (context, snapshot) {
if (snapshot.connectionState == ConnectionState.waiting) {
return const BoxedProgressIndicator();
} else if (snapshot.hasError) {
return Center(child: Text('Error: ${snapshot.error}: ${snapshot.stackTrace}'));
} else if (snapshot.connectionState == ConnectionState.done) {
return WorkoutStats(
_routine.sessions.firstWhereOrNull(
(s) => s.session.date.isSameDayAs(DateTime.now()),
),
);
}
return const Center(child: Text('Unexpected state!'));
},
),
),
NavigationFooter(widget._controller),
],
);
}
}
class WorkoutStats extends ConsumerWidget {
final _logger = Logger('WorkoutStats');
final WorkoutSessionApi? _sessionApi;
WorkoutStats(this._sessionApi, {super.key});
@override
Widget build(BuildContext context, WidgetRef ref) {
final i18n = AppLocalizations.of(context);
if (_sessionApi == null) {
return Center(
child: Text(
'Nothing logged yet.',
style: Theme.of(context).textTheme.titleMedium,
),
);
}
final session = _sessionApi.session;
final sessionDuration = session.duration;
final totalVolume = _sessionApi.logs.fold<double>(0, (sum, log) => sum + log.volume());
return ListView(
padding: const EdgeInsets.all(16.0),
children: [
Row(
children: [
Expanded(
child: InfoCard(
title: i18n.duration,
value: sessionDuration != null
? i18n.durationHoursMinutes(
sessionDuration.inHours,
sessionDuration.inMinutes.remainder(60),
)
: '-/-',
),
),
const SizedBox(width: 10),
Expanded(
child: InfoCard(
title: 'Volume',
value: totalVolume.toStringAsFixed(0),
),
),
],
),
// const SizedBox(height: 16),
// InfoCard(
// title: 'Personal Records',
// value: prCount.toString(),
// color: theme.colorScheme.tertiaryContainer,
// ),
const SizedBox(height: 10),
MuscleGroupsCard(_sessionApi.logs),
const SizedBox(height: 10),
ExercisesCard(_sessionApi),
FilledButton(
onPressed: () {
ref.read(gymStateProvider.notifier).clear();
Navigator.of(context).pop();
},
child: Text(i18n.finishWorkout),
),
],
);
}
}
class ExercisesCard extends StatelessWidget {
final WorkoutSessionApi session;
const ExercisesCard(this.session, {super.key});
@override
Widget build(BuildContext context) {
final exercises = session.exercises;
return Card(
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
AppLocalizations.of(context).exercises,
style: Theme.of(context).textTheme.titleLarge,
),
const SizedBox(height: 16),
...exercises.map((exercise) {
final logs = session.logs.where((log) => log.exerciseId == exercise.id).toList();
return _ExerciseExpansionTile(exercise: exercise, logs: logs);
}),
],
),
),
);
}
}
class _ExerciseExpansionTile extends StatelessWidget {
const _ExerciseExpansionTile({
required this.exercise,
required this.logs,
});
final Exercise exercise;
final List<Log> logs;
@override
Widget build(BuildContext context) {
final languageCode = Localizations.localeOf(context).languageCode;
final theme = Theme.of(context);
final topSet = logs.isEmpty
? null
: logs.reduce((a, b) => (a.weight ?? 0) > (b.weight ?? 0) ? a : b);
final topSetWeight = topSet?.weight?.toStringAsFixed(0) ?? 'N/A';
final topSetWeightUnit = topSet?.weightUnitObj != null
? getServerStringTranslation(topSet!.weightUnitObj!.name, context)
: '';
return ExpansionTile(
// leading: const Icon(Icons.fitness_center),
title: Text(exercise.getTranslation(languageCode).name, style: theme.textTheme.titleMedium),
subtitle: Text('Top set: $topSetWeight $topSetWeightUnit'),
children: logs.map((log) => _SetDataRow(log: log)).toList(),
);
}
}
class MuscleGroup {
final String name;
final double percentage;
final Color color;
MuscleGroup(this.name, this.percentage, this.color);
}
class _SetDataRow extends StatelessWidget {
const _SetDataRow({required this.log});
final Log log;
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
final i18n = AppLocalizations.of(context);
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 8.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
spacing: 5,
children: [
Text(
log.repTextNoNl(context),
style: theme.textTheme.bodyMedium,
),
// if (log.volume() > 0)
// Text(
// '${log.volume().toStringAsFixed(0)} ${getServerStringTranslation(log.weightUnitObj!.name, context)}',
// style: theme.textTheme.bodyMedium,
// ),
],
),
);
}
}
class InfoCard extends StatelessWidget {
final String title;
final String value;
final Color? color;
const InfoCard({required this.title, required this.value, this.color, super.key});
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
return Card(
color: color,
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(title, style: theme.textTheme.titleMedium),
const SizedBox(height: 8),
Text(value, style: theme.textTheme.headlineMedium),
],
),
),
);
}
}
class MuscleGroupsCard extends StatelessWidget {
final List<Log> logs;
const MuscleGroupsCard(this.logs, {super.key});
List<MuscleGroup> _getMuscleGroups(BuildContext context) {
final allMuscles = logs
.expand((log) => [...log.exercise.muscles, ...log.exercise.musclesSecondary])
.toList();
if (allMuscles.isEmpty) {
return [];
}
final muscleCounts = allMuscles.groupListsBy((muscle) => muscle.nameTranslated(context));
final total = allMuscles.length;
int colorIndex = 0;
final colors = [
Colors.blue,
Colors.green,
Colors.orange,
Colors.purple,
Colors.red,
Colors.teal,
Colors.deepOrange,
Colors.indigo,
Colors.pink,
Colors.brown,
Colors.cyan,
Colors.lime,
Colors.amber,
Colors.lightGreen,
Colors.deepPurple,
];
return muscleCounts.entries.map((entry) {
final percentage = (entry.value.length / total) * 100;
final color = colors[colorIndex % colors.length];
colorIndex++;
return MuscleGroup(entry.key, percentage, color);
}).toList();
}
@override
Widget build(BuildContext context) {
final muscles = _getMuscleGroups(context);
final theme = Theme.of(context);
final i18n = AppLocalizations.of(context);
return Card(
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
i18n.muscles,
style: theme.textTheme.titleLarge,
),
const SizedBox(height: 16),
SizedBox(
height: 200,
child: PieChart(
PieChartData(
sections: muscles.map((muscle) {
return PieChartSectionData(
color: muscle.color,
value: muscle.percentage,
title: i18n.percentValue(muscle.percentage.toStringAsFixed(0)),
radius: 50,
titleStyle: TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold,
color: theme.colorScheme.onPrimary,
),
);
}).toList(),
sectionsSpace: 2,
centerSpaceRadius: 40,
),
),
),
const SizedBox(height: 16),
Wrap(
spacing: 16,
runSpacing: 8,
children: muscles.map((muscle) {
return Row(
mainAxisSize: MainAxisSize.min,
children: [
Container(
width: 16,
height: 16,
color: muscle.color,
),
const SizedBox(width: 8),
Text(muscle.name),
],
);
}).toList(),
),
],
),
),
);
}
}

View File

@@ -61,7 +61,10 @@ class SessionPage extends ConsumerWidget {
padding: const EdgeInsets.symmetric(horizontal: 15),
child: SessionForm(
state.routine.id,
onSaved: () => Navigator.of(context).pop(),
onSaved: () => _controller.nextPage(
duration: DEFAULT_ANIMATION_DURATION,
curve: DEFAULT_ANIMATION_CURVE,
),
session: session,
),
),

View File

@@ -193,7 +193,7 @@ class DayLogWidget extends StatelessWidget {
(log) => Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(log.singleLogRepTextNoNl),
Text(log.repTextNoNl(context)),
IconButton(
icon: const Icon(Icons.delete),
key: ValueKey('delete-log-${log.id}'),

View File

@@ -24,6 +24,7 @@ import 'package:mockito/src/dummies.dart' as _i5;
// ignore_for_file: unnecessary_parenthesis
// ignore_for_file: camel_case_types
// ignore_for_file: subtype_of_sealed_class
// ignore_for_file: invalid_use_of_internal_member
class _FakeResponse_0 extends _i1.SmartFake implements _i2.Response {
_FakeResponse_0(Object parent, Invocation parentInvocation) : super(parent, parentInvocation);

View File

@@ -41,6 +41,7 @@ import 'package:wger/providers/user.dart' as _i21;
// ignore_for_file: unnecessary_parenthesis
// ignore_for_file: camel_case_types
// ignore_for_file: subtype_of_sealed_class
// ignore_for_file: invalid_use_of_internal_member
class _FakeWgerBaseProvider_0 extends _i1.SmartFake implements _i2.WgerBaseProvider {
_FakeWgerBaseProvider_0(Object parent, Invocation parentInvocation)
@@ -204,14 +205,14 @@ class MockExercisesProvider extends _i1.Mock implements _i17.ExercisesProvider {
as List<_i8.Language>);
@override
set database(_i3.ExerciseDatabase? _database) => super.noSuchMethod(
Invocation.setter(#database, _database),
set database(_i3.ExerciseDatabase? value) => super.noSuchMethod(
Invocation.setter(#database, value),
returnValueForMissingStub: null,
);
@override
set exercises(List<_i4.Exercise>? _exercises) => super.noSuchMethod(
Invocation.setter(#exercises, _exercises),
set exercises(List<_i4.Exercise>? value) => super.noSuchMethod(
Invocation.setter(#exercises, value),
returnValueForMissingStub: null,
);
@@ -586,14 +587,14 @@ class MockNutritionPlansProvider extends _i1.Mock implements _i20.NutritionPlans
as List<_i10.NutritionalPlan>);
@override
set database(_i9.IngredientDatabase? _database) => super.noSuchMethod(
Invocation.setter(#database, _database),
set database(_i9.IngredientDatabase? value) => super.noSuchMethod(
Invocation.setter(#database, value),
returnValueForMissingStub: null,
);
@override
set ingredients(List<_i13.Ingredient>? _ingredients) => super.noSuchMethod(
Invocation.setter(#ingredients, _ingredients),
set ingredients(List<_i13.Ingredient>? value) => super.noSuchMethod(
Invocation.setter(#ingredients, value),
returnValueForMissingStub: null,
);
@@ -943,20 +944,20 @@ class MockUserProvider extends _i1.Mock implements _i21.UserProvider {
as _i14.SharedPreferencesAsync);
@override
set themeMode(_i22.ThemeMode? _themeMode) => super.noSuchMethod(
Invocation.setter(#themeMode, _themeMode),
set themeMode(_i22.ThemeMode? value) => super.noSuchMethod(
Invocation.setter(#themeMode, value),
returnValueForMissingStub: null,
);
@override
set prefs(_i14.SharedPreferencesAsync? _prefs) => super.noSuchMethod(
Invocation.setter(#prefs, _prefs),
set prefs(_i14.SharedPreferencesAsync? value) => super.noSuchMethod(
Invocation.setter(#prefs, value),
returnValueForMissingStub: null,
);
@override
set profile(_i23.Profile? _profile) => super.noSuchMethod(
Invocation.setter(#profile, _profile),
set profile(_i23.Profile? value) => super.noSuchMethod(
Invocation.setter(#profile, value),
returnValueForMissingStub: null,
);
@@ -1053,14 +1054,14 @@ class MockWgerBaseProvider extends _i1.Mock implements _i2.WgerBaseProvider {
as _i16.Client);
@override
set auth(_i15.AuthProvider? _auth) => super.noSuchMethod(
Invocation.setter(#auth, _auth),
set auth(_i15.AuthProvider? value) => super.noSuchMethod(
Invocation.setter(#auth, value),
returnValueForMissingStub: null,
);
@override
set client(_i16.Client? _client) => super.noSuchMethod(
Invocation.setter(#client, _client),
set client(_i16.Client? value) => super.noSuchMethod(
Invocation.setter(#client, value),
returnValueForMissingStub: null,
);

View File

@@ -8,11 +8,11 @@ import 'dart:ui' as _i15;
import 'package:http/http.dart' as _i5;
import 'package:mockito/mockito.dart' as _i1;
import 'package:mockito/src/dummies.dart' as _i7;
import 'package:mockito/src/dummies.dart' as _i8;
import 'package:wger/models/exercises/category.dart' as _i13;
import 'package:wger/models/exercises/equipment.dart' as _i9;
import 'package:wger/models/exercises/exercise_submission.dart' as _i11;
import 'package:wger/models/exercises/exercise_submission_images.dart' as _i8;
import 'package:wger/models/exercises/exercise_submission_images.dart' as _i7;
import 'package:wger/models/exercises/language.dart' as _i12;
import 'package:wger/models/exercises/muscle.dart' as _i10;
import 'package:wger/models/exercises/variation.dart' as _i3;
@@ -33,6 +33,7 @@ import 'package:wger/providers/base_provider.dart' as _i2;
// ignore_for_file: unnecessary_parenthesis
// ignore_for_file: camel_case_types
// ignore_for_file: subtype_of_sealed_class
// ignore_for_file: invalid_use_of_internal_member
class _FakeWgerBaseProvider_0 extends _i1.SmartFake implements _i2.WgerBaseProvider {
_FakeWgerBaseProvider_0(Object parent, Invocation parentInvocation)
@@ -78,11 +79,19 @@ class MockAddExerciseProvider extends _i1.Mock implements _i6.AddExerciseProvide
)
as _i2.WgerBaseProvider);
@override
List<_i7.ExerciseSubmissionImage> get exerciseImages =>
(super.noSuchMethod(
Invocation.getter(#exerciseImages),
returnValue: <_i7.ExerciseSubmissionImage>[],
)
as List<_i7.ExerciseSubmissionImage>);
@override
String get author =>
(super.noSuchMethod(
Invocation.getter(#author),
returnValue: _i7.dummyValue<String>(
returnValue: _i8.dummyValue<String>(
this,
Invocation.getter(#author),
),
@@ -105,14 +114,6 @@ class MockAddExerciseProvider extends _i1.Mock implements _i6.AddExerciseProvide
)
as List<String>);
@override
List<_i8.ExerciseSubmissionImage> get exerciseImages =>
(super.noSuchMethod(
Invocation.getter(#exerciseImages),
returnValue: <_i8.ExerciseSubmissionImage>[],
)
as List<_i8.ExerciseSubmissionImage>);
@override
List<_i9.Equipment> get equipment =>
(super.noSuchMethod(
@@ -153,7 +154,7 @@ class MockAddExerciseProvider extends _i1.Mock implements _i6.AddExerciseProvide
_i11.ExerciseSubmissionApi get exerciseApiObject =>
(super.noSuchMethod(
Invocation.getter(#exerciseApiObject),
returnValue: _i7.dummyValue<_i11.ExerciseSubmissionApi>(
returnValue: _i8.dummyValue<_i11.ExerciseSubmissionApi>(
this,
Invocation.getter(#exerciseApiObject),
),
@@ -161,62 +162,62 @@ class MockAddExerciseProvider extends _i1.Mock implements _i6.AddExerciseProvide
as _i11.ExerciseSubmissionApi);
@override
set author(String? _author) => super.noSuchMethod(
Invocation.setter(#author, _author),
set author(String? value) => super.noSuchMethod(
Invocation.setter(#author, value),
returnValueForMissingStub: null,
);
@override
set exerciseNameEn(String? _exerciseNameEn) => super.noSuchMethod(
Invocation.setter(#exerciseNameEn, _exerciseNameEn),
set exerciseNameEn(String? value) => super.noSuchMethod(
Invocation.setter(#exerciseNameEn, value),
returnValueForMissingStub: null,
);
@override
set exerciseNameTrans(String? _exerciseNameTrans) => super.noSuchMethod(
Invocation.setter(#exerciseNameTrans, _exerciseNameTrans),
set exerciseNameTrans(String? value) => super.noSuchMethod(
Invocation.setter(#exerciseNameTrans, value),
returnValueForMissingStub: null,
);
@override
set descriptionEn(String? _descriptionEn) => super.noSuchMethod(
Invocation.setter(#descriptionEn, _descriptionEn),
set descriptionEn(String? value) => super.noSuchMethod(
Invocation.setter(#descriptionEn, value),
returnValueForMissingStub: null,
);
@override
set descriptionTrans(String? _descriptionTrans) => super.noSuchMethod(
Invocation.setter(#descriptionTrans, _descriptionTrans),
set descriptionTrans(String? value) => super.noSuchMethod(
Invocation.setter(#descriptionTrans, value),
returnValueForMissingStub: null,
);
@override
set languageEn(_i12.Language? _languageEn) => super.noSuchMethod(
Invocation.setter(#languageEn, _languageEn),
set languageEn(_i12.Language? value) => super.noSuchMethod(
Invocation.setter(#languageEn, value),
returnValueForMissingStub: null,
);
@override
set languageTranslation(_i12.Language? _languageTranslation) => super.noSuchMethod(
Invocation.setter(#languageTranslation, _languageTranslation),
set languageTranslation(_i12.Language? value) => super.noSuchMethod(
Invocation.setter(#languageTranslation, value),
returnValueForMissingStub: null,
);
@override
set alternateNamesEn(List<String>? _alternateNamesEn) => super.noSuchMethod(
Invocation.setter(#alternateNamesEn, _alternateNamesEn),
set alternateNamesEn(List<String>? value) => super.noSuchMethod(
Invocation.setter(#alternateNamesEn, value),
returnValueForMissingStub: null,
);
@override
set alternateNamesTrans(List<String>? _alternateNamesTrans) => super.noSuchMethod(
Invocation.setter(#alternateNamesTrans, _alternateNamesTrans),
set alternateNamesTrans(List<String>? value) => super.noSuchMethod(
Invocation.setter(#alternateNamesTrans, value),
returnValueForMissingStub: null,
);
@override
set category(_i13.ExerciseCategory? _category) => super.noSuchMethod(
Invocation.setter(#category, _category),
set category(_i13.ExerciseCategory? value) => super.noSuchMethod(
Invocation.setter(#category, value),
returnValueForMissingStub: null,
);
@@ -261,7 +262,7 @@ class MockAddExerciseProvider extends _i1.Mock implements _i6.AddExerciseProvide
);
@override
void addExerciseImages(List<_i8.ExerciseSubmissionImage>? images) => super.noSuchMethod(
void addExerciseImages(List<_i7.ExerciseSubmissionImage>? images) => super.noSuchMethod(
Invocation.method(#addExerciseImages, [images]),
returnValueForMissingStub: null,
);
@@ -355,14 +356,14 @@ class MockWgerBaseProvider extends _i1.Mock implements _i2.WgerBaseProvider {
as _i5.Client);
@override
set auth(_i4.AuthProvider? _auth) => super.noSuchMethod(
Invocation.setter(#auth, _auth),
set auth(_i4.AuthProvider? value) => super.noSuchMethod(
Invocation.setter(#auth, value),
returnValueForMissingStub: null,
);
@override
set client(_i5.Client? _client) => super.noSuchMethod(
Invocation.setter(#client, _client),
set client(_i5.Client? value) => super.noSuchMethod(
Invocation.setter(#client, value),
returnValueForMissingStub: null,
);

View File

@@ -8,14 +8,14 @@ import 'dart:ui' as _i16;
import 'package:flutter/material.dart' as _i18;
import 'package:mockito/mockito.dart' as _i1;
import 'package:mockito/src/dummies.dart' as _i12;
import 'package:mockito/src/dummies.dart' as _i13;
import 'package:shared_preferences/shared_preferences.dart' as _i4;
import 'package:wger/database/exercises/exercise_database.dart' as _i5;
import 'package:wger/models/exercises/category.dart' as _i7;
import 'package:wger/models/exercises/equipment.dart' as _i8;
import 'package:wger/models/exercises/exercise.dart' as _i6;
import 'package:wger/models/exercises/exercise_submission.dart' as _i14;
import 'package:wger/models/exercises/exercise_submission_images.dart' as _i13;
import 'package:wger/models/exercises/exercise_submission_images.dart' as _i12;
import 'package:wger/models/exercises/language.dart' as _i10;
import 'package:wger/models/exercises/muscle.dart' as _i9;
import 'package:wger/models/exercises/variation.dart' as _i3;
@@ -38,6 +38,7 @@ import 'package:wger/providers/user.dart' as _i17;
// ignore_for_file: unnecessary_parenthesis
// ignore_for_file: camel_case_types
// ignore_for_file: subtype_of_sealed_class
// ignore_for_file: invalid_use_of_internal_member
class _FakeWgerBaseProvider_0 extends _i1.SmartFake implements _i2.WgerBaseProvider {
_FakeWgerBaseProvider_0(Object parent, Invocation parentInvocation)
@@ -98,11 +99,19 @@ class MockAddExerciseProvider extends _i1.Mock implements _i11.AddExerciseProvid
)
as _i2.WgerBaseProvider);
@override
List<_i12.ExerciseSubmissionImage> get exerciseImages =>
(super.noSuchMethod(
Invocation.getter(#exerciseImages),
returnValue: <_i12.ExerciseSubmissionImage>[],
)
as List<_i12.ExerciseSubmissionImage>);
@override
String get author =>
(super.noSuchMethod(
Invocation.getter(#author),
returnValue: _i12.dummyValue<String>(
returnValue: _i13.dummyValue<String>(
this,
Invocation.getter(#author),
),
@@ -125,14 +134,6 @@ class MockAddExerciseProvider extends _i1.Mock implements _i11.AddExerciseProvid
)
as List<String>);
@override
List<_i13.ExerciseSubmissionImage> get exerciseImages =>
(super.noSuchMethod(
Invocation.getter(#exerciseImages),
returnValue: <_i13.ExerciseSubmissionImage>[],
)
as List<_i13.ExerciseSubmissionImage>);
@override
List<_i8.Equipment> get equipment =>
(super.noSuchMethod(
@@ -173,7 +174,7 @@ class MockAddExerciseProvider extends _i1.Mock implements _i11.AddExerciseProvid
_i14.ExerciseSubmissionApi get exerciseApiObject =>
(super.noSuchMethod(
Invocation.getter(#exerciseApiObject),
returnValue: _i12.dummyValue<_i14.ExerciseSubmissionApi>(
returnValue: _i13.dummyValue<_i14.ExerciseSubmissionApi>(
this,
Invocation.getter(#exerciseApiObject),
),
@@ -181,62 +182,62 @@ class MockAddExerciseProvider extends _i1.Mock implements _i11.AddExerciseProvid
as _i14.ExerciseSubmissionApi);
@override
set author(String? _author) => super.noSuchMethod(
Invocation.setter(#author, _author),
set author(String? value) => super.noSuchMethod(
Invocation.setter(#author, value),
returnValueForMissingStub: null,
);
@override
set exerciseNameEn(String? _exerciseNameEn) => super.noSuchMethod(
Invocation.setter(#exerciseNameEn, _exerciseNameEn),
set exerciseNameEn(String? value) => super.noSuchMethod(
Invocation.setter(#exerciseNameEn, value),
returnValueForMissingStub: null,
);
@override
set exerciseNameTrans(String? _exerciseNameTrans) => super.noSuchMethod(
Invocation.setter(#exerciseNameTrans, _exerciseNameTrans),
set exerciseNameTrans(String? value) => super.noSuchMethod(
Invocation.setter(#exerciseNameTrans, value),
returnValueForMissingStub: null,
);
@override
set descriptionEn(String? _descriptionEn) => super.noSuchMethod(
Invocation.setter(#descriptionEn, _descriptionEn),
set descriptionEn(String? value) => super.noSuchMethod(
Invocation.setter(#descriptionEn, value),
returnValueForMissingStub: null,
);
@override
set descriptionTrans(String? _descriptionTrans) => super.noSuchMethod(
Invocation.setter(#descriptionTrans, _descriptionTrans),
set descriptionTrans(String? value) => super.noSuchMethod(
Invocation.setter(#descriptionTrans, value),
returnValueForMissingStub: null,
);
@override
set languageEn(_i10.Language? _languageEn) => super.noSuchMethod(
Invocation.setter(#languageEn, _languageEn),
set languageEn(_i10.Language? value) => super.noSuchMethod(
Invocation.setter(#languageEn, value),
returnValueForMissingStub: null,
);
@override
set languageTranslation(_i10.Language? _languageTranslation) => super.noSuchMethod(
Invocation.setter(#languageTranslation, _languageTranslation),
set languageTranslation(_i10.Language? value) => super.noSuchMethod(
Invocation.setter(#languageTranslation, value),
returnValueForMissingStub: null,
);
@override
set alternateNamesEn(List<String>? _alternateNamesEn) => super.noSuchMethod(
Invocation.setter(#alternateNamesEn, _alternateNamesEn),
set alternateNamesEn(List<String>? value) => super.noSuchMethod(
Invocation.setter(#alternateNamesEn, value),
returnValueForMissingStub: null,
);
@override
set alternateNamesTrans(List<String>? _alternateNamesTrans) => super.noSuchMethod(
Invocation.setter(#alternateNamesTrans, _alternateNamesTrans),
set alternateNamesTrans(List<String>? value) => super.noSuchMethod(
Invocation.setter(#alternateNamesTrans, value),
returnValueForMissingStub: null,
);
@override
set category(_i7.ExerciseCategory? _category) => super.noSuchMethod(
Invocation.setter(#category, _category),
set category(_i7.ExerciseCategory? value) => super.noSuchMethod(
Invocation.setter(#category, value),
returnValueForMissingStub: null,
);
@@ -281,7 +282,7 @@ class MockAddExerciseProvider extends _i1.Mock implements _i11.AddExerciseProvid
);
@override
void addExerciseImages(List<_i13.ExerciseSubmissionImage>? images) => super.noSuchMethod(
void addExerciseImages(List<_i12.ExerciseSubmissionImage>? images) => super.noSuchMethod(
Invocation.method(#addExerciseImages, [images]),
returnValueForMissingStub: null,
);
@@ -389,20 +390,20 @@ class MockUserProvider extends _i1.Mock implements _i17.UserProvider {
as _i4.SharedPreferencesAsync);
@override
set themeMode(_i18.ThemeMode? _themeMode) => super.noSuchMethod(
Invocation.setter(#themeMode, _themeMode),
set themeMode(_i18.ThemeMode? value) => super.noSuchMethod(
Invocation.setter(#themeMode, value),
returnValueForMissingStub: null,
);
@override
set prefs(_i4.SharedPreferencesAsync? _prefs) => super.noSuchMethod(
Invocation.setter(#prefs, _prefs),
set prefs(_i4.SharedPreferencesAsync? value) => super.noSuchMethod(
Invocation.setter(#prefs, value),
returnValueForMissingStub: null,
);
@override
set profile(_i19.Profile? _profile) => super.noSuchMethod(
Invocation.setter(#profile, _profile),
set profile(_i19.Profile? value) => super.noSuchMethod(
Invocation.setter(#profile, value),
returnValueForMissingStub: null,
);
@@ -561,14 +562,14 @@ class MockExercisesProvider extends _i1.Mock implements _i20.ExercisesProvider {
as List<_i10.Language>);
@override
set database(_i5.ExerciseDatabase? _database) => super.noSuchMethod(
Invocation.setter(#database, _database),
set database(_i5.ExerciseDatabase? value) => super.noSuchMethod(
Invocation.setter(#database, value),
returnValueForMissingStub: null,
);
@override
set exercises(List<_i6.Exercise>? _exercises) => super.noSuchMethod(
Invocation.setter(#exercises, _exercises),
set exercises(List<_i6.Exercise>? value) => super.noSuchMethod(
Invocation.setter(#exercises, value),
returnValueForMissingStub: null,
);

View File

@@ -29,6 +29,7 @@ import 'package:wger/providers/exercises.dart' as _i9;
// ignore_for_file: unnecessary_parenthesis
// ignore_for_file: camel_case_types
// ignore_for_file: subtype_of_sealed_class
// ignore_for_file: invalid_use_of_internal_member
class _FakeWgerBaseProvider_0 extends _i1.SmartFake implements _i2.WgerBaseProvider {
_FakeWgerBaseProvider_0(Object parent, Invocation parentInvocation)
@@ -148,14 +149,14 @@ class MockExercisesProvider extends _i1.Mock implements _i9.ExercisesProvider {
as List<_i8.Language>);
@override
set database(_i3.ExerciseDatabase? _database) => super.noSuchMethod(
Invocation.setter(#database, _database),
set database(_i3.ExerciseDatabase? value) => super.noSuchMethod(
Invocation.setter(#database, value),
returnValueForMissingStub: null,
);
@override
set exercises(List<_i4.Exercise>? _exercises) => super.noSuchMethod(
Invocation.setter(#exercises, _exercises),
set exercises(List<_i4.Exercise>? value) => super.noSuchMethod(
Invocation.setter(#exercises, value),
returnValueForMissingStub: null,
);

View File

@@ -26,6 +26,7 @@ import 'package:wger/providers/gallery.dart' as _i4;
// ignore_for_file: unnecessary_parenthesis
// ignore_for_file: camel_case_types
// ignore_for_file: subtype_of_sealed_class
// ignore_for_file: invalid_use_of_internal_member
class _FakeAuthProvider_0 extends _i1.SmartFake implements _i2.AuthProvider {
_FakeAuthProvider_0(Object parent, Invocation parentInvocation) : super(parent, parentInvocation);
@@ -60,8 +61,8 @@ class MockGalleryProvider extends _i1.Mock implements _i4.GalleryProvider {
as List<_i5.Image>);
@override
set images(List<_i5.Image>? _images) => super.noSuchMethod(
Invocation.setter(#images, _images),
set images(List<_i5.Image>? value) => super.noSuchMethod(
Invocation.setter(#images, value),
returnValueForMissingStub: null,
);
@@ -82,14 +83,14 @@ class MockGalleryProvider extends _i1.Mock implements _i4.GalleryProvider {
as _i3.Client);
@override
set auth(_i2.AuthProvider? _auth) => super.noSuchMethod(
Invocation.setter(#auth, _auth),
set auth(_i2.AuthProvider? value) => super.noSuchMethod(
Invocation.setter(#auth, value),
returnValueForMissingStub: null,
);
@override
set client(_i3.Client? _client) => super.noSuchMethod(
Invocation.setter(#client, _client),
set client(_i3.Client? value) => super.noSuchMethod(
Invocation.setter(#client, value),
returnValueForMissingStub: null,
);

View File

@@ -26,6 +26,7 @@ import 'package:wger/providers/gallery.dart' as _i4;
// ignore_for_file: unnecessary_parenthesis
// ignore_for_file: camel_case_types
// ignore_for_file: subtype_of_sealed_class
// ignore_for_file: invalid_use_of_internal_member
class _FakeAuthProvider_0 extends _i1.SmartFake implements _i2.AuthProvider {
_FakeAuthProvider_0(Object parent, Invocation parentInvocation) : super(parent, parentInvocation);
@@ -60,8 +61,8 @@ class MockGalleryProvider extends _i1.Mock implements _i4.GalleryProvider {
as List<_i5.Image>);
@override
set images(List<_i5.Image>? _images) => super.noSuchMethod(
Invocation.setter(#images, _images),
set images(List<_i5.Image>? value) => super.noSuchMethod(
Invocation.setter(#images, value),
returnValueForMissingStub: null,
);
@@ -82,14 +83,14 @@ class MockGalleryProvider extends _i1.Mock implements _i4.GalleryProvider {
as _i3.Client);
@override
set auth(_i2.AuthProvider? _auth) => super.noSuchMethod(
Invocation.setter(#auth, _auth),
set auth(_i2.AuthProvider? value) => super.noSuchMethod(
Invocation.setter(#auth, value),
returnValueForMissingStub: null,
);
@override
set client(_i3.Client? _client) => super.noSuchMethod(
Invocation.setter(#client, _client),
set client(_i3.Client? value) => super.noSuchMethod(
Invocation.setter(#client, value),
returnValueForMissingStub: null,
);

View File

@@ -25,6 +25,7 @@ import 'package:wger/providers/measurement.dart' as _i4;
// ignore_for_file: unnecessary_parenthesis
// ignore_for_file: camel_case_types
// ignore_for_file: subtype_of_sealed_class
// ignore_for_file: invalid_use_of_internal_member
class _FakeWgerBaseProvider_0 extends _i1.SmartFake implements _i2.WgerBaseProvider {
_FakeWgerBaseProvider_0(Object parent, Invocation parentInvocation)

View File

@@ -23,6 +23,7 @@ import 'package:wger/providers/base_provider.dart' as _i4;
// ignore_for_file: unnecessary_parenthesis
// ignore_for_file: camel_case_types
// ignore_for_file: subtype_of_sealed_class
// ignore_for_file: invalid_use_of_internal_member
class _FakeAuthProvider_0 extends _i1.SmartFake implements _i2.AuthProvider {
_FakeAuthProvider_0(Object parent, Invocation parentInvocation) : super(parent, parentInvocation);
@@ -65,14 +66,14 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider {
as _i3.Client);
@override
set auth(_i2.AuthProvider? _auth) => super.noSuchMethod(
Invocation.setter(#auth, _auth),
set auth(_i2.AuthProvider? value) => super.noSuchMethod(
Invocation.setter(#auth, value),
returnValueForMissingStub: null,
);
@override
set client(_i3.Client? _client) => super.noSuchMethod(
Invocation.setter(#client, _client),
set client(_i3.Client? value) => super.noSuchMethod(
Invocation.setter(#client, value),
returnValueForMissingStub: null,
);

View File

@@ -28,6 +28,7 @@ import 'package:wger/providers/nutrition.dart' as _i8;
// ignore_for_file: unnecessary_parenthesis
// ignore_for_file: camel_case_types
// ignore_for_file: subtype_of_sealed_class
// ignore_for_file: invalid_use_of_internal_member
class _FakeWgerBaseProvider_0 extends _i1.SmartFake implements _i2.WgerBaseProvider {
_FakeWgerBaseProvider_0(Object parent, Invocation parentInvocation)
@@ -103,14 +104,14 @@ class MockNutritionPlansProvider extends _i1.Mock implements _i8.NutritionPlansP
as List<_i4.NutritionalPlan>);
@override
set database(_i3.IngredientDatabase? _database) => super.noSuchMethod(
Invocation.setter(#database, _database),
set database(_i3.IngredientDatabase? value) => super.noSuchMethod(
Invocation.setter(#database, value),
returnValueForMissingStub: null,
);
@override
set ingredients(List<_i7.Ingredient>? _ingredients) => super.noSuchMethod(
Invocation.setter(#ingredients, _ingredients),
set ingredients(List<_i7.Ingredient>? value) => super.noSuchMethod(
Invocation.setter(#ingredients, value),
returnValueForMissingStub: null,
);

View File

@@ -28,6 +28,7 @@ import 'package:wger/providers/nutrition.dart' as _i8;
// ignore_for_file: unnecessary_parenthesis
// ignore_for_file: camel_case_types
// ignore_for_file: subtype_of_sealed_class
// ignore_for_file: invalid_use_of_internal_member
class _FakeWgerBaseProvider_0 extends _i1.SmartFake implements _i2.WgerBaseProvider {
_FakeWgerBaseProvider_0(Object parent, Invocation parentInvocation)
@@ -103,14 +104,14 @@ class MockNutritionPlansProvider extends _i1.Mock implements _i8.NutritionPlansP
as List<_i4.NutritionalPlan>);
@override
set database(_i3.IngredientDatabase? _database) => super.noSuchMethod(
Invocation.setter(#database, _database),
set database(_i3.IngredientDatabase? value) => super.noSuchMethod(
Invocation.setter(#database, value),
returnValueForMissingStub: null,
);
@override
set ingredients(List<_i7.Ingredient>? _ingredients) => super.noSuchMethod(
Invocation.setter(#ingredients, _ingredients),
set ingredients(List<_i7.Ingredient>? value) => super.noSuchMethod(
Invocation.setter(#ingredients, value),
returnValueForMissingStub: null,
);

View File

@@ -28,6 +28,7 @@ import 'package:wger/providers/base_provider.dart' as _i4;
// ignore_for_file: unnecessary_parenthesis
// ignore_for_file: camel_case_types
// ignore_for_file: subtype_of_sealed_class
// ignore_for_file: invalid_use_of_internal_member
class _FakeAuthProvider_0 extends _i1.SmartFake implements _i2.AuthProvider {
_FakeAuthProvider_0(Object parent, Invocation parentInvocation) : super(parent, parentInvocation);
@@ -75,14 +76,14 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider {
as _i3.Client);
@override
set auth(_i2.AuthProvider? _auth) => super.noSuchMethod(
Invocation.setter(#auth, _auth),
set auth(_i2.AuthProvider? value) => super.noSuchMethod(
Invocation.setter(#auth, value),
returnValueForMissingStub: null,
);
@override
set client(_i3.Client? _client) => super.noSuchMethod(
Invocation.setter(#client, _client),
set client(_i3.Client? value) => super.noSuchMethod(
Invocation.setter(#client, value),
returnValueForMissingStub: null,
);
@@ -213,50 +214,50 @@ class MockAuthProvider extends _i1.Mock implements _i2.AuthProvider {
bool get isAuth => (super.noSuchMethod(Invocation.getter(#isAuth), returnValue: false) as bool);
@override
set token(String? _token) => super.noSuchMethod(
Invocation.setter(#token, _token),
set token(String? value) => super.noSuchMethod(
Invocation.setter(#token, value),
returnValueForMissingStub: null,
);
@override
set serverUrl(String? _serverUrl) => super.noSuchMethod(
Invocation.setter(#serverUrl, _serverUrl),
set serverUrl(String? value) => super.noSuchMethod(
Invocation.setter(#serverUrl, value),
returnValueForMissingStub: null,
);
@override
set serverVersion(String? _serverVersion) => super.noSuchMethod(
Invocation.setter(#serverVersion, _serverVersion),
set serverVersion(String? value) => super.noSuchMethod(
Invocation.setter(#serverVersion, value),
returnValueForMissingStub: null,
);
@override
set applicationVersion(_i6.PackageInfo? _applicationVersion) => super.noSuchMethod(
Invocation.setter(#applicationVersion, _applicationVersion),
set applicationVersion(_i6.PackageInfo? value) => super.noSuchMethod(
Invocation.setter(#applicationVersion, value),
returnValueForMissingStub: null,
);
@override
set metadata(Map<String, String>? _metadata) => super.noSuchMethod(
Invocation.setter(#metadata, _metadata),
set metadata(Map<String, String>? value) => super.noSuchMethod(
Invocation.setter(#metadata, value),
returnValueForMissingStub: null,
);
@override
set state(_i2.AuthState? _state) => super.noSuchMethod(
Invocation.setter(#state, _state),
set state(_i2.AuthState? value) => super.noSuchMethod(
Invocation.setter(#state, value),
returnValueForMissingStub: null,
);
@override
set client(_i3.Client? _client) => super.noSuchMethod(
Invocation.setter(#client, _client),
set client(_i3.Client? value) => super.noSuchMethod(
Invocation.setter(#client, value),
returnValueForMissingStub: null,
);
@override
set dataInit(bool? _dataInit) => super.noSuchMethod(
Invocation.setter(#dataInit, _dataInit),
set dataInit(bool? value) => super.noSuchMethod(
Invocation.setter(#dataInit, value),
returnValueForMissingStub: null,
);

View File

@@ -28,6 +28,7 @@ import 'package:wger/providers/base_provider.dart' as _i8;
// ignore_for_file: unnecessary_parenthesis
// ignore_for_file: camel_case_types
// ignore_for_file: subtype_of_sealed_class
// ignore_for_file: invalid_use_of_internal_member
class _FakeClient_0 extends _i1.SmartFake implements _i2.Client {
_FakeClient_0(Object parent, Invocation parentInvocation) : super(parent, parentInvocation);
@@ -90,50 +91,50 @@ class MockAuthProvider extends _i1.Mock implements _i3.AuthProvider {
bool get isAuth => (super.noSuchMethod(Invocation.getter(#isAuth), returnValue: false) as bool);
@override
set token(String? _token) => super.noSuchMethod(
Invocation.setter(#token, _token),
set token(String? value) => super.noSuchMethod(
Invocation.setter(#token, value),
returnValueForMissingStub: null,
);
@override
set serverUrl(String? _serverUrl) => super.noSuchMethod(
Invocation.setter(#serverUrl, _serverUrl),
set serverUrl(String? value) => super.noSuchMethod(
Invocation.setter(#serverUrl, value),
returnValueForMissingStub: null,
);
@override
set serverVersion(String? _serverVersion) => super.noSuchMethod(
Invocation.setter(#serverVersion, _serverVersion),
set serverVersion(String? value) => super.noSuchMethod(
Invocation.setter(#serverVersion, value),
returnValueForMissingStub: null,
);
@override
set applicationVersion(_i4.PackageInfo? _applicationVersion) => super.noSuchMethod(
Invocation.setter(#applicationVersion, _applicationVersion),
set applicationVersion(_i4.PackageInfo? value) => super.noSuchMethod(
Invocation.setter(#applicationVersion, value),
returnValueForMissingStub: null,
);
@override
set metadata(Map<String, String>? _metadata) => super.noSuchMethod(
Invocation.setter(#metadata, _metadata),
set metadata(Map<String, String>? value) => super.noSuchMethod(
Invocation.setter(#metadata, value),
returnValueForMissingStub: null,
);
@override
set state(_i3.AuthState? _state) => super.noSuchMethod(
Invocation.setter(#state, _state),
set state(_i3.AuthState? value) => super.noSuchMethod(
Invocation.setter(#state, value),
returnValueForMissingStub: null,
);
@override
set client(_i2.Client? _client) => super.noSuchMethod(
Invocation.setter(#client, _client),
set client(_i2.Client? value) => super.noSuchMethod(
Invocation.setter(#client, value),
returnValueForMissingStub: null,
);
@override
set dataInit(bool? _dataInit) => super.noSuchMethod(
Invocation.setter(#dataInit, _dataInit),
set dataInit(bool? value) => super.noSuchMethod(
Invocation.setter(#dataInit, value),
returnValueForMissingStub: null,
);
@@ -310,14 +311,14 @@ class MockWgerBaseProvider extends _i1.Mock implements _i8.WgerBaseProvider {
as _i2.Client);
@override
set auth(_i3.AuthProvider? _auth) => super.noSuchMethod(
Invocation.setter(#auth, _auth),
set auth(_i3.AuthProvider? value) => super.noSuchMethod(
Invocation.setter(#auth, value),
returnValueForMissingStub: null,
);
@override
set client(_i2.Client? _client) => super.noSuchMethod(
Invocation.setter(#client, _client),
set client(_i2.Client? value) => super.noSuchMethod(
Invocation.setter(#client, value),
returnValueForMissingStub: null,
);

View File

@@ -24,6 +24,7 @@ import 'package:mockito/src/dummies.dart' as _i5;
// ignore_for_file: unnecessary_parenthesis
// ignore_for_file: camel_case_types
// ignore_for_file: subtype_of_sealed_class
// ignore_for_file: invalid_use_of_internal_member
class _FakeResponse_0 extends _i1.SmartFake implements _i2.Response {
_FakeResponse_0(Object parent, Invocation parentInvocation) : super(parent, parentInvocation);

View File

@@ -35,6 +35,7 @@ import 'package:wger/providers/routines.dart' as _i12;
// ignore_for_file: unnecessary_parenthesis
// ignore_for_file: camel_case_types
// ignore_for_file: subtype_of_sealed_class
// ignore_for_file: invalid_use_of_internal_member
class _FakeWgerBaseProvider_0 extends _i1.SmartFake implements _i2.WgerBaseProvider {
_FakeWgerBaseProvider_0(Object parent, Invocation parentInvocation)
@@ -145,8 +146,8 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider {
as _i4.RepetitionUnit);
@override
set activeRoutine(_i5.Routine? _activeRoutine) => super.noSuchMethod(
Invocation.setter(#activeRoutine, _activeRoutine),
set activeRoutine(_i5.Routine? value) => super.noSuchMethod(
Invocation.setter(#activeRoutine, value),
returnValueForMissingStub: null,
);

View File

@@ -35,6 +35,7 @@ import 'package:wger/providers/routines.dart' as _i12;
// ignore_for_file: unnecessary_parenthesis
// ignore_for_file: camel_case_types
// ignore_for_file: subtype_of_sealed_class
// ignore_for_file: invalid_use_of_internal_member
class _FakeWgerBaseProvider_0 extends _i1.SmartFake implements _i2.WgerBaseProvider {
_FakeWgerBaseProvider_0(Object parent, Invocation parentInvocation)
@@ -145,8 +146,8 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider {
as _i4.RepetitionUnit);
@override
set activeRoutine(_i5.Routine? _activeRoutine) => super.noSuchMethod(
Invocation.setter(#activeRoutine, _activeRoutine),
set activeRoutine(_i5.Routine? value) => super.noSuchMethod(
Invocation.setter(#activeRoutine, value),
returnValueForMissingStub: null,
);

View File

@@ -146,9 +146,8 @@ void main() {
expect(find.text('Bench press'), findsOneWidget);
expect(find.byType(LogPage), findsOneWidget);
expect(find.byType(Form), findsOneWidget);
expect(find.byType(ListTile), findsNWidgets(3), reason: 'Two logs and the switch tile');
expect(find.text('10 × 10 kg (1.5 RiR)'), findsOneWidget);
expect(find.text('12 × 10 kg (2 RiR)'), findsOneWidget);
expect(find.text('10 × 10 kg (1.5 RiR)'), findsOneWidget);
expect(find.text('12 × 10 kg (2 RiR)'), findsOneWidget);
// TODO: commented out for now
// expect(find.text('Make sure to warm up'), findsOneWidget, reason: 'Set comment');

View File

@@ -43,6 +43,7 @@ import 'package:wger/providers/routines.dart' as _i23;
// ignore_for_file: unnecessary_parenthesis
// ignore_for_file: camel_case_types
// ignore_for_file: subtype_of_sealed_class
// ignore_for_file: invalid_use_of_internal_member
class _FakeAuthProvider_0 extends _i1.SmartFake implements _i2.AuthProvider {
_FakeAuthProvider_0(Object parent, Invocation parentInvocation) : super(parent, parentInvocation);
@@ -154,14 +155,14 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider {
as _i3.Client);
@override
set auth(_i2.AuthProvider? _auth) => super.noSuchMethod(
Invocation.setter(#auth, _auth),
set auth(_i2.AuthProvider? value) => super.noSuchMethod(
Invocation.setter(#auth, value),
returnValueForMissingStub: null,
);
@override
set client(_i3.Client? _client) => super.noSuchMethod(
Invocation.setter(#client, _client),
set client(_i3.Client? value) => super.noSuchMethod(
Invocation.setter(#client, value),
returnValueForMissingStub: null,
);
@@ -342,14 +343,14 @@ class MockExercisesProvider extends _i1.Mock implements _i21.ExercisesProvider {
as List<_i10.Language>);
@override
set database(_i5.ExerciseDatabase? _database) => super.noSuchMethod(
Invocation.setter(#database, _database),
set database(_i5.ExerciseDatabase? value) => super.noSuchMethod(
Invocation.setter(#database, value),
returnValueForMissingStub: null,
);
@override
set exercises(List<_i6.Exercise>? _exercises) => super.noSuchMethod(
Invocation.setter(#exercises, _exercises),
set exercises(List<_i6.Exercise>? value) => super.noSuchMethod(
Invocation.setter(#exercises, value),
returnValueForMissingStub: null,
);
@@ -743,8 +744,8 @@ class MockRoutinesProvider extends _i1.Mock implements _i23.RoutinesProvider {
as _i12.RepetitionUnit);
@override
set activeRoutine(_i13.Routine? _activeRoutine) => super.noSuchMethod(
Invocation.setter(#activeRoutine, _activeRoutine),
set activeRoutine(_i13.Routine? value) => super.noSuchMethod(
Invocation.setter(#activeRoutine, value),
returnValueForMissingStub: null,
);

View File

@@ -59,6 +59,8 @@ void main() {
});
Widget renderSessionPage({locale = 'en'}) {
final controller = PageController(initialPage: 0);
return UncontrolledProviderScope(
container: container,
child: ChangeNotifierProvider<RoutinesProvider>(
@@ -68,8 +70,11 @@ void main() {
localizationsDelegates: AppLocalizations.localizationsDelegates,
supportedLocales: AppLocalizations.supportedLocales,
home: Scaffold(
body: SessionPage(
PageController(),
body: PageView(
controller: controller,
children: [
SessionPage(controller),
],
),
),
),
@@ -133,6 +138,7 @@ void main() {
final captured =
verify(mockRoutinesProvider.editSession(captureAny)).captured.single as WorkoutSession;
print(captured);
expect(captured.id, 1);
expect(captured.impression, 3);
expect(captured.notes, equals('This is a note'));

View File

@@ -35,6 +35,7 @@ import 'package:wger/providers/routines.dart' as _i12;
// ignore_for_file: unnecessary_parenthesis
// ignore_for_file: camel_case_types
// ignore_for_file: subtype_of_sealed_class
// ignore_for_file: invalid_use_of_internal_member
class _FakeWgerBaseProvider_0 extends _i1.SmartFake implements _i2.WgerBaseProvider {
_FakeWgerBaseProvider_0(Object parent, Invocation parentInvocation)
@@ -145,8 +146,8 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider {
as _i4.RepetitionUnit);
@override
set activeRoutine(_i5.Routine? _activeRoutine) => super.noSuchMethod(
Invocation.setter(#activeRoutine, _activeRoutine),
set activeRoutine(_i5.Routine? value) => super.noSuchMethod(
Invocation.setter(#activeRoutine, value),
returnValueForMissingStub: null,
);

View File

@@ -35,6 +35,7 @@ import 'package:wger/providers/routines.dart' as _i12;
// ignore_for_file: unnecessary_parenthesis
// ignore_for_file: camel_case_types
// ignore_for_file: subtype_of_sealed_class
// ignore_for_file: invalid_use_of_internal_member
class _FakeWgerBaseProvider_0 extends _i1.SmartFake implements _i2.WgerBaseProvider {
_FakeWgerBaseProvider_0(Object parent, Invocation parentInvocation)
@@ -145,8 +146,8 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider {
as _i4.RepetitionUnit);
@override
set activeRoutine(_i5.Routine? _activeRoutine) => super.noSuchMethod(
Invocation.setter(#activeRoutine, _activeRoutine),
set activeRoutine(_i5.Routine? value) => super.noSuchMethod(
Invocation.setter(#activeRoutine, value),
returnValueForMissingStub: null,
);

View File

@@ -35,6 +35,7 @@ import 'package:wger/providers/routines.dart' as _i12;
// ignore_for_file: unnecessary_parenthesis
// ignore_for_file: camel_case_types
// ignore_for_file: subtype_of_sealed_class
// ignore_for_file: invalid_use_of_internal_member
class _FakeWgerBaseProvider_0 extends _i1.SmartFake implements _i2.WgerBaseProvider {
_FakeWgerBaseProvider_0(Object parent, Invocation parentInvocation)
@@ -145,8 +146,8 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider {
as _i4.RepetitionUnit);
@override
set activeRoutine(_i5.Routine? _activeRoutine) => super.noSuchMethod(
Invocation.setter(#activeRoutine, _activeRoutine),
set activeRoutine(_i5.Routine? value) => super.noSuchMethod(
Invocation.setter(#activeRoutine, value),
returnValueForMissingStub: null,
);

View File

@@ -35,6 +35,7 @@ import 'package:wger/providers/routines.dart' as _i12;
// ignore_for_file: unnecessary_parenthesis
// ignore_for_file: camel_case_types
// ignore_for_file: subtype_of_sealed_class
// ignore_for_file: invalid_use_of_internal_member
class _FakeWgerBaseProvider_0 extends _i1.SmartFake implements _i2.WgerBaseProvider {
_FakeWgerBaseProvider_0(Object parent, Invocation parentInvocation)
@@ -145,8 +146,8 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider {
as _i4.RepetitionUnit);
@override
set activeRoutine(_i5.Routine? _activeRoutine) => super.noSuchMethod(
Invocation.setter(#activeRoutine, _activeRoutine),
set activeRoutine(_i5.Routine? value) => super.noSuchMethod(
Invocation.setter(#activeRoutine, value),
returnValueForMissingStub: null,
);

View File

@@ -35,6 +35,7 @@ import 'package:wger/providers/routines.dart' as _i12;
// ignore_for_file: unnecessary_parenthesis
// ignore_for_file: camel_case_types
// ignore_for_file: subtype_of_sealed_class
// ignore_for_file: invalid_use_of_internal_member
class _FakeWgerBaseProvider_0 extends _i1.SmartFake implements _i2.WgerBaseProvider {
_FakeWgerBaseProvider_0(Object parent, Invocation parentInvocation)
@@ -145,8 +146,8 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider {
as _i4.RepetitionUnit);
@override
set activeRoutine(_i5.Routine? _activeRoutine) => super.noSuchMethod(
Invocation.setter(#activeRoutine, _activeRoutine),
set activeRoutine(_i5.Routine? value) => super.noSuchMethod(
Invocation.setter(#activeRoutine, value),
returnValueForMissingStub: null,
);

View File

@@ -35,6 +35,7 @@ import 'package:wger/providers/routines.dart' as _i12;
// ignore_for_file: unnecessary_parenthesis
// ignore_for_file: camel_case_types
// ignore_for_file: subtype_of_sealed_class
// ignore_for_file: invalid_use_of_internal_member
class _FakeWgerBaseProvider_0 extends _i1.SmartFake implements _i2.WgerBaseProvider {
_FakeWgerBaseProvider_0(Object parent, Invocation parentInvocation)
@@ -145,8 +146,8 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider {
as _i4.RepetitionUnit);
@override
set activeRoutine(_i5.Routine? _activeRoutine) => super.noSuchMethod(
Invocation.setter(#activeRoutine, _activeRoutine),
set activeRoutine(_i5.Routine? value) => super.noSuchMethod(
Invocation.setter(#activeRoutine, value),
returnValueForMissingStub: null,
);

View File

@@ -23,6 +23,7 @@ import 'package:wger/providers/base_provider.dart' as _i4;
// ignore_for_file: unnecessary_parenthesis
// ignore_for_file: camel_case_types
// ignore_for_file: subtype_of_sealed_class
// ignore_for_file: invalid_use_of_internal_member
class _FakeAuthProvider_0 extends _i1.SmartFake implements _i2.AuthProvider {
_FakeAuthProvider_0(Object parent, Invocation parentInvocation) : super(parent, parentInvocation);
@@ -65,14 +66,14 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider {
as _i3.Client);
@override
set auth(_i2.AuthProvider? _auth) => super.noSuchMethod(
Invocation.setter(#auth, _auth),
set auth(_i2.AuthProvider? value) => super.noSuchMethod(
Invocation.setter(#auth, value),
returnValueForMissingStub: null,
);
@override
set client(_i3.Client? _client) => super.noSuchMethod(
Invocation.setter(#client, _client),
set client(_i3.Client? value) => super.noSuchMethod(
Invocation.setter(#client, value),
returnValueForMissingStub: null,
);

View File

@@ -31,6 +31,7 @@ import 'package:wger/providers/exercises.dart' as _i12;
// ignore_for_file: unnecessary_parenthesis
// ignore_for_file: camel_case_types
// ignore_for_file: subtype_of_sealed_class
// ignore_for_file: invalid_use_of_internal_member
class _FakeAuthProvider_0 extends _i1.SmartFake implements _i2.AuthProvider {
_FakeAuthProvider_0(Object parent, Invocation parentInvocation) : super(parent, parentInvocation);
@@ -104,14 +105,14 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider {
as _i3.Client);
@override
set auth(_i2.AuthProvider? _auth) => super.noSuchMethod(
Invocation.setter(#auth, _auth),
set auth(_i2.AuthProvider? value) => super.noSuchMethod(
Invocation.setter(#auth, value),
returnValueForMissingStub: null,
);
@override
set client(_i3.Client? _client) => super.noSuchMethod(
Invocation.setter(#client, _client),
set client(_i3.Client? value) => super.noSuchMethod(
Invocation.setter(#client, value),
returnValueForMissingStub: null,
);
@@ -292,14 +293,14 @@ class MockExercisesProvider extends _i1.Mock implements _i12.ExercisesProvider {
as List<_i10.Language>);
@override
set database(_i5.ExerciseDatabase? _database) => super.noSuchMethod(
Invocation.setter(#database, _database),
set database(_i5.ExerciseDatabase? value) => super.noSuchMethod(
Invocation.setter(#database, value),
returnValueForMissingStub: null,
);
@override
set exercises(List<_i6.Exercise>? _exercises) => super.noSuchMethod(
Invocation.setter(#exercises, _exercises),
set exercises(List<_i6.Exercise>? value) => super.noSuchMethod(
Invocation.setter(#exercises, value),
returnValueForMissingStub: null,
);

View File

@@ -23,6 +23,7 @@ import 'package:wger/providers/base_provider.dart' as _i4;
// ignore_for_file: unnecessary_parenthesis
// ignore_for_file: camel_case_types
// ignore_for_file: subtype_of_sealed_class
// ignore_for_file: invalid_use_of_internal_member
class _FakeAuthProvider_0 extends _i1.SmartFake implements _i2.AuthProvider {
_FakeAuthProvider_0(Object parent, Invocation parentInvocation) : super(parent, parentInvocation);
@@ -65,14 +66,14 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider {
as _i3.Client);
@override
set auth(_i2.AuthProvider? _auth) => super.noSuchMethod(
Invocation.setter(#auth, _auth),
set auth(_i2.AuthProvider? value) => super.noSuchMethod(
Invocation.setter(#auth, value),
returnValueForMissingStub: null,
);
@override
set client(_i3.Client? _client) => super.noSuchMethod(
Invocation.setter(#client, _client),
set client(_i3.Client? value) => super.noSuchMethod(
Invocation.setter(#client, value),
returnValueForMissingStub: null,
);

View File

@@ -35,6 +35,7 @@ import 'package:wger/providers/routines.dart' as _i12;
// ignore_for_file: unnecessary_parenthesis
// ignore_for_file: camel_case_types
// ignore_for_file: subtype_of_sealed_class
// ignore_for_file: invalid_use_of_internal_member
class _FakeWgerBaseProvider_0 extends _i1.SmartFake implements _i2.WgerBaseProvider {
_FakeWgerBaseProvider_0(Object parent, Invocation parentInvocation)
@@ -145,8 +146,8 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider {
as _i4.RepetitionUnit);
@override
set activeRoutine(_i5.Routine? _activeRoutine) => super.noSuchMethod(
Invocation.setter(#activeRoutine, _activeRoutine),
set activeRoutine(_i5.Routine? value) => super.noSuchMethod(
Invocation.setter(#activeRoutine, value),
returnValueForMissingStub: null,
);

View File

@@ -35,6 +35,7 @@ import 'package:wger/providers/routines.dart' as _i12;
// ignore_for_file: unnecessary_parenthesis
// ignore_for_file: camel_case_types
// ignore_for_file: subtype_of_sealed_class
// ignore_for_file: invalid_use_of_internal_member
class _FakeWgerBaseProvider_0 extends _i1.SmartFake implements _i2.WgerBaseProvider {
_FakeWgerBaseProvider_0(Object parent, Invocation parentInvocation)
@@ -145,8 +146,8 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider {
as _i4.RepetitionUnit);
@override
set activeRoutine(_i5.Routine? _activeRoutine) => super.noSuchMethod(
Invocation.setter(#activeRoutine, _activeRoutine),
set activeRoutine(_i5.Routine? value) => super.noSuchMethod(
Invocation.setter(#activeRoutine, value),
returnValueForMissingStub: null,
);

View File

@@ -23,6 +23,7 @@ import 'package:wger/providers/base_provider.dart' as _i4;
// ignore_for_file: unnecessary_parenthesis
// ignore_for_file: camel_case_types
// ignore_for_file: subtype_of_sealed_class
// ignore_for_file: invalid_use_of_internal_member
class _FakeAuthProvider_0 extends _i1.SmartFake implements _i2.AuthProvider {
_FakeAuthProvider_0(Object parent, Invocation parentInvocation) : super(parent, parentInvocation);
@@ -65,14 +66,14 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider {
as _i3.Client);
@override
set auth(_i2.AuthProvider? _auth) => super.noSuchMethod(
Invocation.setter(#auth, _auth),
set auth(_i2.AuthProvider? value) => super.noSuchMethod(
Invocation.setter(#auth, value),
returnValueForMissingStub: null,
);
@override
set client(_i3.Client? _client) => super.noSuchMethod(
Invocation.setter(#client, _client),
set client(_i3.Client? value) => super.noSuchMethod(
Invocation.setter(#client, value),
returnValueForMissingStub: null,
);

View File

@@ -34,6 +34,7 @@ import 'package:wger/providers/user.dart' as _i13;
// ignore_for_file: unnecessary_parenthesis
// ignore_for_file: camel_case_types
// ignore_for_file: subtype_of_sealed_class
// ignore_for_file: invalid_use_of_internal_member
class _FakeWgerBaseProvider_0 extends _i1.SmartFake implements _i2.WgerBaseProvider {
_FakeWgerBaseProvider_0(Object parent, Invocation parentInvocation)
@@ -231,20 +232,20 @@ class MockUserProvider extends _i1.Mock implements _i13.UserProvider {
as _i4.SharedPreferencesAsync);
@override
set themeMode(_i14.ThemeMode? _themeMode) => super.noSuchMethod(
Invocation.setter(#themeMode, _themeMode),
set themeMode(_i14.ThemeMode? value) => super.noSuchMethod(
Invocation.setter(#themeMode, value),
returnValueForMissingStub: null,
);
@override
set prefs(_i4.SharedPreferencesAsync? _prefs) => super.noSuchMethod(
Invocation.setter(#prefs, _prefs),
set prefs(_i4.SharedPreferencesAsync? value) => super.noSuchMethod(
Invocation.setter(#prefs, value),
returnValueForMissingStub: null,
);
@override
set profile(_i15.Profile? _profile) => super.noSuchMethod(
Invocation.setter(#profile, _profile),
set profile(_i15.Profile? value) => super.noSuchMethod(
Invocation.setter(#profile, value),
returnValueForMissingStub: null,
);
@@ -363,14 +364,14 @@ class MockNutritionPlansProvider extends _i1.Mock implements _i16.NutritionPlans
as List<_i6.NutritionalPlan>);
@override
set database(_i5.IngredientDatabase? _database) => super.noSuchMethod(
Invocation.setter(#database, _database),
set database(_i5.IngredientDatabase? value) => super.noSuchMethod(
Invocation.setter(#database, value),
returnValueForMissingStub: null,
);
@override
set ingredients(List<_i9.Ingredient>? _ingredients) => super.noSuchMethod(
Invocation.setter(#ingredients, _ingredients),
set ingredients(List<_i9.Ingredient>? value) => super.noSuchMethod(
Invocation.setter(#ingredients, value),
returnValueForMissingStub: null,
);