mirror of
https://github.com/wger-project/flutter.git
synced 2026-02-18 00:17:48 +01:00
Load the new DayData entries and the regular data objects from structure endpoint
This commit is contained in:
@@ -23,7 +23,7 @@ import '../test_data/profile.dart';
|
||||
import '../test_data/routines.dart';
|
||||
|
||||
Widget createDashboardScreen({locale = 'en'}) {
|
||||
final mockWorkoutProvider = MockWorkoutPlansProvider();
|
||||
final mockWorkoutProvider = MockRoutinesProvider();
|
||||
when(mockWorkoutProvider.activePlan).thenReturn(getWorkout(exercises: getScreenshotExercises()));
|
||||
|
||||
final Map<String, dynamic> logs = {
|
||||
@@ -60,7 +60,7 @@ Widget createDashboardScreen({locale = 'en'}) {
|
||||
ChangeNotifierProvider<UserProvider>(
|
||||
create: (context) => mockUserProvider,
|
||||
),
|
||||
ChangeNotifierProvider<WorkoutPlansProvider>(
|
||||
ChangeNotifierProvider<RoutinesProvider>(
|
||||
create: (context) => mockWorkoutProvider,
|
||||
),
|
||||
ChangeNotifierProvider<NutritionPlansProvider>(
|
||||
|
||||
@@ -13,14 +13,14 @@ import '../test_data/routines.dart';
|
||||
Widget createWorkoutDetailScreen({locale = 'en'}) {
|
||||
final key = GlobalKey<NavigatorState>();
|
||||
|
||||
final mockWorkoutProvider = MockWorkoutPlansProvider();
|
||||
final mockWorkoutProvider = MockRoutinesProvider();
|
||||
final workout = getWorkout(exercises: getScreenshotExercises());
|
||||
when(mockWorkoutProvider.activePlan).thenReturn(workout);
|
||||
when(mockWorkoutProvider.fetchAndSetWorkoutPlanFull(1)).thenAnswer((_) => Future.value(workout));
|
||||
|
||||
return MultiProvider(
|
||||
providers: [
|
||||
ChangeNotifierProvider<WorkoutPlansProvider>(
|
||||
ChangeNotifierProvider<RoutinesProvider>(
|
||||
create: (context) => mockWorkoutProvider,
|
||||
),
|
||||
],
|
||||
|
||||
@@ -25,8 +25,8 @@ Widget createGymModeScreen({locale = 'en'}) {
|
||||
//when(mockExerciseProvider.findExerciseBaseById(2)).thenReturn(bases[1]); // crunches
|
||||
//when(mockExerciseProvider.findExerciseBaseById(3)).thenReturn(bases[2]); // dead lift
|
||||
|
||||
return ChangeNotifierProvider<WorkoutPlansProvider>(
|
||||
create: (context) => WorkoutPlansProvider(
|
||||
return ChangeNotifierProvider<RoutinesProvider>(
|
||||
create: (context) => RoutinesProvider(
|
||||
mockBaseProvider,
|
||||
mockExerciseProvider,
|
||||
[workout],
|
||||
|
||||
@@ -7,9 +7,7 @@ class $ExercisesTable extends Exercises with TableInfo<$ExercisesTable, Exercise
|
||||
@override
|
||||
final GeneratedDatabase attachedDatabase;
|
||||
final String? _alias;
|
||||
|
||||
$ExercisesTable(this.attachedDatabase, [this._alias]);
|
||||
|
||||
static const VerificationMeta _idMeta = const VerificationMeta('id');
|
||||
@override
|
||||
late final GeneratedColumn<int> id = GeneratedColumn<int>('id', aliasedName, false,
|
||||
@@ -28,17 +26,13 @@ class $ExercisesTable extends Exercises with TableInfo<$ExercisesTable, Exercise
|
||||
late final GeneratedColumn<DateTime> lastFetched = GeneratedColumn<DateTime>(
|
||||
'last_fetched', aliasedName, false,
|
||||
type: DriftSqlType.dateTime, requiredDuringInsert: true);
|
||||
|
||||
@override
|
||||
List<GeneratedColumn> get $columns => [id, data, lastUpdate, lastFetched];
|
||||
|
||||
@override
|
||||
String get aliasedName => _alias ?? actualTableName;
|
||||
|
||||
@override
|
||||
String get actualTableName => $name;
|
||||
static const String $name = 'exercises';
|
||||
|
||||
@override
|
||||
VerificationContext validateIntegrity(Insertable<ExerciseTable> instance,
|
||||
{bool isInserting = false}) {
|
||||
@@ -71,7 +65,6 @@ class $ExercisesTable extends Exercises with TableInfo<$ExercisesTable, Exercise
|
||||
|
||||
@override
|
||||
Set<GeneratedColumn> get $primaryKey => const {};
|
||||
|
||||
@override
|
||||
ExerciseTable map(Map<String, dynamic> data, {String? tablePrefix}) {
|
||||
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
|
||||
@@ -100,10 +93,8 @@ class ExerciseTable extends DataClass implements Insertable<ExerciseTable> {
|
||||
/// when the exercise itself was last updated in `lastUpdate`, we can save
|
||||
/// ourselves a lot of requests if we don't check too often
|
||||
final DateTime lastFetched;
|
||||
|
||||
const ExerciseTable(
|
||||
{required this.id, required this.data, required this.lastUpdate, required this.lastFetched});
|
||||
|
||||
@override
|
||||
Map<String, Expression> toColumns(bool nullToAbsent) {
|
||||
final map = <String, Expression>{};
|
||||
@@ -132,7 +123,6 @@ class ExerciseTable extends DataClass implements Insertable<ExerciseTable> {
|
||||
lastFetched: serializer.fromJson<DateTime>(json['lastFetched']),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
|
||||
serializer ??= driftRuntimeOptions.defaultSerializer;
|
||||
@@ -151,7 +141,6 @@ class ExerciseTable extends DataClass implements Insertable<ExerciseTable> {
|
||||
lastUpdate: lastUpdate ?? this.lastUpdate,
|
||||
lastFetched: lastFetched ?? this.lastFetched,
|
||||
);
|
||||
|
||||
ExerciseTable copyWithCompanion(ExercisesCompanion data) {
|
||||
return ExerciseTable(
|
||||
id: data.id.present ? data.id.value : this.id,
|
||||
@@ -174,7 +163,6 @@ class ExerciseTable extends DataClass implements Insertable<ExerciseTable> {
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(id, data, lastUpdate, lastFetched);
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
@@ -191,7 +179,6 @@ class ExercisesCompanion extends UpdateCompanion<ExerciseTable> {
|
||||
final Value<DateTime> lastUpdate;
|
||||
final Value<DateTime> lastFetched;
|
||||
final Value<int> rowid;
|
||||
|
||||
const ExercisesCompanion({
|
||||
this.id = const Value.absent(),
|
||||
this.data = const Value.absent(),
|
||||
@@ -199,7 +186,6 @@ class ExercisesCompanion extends UpdateCompanion<ExerciseTable> {
|
||||
this.lastFetched = const Value.absent(),
|
||||
this.rowid = const Value.absent(),
|
||||
});
|
||||
|
||||
ExercisesCompanion.insert({
|
||||
required int id,
|
||||
required String data,
|
||||
@@ -210,7 +196,6 @@ class ExercisesCompanion extends UpdateCompanion<ExerciseTable> {
|
||||
data = Value(data),
|
||||
lastUpdate = Value(lastUpdate),
|
||||
lastFetched = Value(lastFetched);
|
||||
|
||||
static Insertable<ExerciseTable> custom({
|
||||
Expression<int>? id,
|
||||
Expression<String>? data,
|
||||
@@ -280,9 +265,7 @@ class $MusclesTable extends Muscles with TableInfo<$MusclesTable, MuscleTable> {
|
||||
@override
|
||||
final GeneratedDatabase attachedDatabase;
|
||||
final String? _alias;
|
||||
|
||||
$MusclesTable(this.attachedDatabase, [this._alias]);
|
||||
|
||||
static const VerificationMeta _idMeta = const VerificationMeta('id');
|
||||
@override
|
||||
late final GeneratedColumn<int> id = GeneratedColumn<int>('id', aliasedName, false,
|
||||
@@ -293,17 +276,13 @@ class $MusclesTable extends Muscles with TableInfo<$MusclesTable, MuscleTable> {
|
||||
'data', aliasedName, false,
|
||||
type: DriftSqlType.string, requiredDuringInsert: true)
|
||||
.withConverter<Muscle>($MusclesTable.$converterdata);
|
||||
|
||||
@override
|
||||
List<GeneratedColumn> get $columns => [id, data];
|
||||
|
||||
@override
|
||||
String get aliasedName => _alias ?? actualTableName;
|
||||
|
||||
@override
|
||||
String get actualTableName => $name;
|
||||
static const String $name = 'muscles';
|
||||
|
||||
@override
|
||||
VerificationContext validateIntegrity(Insertable<MuscleTable> instance,
|
||||
{bool isInserting = false}) {
|
||||
@@ -320,7 +299,6 @@ class $MusclesTable extends Muscles with TableInfo<$MusclesTable, MuscleTable> {
|
||||
|
||||
@override
|
||||
Set<GeneratedColumn> get $primaryKey => const {};
|
||||
|
||||
@override
|
||||
MuscleTable map(Map<String, dynamic> data, {String? tablePrefix}) {
|
||||
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
|
||||
@@ -342,9 +320,7 @@ class $MusclesTable extends Muscles with TableInfo<$MusclesTable, MuscleTable> {
|
||||
class MuscleTable extends DataClass implements Insertable<MuscleTable> {
|
||||
final int id;
|
||||
final Muscle data;
|
||||
|
||||
const MuscleTable({required this.id, required this.data});
|
||||
|
||||
@override
|
||||
Map<String, Expression> toColumns(bool nullToAbsent) {
|
||||
final map = <String, Expression>{};
|
||||
@@ -369,7 +345,6 @@ class MuscleTable extends DataClass implements Insertable<MuscleTable> {
|
||||
data: serializer.fromJson<Muscle>(json['data']),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
|
||||
serializer ??= driftRuntimeOptions.defaultSerializer;
|
||||
@@ -383,7 +358,6 @@ class MuscleTable extends DataClass implements Insertable<MuscleTable> {
|
||||
id: id ?? this.id,
|
||||
data: data ?? this.data,
|
||||
);
|
||||
|
||||
MuscleTable copyWithCompanion(MusclesCompanion data) {
|
||||
return MuscleTable(
|
||||
id: data.id.present ? data.id.value : this.id,
|
||||
@@ -402,7 +376,6 @@ class MuscleTable extends DataClass implements Insertable<MuscleTable> {
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(id, data);
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
@@ -413,20 +386,17 @@ class MusclesCompanion extends UpdateCompanion<MuscleTable> {
|
||||
final Value<int> id;
|
||||
final Value<Muscle> data;
|
||||
final Value<int> rowid;
|
||||
|
||||
const MusclesCompanion({
|
||||
this.id = const Value.absent(),
|
||||
this.data = const Value.absent(),
|
||||
this.rowid = const Value.absent(),
|
||||
});
|
||||
|
||||
MusclesCompanion.insert({
|
||||
required int id,
|
||||
required Muscle data,
|
||||
this.rowid = const Value.absent(),
|
||||
}) : id = Value(id),
|
||||
data = Value(data);
|
||||
|
||||
static Insertable<MuscleTable> custom({
|
||||
Expression<int>? id,
|
||||
Expression<String>? data,
|
||||
@@ -477,9 +447,7 @@ class $EquipmentsTable extends Equipments with TableInfo<$EquipmentsTable, Equip
|
||||
@override
|
||||
final GeneratedDatabase attachedDatabase;
|
||||
final String? _alias;
|
||||
|
||||
$EquipmentsTable(this.attachedDatabase, [this._alias]);
|
||||
|
||||
static const VerificationMeta _idMeta = const VerificationMeta('id');
|
||||
@override
|
||||
late final GeneratedColumn<int> id = GeneratedColumn<int>('id', aliasedName, false,
|
||||
@@ -490,17 +458,13 @@ class $EquipmentsTable extends Equipments with TableInfo<$EquipmentsTable, Equip
|
||||
'data', aliasedName, false,
|
||||
type: DriftSqlType.string, requiredDuringInsert: true)
|
||||
.withConverter<Equipment>($EquipmentsTable.$converterdata);
|
||||
|
||||
@override
|
||||
List<GeneratedColumn> get $columns => [id, data];
|
||||
|
||||
@override
|
||||
String get aliasedName => _alias ?? actualTableName;
|
||||
|
||||
@override
|
||||
String get actualTableName => $name;
|
||||
static const String $name = 'equipments';
|
||||
|
||||
@override
|
||||
VerificationContext validateIntegrity(Insertable<EquipmentTable> instance,
|
||||
{bool isInserting = false}) {
|
||||
@@ -517,7 +481,6 @@ class $EquipmentsTable extends Equipments with TableInfo<$EquipmentsTable, Equip
|
||||
|
||||
@override
|
||||
Set<GeneratedColumn> get $primaryKey => const {};
|
||||
|
||||
@override
|
||||
EquipmentTable map(Map<String, dynamic> data, {String? tablePrefix}) {
|
||||
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
|
||||
@@ -539,9 +502,7 @@ class $EquipmentsTable extends Equipments with TableInfo<$EquipmentsTable, Equip
|
||||
class EquipmentTable extends DataClass implements Insertable<EquipmentTable> {
|
||||
final int id;
|
||||
final Equipment data;
|
||||
|
||||
const EquipmentTable({required this.id, required this.data});
|
||||
|
||||
@override
|
||||
Map<String, Expression> toColumns(bool nullToAbsent) {
|
||||
final map = <String, Expression>{};
|
||||
@@ -566,7 +527,6 @@ class EquipmentTable extends DataClass implements Insertable<EquipmentTable> {
|
||||
data: serializer.fromJson<Equipment>(json['data']),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
|
||||
serializer ??= driftRuntimeOptions.defaultSerializer;
|
||||
@@ -580,7 +540,6 @@ class EquipmentTable extends DataClass implements Insertable<EquipmentTable> {
|
||||
id: id ?? this.id,
|
||||
data: data ?? this.data,
|
||||
);
|
||||
|
||||
EquipmentTable copyWithCompanion(EquipmentsCompanion data) {
|
||||
return EquipmentTable(
|
||||
id: data.id.present ? data.id.value : this.id,
|
||||
@@ -599,7 +558,6 @@ class EquipmentTable extends DataClass implements Insertable<EquipmentTable> {
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(id, data);
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
@@ -610,20 +568,17 @@ class EquipmentsCompanion extends UpdateCompanion<EquipmentTable> {
|
||||
final Value<int> id;
|
||||
final Value<Equipment> data;
|
||||
final Value<int> rowid;
|
||||
|
||||
const EquipmentsCompanion({
|
||||
this.id = const Value.absent(),
|
||||
this.data = const Value.absent(),
|
||||
this.rowid = const Value.absent(),
|
||||
});
|
||||
|
||||
EquipmentsCompanion.insert({
|
||||
required int id,
|
||||
required Equipment data,
|
||||
this.rowid = const Value.absent(),
|
||||
}) : id = Value(id),
|
||||
data = Value(data);
|
||||
|
||||
static Insertable<EquipmentTable> custom({
|
||||
Expression<int>? id,
|
||||
Expression<String>? data,
|
||||
@@ -674,9 +629,7 @@ class $CategoriesTable extends Categories with TableInfo<$CategoriesTable, Categ
|
||||
@override
|
||||
final GeneratedDatabase attachedDatabase;
|
||||
final String? _alias;
|
||||
|
||||
$CategoriesTable(this.attachedDatabase, [this._alias]);
|
||||
|
||||
static const VerificationMeta _idMeta = const VerificationMeta('id');
|
||||
@override
|
||||
late final GeneratedColumn<int> id = GeneratedColumn<int>('id', aliasedName, false,
|
||||
@@ -687,17 +640,13 @@ class $CategoriesTable extends Categories with TableInfo<$CategoriesTable, Categ
|
||||
GeneratedColumn<String>('data', aliasedName, false,
|
||||
type: DriftSqlType.string, requiredDuringInsert: true)
|
||||
.withConverter<ExerciseCategory>($CategoriesTable.$converterdata);
|
||||
|
||||
@override
|
||||
List<GeneratedColumn> get $columns => [id, data];
|
||||
|
||||
@override
|
||||
String get aliasedName => _alias ?? actualTableName;
|
||||
|
||||
@override
|
||||
String get actualTableName => $name;
|
||||
static const String $name = 'categories';
|
||||
|
||||
@override
|
||||
VerificationContext validateIntegrity(Insertable<CategoryTable> instance,
|
||||
{bool isInserting = false}) {
|
||||
@@ -714,7 +663,6 @@ class $CategoriesTable extends Categories with TableInfo<$CategoriesTable, Categ
|
||||
|
||||
@override
|
||||
Set<GeneratedColumn> get $primaryKey => const {};
|
||||
|
||||
@override
|
||||
CategoryTable map(Map<String, dynamic> data, {String? tablePrefix}) {
|
||||
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
|
||||
@@ -736,9 +684,7 @@ class $CategoriesTable extends Categories with TableInfo<$CategoriesTable, Categ
|
||||
class CategoryTable extends DataClass implements Insertable<CategoryTable> {
|
||||
final int id;
|
||||
final ExerciseCategory data;
|
||||
|
||||
const CategoryTable({required this.id, required this.data});
|
||||
|
||||
@override
|
||||
Map<String, Expression> toColumns(bool nullToAbsent) {
|
||||
final map = <String, Expression>{};
|
||||
@@ -763,7 +709,6 @@ class CategoryTable extends DataClass implements Insertable<CategoryTable> {
|
||||
data: serializer.fromJson<ExerciseCategory>(json['data']),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
|
||||
serializer ??= driftRuntimeOptions.defaultSerializer;
|
||||
@@ -777,7 +722,6 @@ class CategoryTable extends DataClass implements Insertable<CategoryTable> {
|
||||
id: id ?? this.id,
|
||||
data: data ?? this.data,
|
||||
);
|
||||
|
||||
CategoryTable copyWithCompanion(CategoriesCompanion data) {
|
||||
return CategoryTable(
|
||||
id: data.id.present ? data.id.value : this.id,
|
||||
@@ -796,7 +740,6 @@ class CategoryTable extends DataClass implements Insertable<CategoryTable> {
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(id, data);
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
@@ -807,20 +750,17 @@ class CategoriesCompanion extends UpdateCompanion<CategoryTable> {
|
||||
final Value<int> id;
|
||||
final Value<ExerciseCategory> data;
|
||||
final Value<int> rowid;
|
||||
|
||||
const CategoriesCompanion({
|
||||
this.id = const Value.absent(),
|
||||
this.data = const Value.absent(),
|
||||
this.rowid = const Value.absent(),
|
||||
});
|
||||
|
||||
CategoriesCompanion.insert({
|
||||
required int id,
|
||||
required ExerciseCategory data,
|
||||
this.rowid = const Value.absent(),
|
||||
}) : id = Value(id),
|
||||
data = Value(data);
|
||||
|
||||
static Insertable<CategoryTable> custom({
|
||||
Expression<int>? id,
|
||||
Expression<String>? data,
|
||||
@@ -871,9 +811,7 @@ class $LanguagesTable extends Languages with TableInfo<$LanguagesTable, Language
|
||||
@override
|
||||
final GeneratedDatabase attachedDatabase;
|
||||
final String? _alias;
|
||||
|
||||
$LanguagesTable(this.attachedDatabase, [this._alias]);
|
||||
|
||||
static const VerificationMeta _idMeta = const VerificationMeta('id');
|
||||
@override
|
||||
late final GeneratedColumn<int> id = GeneratedColumn<int>('id', aliasedName, false,
|
||||
@@ -884,17 +822,13 @@ class $LanguagesTable extends Languages with TableInfo<$LanguagesTable, Language
|
||||
'data', aliasedName, false,
|
||||
type: DriftSqlType.string, requiredDuringInsert: true)
|
||||
.withConverter<Language>($LanguagesTable.$converterdata);
|
||||
|
||||
@override
|
||||
List<GeneratedColumn> get $columns => [id, data];
|
||||
|
||||
@override
|
||||
String get aliasedName => _alias ?? actualTableName;
|
||||
|
||||
@override
|
||||
String get actualTableName => $name;
|
||||
static const String $name = 'languages';
|
||||
|
||||
@override
|
||||
VerificationContext validateIntegrity(Insertable<LanguagesTable> instance,
|
||||
{bool isInserting = false}) {
|
||||
@@ -911,7 +845,6 @@ class $LanguagesTable extends Languages with TableInfo<$LanguagesTable, Language
|
||||
|
||||
@override
|
||||
Set<GeneratedColumn> get $primaryKey => const {};
|
||||
|
||||
@override
|
||||
LanguagesTable map(Map<String, dynamic> data, {String? tablePrefix}) {
|
||||
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
|
||||
@@ -933,9 +866,7 @@ class $LanguagesTable extends Languages with TableInfo<$LanguagesTable, Language
|
||||
class LanguagesTable extends DataClass implements Insertable<LanguagesTable> {
|
||||
final int id;
|
||||
final Language data;
|
||||
|
||||
const LanguagesTable({required this.id, required this.data});
|
||||
|
||||
@override
|
||||
Map<String, Expression> toColumns(bool nullToAbsent) {
|
||||
final map = <String, Expression>{};
|
||||
@@ -960,7 +891,6 @@ class LanguagesTable extends DataClass implements Insertable<LanguagesTable> {
|
||||
data: serializer.fromJson<Language>(json['data']),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
|
||||
serializer ??= driftRuntimeOptions.defaultSerializer;
|
||||
@@ -974,7 +904,6 @@ class LanguagesTable extends DataClass implements Insertable<LanguagesTable> {
|
||||
id: id ?? this.id,
|
||||
data: data ?? this.data,
|
||||
);
|
||||
|
||||
LanguagesTable copyWithCompanion(LanguagesCompanion data) {
|
||||
return LanguagesTable(
|
||||
id: data.id.present ? data.id.value : this.id,
|
||||
@@ -993,7 +922,6 @@ class LanguagesTable extends DataClass implements Insertable<LanguagesTable> {
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(id, data);
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
@@ -1004,20 +932,17 @@ class LanguagesCompanion extends UpdateCompanion<LanguagesTable> {
|
||||
final Value<int> id;
|
||||
final Value<Language> data;
|
||||
final Value<int> rowid;
|
||||
|
||||
const LanguagesCompanion({
|
||||
this.id = const Value.absent(),
|
||||
this.data = const Value.absent(),
|
||||
this.rowid = const Value.absent(),
|
||||
});
|
||||
|
||||
LanguagesCompanion.insert({
|
||||
required int id,
|
||||
required Language data,
|
||||
this.rowid = const Value.absent(),
|
||||
}) : id = Value(id),
|
||||
data = Value(data);
|
||||
|
||||
static Insertable<LanguagesTable> custom({
|
||||
Expression<int>? id,
|
||||
Expression<String>? data,
|
||||
@@ -1066,18 +991,15 @@ class LanguagesCompanion extends UpdateCompanion<LanguagesTable> {
|
||||
|
||||
abstract class _$ExerciseDatabase extends GeneratedDatabase {
|
||||
_$ExerciseDatabase(QueryExecutor e) : super(e);
|
||||
|
||||
$ExerciseDatabaseManager get managers => $ExerciseDatabaseManager(this);
|
||||
late final $ExercisesTable exercises = $ExercisesTable(this);
|
||||
late final $MusclesTable muscles = $MusclesTable(this);
|
||||
late final $EquipmentsTable equipments = $EquipmentsTable(this);
|
||||
late final $CategoriesTable categories = $CategoriesTable(this);
|
||||
late final $LanguagesTable languages = $LanguagesTable(this);
|
||||
|
||||
@override
|
||||
Iterable<TableInfo<Table, Object?>> get allTables =>
|
||||
allSchemaEntities.whereType<TableInfo<Table, Object?>>();
|
||||
|
||||
@override
|
||||
List<DatabaseSchemaEntity> get allSchemaEntities =>
|
||||
[exercises, muscles, equipments, categories, languages];
|
||||
@@ -1106,7 +1028,6 @@ class $$ExercisesTableFilterComposer extends Composer<_$ExerciseDatabase, $Exerc
|
||||
super.$addJoinBuilderToRootComposer,
|
||||
super.$removeJoinBuilderFromRootComposer,
|
||||
});
|
||||
|
||||
ColumnFilters<int> get id =>
|
||||
$composableBuilder(column: $table.id, builder: (column) => ColumnFilters(column));
|
||||
|
||||
@@ -1128,7 +1049,6 @@ class $$ExercisesTableOrderingComposer extends Composer<_$ExerciseDatabase, $Exe
|
||||
super.$addJoinBuilderToRootComposer,
|
||||
super.$removeJoinBuilderFromRootComposer,
|
||||
});
|
||||
|
||||
ColumnOrderings<int> get id =>
|
||||
$composableBuilder(column: $table.id, builder: (column) => ColumnOrderings(column));
|
||||
|
||||
@@ -1150,7 +1070,6 @@ class $$ExercisesTableAnnotationComposer extends Composer<_$ExerciseDatabase, $E
|
||||
super.$addJoinBuilderToRootComposer,
|
||||
super.$removeJoinBuilderFromRootComposer,
|
||||
});
|
||||
|
||||
GeneratedColumn<int> get id => $composableBuilder(column: $table.id, builder: (column) => column);
|
||||
|
||||
GeneratedColumn<String> get data =>
|
||||
@@ -1248,7 +1167,6 @@ class $$MusclesTableFilterComposer extends Composer<_$ExerciseDatabase, $Muscles
|
||||
super.$addJoinBuilderToRootComposer,
|
||||
super.$removeJoinBuilderFromRootComposer,
|
||||
});
|
||||
|
||||
ColumnFilters<int> get id =>
|
||||
$composableBuilder(column: $table.id, builder: (column) => ColumnFilters(column));
|
||||
|
||||
@@ -1264,7 +1182,6 @@ class $$MusclesTableOrderingComposer extends Composer<_$ExerciseDatabase, $Muscl
|
||||
super.$addJoinBuilderToRootComposer,
|
||||
super.$removeJoinBuilderFromRootComposer,
|
||||
});
|
||||
|
||||
ColumnOrderings<int> get id =>
|
||||
$composableBuilder(column: $table.id, builder: (column) => ColumnOrderings(column));
|
||||
|
||||
@@ -1280,7 +1197,6 @@ class $$MusclesTableAnnotationComposer extends Composer<_$ExerciseDatabase, $Mus
|
||||
super.$addJoinBuilderToRootComposer,
|
||||
super.$removeJoinBuilderFromRootComposer,
|
||||
});
|
||||
|
||||
GeneratedColumn<int> get id => $composableBuilder(column: $table.id, builder: (column) => column);
|
||||
|
||||
GeneratedColumnWithTypeConverter<Muscle, String> get data =>
|
||||
@@ -1364,7 +1280,6 @@ class $$EquipmentsTableFilterComposer extends Composer<_$ExerciseDatabase, $Equi
|
||||
super.$addJoinBuilderToRootComposer,
|
||||
super.$removeJoinBuilderFromRootComposer,
|
||||
});
|
||||
|
||||
ColumnFilters<int> get id =>
|
||||
$composableBuilder(column: $table.id, builder: (column) => ColumnFilters(column));
|
||||
|
||||
@@ -1380,7 +1295,6 @@ class $$EquipmentsTableOrderingComposer extends Composer<_$ExerciseDatabase, $Eq
|
||||
super.$addJoinBuilderToRootComposer,
|
||||
super.$removeJoinBuilderFromRootComposer,
|
||||
});
|
||||
|
||||
ColumnOrderings<int> get id =>
|
||||
$composableBuilder(column: $table.id, builder: (column) => ColumnOrderings(column));
|
||||
|
||||
@@ -1396,7 +1310,6 @@ class $$EquipmentsTableAnnotationComposer extends Composer<_$ExerciseDatabase, $
|
||||
super.$addJoinBuilderToRootComposer,
|
||||
super.$removeJoinBuilderFromRootComposer,
|
||||
});
|
||||
|
||||
GeneratedColumn<int> get id => $composableBuilder(column: $table.id, builder: (column) => column);
|
||||
|
||||
GeneratedColumnWithTypeConverter<Equipment, String> get data =>
|
||||
@@ -1480,7 +1393,6 @@ class $$CategoriesTableFilterComposer extends Composer<_$ExerciseDatabase, $Cate
|
||||
super.$addJoinBuilderToRootComposer,
|
||||
super.$removeJoinBuilderFromRootComposer,
|
||||
});
|
||||
|
||||
ColumnFilters<int> get id =>
|
||||
$composableBuilder(column: $table.id, builder: (column) => ColumnFilters(column));
|
||||
|
||||
@@ -1497,7 +1409,6 @@ class $$CategoriesTableOrderingComposer extends Composer<_$ExerciseDatabase, $Ca
|
||||
super.$addJoinBuilderToRootComposer,
|
||||
super.$removeJoinBuilderFromRootComposer,
|
||||
});
|
||||
|
||||
ColumnOrderings<int> get id =>
|
||||
$composableBuilder(column: $table.id, builder: (column) => ColumnOrderings(column));
|
||||
|
||||
@@ -1513,7 +1424,6 @@ class $$CategoriesTableAnnotationComposer extends Composer<_$ExerciseDatabase, $
|
||||
super.$addJoinBuilderToRootComposer,
|
||||
super.$removeJoinBuilderFromRootComposer,
|
||||
});
|
||||
|
||||
GeneratedColumn<int> get id => $composableBuilder(column: $table.id, builder: (column) => column);
|
||||
|
||||
GeneratedColumnWithTypeConverter<ExerciseCategory, String> get data =>
|
||||
@@ -1597,7 +1507,6 @@ class $$LanguagesTableFilterComposer extends Composer<_$ExerciseDatabase, $Langu
|
||||
super.$addJoinBuilderToRootComposer,
|
||||
super.$removeJoinBuilderFromRootComposer,
|
||||
});
|
||||
|
||||
ColumnFilters<int> get id =>
|
||||
$composableBuilder(column: $table.id, builder: (column) => ColumnFilters(column));
|
||||
|
||||
@@ -1613,7 +1522,6 @@ class $$LanguagesTableOrderingComposer extends Composer<_$ExerciseDatabase, $Lan
|
||||
super.$addJoinBuilderToRootComposer,
|
||||
super.$removeJoinBuilderFromRootComposer,
|
||||
});
|
||||
|
||||
ColumnOrderings<int> get id =>
|
||||
$composableBuilder(column: $table.id, builder: (column) => ColumnOrderings(column));
|
||||
|
||||
@@ -1629,7 +1537,6 @@ class $$LanguagesTableAnnotationComposer extends Composer<_$ExerciseDatabase, $L
|
||||
super.$addJoinBuilderToRootComposer,
|
||||
super.$removeJoinBuilderFromRootComposer,
|
||||
});
|
||||
|
||||
GeneratedColumn<int> get id => $composableBuilder(column: $table.id, builder: (column) => column);
|
||||
|
||||
GeneratedColumnWithTypeConverter<Language, String> get data =>
|
||||
@@ -1697,18 +1604,12 @@ typedef $$LanguagesTableProcessedTableManager = ProcessedTableManager<
|
||||
|
||||
class $ExerciseDatabaseManager {
|
||||
final _$ExerciseDatabase _db;
|
||||
|
||||
$ExerciseDatabaseManager(this._db);
|
||||
|
||||
$$ExercisesTableTableManager get exercises => $$ExercisesTableTableManager(_db, _db.exercises);
|
||||
|
||||
$$MusclesTableTableManager get muscles => $$MusclesTableTableManager(_db, _db.muscles);
|
||||
|
||||
$$EquipmentsTableTableManager get equipments =>
|
||||
$$EquipmentsTableTableManager(_db, _db.equipments);
|
||||
|
||||
$$CategoriesTableTableManager get categories =>
|
||||
$$CategoriesTableTableManager(_db, _db.categories);
|
||||
|
||||
$$LanguagesTableTableManager get languages => $$LanguagesTableTableManager(_db, _db.languages);
|
||||
}
|
||||
|
||||
@@ -7,9 +7,7 @@ class $IngredientsTable extends Ingredients with TableInfo<$IngredientsTable, In
|
||||
@override
|
||||
final GeneratedDatabase attachedDatabase;
|
||||
final String? _alias;
|
||||
|
||||
$IngredientsTable(this.attachedDatabase, [this._alias]);
|
||||
|
||||
static const VerificationMeta _idMeta = const VerificationMeta('id');
|
||||
@override
|
||||
late final GeneratedColumn<int> id = GeneratedColumn<int>('id', aliasedName, false,
|
||||
@@ -23,17 +21,13 @@ class $IngredientsTable extends Ingredients with TableInfo<$IngredientsTable, In
|
||||
late final GeneratedColumn<DateTime> lastFetched = GeneratedColumn<DateTime>(
|
||||
'last_fetched', aliasedName, false,
|
||||
type: DriftSqlType.dateTime, requiredDuringInsert: true);
|
||||
|
||||
@override
|
||||
List<GeneratedColumn> get $columns => [id, data, lastFetched];
|
||||
|
||||
@override
|
||||
String get aliasedName => _alias ?? actualTableName;
|
||||
|
||||
@override
|
||||
String get actualTableName => $name;
|
||||
static const String $name = 'ingredients';
|
||||
|
||||
@override
|
||||
VerificationContext validateIntegrity(Insertable<IngredientTable> instance,
|
||||
{bool isInserting = false}) {
|
||||
@@ -60,7 +54,6 @@ class $IngredientsTable extends Ingredients with TableInfo<$IngredientsTable, In
|
||||
|
||||
@override
|
||||
Set<GeneratedColumn> get $primaryKey => const {};
|
||||
|
||||
@override
|
||||
IngredientTable map(Map<String, dynamic> data, {String? tablePrefix}) {
|
||||
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
|
||||
@@ -84,9 +77,7 @@ class IngredientTable extends DataClass implements Insertable<IngredientTable> {
|
||||
|
||||
/// The date when the ingredient was last fetched from the server
|
||||
final DateTime lastFetched;
|
||||
|
||||
const IngredientTable({required this.id, required this.data, required this.lastFetched});
|
||||
|
||||
@override
|
||||
Map<String, Expression> toColumns(bool nullToAbsent) {
|
||||
final map = <String, Expression>{};
|
||||
@@ -112,7 +103,6 @@ class IngredientTable extends DataClass implements Insertable<IngredientTable> {
|
||||
lastFetched: serializer.fromJson<DateTime>(json['lastFetched']),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
|
||||
serializer ??= driftRuntimeOptions.defaultSerializer;
|
||||
@@ -128,7 +118,6 @@ class IngredientTable extends DataClass implements Insertable<IngredientTable> {
|
||||
data: data ?? this.data,
|
||||
lastFetched: lastFetched ?? this.lastFetched,
|
||||
);
|
||||
|
||||
IngredientTable copyWithCompanion(IngredientsCompanion data) {
|
||||
return IngredientTable(
|
||||
id: data.id.present ? data.id.value : this.id,
|
||||
@@ -149,7 +138,6 @@ class IngredientTable extends DataClass implements Insertable<IngredientTable> {
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(id, data, lastFetched);
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
@@ -164,14 +152,12 @@ class IngredientsCompanion extends UpdateCompanion<IngredientTable> {
|
||||
final Value<String> data;
|
||||
final Value<DateTime> lastFetched;
|
||||
final Value<int> rowid;
|
||||
|
||||
const IngredientsCompanion({
|
||||
this.id = const Value.absent(),
|
||||
this.data = const Value.absent(),
|
||||
this.lastFetched = const Value.absent(),
|
||||
this.rowid = const Value.absent(),
|
||||
});
|
||||
|
||||
IngredientsCompanion.insert({
|
||||
required int id,
|
||||
required String data,
|
||||
@@ -180,7 +166,6 @@ class IngredientsCompanion extends UpdateCompanion<IngredientTable> {
|
||||
}) : id = Value(id),
|
||||
data = Value(data),
|
||||
lastFetched = Value(lastFetched);
|
||||
|
||||
static Insertable<IngredientTable> custom({
|
||||
Expression<int>? id,
|
||||
Expression<String>? data,
|
||||
@@ -237,14 +222,11 @@ class IngredientsCompanion extends UpdateCompanion<IngredientTable> {
|
||||
|
||||
abstract class _$IngredientDatabase extends GeneratedDatabase {
|
||||
_$IngredientDatabase(QueryExecutor e) : super(e);
|
||||
|
||||
$IngredientDatabaseManager get managers => $IngredientDatabaseManager(this);
|
||||
late final $IngredientsTable ingredients = $IngredientsTable(this);
|
||||
|
||||
@override
|
||||
Iterable<TableInfo<Table, Object?>> get allTables =>
|
||||
allSchemaEntities.whereType<TableInfo<Table, Object?>>();
|
||||
|
||||
@override
|
||||
List<DatabaseSchemaEntity> get allSchemaEntities => [ingredients];
|
||||
}
|
||||
@@ -270,7 +252,6 @@ class $$IngredientsTableFilterComposer extends Composer<_$IngredientDatabase, $I
|
||||
super.$addJoinBuilderToRootComposer,
|
||||
super.$removeJoinBuilderFromRootComposer,
|
||||
});
|
||||
|
||||
ColumnFilters<int> get id =>
|
||||
$composableBuilder(column: $table.id, builder: (column) => ColumnFilters(column));
|
||||
|
||||
@@ -289,7 +270,6 @@ class $$IngredientsTableOrderingComposer extends Composer<_$IngredientDatabase,
|
||||
super.$addJoinBuilderToRootComposer,
|
||||
super.$removeJoinBuilderFromRootComposer,
|
||||
});
|
||||
|
||||
ColumnOrderings<int> get id =>
|
||||
$composableBuilder(column: $table.id, builder: (column) => ColumnOrderings(column));
|
||||
|
||||
@@ -309,7 +289,6 @@ class $$IngredientsTableAnnotationComposer
|
||||
super.$addJoinBuilderToRootComposer,
|
||||
super.$removeJoinBuilderFromRootComposer,
|
||||
});
|
||||
|
||||
GeneratedColumn<int> get id => $composableBuilder(column: $table.id, builder: (column) => column);
|
||||
|
||||
GeneratedColumn<String> get data =>
|
||||
@@ -384,9 +363,7 @@ typedef $$IngredientsTableProcessedTableManager = ProcessedTableManager<
|
||||
|
||||
class $IngredientDatabaseManager {
|
||||
final _$IngredientDatabase _db;
|
||||
|
||||
$IngredientDatabaseManager(this._db);
|
||||
|
||||
$$IngredientsTableTableManager get ingredients =>
|
||||
$$IngredientsTableTableManager(_db, _db.ingredients);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
String? numToString(num? e) {
|
||||
if (e == null) {
|
||||
return null;
|
||||
|
||||
@@ -134,7 +134,7 @@ dynamic showDeleteDialog(
|
||||
),
|
||||
onPressed: () {
|
||||
exerciseData[exercise]!.removeWhere((el) => el.id == log.id);
|
||||
Provider.of<WorkoutPlansProvider>(context, listen: false).deleteLog(
|
||||
Provider.of<RoutinesProvider>(context, listen: false).deleteLog(
|
||||
log,
|
||||
);
|
||||
|
||||
|
||||
@@ -81,14 +81,14 @@ class MyApp extends StatelessWidget {
|
||||
update: (context, base, previous) =>
|
||||
previous ?? ExercisesProvider(WgerBaseProvider(base)),
|
||||
),
|
||||
ChangeNotifierProxyProvider2<AuthProvider, ExercisesProvider, WorkoutPlansProvider>(
|
||||
create: (context) => WorkoutPlansProvider(
|
||||
ChangeNotifierProxyProvider2<AuthProvider, ExercisesProvider, RoutinesProvider>(
|
||||
create: (context) => RoutinesProvider(
|
||||
WgerBaseProvider(Provider.of(context, listen: false)),
|
||||
Provider.of(context, listen: false),
|
||||
[],
|
||||
),
|
||||
update: (context, auth, exercises, previous) =>
|
||||
previous ?? WorkoutPlansProvider(WgerBaseProvider(auth), exercises, []),
|
||||
previous ?? RoutinesProvider(WgerBaseProvider(auth), exercises, []),
|
||||
),
|
||||
ChangeNotifierProxyProvider<AuthProvider, NutritionPlansProvider>(
|
||||
create: (context) => NutritionPlansProvider(
|
||||
|
||||
@@ -35,7 +35,7 @@ class ExerciseApiData with _$ExerciseApiData {
|
||||
// ignore: invalid_annotation_target
|
||||
required List<Equipment> equipment,
|
||||
// ignore: invalid_annotation_target
|
||||
@JsonKey(name: 'exercises') required List<Translation> translations,
|
||||
@JsonKey(name: 'translations') required List<Translation> translations,
|
||||
required List<ExerciseImage> images,
|
||||
required List<Video> videos,
|
||||
// ignore: invalid_annotation_target
|
||||
|
||||
@@ -21,7 +21,6 @@ ExerciseApiData _$ExerciseApiDataFromJson(Map<String, dynamic> json) {
|
||||
/// @nodoc
|
||||
mixin _$ExerciseApiData {
|
||||
int get id => throw _privateConstructorUsedError;
|
||||
|
||||
String get uuid => throw _privateConstructorUsedError; // ignore: invalid_annotation_target
|
||||
@JsonKey(name: 'variations')
|
||||
int? get variationId => throw _privateConstructorUsedError; // ignore: invalid_annotation_target
|
||||
@@ -32,9 +31,7 @@ mixin _$ExerciseApiData {
|
||||
throw _privateConstructorUsedError; // ignore: invalid_annotation_target
|
||||
@JsonKey(name: 'last_update_global')
|
||||
DateTime get lastUpdateGlobal => throw _privateConstructorUsedError;
|
||||
|
||||
ExerciseCategory get category => throw _privateConstructorUsedError;
|
||||
|
||||
List<Muscle> get muscles =>
|
||||
throw _privateConstructorUsedError; // ignore: invalid_annotation_target
|
||||
@JsonKey(name: 'muscles_secondary')
|
||||
@@ -42,11 +39,9 @@ mixin _$ExerciseApiData {
|
||||
throw _privateConstructorUsedError; // ignore: invalid_annotation_target
|
||||
List<Equipment> get equipment =>
|
||||
throw _privateConstructorUsedError; // ignore: invalid_annotation_target
|
||||
@JsonKey(name: 'exercises')
|
||||
@JsonKey(name: 'translations')
|
||||
List<Translation> get translations => throw _privateConstructorUsedError;
|
||||
|
||||
List<ExerciseImage> get images => throw _privateConstructorUsedError;
|
||||
|
||||
List<Video> get videos => throw _privateConstructorUsedError; // ignore: invalid_annotation_target
|
||||
@JsonKey(name: 'author_history')
|
||||
List<String> get authors =>
|
||||
@@ -67,7 +62,6 @@ mixin _$ExerciseApiData {
|
||||
abstract class $ExerciseApiDataCopyWith<$Res> {
|
||||
factory $ExerciseApiDataCopyWith(ExerciseApiData value, $Res Function(ExerciseApiData) then) =
|
||||
_$ExerciseApiDataCopyWithImpl<$Res, ExerciseApiData>;
|
||||
|
||||
@useResult
|
||||
$Res call(
|
||||
{int id,
|
||||
@@ -80,7 +74,7 @@ abstract class $ExerciseApiDataCopyWith<$Res> {
|
||||
List<Muscle> muscles,
|
||||
@JsonKey(name: 'muscles_secondary') List<Muscle> musclesSecondary,
|
||||
List<Equipment> equipment,
|
||||
@JsonKey(name: 'exercises') List<Translation> translations,
|
||||
@JsonKey(name: 'translations') List<Translation> translations,
|
||||
List<ExerciseImage> images,
|
||||
List<Video> videos,
|
||||
@JsonKey(name: 'author_history') List<String> authors,
|
||||
@@ -94,7 +88,6 @@ class _$ExerciseApiDataCopyWithImpl<$Res, $Val extends ExerciseApiData>
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
@@ -189,7 +182,6 @@ abstract class _$$ExerciseBaseDataImplCopyWith<$Res> implements $ExerciseApiData
|
||||
factory _$$ExerciseBaseDataImplCopyWith(
|
||||
_$ExerciseBaseDataImpl value, $Res Function(_$ExerciseBaseDataImpl) then) =
|
||||
__$$ExerciseBaseDataImplCopyWithImpl<$Res>;
|
||||
|
||||
@override
|
||||
@useResult
|
||||
$Res call(
|
||||
@@ -203,7 +195,7 @@ abstract class _$$ExerciseBaseDataImplCopyWith<$Res> implements $ExerciseApiData
|
||||
List<Muscle> muscles,
|
||||
@JsonKey(name: 'muscles_secondary') List<Muscle> musclesSecondary,
|
||||
List<Equipment> equipment,
|
||||
@JsonKey(name: 'exercises') List<Translation> translations,
|
||||
@JsonKey(name: 'translations') List<Translation> translations,
|
||||
List<ExerciseImage> images,
|
||||
List<Video> videos,
|
||||
@JsonKey(name: 'author_history') List<String> authors,
|
||||
@@ -318,7 +310,7 @@ 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: 'exercises') required final List<Translation> translations,
|
||||
@JsonKey(name: 'translations') required final List<Translation> translations,
|
||||
required final List<ExerciseImage> images,
|
||||
required final List<Video> videos,
|
||||
@JsonKey(name: 'author_history') required final List<String> authors,
|
||||
@@ -339,22 +331,18 @@ class _$ExerciseBaseDataImpl implements _ExerciseBaseData {
|
||||
final int id;
|
||||
@override
|
||||
final String uuid;
|
||||
|
||||
// ignore: invalid_annotation_target
|
||||
@override
|
||||
@JsonKey(name: 'variations')
|
||||
final int? variationId;
|
||||
|
||||
// ignore: invalid_annotation_target
|
||||
@override
|
||||
@JsonKey(name: 'created')
|
||||
final DateTime created;
|
||||
|
||||
// ignore: invalid_annotation_target
|
||||
@override
|
||||
@JsonKey(name: 'last_update')
|
||||
final DateTime lastUpdate;
|
||||
|
||||
// ignore: invalid_annotation_target
|
||||
@override
|
||||
@JsonKey(name: 'last_update_global')
|
||||
@@ -362,7 +350,6 @@ class _$ExerciseBaseDataImpl implements _ExerciseBaseData {
|
||||
@override
|
||||
final ExerciseCategory category;
|
||||
final List<Muscle> _muscles;
|
||||
|
||||
@override
|
||||
List<Muscle> get muscles {
|
||||
if (_muscles is EqualUnmodifiableListView) return _muscles;
|
||||
@@ -372,7 +359,6 @@ class _$ExerciseBaseDataImpl implements _ExerciseBaseData {
|
||||
|
||||
// ignore: invalid_annotation_target
|
||||
final List<Muscle> _musclesSecondary;
|
||||
|
||||
// ignore: invalid_annotation_target
|
||||
@override
|
||||
@JsonKey(name: 'muscles_secondary')
|
||||
@@ -384,7 +370,6 @@ class _$ExerciseBaseDataImpl implements _ExerciseBaseData {
|
||||
|
||||
// ignore: invalid_annotation_target
|
||||
final List<Equipment> _equipment;
|
||||
|
||||
// ignore: invalid_annotation_target
|
||||
@override
|
||||
List<Equipment> get equipment {
|
||||
@@ -395,10 +380,9 @@ class _$ExerciseBaseDataImpl implements _ExerciseBaseData {
|
||||
|
||||
// ignore: invalid_annotation_target
|
||||
final List<Translation> _translations;
|
||||
|
||||
// ignore: invalid_annotation_target
|
||||
@override
|
||||
@JsonKey(name: 'exercises')
|
||||
@JsonKey(name: 'translations')
|
||||
List<Translation> get translations {
|
||||
if (_translations is EqualUnmodifiableListView) return _translations;
|
||||
// ignore: implicit_dynamic_type
|
||||
@@ -406,7 +390,6 @@ class _$ExerciseBaseDataImpl implements _ExerciseBaseData {
|
||||
}
|
||||
|
||||
final List<ExerciseImage> _images;
|
||||
|
||||
@override
|
||||
List<ExerciseImage> get images {
|
||||
if (_images is EqualUnmodifiableListView) return _images;
|
||||
@@ -415,7 +398,6 @@ class _$ExerciseBaseDataImpl implements _ExerciseBaseData {
|
||||
}
|
||||
|
||||
final List<Video> _videos;
|
||||
|
||||
@override
|
||||
List<Video> get videos {
|
||||
if (_videos is EqualUnmodifiableListView) return _videos;
|
||||
@@ -425,7 +407,6 @@ class _$ExerciseBaseDataImpl implements _ExerciseBaseData {
|
||||
|
||||
// ignore: invalid_annotation_target
|
||||
final List<String> _authors;
|
||||
|
||||
// ignore: invalid_annotation_target
|
||||
@override
|
||||
@JsonKey(name: 'author_history')
|
||||
@@ -437,7 +418,6 @@ class _$ExerciseBaseDataImpl implements _ExerciseBaseData {
|
||||
|
||||
// ignore: invalid_annotation_target
|
||||
final List<String> _authorsGlobal;
|
||||
|
||||
// ignore: invalid_annotation_target
|
||||
@override
|
||||
@JsonKey(name: 'total_authors_history')
|
||||
@@ -523,7 +503,7 @@ 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: 'exercises') required final List<Translation> translations,
|
||||
@JsonKey(name: 'translations') required final List<Translation> translations,
|
||||
required final List<ExerciseImage> images,
|
||||
required final List<Video> videos,
|
||||
@JsonKey(name: 'author_history') required final List<String> authors,
|
||||
@@ -534,7 +514,6 @@ abstract class _ExerciseBaseData implements ExerciseApiData {
|
||||
|
||||
@override
|
||||
int get id;
|
||||
|
||||
@override
|
||||
String get uuid; // ignore: invalid_annotation_target
|
||||
@override
|
||||
@@ -549,10 +528,8 @@ abstract class _ExerciseBaseData implements ExerciseApiData {
|
||||
@override
|
||||
@JsonKey(name: 'last_update_global')
|
||||
DateTime get lastUpdateGlobal;
|
||||
|
||||
@override
|
||||
ExerciseCategory get category;
|
||||
|
||||
@override
|
||||
List<Muscle> get muscles; // ignore: invalid_annotation_target
|
||||
@override
|
||||
@@ -561,12 +538,10 @@ abstract class _ExerciseBaseData implements ExerciseApiData {
|
||||
@override
|
||||
List<Equipment> get equipment; // ignore: invalid_annotation_target
|
||||
@override
|
||||
@JsonKey(name: 'exercises')
|
||||
@JsonKey(name: 'translations')
|
||||
List<Translation> get translations;
|
||||
|
||||
@override
|
||||
List<ExerciseImage> get images;
|
||||
|
||||
@override
|
||||
List<Video> get videos; // ignore: invalid_annotation_target
|
||||
@override
|
||||
@@ -595,11 +570,8 @@ mixin _$ExerciseSearchDetails {
|
||||
int get translationId => throw _privateConstructorUsedError; // ignore: invalid_annotation_target
|
||||
@JsonKey(name: 'base_id')
|
||||
int get exerciseId => throw _privateConstructorUsedError;
|
||||
|
||||
String get name => throw _privateConstructorUsedError;
|
||||
|
||||
String get category => throw _privateConstructorUsedError;
|
||||
|
||||
String? get image => throw _privateConstructorUsedError; // ignore: invalid_annotation_target
|
||||
@JsonKey(name: 'image_thumbnail')
|
||||
String? get imageThumbnail => throw _privateConstructorUsedError;
|
||||
@@ -619,7 +591,6 @@ abstract class $ExerciseSearchDetailsCopyWith<$Res> {
|
||||
factory $ExerciseSearchDetailsCopyWith(
|
||||
ExerciseSearchDetails value, $Res Function(ExerciseSearchDetails) then) =
|
||||
_$ExerciseSearchDetailsCopyWithImpl<$Res, ExerciseSearchDetails>;
|
||||
|
||||
@useResult
|
||||
$Res call(
|
||||
{@JsonKey(name: 'id') int translationId,
|
||||
@@ -637,7 +608,6 @@ class _$ExerciseSearchDetailsCopyWithImpl<$Res, $Val extends ExerciseSearchDetai
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
@@ -688,7 +658,6 @@ abstract class _$$ExerciseSearchDetailsImplCopyWith<$Res>
|
||||
factory _$$ExerciseSearchDetailsImplCopyWith(
|
||||
_$ExerciseSearchDetailsImpl value, $Res Function(_$ExerciseSearchDetailsImpl) then) =
|
||||
__$$ExerciseSearchDetailsImplCopyWithImpl<$Res>;
|
||||
|
||||
@override
|
||||
@useResult
|
||||
$Res call(
|
||||
@@ -767,7 +736,6 @@ class _$ExerciseSearchDetailsImpl implements _ExerciseSearchDetails {
|
||||
@override
|
||||
@JsonKey(name: 'id')
|
||||
final int translationId;
|
||||
|
||||
// ignore: invalid_annotation_target
|
||||
@override
|
||||
@JsonKey(name: 'base_id')
|
||||
@@ -778,7 +746,6 @@ class _$ExerciseSearchDetailsImpl implements _ExerciseSearchDetails {
|
||||
final String category;
|
||||
@override
|
||||
final String? image;
|
||||
|
||||
// ignore: invalid_annotation_target
|
||||
@override
|
||||
@JsonKey(name: 'image_thumbnail')
|
||||
@@ -845,13 +812,10 @@ abstract class _ExerciseSearchDetails implements ExerciseSearchDetails {
|
||||
@override
|
||||
@JsonKey(name: 'base_id')
|
||||
int get exerciseId;
|
||||
|
||||
@override
|
||||
String get name;
|
||||
|
||||
@override
|
||||
String get category;
|
||||
|
||||
@override
|
||||
String? get image; // ignore: invalid_annotation_target
|
||||
@override
|
||||
@@ -873,7 +837,6 @@ ExerciseSearchEntry _$ExerciseSearchEntryFromJson(Map<String, dynamic> json) {
|
||||
/// @nodoc
|
||||
mixin _$ExerciseSearchEntry {
|
||||
String get value => throw _privateConstructorUsedError;
|
||||
|
||||
ExerciseSearchDetails get data => throw _privateConstructorUsedError;
|
||||
|
||||
/// Serializes this ExerciseSearchEntry to a JSON map.
|
||||
@@ -891,7 +854,6 @@ abstract class $ExerciseSearchEntryCopyWith<$Res> {
|
||||
factory $ExerciseSearchEntryCopyWith(
|
||||
ExerciseSearchEntry value, $Res Function(ExerciseSearchEntry) then) =
|
||||
_$ExerciseSearchEntryCopyWithImpl<$Res, ExerciseSearchEntry>;
|
||||
|
||||
@useResult
|
||||
$Res call({String value, ExerciseSearchDetails data});
|
||||
|
||||
@@ -905,7 +867,6 @@ class _$ExerciseSearchEntryCopyWithImpl<$Res, $Val extends ExerciseSearchEntry>
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
@@ -946,7 +907,6 @@ abstract class _$$ExerciseSearchEntryImplCopyWith<$Res>
|
||||
factory _$$ExerciseSearchEntryImplCopyWith(
|
||||
_$ExerciseSearchEntryImpl value, $Res Function(_$ExerciseSearchEntryImpl) then) =
|
||||
__$$ExerciseSearchEntryImplCopyWithImpl<$Res>;
|
||||
|
||||
@override
|
||||
@useResult
|
||||
$Res call({String value, ExerciseSearchDetails data});
|
||||
@@ -1041,7 +1001,6 @@ abstract class _ExerciseSearchEntry implements ExerciseSearchEntry {
|
||||
|
||||
@override
|
||||
String get value;
|
||||
|
||||
@override
|
||||
ExerciseSearchDetails get data;
|
||||
|
||||
@@ -1075,7 +1034,6 @@ abstract class $ExerciseApiSearchCopyWith<$Res> {
|
||||
factory $ExerciseApiSearchCopyWith(
|
||||
ExerciseApiSearch value, $Res Function(ExerciseApiSearch) then) =
|
||||
_$ExerciseApiSearchCopyWithImpl<$Res, ExerciseApiSearch>;
|
||||
|
||||
@useResult
|
||||
$Res call({List<ExerciseSearchEntry> suggestions});
|
||||
}
|
||||
@@ -1087,7 +1045,6 @@ class _$ExerciseApiSearchCopyWithImpl<$Res, $Val extends ExerciseApiSearch>
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
@@ -1112,7 +1069,6 @@ abstract class _$$ExerciseApiSearchImplCopyWith<$Res> implements $ExerciseApiSea
|
||||
factory _$$ExerciseApiSearchImplCopyWith(
|
||||
_$ExerciseApiSearchImpl value, $Res Function(_$ExerciseApiSearchImpl) then) =
|
||||
__$$ExerciseApiSearchImplCopyWithImpl<$Res>;
|
||||
|
||||
@override
|
||||
@useResult
|
||||
$Res call({List<ExerciseSearchEntry> suggestions});
|
||||
@@ -1152,7 +1108,6 @@ class _$ExerciseApiSearchImpl implements _ExerciseApiSearch {
|
||||
_$$ExerciseApiSearchImplFromJson(json);
|
||||
|
||||
final List<ExerciseSearchEntry> _suggestions;
|
||||
|
||||
@override
|
||||
List<ExerciseSearchEntry> get suggestions {
|
||||
if (_suggestions is EqualUnmodifiableListView) return _suggestions;
|
||||
|
||||
@@ -24,7 +24,7 @@ _$ExerciseBaseDataImpl _$$ExerciseBaseDataImplFromJson(Map<String, dynamic> json
|
||||
equipment: (json['equipment'] as List<dynamic>)
|
||||
.map((e) => Equipment.fromJson(e as Map<String, dynamic>))
|
||||
.toList(),
|
||||
translations: (json['exercises'] as List<dynamic>)
|
||||
translations: (json['translations'] as List<dynamic>)
|
||||
.map((e) => Translation.fromJson(e as Map<String, dynamic>))
|
||||
.toList(),
|
||||
images: (json['images'] as List<dynamic>)
|
||||
@@ -50,7 +50,7 @@ Map<String, dynamic> _$$ExerciseBaseDataImplToJson(_$ExerciseBaseDataImpl instan
|
||||
'muscles': instance.muscles,
|
||||
'muscles_secondary': instance.musclesSecondary,
|
||||
'equipment': instance.equipment,
|
||||
'exercises': instance.translations,
|
||||
'translations': instance.translations,
|
||||
'images': instance.images,
|
||||
'videos': instance.videos,
|
||||
'author_history': instance.authors,
|
||||
|
||||
@@ -21,9 +21,7 @@ IngredientApiSearchDetails _$IngredientApiSearchDetailsFromJson(Map<String, dyna
|
||||
/// @nodoc
|
||||
mixin _$IngredientApiSearchDetails {
|
||||
int get id => throw _privateConstructorUsedError;
|
||||
|
||||
String get name => throw _privateConstructorUsedError;
|
||||
|
||||
String? get image => throw _privateConstructorUsedError; // ignore: invalid_annotation_target
|
||||
@JsonKey(name: 'image_thumbnail')
|
||||
String? get imageThumbnail => throw _privateConstructorUsedError;
|
||||
@@ -43,7 +41,6 @@ abstract class $IngredientApiSearchDetailsCopyWith<$Res> {
|
||||
factory $IngredientApiSearchDetailsCopyWith(
|
||||
IngredientApiSearchDetails value, $Res Function(IngredientApiSearchDetails) then) =
|
||||
_$IngredientApiSearchDetailsCopyWithImpl<$Res, IngredientApiSearchDetails>;
|
||||
|
||||
@useResult
|
||||
$Res call(
|
||||
{int id,
|
||||
@@ -59,7 +56,6 @@ class _$IngredientApiSearchDetailsCopyWithImpl<$Res, $Val extends IngredientApiS
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
@@ -100,7 +96,6 @@ abstract class _$$IngredientApiSearchDetailsImplCopyWith<$Res>
|
||||
factory _$$IngredientApiSearchDetailsImplCopyWith(_$IngredientApiSearchDetailsImpl value,
|
||||
$Res Function(_$IngredientApiSearchDetailsImpl) then) =
|
||||
__$$IngredientApiSearchDetailsImplCopyWithImpl<$Res>;
|
||||
|
||||
@override
|
||||
@useResult
|
||||
$Res call(
|
||||
@@ -167,7 +162,6 @@ class _$IngredientApiSearchDetailsImpl implements _IngredientApiSearchDetails {
|
||||
final String name;
|
||||
@override
|
||||
final String? image;
|
||||
|
||||
// ignore: invalid_annotation_target
|
||||
@override
|
||||
@JsonKey(name: 'image_thumbnail')
|
||||
@@ -224,10 +218,8 @@ abstract class _IngredientApiSearchDetails implements IngredientApiSearchDetails
|
||||
|
||||
@override
|
||||
int get id;
|
||||
|
||||
@override
|
||||
String get name;
|
||||
|
||||
@override
|
||||
String? get image; // ignore: invalid_annotation_target
|
||||
@override
|
||||
@@ -249,7 +241,6 @@ IngredientApiSearchEntry _$IngredientApiSearchEntryFromJson(Map<String, dynamic>
|
||||
/// @nodoc
|
||||
mixin _$IngredientApiSearchEntry {
|
||||
String get value => throw _privateConstructorUsedError;
|
||||
|
||||
IngredientApiSearchDetails get data => throw _privateConstructorUsedError;
|
||||
|
||||
/// Serializes this IngredientApiSearchEntry to a JSON map.
|
||||
@@ -267,7 +258,6 @@ abstract class $IngredientApiSearchEntryCopyWith<$Res> {
|
||||
factory $IngredientApiSearchEntryCopyWith(
|
||||
IngredientApiSearchEntry value, $Res Function(IngredientApiSearchEntry) then) =
|
||||
_$IngredientApiSearchEntryCopyWithImpl<$Res, IngredientApiSearchEntry>;
|
||||
|
||||
@useResult
|
||||
$Res call({String value, IngredientApiSearchDetails data});
|
||||
|
||||
@@ -281,7 +271,6 @@ class _$IngredientApiSearchEntryCopyWithImpl<$Res, $Val extends IngredientApiSea
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
@@ -322,7 +311,6 @@ abstract class _$$IngredientApiSearchEntryImplCopyWith<$Res>
|
||||
factory _$$IngredientApiSearchEntryImplCopyWith(_$IngredientApiSearchEntryImpl value,
|
||||
$Res Function(_$IngredientApiSearchEntryImpl) then) =
|
||||
__$$IngredientApiSearchEntryImplCopyWithImpl<$Res>;
|
||||
|
||||
@override
|
||||
@useResult
|
||||
$Res call({String value, IngredientApiSearchDetails data});
|
||||
@@ -418,7 +406,6 @@ abstract class _IngredientApiSearchEntry implements IngredientApiSearchEntry {
|
||||
|
||||
@override
|
||||
String get value;
|
||||
|
||||
@override
|
||||
IngredientApiSearchDetails get data;
|
||||
|
||||
@@ -453,7 +440,6 @@ abstract class $IngredientApiSearchCopyWith<$Res> {
|
||||
factory $IngredientApiSearchCopyWith(
|
||||
IngredientApiSearch value, $Res Function(IngredientApiSearch) then) =
|
||||
_$IngredientApiSearchCopyWithImpl<$Res, IngredientApiSearch>;
|
||||
|
||||
@useResult
|
||||
$Res call({List<IngredientApiSearchEntry> suggestions});
|
||||
}
|
||||
@@ -465,7 +451,6 @@ class _$IngredientApiSearchCopyWithImpl<$Res, $Val extends IngredientApiSearch>
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
@@ -491,7 +476,6 @@ abstract class _$$IngredientApiSearchImplCopyWith<$Res>
|
||||
factory _$$IngredientApiSearchImplCopyWith(
|
||||
_$IngredientApiSearchImpl value, $Res Function(_$IngredientApiSearchImpl) then) =
|
||||
__$$IngredientApiSearchImplCopyWithImpl<$Res>;
|
||||
|
||||
@override
|
||||
@useResult
|
||||
$Res call({List<IngredientApiSearchEntry> suggestions});
|
||||
@@ -531,7 +515,6 @@ class _$IngredientApiSearchImpl implements _IngredientApiSearch {
|
||||
_$$IngredientApiSearchImplFromJson(json);
|
||||
|
||||
final List<IngredientApiSearchEntry> _suggestions;
|
||||
|
||||
@override
|
||||
List<IngredientApiSearchEntry> get suggestions {
|
||||
if (_suggestions is EqualUnmodifiableListView) return _suggestions;
|
||||
|
||||
64
lib/models/workouts/base_config.dart
Normal file
64
lib/models/workouts/base_config.dart
Normal file
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* This file is part of wger Workout Manager <https://github.com/wger-project>.
|
||||
* Copyright (C) 2020, 2021 wger Team
|
||||
*
|
||||
* wger Workout Manager is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
|
||||
part 'base_config.g.dart';
|
||||
|
||||
@JsonSerializable()
|
||||
class BaseConfig {
|
||||
@JsonKey(required: true)
|
||||
late int id;
|
||||
|
||||
@JsonKey(required: true, name: 'slot_entry')
|
||||
late int slotEntryId;
|
||||
|
||||
@JsonKey(required: true)
|
||||
late int iteration;
|
||||
|
||||
@JsonKey(required: true)
|
||||
late String trigger;
|
||||
|
||||
@JsonKey(required: true)
|
||||
late num value;
|
||||
|
||||
@JsonKey(required: true)
|
||||
late String operation;
|
||||
|
||||
@JsonKey(required: true)
|
||||
late String step;
|
||||
|
||||
@JsonKey(required: true, name: 'need_log_to_apply')
|
||||
late String needLogToApply;
|
||||
|
||||
BaseConfig({
|
||||
required this.id,
|
||||
required this.slotEntryId,
|
||||
required this.iteration,
|
||||
required this.trigger,
|
||||
required this.value,
|
||||
required this.operation,
|
||||
required this.step,
|
||||
required this.needLogToApply,
|
||||
});
|
||||
|
||||
// Boilerplate
|
||||
factory BaseConfig.fromJson(Map<String, dynamic> json) => _$BaseConfigFromJson(json);
|
||||
|
||||
Map<String, dynamic> toJson() => _$BaseConfigToJson(this);
|
||||
}
|
||||
44
lib/models/workouts/base_config.g.dart
Normal file
44
lib/models/workouts/base_config.g.dart
Normal file
@@ -0,0 +1,44 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'base_config.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
BaseConfig _$BaseConfigFromJson(Map<String, dynamic> json) {
|
||||
$checkKeys(
|
||||
json,
|
||||
requiredKeys: const [
|
||||
'id',
|
||||
'slot_entry',
|
||||
'iteration',
|
||||
'trigger',
|
||||
'value',
|
||||
'operation',
|
||||
'step',
|
||||
'need_log_to_apply'
|
||||
],
|
||||
);
|
||||
return BaseConfig(
|
||||
id: (json['id'] as num).toInt(),
|
||||
slotEntryId: (json['slot_entry'] as num).toInt(),
|
||||
iteration: (json['iteration'] as num).toInt(),
|
||||
trigger: json['trigger'] as String,
|
||||
value: json['value'] as num,
|
||||
operation: json['operation'] as String,
|
||||
step: json['step'] as String,
|
||||
needLogToApply: json['need_log_to_apply'] as String,
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$BaseConfigToJson(BaseConfig instance) => <String, dynamic>{
|
||||
'id': instance.id,
|
||||
'slot_entry': instance.slotEntryId,
|
||||
'iteration': instance.iteration,
|
||||
'trigger': instance.trigger,
|
||||
'value': instance.value,
|
||||
'operation': instance.operation,
|
||||
'step': instance.step,
|
||||
'need_log_to_apply': instance.needLogToApply,
|
||||
};
|
||||
@@ -45,7 +45,7 @@ class Day {
|
||||
late String type;
|
||||
|
||||
@JsonKey(required: true)
|
||||
late Object config;
|
||||
late Object? config;
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
List<Slot> slots = [];
|
||||
|
||||
@@ -28,7 +28,7 @@ Day _$DayFromJson(Map<String, dynamic> json) {
|
||||
..isRest = json['is_rest'] as bool
|
||||
..needLogsToAdvance = json['need_logs_to_advance'] as bool
|
||||
..type = json['type'] as String
|
||||
..config = json['config'] as Object;
|
||||
..config = json['config'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$DayToJson(Day instance) => <String, dynamic>{
|
||||
|
||||
54
lib/models/workouts/day_data.dart
Normal file
54
lib/models/workouts/day_data.dart
Normal file
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* This file is part of wger Workout Manager <https://github.com/wger-project>.
|
||||
* Copyright (C) 2020, 2021 wger Team
|
||||
*
|
||||
* wger Workout Manager is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
import 'package:wger/models/workouts/day.dart';
|
||||
import 'package:wger/models/workouts/slot_data.dart';
|
||||
|
||||
part 'day_data.g.dart';
|
||||
|
||||
@JsonSerializable()
|
||||
class DayData {
|
||||
@JsonKey(required: true)
|
||||
late int iteration;
|
||||
|
||||
@JsonKey(required: true)
|
||||
late DateTime date;
|
||||
|
||||
@JsonKey(required: true)
|
||||
late String? label;
|
||||
|
||||
@JsonKey(required: false)
|
||||
late Day day;
|
||||
|
||||
@JsonKey(required: false)
|
||||
late List<SlotData> slots;
|
||||
|
||||
DayData({
|
||||
required this.iteration,
|
||||
required this.date,
|
||||
required this.label,
|
||||
required this.day,
|
||||
required this.slots,
|
||||
});
|
||||
|
||||
// Boilerplate
|
||||
factory DayData.fromJson(Map<String, dynamic> json) => _$DayDataFromJson(json);
|
||||
|
||||
Map<String, dynamic> toJson() => _$DayDataToJson(this);
|
||||
}
|
||||
31
lib/models/workouts/day_data.g.dart
Normal file
31
lib/models/workouts/day_data.g.dart
Normal file
@@ -0,0 +1,31 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'day_data.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
DayData _$DayDataFromJson(Map<String, dynamic> json) {
|
||||
$checkKeys(
|
||||
json,
|
||||
requiredKeys: const ['iteration', 'date', 'label'],
|
||||
);
|
||||
return DayData(
|
||||
iteration: (json['iteration'] as num).toInt(),
|
||||
date: DateTime.parse(json['date'] as String),
|
||||
label: json['label'] as String?,
|
||||
day: Day.fromJson(json['day'] as Map<String, dynamic>),
|
||||
slots: (json['slots'] as List<dynamic>)
|
||||
.map((e) => SlotData.fromJson(e as Map<String, dynamic>))
|
||||
.toList(),
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$DayDataToJson(DayData instance) => <String, dynamic>{
|
||||
'iteration': instance.iteration,
|
||||
'date': instance.date.toIso8601String(),
|
||||
'label': instance.label,
|
||||
'day': instance.day,
|
||||
'slots': instance.slots,
|
||||
};
|
||||
@@ -30,14 +30,14 @@ class Log {
|
||||
@JsonKey(required: true)
|
||||
int? id;
|
||||
|
||||
@JsonKey(required: true, name: 'exercise_base')
|
||||
late int exerciseBaseId;
|
||||
@JsonKey(required: true, name: 'exercise')
|
||||
late int exerciseId;
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
late Exercise exerciseBaseObj;
|
||||
late Exercise exercise;
|
||||
|
||||
@JsonKey(required: true, name: 'workout')
|
||||
late int workoutPlan;
|
||||
@JsonKey(required: true, name: 'routine')
|
||||
late int routineId;
|
||||
|
||||
@JsonKey(required: true)
|
||||
late int reps;
|
||||
@@ -68,8 +68,8 @@ class Log {
|
||||
|
||||
Log({
|
||||
this.id,
|
||||
required this.exerciseBaseId,
|
||||
required this.workoutPlan,
|
||||
required this.exerciseId,
|
||||
required this.routineId,
|
||||
required this.reps,
|
||||
required this.rir,
|
||||
required this.repetitionUnitId,
|
||||
@@ -86,8 +86,8 @@ class Log {
|
||||
Map<String, dynamic> toJson() => _$LogToJson(this);
|
||||
|
||||
set exerciseBase(Exercise base) {
|
||||
exerciseBaseObj = base;
|
||||
exerciseBaseId = base.id!;
|
||||
exercise = base;
|
||||
exerciseId = base.id!;
|
||||
}
|
||||
|
||||
set weightUnit(WeightUnit weightUnit) {
|
||||
@@ -122,7 +122,7 @@ class Log {
|
||||
//ignore: avoid_equals_and_hash_code_on_mutable_classes
|
||||
bool operator ==(o) {
|
||||
return o is Log &&
|
||||
exerciseBaseId == o.exerciseBaseId &&
|
||||
exerciseId == o.exerciseId &&
|
||||
weight == o.weight &&
|
||||
weightUnitId == o.weightUnitId &&
|
||||
reps == o.reps &&
|
||||
@@ -132,14 +132,13 @@ class Log {
|
||||
|
||||
@override
|
||||
//ignore: avoid_equals_and_hash_code_on_mutable_classes
|
||||
int get hashCode =>
|
||||
Object.hash(exerciseBaseId, weight, weightUnitId, reps, repetitionUnitId, rir);
|
||||
int get hashCode => Object.hash(exerciseId, weight, weightUnitId, reps, repetitionUnitId, rir);
|
||||
|
||||
//@override
|
||||
//int get hashCode => super.hashCode;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'Log(id: $id, ex: $exerciseBaseId, weightU: $weightUnitId, w: $weight, repU: $repetitionUnitId, rep: $reps, rir: $rir)';
|
||||
return 'Log(id: $id, ex: $exerciseId, weightU: $weightUnitId, w: $weight, repU: $repetitionUnitId, rep: $reps, rir: $rir)';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,8 +11,8 @@ Log _$LogFromJson(Map<String, dynamic> json) {
|
||||
json,
|
||||
requiredKeys: const [
|
||||
'id',
|
||||
'exercise_base',
|
||||
'workout',
|
||||
'exercise',
|
||||
'routine',
|
||||
'reps',
|
||||
'repetition_unit',
|
||||
'weight',
|
||||
@@ -22,8 +22,8 @@ Log _$LogFromJson(Map<String, dynamic> json) {
|
||||
);
|
||||
return Log(
|
||||
id: (json['id'] as num?)?.toInt(),
|
||||
exerciseBaseId: (json['exercise_base'] as num).toInt(),
|
||||
workoutPlan: (json['workout'] as num).toInt(),
|
||||
exerciseId: (json['exercise'] as num).toInt(),
|
||||
routineId: (json['routine'] as num).toInt(),
|
||||
reps: (json['reps'] as num).toInt(),
|
||||
rir: json['rir'] as String?,
|
||||
repetitionUnitId: (json['repetition_unit'] as num).toInt(),
|
||||
@@ -35,8 +35,8 @@ Log _$LogFromJson(Map<String, dynamic> json) {
|
||||
|
||||
Map<String, dynamic> _$LogToJson(Log instance) => <String, dynamic>{
|
||||
'id': instance.id,
|
||||
'exercise_base': instance.exerciseBaseId,
|
||||
'workout': instance.workoutPlan,
|
||||
'exercise': instance.exerciseId,
|
||||
'routine': instance.routineId,
|
||||
'reps': instance.reps,
|
||||
'rir': instance.rir,
|
||||
'repetition_unit': instance.repetitionUnitId,
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
import 'package:wger/models/exercises/exercise.dart';
|
||||
import 'package:wger/models/workouts/day.dart';
|
||||
import 'package:wger/models/workouts/day_data.dart';
|
||||
import 'package:wger/models/workouts/log.dart';
|
||||
|
||||
part 'routine.g.dart';
|
||||
@@ -46,9 +47,15 @@ class Routine {
|
||||
@JsonKey(required: true)
|
||||
late DateTime end;
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@JsonKey(includeFromJson: true, required: false, includeToJson: false)
|
||||
List<Day> days = [];
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
List<DayData> dayData = [];
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
List<DayData> dayDataCurrentIteration = [];
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
List<Log> logs = [];
|
||||
|
||||
@@ -86,7 +93,7 @@ class Routine {
|
||||
/// reps, etc. are considered equal. Workout ID, Log ID and date are not
|
||||
/// considered.
|
||||
List<Log> filterLogsByExerciseBase(Exercise exerciseBase, {bool unique = false}) {
|
||||
var out = logs.where((element) => element.exerciseBaseId == exerciseBase.id).toList();
|
||||
var out = logs.where((element) => element.exerciseId == exerciseBase.id).toList();
|
||||
|
||||
if (unique) {
|
||||
out = out.toSet().toList();
|
||||
@@ -101,7 +108,7 @@ class Routine {
|
||||
Map<DateTime, Map<String, dynamic>> get logData {
|
||||
final out = <DateTime, Map<String, dynamic>>{};
|
||||
for (final log in logs) {
|
||||
final exercise = log.exerciseBaseObj;
|
||||
final exercise = log.exercise;
|
||||
final date = log.date;
|
||||
|
||||
if (!out.containsKey(date)) {
|
||||
|
||||
@@ -9,15 +9,7 @@ part of 'routine.dart';
|
||||
Routine _$RoutineFromJson(Map<String, dynamic> json) {
|
||||
$checkKeys(
|
||||
json,
|
||||
requiredKeys: const [
|
||||
'id',
|
||||
'created',
|
||||
'name',
|
||||
'description',
|
||||
'fit_in_week',
|
||||
'start',
|
||||
'end'
|
||||
],
|
||||
requiredKeys: const ['id', 'created', 'name', 'description', 'fit_in_week', 'start', 'end'],
|
||||
);
|
||||
return Routine(
|
||||
id: (json['id'] as num?)?.toInt(),
|
||||
@@ -27,6 +19,9 @@ Routine _$RoutineFromJson(Map<String, dynamic> json) {
|
||||
end: DateTime.parse(json['end'] as String),
|
||||
fitInWeek: json['fit_in_week'] as bool? ?? false,
|
||||
description: json['description'] as String?,
|
||||
days: (json['days'] as List<dynamic>?)
|
||||
?.map((e) => Day.fromJson(e as Map<String, dynamic>))
|
||||
.toList(),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
103
lib/models/workouts/set_config_data.dart
Normal file
103
lib/models/workouts/set_config_data.dart
Normal file
@@ -0,0 +1,103 @@
|
||||
/*
|
||||
* This file is part of wger Workout Manager <https://github.com/wger-project>.
|
||||
* Copyright (C) wger Team
|
||||
*
|
||||
* wger Workout Manager is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
import 'package:wger/helpers/json.dart';
|
||||
import 'package:wger/models/exercises/exercise.dart';
|
||||
|
||||
part 'set_config_data.g.dart';
|
||||
|
||||
@JsonSerializable()
|
||||
class SetConfigData {
|
||||
@JsonKey(required: true, name: 'exercise')
|
||||
late int exerciseId;
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
late Exercise exercise;
|
||||
|
||||
@JsonKey(required: true, name: 'slot_entry_id')
|
||||
late int slotEntryId;
|
||||
|
||||
@JsonKey(required: true)
|
||||
late String type;
|
||||
|
||||
@JsonKey(required: true, name: 'sets')
|
||||
late num? nrOfSets;
|
||||
|
||||
@JsonKey(required: true, fromJson: stringToNumNull)
|
||||
late num? weight;
|
||||
|
||||
@JsonKey(required: true, name: 'max_weight', fromJson: stringToNumNull)
|
||||
late num? maxWeight;
|
||||
|
||||
@JsonKey(required: true, name: 'weight_unit')
|
||||
late int? weightUnitId;
|
||||
|
||||
@JsonKey(required: true, name: 'weight_rounding', fromJson: stringToNumNull)
|
||||
late num? weightRounding;
|
||||
|
||||
@JsonKey(required: true, fromJson: stringToNumNull)
|
||||
late num? reps;
|
||||
|
||||
@JsonKey(required: true, name: 'max_reps', fromJson: stringToNumNull)
|
||||
late num? maxReps;
|
||||
|
||||
@JsonKey(required: true, name: 'reps_unit')
|
||||
late int? repsUnitId;
|
||||
|
||||
@JsonKey(required: true, name: 'reps_rounding', fromJson: stringToNumNull)
|
||||
late num? repsRounding;
|
||||
|
||||
@JsonKey(required: true)
|
||||
late String? rir;
|
||||
|
||||
@JsonKey(required: true)
|
||||
late String? rpe;
|
||||
|
||||
@JsonKey(required: true, name: 'rest', fromJson: stringToNum)
|
||||
late num? restTime;
|
||||
|
||||
@JsonKey(required: true, name: 'max_rest', fromJson: stringToNum)
|
||||
late num? maxRestTime;
|
||||
|
||||
@JsonKey(required: true)
|
||||
late String comment;
|
||||
|
||||
SetConfigData({
|
||||
required this.exerciseId,
|
||||
required this.slotEntryId,
|
||||
required this.type,
|
||||
required this.weight,
|
||||
required this.weightUnitId,
|
||||
required this.weightRounding,
|
||||
required this.reps,
|
||||
required this.maxReps,
|
||||
required this.repsUnitId,
|
||||
required this.repsRounding,
|
||||
required this.rir,
|
||||
required this.rpe,
|
||||
required this.restTime,
|
||||
required this.maxRestTime,
|
||||
required this.comment,
|
||||
});
|
||||
|
||||
// Boilerplate
|
||||
factory SetConfigData.fromJson(Map<String, dynamic> json) => _$SetConfigDataFromJson(json);
|
||||
|
||||
Map<String, dynamic> toJson() => _$SetConfigDataToJson(this);
|
||||
}
|
||||
71
lib/models/workouts/set_config_data.g.dart
Normal file
71
lib/models/workouts/set_config_data.g.dart
Normal file
@@ -0,0 +1,71 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'set_config_data.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
SetConfigData _$SetConfigDataFromJson(Map<String, dynamic> json) {
|
||||
$checkKeys(
|
||||
json,
|
||||
requiredKeys: const [
|
||||
'exercise',
|
||||
'slot_entry_id',
|
||||
'type',
|
||||
'sets',
|
||||
'weight',
|
||||
'max_weight',
|
||||
'weight_unit',
|
||||
'weight_rounding',
|
||||
'reps',
|
||||
'max_reps',
|
||||
'reps_unit',
|
||||
'reps_rounding',
|
||||
'rir',
|
||||
'rpe',
|
||||
'rest',
|
||||
'max_rest',
|
||||
'comment'
|
||||
],
|
||||
);
|
||||
return SetConfigData(
|
||||
exerciseId: (json['exercise'] as num).toInt(),
|
||||
slotEntryId: (json['slot_entry_id'] as num).toInt(),
|
||||
type: json['type'] as String,
|
||||
weight: stringToNumNull(json['weight'] as String?),
|
||||
weightUnitId: (json['weight_unit'] as num?)?.toInt(),
|
||||
weightRounding: stringToNumNull(json['weight_rounding'] as String?),
|
||||
reps: stringToNumNull(json['reps'] as String?),
|
||||
maxReps: stringToNumNull(json['max_reps'] as String?),
|
||||
repsUnitId: (json['reps_unit'] as num?)?.toInt(),
|
||||
repsRounding: stringToNumNull(json['reps_rounding'] as String?),
|
||||
rir: json['rir'] as String?,
|
||||
rpe: json['rpe'] as String?,
|
||||
restTime: stringToNum(json['rest'] as String?),
|
||||
maxRestTime: stringToNum(json['max_rest'] as String?),
|
||||
comment: json['comment'] as String,
|
||||
)
|
||||
..nrOfSets = json['sets'] as num?
|
||||
..maxWeight = stringToNumNull(json['max_weight'] as String?);
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$SetConfigDataToJson(SetConfigData instance) => <String, dynamic>{
|
||||
'exercise': instance.exerciseId,
|
||||
'slot_entry_id': instance.slotEntryId,
|
||||
'type': instance.type,
|
||||
'sets': instance.nrOfSets,
|
||||
'weight': instance.weight,
|
||||
'max_weight': instance.maxWeight,
|
||||
'weight_unit': instance.weightUnitId,
|
||||
'weight_rounding': instance.weightRounding,
|
||||
'reps': instance.reps,
|
||||
'max_reps': instance.maxReps,
|
||||
'reps_unit': instance.repsUnitId,
|
||||
'reps_rounding': instance.repsRounding,
|
||||
'rir': instance.rir,
|
||||
'rpe': instance.rpe,
|
||||
'rest': instance.restTime,
|
||||
'max_rest': instance.maxRestTime,
|
||||
'comment': instance.comment,
|
||||
};
|
||||
@@ -39,7 +39,7 @@ class Slot {
|
||||
late String comment;
|
||||
|
||||
@JsonKey(required: true)
|
||||
late Object config;
|
||||
late Object? config;
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
List<Exercise> exercisesObj = [];
|
||||
|
||||
@@ -16,7 +16,7 @@ Slot _$SlotFromJson(Map<String, dynamic> json) {
|
||||
day: (json['day'] as num).toInt(),
|
||||
comment: json['comment'] as String? ?? '',
|
||||
order: (json['order'] as num).toInt(),
|
||||
config: json['config'] as Object,
|
||||
config: json['config'],
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
48
lib/models/workouts/slot_data.dart
Normal file
48
lib/models/workouts/slot_data.dart
Normal file
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* This file is part of wger Workout Manager <https://github.com/wger-project>.
|
||||
* Copyright (C) 2020, 2021 wger Team
|
||||
*
|
||||
* wger Workout Manager is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
import 'package:wger/models/workouts/set_config_data.dart';
|
||||
|
||||
part 'slot_data.g.dart';
|
||||
|
||||
@JsonSerializable()
|
||||
class SlotData {
|
||||
@JsonKey(required: true)
|
||||
late String comment;
|
||||
|
||||
@JsonKey(required: true, name: 'is_superset')
|
||||
late bool isSuperset;
|
||||
|
||||
@JsonKey(required: true, name: 'exercises')
|
||||
late List<int> exerciseIds;
|
||||
|
||||
@JsonKey(required: true, name: 'sets')
|
||||
late List<SetConfigData> setConfigs;
|
||||
|
||||
SlotData({
|
||||
required this.comment,
|
||||
required this.isSuperset,
|
||||
required this.exerciseIds,
|
||||
});
|
||||
|
||||
// Boilerplate
|
||||
factory SlotData.fromJson(Map<String, dynamic> json) => _$SlotDataFromJson(json);
|
||||
|
||||
Map<String, dynamic> toJson() => _$SlotDataToJson(this);
|
||||
}
|
||||
28
lib/models/workouts/slot_data.g.dart
Normal file
28
lib/models/workouts/slot_data.g.dart
Normal file
@@ -0,0 +1,28 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'slot_data.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
SlotData _$SlotDataFromJson(Map<String, dynamic> json) {
|
||||
$checkKeys(
|
||||
json,
|
||||
requiredKeys: const ['comment', 'is_superset', 'exercises', 'sets'],
|
||||
);
|
||||
return SlotData(
|
||||
comment: json['comment'] as String,
|
||||
isSuperset: json['is_superset'] as bool,
|
||||
exerciseIds: (json['exercises'] as List<dynamic>).map((e) => (e as num).toInt()).toList(),
|
||||
)..setConfigs = (json['sets'] as List<dynamic>)
|
||||
.map((e) => SetConfigData.fromJson(e as Map<String, dynamic>))
|
||||
.toList();
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$SlotDataToJson(SlotData instance) => <String, dynamic>{
|
||||
'comment': instance.comment,
|
||||
'is_superset': instance.isSuperset,
|
||||
'exercises': instance.exerciseIds,
|
||||
'sets': instance.setConfigs,
|
||||
};
|
||||
@@ -17,8 +17,8 @@
|
||||
*/
|
||||
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
import 'package:wger/helpers/json.dart';
|
||||
import 'package:wger/models/exercises/exercise.dart';
|
||||
import 'package:wger/models/workouts/base_config.dart';
|
||||
import 'package:wger/models/workouts/repetition_unit.dart';
|
||||
import 'package:wger/models/workouts/weight_unit.dart';
|
||||
|
||||
@@ -58,11 +58,11 @@ class SlotEntry {
|
||||
@JsonKey(required: true, name: 'repetition_rounding')
|
||||
late num repetitionRounding;
|
||||
|
||||
@JsonKey(required: true)
|
||||
int? reps;
|
||||
@JsonKey(required: true, name: 'reps_configs')
|
||||
late List<BaseConfig> repsConfig;
|
||||
|
||||
@JsonKey(required: true, fromJson: stringToNum, toJson: numToString)
|
||||
num? weight;
|
||||
@JsonKey(required: true, name: 'max_reps_configs')
|
||||
late List<BaseConfig> maxRepsConfig;
|
||||
|
||||
@JsonKey(required: true, name: 'weight_unit')
|
||||
late int weightUnitId;
|
||||
@@ -73,11 +73,29 @@ class SlotEntry {
|
||||
@JsonKey(required: true, name: 'weight_rounding')
|
||||
late num weightRounding;
|
||||
|
||||
@JsonKey(required: true, name: 'weight_configs')
|
||||
late List<BaseConfig> weightConfigs;
|
||||
|
||||
@JsonKey(required: true, name: 'max_weight_configs')
|
||||
late List<BaseConfig> maxWeightConfigs;
|
||||
|
||||
@JsonKey(required: true, name: 'set_nr_configs')
|
||||
late List<BaseConfig> setNrConfigs;
|
||||
|
||||
@JsonKey(required: true, name: 'rir_configs')
|
||||
late List<BaseConfig> rirConfigs;
|
||||
|
||||
@JsonKey(required: true, name: 'rest_configs')
|
||||
late List<BaseConfig> restTimeConfigs;
|
||||
|
||||
@JsonKey(required: true, name: 'max_rest_configs')
|
||||
late List<BaseConfig> maxRestTimeConfigs;
|
||||
|
||||
@JsonKey(required: true)
|
||||
late String comment = '';
|
||||
|
||||
@JsonKey(required: true)
|
||||
late Object config;
|
||||
late Object? config;
|
||||
|
||||
SlotEntry({
|
||||
this.id,
|
||||
@@ -87,7 +105,6 @@ class SlotEntry {
|
||||
required this.exerciseId,
|
||||
required this.repetitionUnitId,
|
||||
required this.repetitionRounding,
|
||||
required this.reps,
|
||||
required this.weightUnitId,
|
||||
required this.weightRounding,
|
||||
required this.comment,
|
||||
|
||||
@@ -17,10 +17,16 @@ SlotEntry _$SlotEntryFromJson(Map<String, dynamic> json) {
|
||||
'exercise',
|
||||
'repetition_unit',
|
||||
'repetition_rounding',
|
||||
'reps',
|
||||
'weight',
|
||||
'reps_configs',
|
||||
'max_reps_configs',
|
||||
'weight_unit',
|
||||
'weight_rounding',
|
||||
'weight_configs',
|
||||
'max_weight_configs',
|
||||
'set_nr_configs',
|
||||
'rir_configs',
|
||||
'rest_configs',
|
||||
'max_rest_configs',
|
||||
'comment',
|
||||
'config'
|
||||
],
|
||||
@@ -33,13 +39,35 @@ SlotEntry _$SlotEntryFromJson(Map<String, dynamic> json) {
|
||||
exerciseId: (json['exercise'] as num).toInt(),
|
||||
repetitionUnitId: (json['repetition_unit'] as num).toInt(),
|
||||
repetitionRounding: json['repetition_rounding'] as num,
|
||||
reps: (json['reps'] as num?)?.toInt(),
|
||||
weightUnitId: (json['weight_unit'] as num).toInt(),
|
||||
weightRounding: json['weight_rounding'] as num,
|
||||
comment: json['comment'] as String,
|
||||
)
|
||||
..weight = stringToNum(json['weight'] as String?)
|
||||
..config = json['config'] as Object;
|
||||
..repsConfig = (json['reps_configs'] as List<dynamic>)
|
||||
.map((e) => BaseConfig.fromJson(e as Map<String, dynamic>))
|
||||
.toList()
|
||||
..maxRepsConfig = (json['max_reps_configs'] as List<dynamic>)
|
||||
.map((e) => BaseConfig.fromJson(e as Map<String, dynamic>))
|
||||
.toList()
|
||||
..weightConfigs = (json['weight_configs'] as List<dynamic>)
|
||||
.map((e) => BaseConfig.fromJson(e as Map<String, dynamic>))
|
||||
.toList()
|
||||
..maxWeightConfigs = (json['max_weight_configs'] as List<dynamic>)
|
||||
.map((e) => BaseConfig.fromJson(e as Map<String, dynamic>))
|
||||
.toList()
|
||||
..setNrConfigs = (json['set_nr_configs'] as List<dynamic>)
|
||||
.map((e) => BaseConfig.fromJson(e as Map<String, dynamic>))
|
||||
.toList()
|
||||
..rirConfigs = (json['rir_configs'] as List<dynamic>)
|
||||
.map((e) => BaseConfig.fromJson(e as Map<String, dynamic>))
|
||||
.toList()
|
||||
..restTimeConfigs = (json['rest_configs'] as List<dynamic>)
|
||||
.map((e) => BaseConfig.fromJson(e as Map<String, dynamic>))
|
||||
.toList()
|
||||
..maxRestTimeConfigs = (json['max_rest_configs'] as List<dynamic>)
|
||||
.map((e) => BaseConfig.fromJson(e as Map<String, dynamic>))
|
||||
.toList()
|
||||
..config = json['config'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$SlotEntryToJson(SlotEntry instance) => <String, dynamic>{
|
||||
@@ -50,10 +78,16 @@ Map<String, dynamic> _$SlotEntryToJson(SlotEntry instance) => <String, dynamic>{
|
||||
'exercise': instance.exerciseId,
|
||||
'repetition_unit': instance.repetitionUnitId,
|
||||
'repetition_rounding': instance.repetitionRounding,
|
||||
'reps': instance.reps,
|
||||
'weight': numToString(instance.weight),
|
||||
'reps_configs': instance.repsConfig,
|
||||
'max_reps_configs': instance.maxRepsConfig,
|
||||
'weight_unit': instance.weightUnitId,
|
||||
'weight_rounding': instance.weightRounding,
|
||||
'weight_configs': instance.weightConfigs,
|
||||
'max_weight_configs': instance.maxWeightConfigs,
|
||||
'set_nr_configs': instance.setNrConfigs,
|
||||
'rir_configs': instance.rirConfigs,
|
||||
'rest_configs': instance.restTimeConfigs,
|
||||
'max_rest_configs': instance.maxRestTimeConfigs,
|
||||
'comment': instance.comment,
|
||||
'config': instance.config,
|
||||
};
|
||||
|
||||
@@ -56,7 +56,8 @@ class WgerBaseProvider {
|
||||
}
|
||||
|
||||
/// Fetch and retrieve the overview list of objects, returns the JSON parsed response
|
||||
Future<Map<String, dynamic>> fetch(Uri uri) async {
|
||||
Future<dynamic> fetch(Uri uri) async {
|
||||
// Future<Map<String, dynamic> | List<dynamic>> fetch(Uri uri) async {
|
||||
// Send the request
|
||||
final response = await client.get(
|
||||
uri,
|
||||
|
||||
@@ -26,6 +26,7 @@ import 'package:wger/helpers/consts.dart';
|
||||
import 'package:wger/models/exercises/exercise.dart';
|
||||
import 'package:wger/models/exercises/translation.dart';
|
||||
import 'package:wger/models/workouts/day.dart';
|
||||
import 'package:wger/models/workouts/day_data.dart';
|
||||
import 'package:wger/models/workouts/log.dart';
|
||||
import 'package:wger/models/workouts/repetition_unit.dart';
|
||||
import 'package:wger/models/workouts/routine.dart';
|
||||
@@ -36,8 +37,11 @@ import 'package:wger/models/workouts/weight_unit.dart';
|
||||
import 'package:wger/providers/base_provider.dart';
|
||||
import 'package:wger/providers/exercises.dart';
|
||||
|
||||
class WorkoutPlansProvider with ChangeNotifier {
|
||||
class RoutinesProvider with ChangeNotifier {
|
||||
static const _routinesUrlPath = 'routine';
|
||||
static const _routinesStructureSubpath = 'structure';
|
||||
static const _routinesDateSequenceSubpath = 'date-sequence-display';
|
||||
static const _routinesCurrentIterationSubpath = 'current-iteration-display';
|
||||
static const _daysUrlPath = 'day';
|
||||
static const _slotsUrlPath = 'slot';
|
||||
static const _slotEntriesUrlPath = 'slot-entry';
|
||||
@@ -53,7 +57,7 @@ class WorkoutPlansProvider with ChangeNotifier {
|
||||
List<WeightUnit> _weightUnits = [];
|
||||
List<RepetitionUnit> _repetitionUnit = [];
|
||||
|
||||
WorkoutPlansProvider(
|
||||
RoutinesProvider(
|
||||
this.baseProvider,
|
||||
ExercisesProvider exercises,
|
||||
List<Routine> entries,
|
||||
@@ -162,6 +166,23 @@ class WorkoutPlansProvider with ChangeNotifier {
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
void setExerciseAndUnits(List<DayData> entries) async {
|
||||
for (final entry in entries) {
|
||||
for (final slot in entry.slots) {
|
||||
for (final setConfig in slot.setConfigs) {
|
||||
setConfig.exercise = await _exercises.fetchAndSetExercise(setConfig.exerciseId);
|
||||
// slotEntry.exerciseObj = await _exercises.fetchAndSetExercise(slotEntry.exerciseId);
|
||||
// slotEntry.repetitionUnitObj = _repetitionUnit.firstWhere(
|
||||
// (e) => e.id == slotEntry.repetitionUnitId,
|
||||
// );
|
||||
// slotEntry.weightUnitObj = _weightUnits.firstWhere(
|
||||
// (e) => e.id == slotEntry.weightUnitId,
|
||||
// );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Fetches a workout plan sparsely, i.e. only with the data on the plan
|
||||
/// object itself and no child attributes
|
||||
Future<Routine> fetchAndSetPlanSparse(int planId) async {
|
||||
@@ -177,80 +198,78 @@ class WorkoutPlansProvider with ChangeNotifier {
|
||||
}
|
||||
|
||||
/// Fetches a workout plan fully, i.e. with all corresponding child attributes
|
||||
Future<Routine> fetchAndSetWorkoutPlanFull(int workoutId) async {
|
||||
// Load a list of all settings so that we can search through it
|
||||
//
|
||||
// This is a bit ugly, but saves us sending lots of requests later on
|
||||
final allSettingsData = await baseProvider.fetch(
|
||||
baseProvider.makeUrl(_slotEntriesUrlPath, query: {'limit': '1000'}),
|
||||
);
|
||||
Future<Routine> fetchAndSetWorkoutPlanFull(int routineId) async {
|
||||
// Fetch structure and computed data
|
||||
final results = await Future.wait([
|
||||
baseProvider.fetch(
|
||||
baseProvider.makeUrl(
|
||||
_routinesUrlPath,
|
||||
objectMethod: _routinesStructureSubpath,
|
||||
id: routineId,
|
||||
),
|
||||
),
|
||||
baseProvider.fetch(
|
||||
baseProvider.makeUrl(
|
||||
_routinesUrlPath,
|
||||
id: routineId,
|
||||
objectMethod: _routinesDateSequenceSubpath,
|
||||
),
|
||||
),
|
||||
baseProvider.fetch(
|
||||
baseProvider.makeUrl(
|
||||
_routinesUrlPath,
|
||||
id: routineId,
|
||||
objectMethod: _routinesCurrentIterationSubpath,
|
||||
),
|
||||
)
|
||||
]);
|
||||
|
||||
Routine plan;
|
||||
try {
|
||||
plan = findById(workoutId);
|
||||
} on StateError {
|
||||
plan = await fetchAndSetPlanSparse(workoutId);
|
||||
}
|
||||
final routine = Routine.fromJson(results[0] as Map<String, dynamic>);
|
||||
|
||||
// Days
|
||||
final List<Day> days = [];
|
||||
final daysData = await baseProvider.fetch(
|
||||
baseProvider.makeUrl(_daysUrlPath, query: {'training': plan.id.toString()}),
|
||||
);
|
||||
for (final dayEntry in daysData['results']) {
|
||||
final day = Day.fromJson(dayEntry);
|
||||
final dayData = results[1] as List<dynamic>;
|
||||
final currentIterationData = results[2] as List<dynamic>;
|
||||
|
||||
// Sets
|
||||
final List<Slot> sets = [];
|
||||
final setData = await baseProvider.fetch(
|
||||
baseProvider.makeUrl(_slotsUrlPath, query: {'exerciseday': day.id.toString()}),
|
||||
);
|
||||
for (final setEntry in setData['results']) {
|
||||
final workoutSet = Slot.fromJson(setEntry);
|
||||
/*
|
||||
* Set exercise, repetition and weight unit objects
|
||||
*/
|
||||
final dayDataEntries = dayData.map((entry) => DayData.fromJson(entry)).toList();
|
||||
setExerciseAndUnits(dayDataEntries);
|
||||
|
||||
fetchComputedSettings(workoutSet); // request!
|
||||
final currentIterationDayDataEntries =
|
||||
currentIterationData.map((entry) => DayData.fromJson(entry)).toList();
|
||||
setExerciseAndUnits(currentIterationDayDataEntries);
|
||||
|
||||
final List<SlotEntry> settings = [];
|
||||
final settingData = allSettingsData['results'].where((s) => s['set'] == workoutSet.id);
|
||||
|
||||
for (final settingEntry in settingData) {
|
||||
final workoutSetting = SlotEntry.fromJson(settingEntry);
|
||||
|
||||
workoutSetting.exercise = await _exercises.fetchAndSetExercise(workoutSetting.exerciseId);
|
||||
workoutSetting.weightUnit = _weightUnits.firstWhere(
|
||||
(e) => e.id == workoutSetting.weightUnitId,
|
||||
for (final day in routine.days) {
|
||||
for (final slot in day.slots) {
|
||||
for (final slotEntry in slot.entries) {
|
||||
slotEntry.exerciseObj = await _exercises.fetchAndSetExercise(slotEntry.exerciseId);
|
||||
slotEntry.repetitionUnitObj = _repetitionUnit.firstWhere(
|
||||
(e) => e.id == slotEntry.repetitionUnitId,
|
||||
);
|
||||
workoutSetting.repetitionUnit = _repetitionUnit.firstWhere(
|
||||
(e) => e.id == workoutSetting.repetitionUnitId,
|
||||
slotEntry.weightUnitObj = _weightUnits.firstWhere(
|
||||
(e) => e.id == slotEntry.weightUnitId,
|
||||
);
|
||||
if (!workoutSet.exercisesIds.contains(workoutSetting.exerciseId)) {
|
||||
workoutSet.addExerciseBase(workoutSetting.exerciseObj);
|
||||
}
|
||||
|
||||
settings.add(workoutSetting);
|
||||
}
|
||||
workoutSet.entries = settings;
|
||||
sets.add(workoutSet);
|
||||
}
|
||||
day.slots = sets;
|
||||
days.add(day);
|
||||
}
|
||||
plan.days = days;
|
||||
|
||||
routine.dayData = dayDataEntries;
|
||||
routine.dayDataCurrentIteration = currentIterationDayDataEntries;
|
||||
|
||||
// Logs
|
||||
plan.logs = [];
|
||||
routine.logs = [];
|
||||
|
||||
final logData = await baseProvider.fetchPaginated(baseProvider.makeUrl(
|
||||
_logsUrlPath,
|
||||
query: {'workout': workoutId.toString(), 'limit': '100'},
|
||||
query: {'workout': routineId.toString(), 'limit': '100'},
|
||||
));
|
||||
for (final logEntry in logData) {
|
||||
try {
|
||||
final log = Log.fromJson(logEntry);
|
||||
log.weightUnit = _weightUnits.firstWhere((e) => e.id == log.weightUnitId);
|
||||
log.repetitionUnit = _repetitionUnit.firstWhere((e) => e.id == log.weightUnitId);
|
||||
log.exerciseBase = await _exercises.fetchAndSetExercise(log.exerciseBaseId);
|
||||
plan.logs.add(log);
|
||||
log.exerciseBase = await _exercises.fetchAndSetExercise(log.exerciseId);
|
||||
routine.logs.add(log);
|
||||
} catch (e) {
|
||||
dev.log('fire! fire!');
|
||||
dev.log(e.toString());
|
||||
@@ -259,12 +278,12 @@ class WorkoutPlansProvider with ChangeNotifier {
|
||||
|
||||
// ... and done
|
||||
notifyListeners();
|
||||
return plan;
|
||||
return routine;
|
||||
}
|
||||
|
||||
Future<Routine> addWorkout(Routine workout) async {
|
||||
Future<Routine> addRoutine(Routine routine) async {
|
||||
final data = await baseProvider.post(
|
||||
workout.toJson(),
|
||||
routine.toJson(),
|
||||
baseProvider.makeUrl(_routinesUrlPath),
|
||||
);
|
||||
final plan = Routine.fromJson(data);
|
||||
@@ -352,13 +371,13 @@ class WorkoutPlansProvider with ChangeNotifier {
|
||||
await fetchAndSetRepetitionUnits();
|
||||
|
||||
// Save the result to the cache
|
||||
final exerciseData = {
|
||||
final cacheData = {
|
||||
'date': DateTime.now().toIso8601String(),
|
||||
'expiresIn': DateTime.now().add(const Duration(days: DAYS_TO_CACHE)).toIso8601String(),
|
||||
'repetitionUnits': _repetitionUnit.map((e) => e.toJson()).toList(),
|
||||
'weightUnit': _weightUnits.map((e) => e.toJson()).toList(),
|
||||
};
|
||||
prefs.setString(PREFS_WORKOUT_UNITS, json.encode(exerciseData));
|
||||
prefs.setString(PREFS_WORKOUT_UNITS, json.encode(cacheData));
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
@@ -469,12 +488,12 @@ class WorkoutPlansProvider with ChangeNotifier {
|
||||
return data['results'];
|
||||
}
|
||||
|
||||
Future<void> deleteSet(Slot workoutSet) async {
|
||||
await baseProvider.deleteRequest(_slotsUrlPath, workoutSet.id!);
|
||||
Future<void> deleteSet(int setId) async {
|
||||
await baseProvider.deleteRequest(_slotsUrlPath, setId);
|
||||
|
||||
for (final workout in _workoutPlans) {
|
||||
for (final day in workout.days) {
|
||||
day.slots.removeWhere((element) => element.id == workoutSet.id);
|
||||
day.slots.removeWhere((element) => element.id == setId);
|
||||
}
|
||||
}
|
||||
notifyListeners();
|
||||
@@ -526,9 +545,9 @@ class WorkoutPlansProvider with ChangeNotifier {
|
||||
log.id = newLog.id;
|
||||
log.weightUnit = _weightUnits.firstWhere((e) => e.id == log.weightUnitId);
|
||||
log.repetitionUnit = _repetitionUnit.firstWhere((e) => e.id == log.weightUnitId);
|
||||
log.exerciseBase = await _exercises.fetchAndSetExercise(log.exerciseBaseId);
|
||||
log.exerciseBase = await _exercises.fetchAndSetExercise(log.exerciseId);
|
||||
|
||||
final plan = findById(log.workoutPlan);
|
||||
final plan = findById(log.routineId);
|
||||
plan.logs.add(log);
|
||||
notifyListeners();
|
||||
return newLog;
|
||||
|
||||
@@ -24,6 +24,7 @@ import 'package:wger/widgets/workouts/gym_mode.dart';
|
||||
|
||||
class GymModeScreen extends StatelessWidget {
|
||||
const GymModeScreen();
|
||||
|
||||
static const routeName = '/gym-mode';
|
||||
|
||||
@override
|
||||
@@ -32,7 +33,7 @@ class GymModeScreen extends StatelessWidget {
|
||||
|
||||
return Scaffold(
|
||||
body: SafeArea(
|
||||
child: Consumer<WorkoutPlansProvider>(
|
||||
child: Consumer<RoutinesProvider>(
|
||||
builder: (context, value, child) => GymMode(day),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -39,6 +39,7 @@ import 'package:wger/screens/workout_plans_screen.dart';
|
||||
|
||||
class HomeTabsScreen extends StatefulWidget {
|
||||
const HomeTabsScreen();
|
||||
|
||||
static const routeName = '/dashboard2';
|
||||
|
||||
@override
|
||||
@@ -75,7 +76,7 @@ class _HomeTabsScreenState extends State<HomeTabsScreen> with SingleTickerProvid
|
||||
final authProvider = context.read<AuthProvider>();
|
||||
|
||||
if (!authProvider.dataInit) {
|
||||
final workoutPlansProvider = context.read<WorkoutPlansProvider>();
|
||||
final workoutPlansProvider = context.read<RoutinesProvider>();
|
||||
final nutritionPlansProvider = context.read<NutritionPlansProvider>();
|
||||
final exercisesProvider = context.read<ExercisesProvider>();
|
||||
final galleryProvider = context.read<GalleryProvider>();
|
||||
|
||||
@@ -56,8 +56,7 @@ class _WorkoutPlanScreenState extends State<WorkoutPlanScreen> {
|
||||
}
|
||||
|
||||
Future<Routine> _loadFullWorkout(BuildContext context, int planId) {
|
||||
return Provider.of<WorkoutPlansProvider>(context, listen: false)
|
||||
.fetchAndSetWorkoutPlanFull(planId);
|
||||
return Provider.of<RoutinesProvider>(context, listen: false).fetchAndSetWorkoutPlanFull(planId);
|
||||
}
|
||||
|
||||
Widget getBody(Routine plan) {
|
||||
@@ -106,7 +105,7 @@ class _WorkoutPlanScreenState extends State<WorkoutPlanScreen> {
|
||||
|
||||
// Delete
|
||||
} else if (value == WorkoutOptions.delete) {
|
||||
Provider.of<WorkoutPlansProvider>(context, listen: false)
|
||||
Provider.of<RoutinesProvider>(context, listen: false)
|
||||
.deleteWorkout(workoutPlan.id!);
|
||||
Navigator.of(context).pop();
|
||||
|
||||
@@ -140,7 +139,7 @@ class _WorkoutPlanScreenState extends State<WorkoutPlanScreen> {
|
||||
child: Center(child: CircularProgressIndicator()),
|
||||
)
|
||||
else
|
||||
Consumer<WorkoutPlansProvider>(
|
||||
Consumer<RoutinesProvider>(
|
||||
builder: (context, value, child) => getBody(workoutPlan),
|
||||
),
|
||||
],
|
||||
|
||||
@@ -48,7 +48,7 @@ class WorkoutPlansScreen extends StatelessWidget {
|
||||
},
|
||||
child: const Icon(Icons.add, color: Colors.white),
|
||||
),
|
||||
body: Consumer<WorkoutPlansProvider>(
|
||||
body: Consumer<RoutinesProvider>(
|
||||
builder: (context, workoutProvider, child) => WorkoutPlansList(workoutProvider),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -92,7 +92,7 @@ class MainAppBar extends StatelessWidget implements PreferredSizeWidget {
|
||||
title: Text(AppLocalizations.of(context).logout),
|
||||
onTap: () {
|
||||
context.read<AuthProvider>().logout();
|
||||
context.read<WorkoutPlansProvider>().clear();
|
||||
context.read<RoutinesProvider>().clear();
|
||||
context.read<NutritionPlansProvider>().clear();
|
||||
context.read<BodyWeightProvider>().clear();
|
||||
context.read<GalleryProvider>().clear();
|
||||
|
||||
@@ -116,7 +116,7 @@ class _DashboardCalendarWidgetState extends State<DashboardCalendarWidget>
|
||||
}
|
||||
|
||||
// Process workout sessions
|
||||
final WorkoutPlansProvider plans = Provider.of<WorkoutPlansProvider>(context, listen: false);
|
||||
final RoutinesProvider plans = Provider.of<RoutinesProvider>(context, listen: false);
|
||||
await plans.fetchSessionData().then((entries) {
|
||||
for (final entry in entries['results']) {
|
||||
final session = WorkoutSession.fromJson(entry);
|
||||
|
||||
@@ -376,7 +376,7 @@ class _DashboardWorkoutWidgetState extends State<DashboardWorkoutWidget> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_workoutPlan = context.read<WorkoutPlansProvider>().activePlan;
|
||||
_workoutPlan = context.read<RoutinesProvider>().activePlan;
|
||||
_hasContent = _workoutPlan != null;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,8 +20,9 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:wger/helpers/consts.dart';
|
||||
import 'package:wger/models/workouts/day.dart';
|
||||
import 'package:wger/models/workouts/day_data.dart';
|
||||
import 'package:wger/models/workouts/slot.dart';
|
||||
import 'package:wger/models/workouts/slot_data.dart';
|
||||
import 'package:wger/models/workouts/slot_entry.dart';
|
||||
import 'package:wger/providers/workout_plans.dart';
|
||||
import 'package:wger/screens/form_screen.dart';
|
||||
@@ -90,9 +91,9 @@ class SettingWidget extends StatelessWidget {
|
||||
}
|
||||
|
||||
class WorkoutDayWidget extends StatefulWidget {
|
||||
final Day _day;
|
||||
final DayData _dayData;
|
||||
|
||||
const WorkoutDayWidget(this._day);
|
||||
const WorkoutDayWidget(this._dayData);
|
||||
|
||||
@override
|
||||
_WorkoutDayWidgetState createState() => _WorkoutDayWidgetState();
|
||||
@@ -100,13 +101,13 @@ class WorkoutDayWidget extends StatefulWidget {
|
||||
|
||||
class _WorkoutDayWidgetState extends State<WorkoutDayWidget> {
|
||||
bool _editing = false;
|
||||
late List<Slot> _sets;
|
||||
late List<SlotData> _slots;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_sets = widget._day.slots;
|
||||
_sets.sort((a, b) => a.order.compareTo(b.order));
|
||||
_slots = widget._dayData.slots;
|
||||
//_slots.sort((a, b) => a.order.compareTo(b.order));
|
||||
}
|
||||
|
||||
void _toggleExpanded() {
|
||||
@@ -115,9 +116,9 @@ class _WorkoutDayWidgetState extends State<WorkoutDayWidget> {
|
||||
});
|
||||
}
|
||||
|
||||
Widget getSetRow(Slot set, int index) {
|
||||
Widget getSetRow(SlotData set, int index) {
|
||||
return Row(
|
||||
key: ValueKey(set.id),
|
||||
// key: ValueKey(set.id),
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
if (_editing)
|
||||
@@ -127,21 +128,21 @@ class _WorkoutDayWidgetState extends State<WorkoutDayWidget> {
|
||||
iconSize: ICON_SIZE_SMALL,
|
||||
tooltip: AppLocalizations.of(context).delete,
|
||||
onPressed: () {
|
||||
Provider.of<WorkoutPlansProvider>(context, listen: false).deleteSet(set);
|
||||
// Provider.of<RoutinesProvider>(context, listen: false).deleteSet(set);
|
||||
},
|
||||
),
|
||||
Expanded(
|
||||
child: Column(
|
||||
children: [
|
||||
if (set.comment != '') MutedText(set.comment),
|
||||
...set.settingsFiltered.map(
|
||||
(setting) => SettingWidget(
|
||||
set: set,
|
||||
setting: setting,
|
||||
expanded: _editing,
|
||||
toggle: _toggleExpanded,
|
||||
),
|
||||
),
|
||||
// ...set.settingsFiltered.map(
|
||||
// (setting) => SettingWidget(
|
||||
// set: set,
|
||||
// setting: setting,
|
||||
// expanded: _editing,
|
||||
// toggle: _toggleExpanded,
|
||||
// ),
|
||||
// ),
|
||||
const Divider(),
|
||||
],
|
||||
),
|
||||
@@ -168,7 +169,7 @@ class _WorkoutDayWidgetState extends State<WorkoutDayWidget> {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
DayHeader(
|
||||
day: widget._day,
|
||||
day: widget._dayData,
|
||||
expanded: _editing,
|
||||
toggle: _toggleExpanded,
|
||||
),
|
||||
@@ -187,7 +188,7 @@ class _WorkoutDayWidgetState extends State<WorkoutDayWidget> {
|
||||
FormScreen.routeName,
|
||||
arguments: FormScreenArguments(
|
||||
AppLocalizations.of(context).newSet,
|
||||
SetFormWidget(widget._day),
|
||||
SetFormWidget(widget._dayData.day),
|
||||
hasListView: true,
|
||||
padding: EdgeInsets.zero,
|
||||
),
|
||||
@@ -204,11 +205,11 @@ class _WorkoutDayWidgetState extends State<WorkoutDayWidget> {
|
||||
arguments: FormScreenArguments(
|
||||
AppLocalizations.of(context).edit,
|
||||
DayFormWidget(
|
||||
Provider.of<WorkoutPlansProvider>(
|
||||
Provider.of<RoutinesProvider>(
|
||||
context,
|
||||
listen: false,
|
||||
).findById(widget._day.routineId),
|
||||
widget._day,
|
||||
).findById(widget._dayData.day.routineId),
|
||||
widget._dayData.day,
|
||||
),
|
||||
hasListView: true,
|
||||
),
|
||||
@@ -219,10 +220,10 @@ class _WorkoutDayWidgetState extends State<WorkoutDayWidget> {
|
||||
icon: const Icon(Icons.delete),
|
||||
label: Text(AppLocalizations.of(context).delete),
|
||||
onPressed: () {
|
||||
Provider.of<WorkoutPlansProvider>(
|
||||
Provider.of<RoutinesProvider>(
|
||||
context,
|
||||
listen: false,
|
||||
).deleteDay(widget._day);
|
||||
).deleteDay(widget._dayData.day);
|
||||
},
|
||||
),
|
||||
],
|
||||
@@ -242,16 +243,16 @@ class _WorkoutDayWidgetState extends State<WorkoutDayWidget> {
|
||||
startIndex = newIndex;
|
||||
}
|
||||
setState(() {
|
||||
_sets.insert(newIndex, _sets.removeAt(oldIndex));
|
||||
_slots.insert(newIndex, _slots.removeAt(oldIndex));
|
||||
});
|
||||
_sets = await Provider.of<WorkoutPlansProvider>(
|
||||
context,
|
||||
listen: false,
|
||||
).reorderSets(_sets, startIndex);
|
||||
// _slots = await Provider.of<RoutinesProvider>(
|
||||
// context,
|
||||
// listen: false,
|
||||
// ).reorderSets(_slots, startIndex);
|
||||
},
|
||||
children: [
|
||||
for (var i = 0; i < widget._day.slots.length; i++)
|
||||
getSetRow(widget._day.slots[i], i),
|
||||
for (var i = 0; i < widget._dayData.slots.length; i++)
|
||||
getSetRow(widget._dayData.slots[i], i),
|
||||
],
|
||||
),
|
||||
],
|
||||
@@ -262,15 +263,15 @@ class _WorkoutDayWidgetState extends State<WorkoutDayWidget> {
|
||||
}
|
||||
|
||||
class DayHeader extends StatelessWidget {
|
||||
final Day _day;
|
||||
final DayData _dayData;
|
||||
final bool _editing;
|
||||
final Function _toggle;
|
||||
|
||||
const DayHeader({
|
||||
required Day day,
|
||||
required DayData day,
|
||||
required bool expanded,
|
||||
required Function toggle,
|
||||
}) : _day = day,
|
||||
}) : _dayData = day,
|
||||
_editing = expanded,
|
||||
_toggle = toggle;
|
||||
|
||||
@@ -279,11 +280,11 @@ class DayHeader extends StatelessWidget {
|
||||
return ListTile(
|
||||
contentPadding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||
title: Text(
|
||||
_day.name,
|
||||
_dayData.day.name,
|
||||
style: Theme.of(context).textTheme.headlineSmall,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
subtitle: Text(_day.description),
|
||||
subtitle: Text(_dayData.day.description),
|
||||
leading: const Icon(Icons.play_arrow),
|
||||
minLeadingWidth: 8,
|
||||
trailing: Row(mainAxisSize: MainAxisSize.min, children: [
|
||||
@@ -300,7 +301,7 @@ class DayHeader extends StatelessWidget {
|
||||
onTap: () {
|
||||
Navigator.of(context).pushNamed(
|
||||
GymModeScreen.routeName,
|
||||
arguments: _day,
|
||||
arguments: _dayData,
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
@@ -103,15 +103,15 @@ class WorkoutForm extends StatelessWidget {
|
||||
|
||||
// Save to DB
|
||||
if (_plan.id != null) {
|
||||
await Provider.of<WorkoutPlansProvider>(context, listen: false).editWorkout(_plan);
|
||||
await Provider.of<RoutinesProvider>(context, listen: false).editWorkout(_plan);
|
||||
if (context.mounted) {
|
||||
Navigator.of(context).pop();
|
||||
}
|
||||
} else {
|
||||
final Routine newPlan = await Provider.of<WorkoutPlansProvider>(
|
||||
final Routine newPlan = await Provider.of<RoutinesProvider>(
|
||||
context,
|
||||
listen: false,
|
||||
).addWorkout(_plan);
|
||||
).addRoutine(_plan);
|
||||
if (context.mounted) {
|
||||
Navigator.of(context).pushReplacementNamed(
|
||||
WorkoutPlanScreen.routeName,
|
||||
@@ -187,12 +187,12 @@ class _DayFormWidgetState extends State<DayFormWidget> {
|
||||
|
||||
try {
|
||||
if (widget._day.id == null) {
|
||||
Provider.of<WorkoutPlansProvider>(context, listen: false).addDay(
|
||||
Provider.of<RoutinesProvider>(context, listen: false).addDay(
|
||||
widget._day,
|
||||
widget.workout,
|
||||
);
|
||||
} else {
|
||||
Provider.of<WorkoutPlansProvider>(context, listen: false).editDay(
|
||||
Provider.of<RoutinesProvider>(context, listen: false).editDay(
|
||||
widget._day,
|
||||
);
|
||||
}
|
||||
@@ -268,7 +268,7 @@ class _SetFormWidgetState extends State<SetFormWidget> {
|
||||
|
||||
/// Adds settings to the set
|
||||
void addSettings() {
|
||||
final workoutProvider = context.read<WorkoutPlansProvider>();
|
||||
final workoutProvider = context.read<RoutinesProvider>();
|
||||
|
||||
widget._set.entries = [];
|
||||
int order = 0;
|
||||
@@ -391,12 +391,12 @@ class _SetFormWidgetState extends State<SetFormWidget> {
|
||||
}
|
||||
|
||||
// At least one setting has to be filled in
|
||||
if (widget._set.entries
|
||||
.where((s) => s.weight == null && s.reps == null)
|
||||
.length ==
|
||||
widget._set.entries.length) {
|
||||
return AppLocalizations.of(context).enterRepetitionsOrWeight;
|
||||
}
|
||||
// if (widget._set.entries
|
||||
// .where((s) => s.weight == null && s.reps == null)
|
||||
// .length ==
|
||||
// widget._set.entries.length) {
|
||||
// return AppLocalizations.of(context).enterRepetitionsOrWeight;
|
||||
// }
|
||||
return null;
|
||||
},
|
||||
);
|
||||
@@ -538,7 +538,7 @@ class _SetFormWidgetState extends State<SetFormWidget> {
|
||||
}
|
||||
_formKey.currentState!.save();
|
||||
|
||||
final workoutProvider = Provider.of<WorkoutPlansProvider>(
|
||||
final workoutProvider = Provider.of<RoutinesProvider>(
|
||||
context,
|
||||
listen: false,
|
||||
);
|
||||
@@ -548,7 +548,7 @@ class _SetFormWidgetState extends State<SetFormWidget> {
|
||||
widget._set.id = setDb.id;
|
||||
|
||||
// Remove unused settings
|
||||
widget._set.entries.removeWhere((s) => s.weight == null && s.reps == null);
|
||||
// widget._set.entries.removeWhere((s) => s.weight == null && s.reps == null);
|
||||
|
||||
// Save remaining settings
|
||||
for (final setting in widget._set.entries) {
|
||||
@@ -735,7 +735,7 @@ class RepsInputWidget extends StatelessWidget {
|
||||
onChanged: (newValue) {
|
||||
if (newValue != '') {
|
||||
try {
|
||||
_setting.reps = int.parse(newValue);
|
||||
// _setting.reps = int.parse(newValue);
|
||||
} catch (e) {}
|
||||
}
|
||||
},
|
||||
@@ -772,7 +772,7 @@ class WeightInputWidget extends StatelessWidget {
|
||||
onChanged: (newValue) {
|
||||
if (newValue != '') {
|
||||
try {
|
||||
_setting.weight = double.parse(newValue);
|
||||
// _setting.weight = double.parse(newValue);
|
||||
} catch (e) {}
|
||||
}
|
||||
},
|
||||
@@ -883,7 +883,7 @@ class _WeightUnitInputWidgetState extends State<WeightUnitInputWidget> {
|
||||
widget._setting.weightUnit = newValue;
|
||||
});
|
||||
},
|
||||
items: Provider.of<WorkoutPlansProvider>(context, listen: false)
|
||||
items: Provider.of<RoutinesProvider>(context, listen: false)
|
||||
.weightUnits
|
||||
.map<DropdownMenuItem<WeightUnit>>((WeightUnit value) {
|
||||
return DropdownMenuItem<WeightUnit>(
|
||||
@@ -925,7 +925,7 @@ class _RepetitionUnitInputWidgetState extends State<RepetitionUnitInputWidget> {
|
||||
widget._setting.repetitionUnit = newValue;
|
||||
});
|
||||
},
|
||||
items: Provider.of<WorkoutPlansProvider>(context, listen: false)
|
||||
items: Provider.of<RoutinesProvider>(context, listen: false)
|
||||
.repetitionUnits
|
||||
.map<DropdownMenuItem<RepetitionUnit>>((RepetitionUnit value) {
|
||||
return DropdownMenuItem<RepetitionUnit>(
|
||||
|
||||
@@ -104,7 +104,7 @@ class _GymModeState extends State<GymMode> {
|
||||
// Returns the list of exercise overview, sets and pause pages
|
||||
List<Widget> getContent() {
|
||||
final exerciseProvider = Provider.of<ExercisesProvider>(context, listen: false);
|
||||
final workoutProvider = Provider.of<WorkoutPlansProvider>(context, listen: false);
|
||||
final workoutProvider = Provider.of<RoutinesProvider>(context, listen: false);
|
||||
var currentElement = 1;
|
||||
final List<Widget> out = [];
|
||||
|
||||
@@ -149,7 +149,7 @@ class _GymModeState extends State<GymMode> {
|
||||
StartPage(_controller, widget._workoutDay, _exercisePages),
|
||||
...getContent(),
|
||||
SessionPage(
|
||||
Provider.of<WorkoutPlansProvider>(context, listen: false)
|
||||
Provider.of<RoutinesProvider>(context, listen: false)
|
||||
.findById(widget._workoutDay.routineId),
|
||||
_controller,
|
||||
widget._start,
|
||||
@@ -238,7 +238,7 @@ class LogPage extends StatefulWidget {
|
||||
this._exercisePages,
|
||||
) {
|
||||
_log.date = DateTime.now();
|
||||
_log.workoutPlan = _workoutPlan.id!;
|
||||
_log.routineId = _workoutPlan.id!;
|
||||
_log.exerciseBase = _exerciseBase;
|
||||
_log.weightUnit = _entry.weightUnitObj;
|
||||
_log.repetitionUnit = _entry.repetitionUnitObj;
|
||||
@@ -265,13 +265,13 @@ class _LogPageState extends State<LogPage> {
|
||||
|
||||
focusNode = FocusNode();
|
||||
|
||||
if (widget._entry.reps != null) {
|
||||
_repsController.text = widget._entry.reps.toString();
|
||||
}
|
||||
// if (widget._entry.reps != null) {
|
||||
_repsController.text = 'widget._entry.reps.toString()';
|
||||
// }
|
||||
|
||||
if (widget._entry.weight != null) {
|
||||
_weightController.text = widget._entry.weight.toString();
|
||||
}
|
||||
// if (widget._entry.weight != null) {
|
||||
_weightController.text = 'widget._entry.weight.toString()';
|
||||
// }
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -459,7 +459,7 @@ class _LogPageState extends State<LogPage> {
|
||||
|
||||
// Save the entry on the server
|
||||
try {
|
||||
await Provider.of<WorkoutPlansProvider>(
|
||||
await Provider.of<RoutinesProvider>(
|
||||
context,
|
||||
listen: false,
|
||||
).addLog(widget._log);
|
||||
@@ -631,7 +631,7 @@ class _LogPageState extends State<LogPage> {
|
||||
: Container(),
|
||||
),
|
||||
// Only show calculator for barbell
|
||||
if (widget._log.exerciseBaseObj.equipment.map((e) => e.id).contains(ID_EQUIPMENT_BARBELL))
|
||||
if (widget._log.exercise.equipment.map((e) => e.id).contains(ID_EQUIPMENT_BARBELL))
|
||||
getPlates(),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 15),
|
||||
@@ -889,7 +889,7 @@ class _SessionPageState extends State<SessionPage> {
|
||||
|
||||
// Save the entry on the server
|
||||
try {
|
||||
await Provider.of<WorkoutPlansProvider>(
|
||||
await Provider.of<RoutinesProvider>(
|
||||
context,
|
||||
listen: false,
|
||||
).addSession(_session);
|
||||
|
||||
@@ -36,7 +36,7 @@ class ExerciseLogChart extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final workoutPlansData = Provider.of<WorkoutPlansProvider>(context, listen: false);
|
||||
final workoutPlansData = Provider.of<RoutinesProvider>(context, listen: false);
|
||||
final workout = workoutPlansData.currentPlan;
|
||||
var colors = generateChartColors(1).iterator;
|
||||
|
||||
|
||||
@@ -25,10 +25,10 @@ import 'package:wger/widgets/workouts/day.dart';
|
||||
import 'package:wger/widgets/workouts/forms.dart';
|
||||
|
||||
class WorkoutPlanDetail extends StatefulWidget {
|
||||
final Routine _workoutPlan;
|
||||
final Routine _routine;
|
||||
final Function _changeMode;
|
||||
|
||||
const WorkoutPlanDetail(this._workoutPlan, this._changeMode);
|
||||
const WorkoutPlanDetail(this._routine, this._changeMode);
|
||||
|
||||
@override
|
||||
_WorkoutPlanDetailState createState() => _WorkoutPlanDetailState();
|
||||
@@ -39,7 +39,7 @@ class _WorkoutPlanDetailState extends State<WorkoutPlanDetail> {
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
children: [
|
||||
if (widget._workoutPlan.days.isNotEmpty)
|
||||
if (widget._routine.dayDataCurrentIteration.isNotEmpty)
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(10),
|
||||
child: ToggleButtons(
|
||||
@@ -56,12 +56,12 @@ class _WorkoutPlanDetailState extends State<WorkoutPlanDetail> {
|
||||
],
|
||||
),
|
||||
),
|
||||
if (widget._workoutPlan.description != '')
|
||||
if (widget._routine.description != '')
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(15),
|
||||
child: Text(widget._workoutPlan.description),
|
||||
child: Text(widget._routine.description),
|
||||
),
|
||||
...widget._workoutPlan.days.map((workoutDay) => WorkoutDayWidget(workoutDay)),
|
||||
...widget._routine.dayDataCurrentIteration.map((dayData) => WorkoutDayWidget(dayData)),
|
||||
Column(
|
||||
children: [
|
||||
ElevatedButton(
|
||||
@@ -72,7 +72,7 @@ class _WorkoutPlanDetailState extends State<WorkoutPlanDetail> {
|
||||
FormScreen.routeName,
|
||||
arguments: FormScreenArguments(
|
||||
AppLocalizations.of(context).newDay,
|
||||
DayFormWidget(widget._workoutPlan),
|
||||
DayFormWidget(widget._routine),
|
||||
hasListView: true,
|
||||
),
|
||||
);
|
||||
|
||||
@@ -25,7 +25,7 @@ import 'package:wger/screens/workout_plan_screen.dart';
|
||||
import 'package:wger/widgets/core/text_prompt.dart';
|
||||
|
||||
class WorkoutPlansList extends StatelessWidget {
|
||||
final WorkoutPlansProvider _workoutProvider;
|
||||
final RoutinesProvider _workoutProvider;
|
||||
|
||||
const WorkoutPlansList(this._workoutProvider);
|
||||
|
||||
@@ -87,7 +87,7 @@ class WorkoutPlansList extends StatelessWidget {
|
||||
),
|
||||
onPressed: () {
|
||||
// Confirmed, delete the workout
|
||||
Provider.of<WorkoutPlansProvider>(
|
||||
Provider.of<RoutinesProvider>(
|
||||
context,
|
||||
listen: false,
|
||||
).deleteWorkout(currentWorkout.id!);
|
||||
|
||||
@@ -34,8 +34,7 @@ class _FakeResponse_0 extends _i1.SmartFake implements _i2.Response {
|
||||
);
|
||||
}
|
||||
|
||||
class _FakeStreamedResponse_1 extends _i1.SmartFake
|
||||
implements _i2.StreamedResponse {
|
||||
class _FakeStreamedResponse_1 extends _i1.SmartFake implements _i2.StreamedResponse {
|
||||
_FakeStreamedResponse_1(
|
||||
Object parent,
|
||||
Invocation parentInvocation,
|
||||
@@ -255,14 +254,12 @@ class MockClient extends _i1.Mock implements _i2.Client {
|
||||
) as _i3.Future<_i6.Uint8List>);
|
||||
|
||||
@override
|
||||
_i3.Future<_i2.StreamedResponse> send(_i2.BaseRequest? request) =>
|
||||
(super.noSuchMethod(
|
||||
_i3.Future<_i2.StreamedResponse> send(_i2.BaseRequest? request) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#send,
|
||||
[request],
|
||||
),
|
||||
returnValue:
|
||||
_i3.Future<_i2.StreamedResponse>.value(_FakeStreamedResponse_1(
|
||||
returnValue: _i3.Future<_i2.StreamedResponse>.value(_FakeStreamedResponse_1(
|
||||
this,
|
||||
Invocation.method(
|
||||
#send,
|
||||
|
||||
@@ -34,8 +34,7 @@ import 'package:wger/providers/user.dart' as _i15;
|
||||
// ignore_for_file: camel_case_types
|
||||
// ignore_for_file: subtype_of_sealed_class
|
||||
|
||||
class _FakeWgerBaseProvider_0 extends _i1.SmartFake
|
||||
implements _i2.WgerBaseProvider {
|
||||
class _FakeWgerBaseProvider_0 extends _i1.SmartFake implements _i2.WgerBaseProvider {
|
||||
_FakeWgerBaseProvider_0(
|
||||
Object parent,
|
||||
Invocation parentInvocation,
|
||||
@@ -88,8 +87,7 @@ class _FakeAlias_4 extends _i1.SmartFake implements _i6.Alias {
|
||||
/// A class which mocks [AddExerciseProvider].
|
||||
///
|
||||
/// See the documentation for Mockito's code generation for more information.
|
||||
class MockAddExerciseProvider extends _i1.Mock
|
||||
implements _i7.AddExerciseProvider {
|
||||
class MockAddExerciseProvider extends _i1.Mock implements _i7.AddExerciseProvider {
|
||||
MockAddExerciseProvider() {
|
||||
_i1.throwOnMissingStub(this);
|
||||
}
|
||||
@@ -378,8 +376,7 @@ class MockAddExerciseProvider extends _i1.Mock
|
||||
) as _i13.Future<void>);
|
||||
|
||||
@override
|
||||
_i13.Future<_i4.Translation> addExerciseTranslation(
|
||||
_i4.Translation? exercise) =>
|
||||
_i13.Future<_i4.Translation> addExerciseTranslation(_i4.Translation? exercise) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#addExerciseTranslation,
|
||||
|
||||
@@ -236,13 +236,13 @@ class MockGalleryProvider extends _i1.Mock implements _i4.GalleryProvider {
|
||||
) as Uri);
|
||||
|
||||
@override
|
||||
_i6.Future<Map<String, dynamic>> fetch(Uri? uri) => (super.noSuchMethod(
|
||||
_i6.Future<dynamic> fetch(Uri? uri) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#fetch,
|
||||
[uri],
|
||||
),
|
||||
returnValue: _i6.Future<Map<String, dynamic>>.value(<String, dynamic>{}),
|
||||
) as _i6.Future<Map<String, dynamic>>);
|
||||
returnValue: _i6.Future<dynamic>.value(),
|
||||
) as _i6.Future<dynamic>);
|
||||
|
||||
@override
|
||||
_i6.Future<List<dynamic>> fetchPaginated(Uri? uri) => (super.noSuchMethod(
|
||||
|
||||
@@ -236,13 +236,13 @@ class MockGalleryProvider extends _i1.Mock implements _i4.GalleryProvider {
|
||||
) as Uri);
|
||||
|
||||
@override
|
||||
_i6.Future<Map<String, dynamic>> fetch(Uri? uri) => (super.noSuchMethod(
|
||||
_i6.Future<dynamic> fetch(Uri? uri) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#fetch,
|
||||
[uri],
|
||||
),
|
||||
returnValue: _i6.Future<Map<String, dynamic>>.value(<String, dynamic>{}),
|
||||
) as _i6.Future<Map<String, dynamic>>);
|
||||
returnValue: _i6.Future<dynamic>.value(),
|
||||
) as _i6.Future<dynamic>);
|
||||
|
||||
@override
|
||||
_i6.Future<List<dynamic>> fetchPaginated(Uri? uri) => (super.noSuchMethod(
|
||||
|
||||
@@ -25,8 +25,7 @@ import 'package:wger/providers/measurement.dart' as _i4;
|
||||
// ignore_for_file: camel_case_types
|
||||
// ignore_for_file: subtype_of_sealed_class
|
||||
|
||||
class _FakeWgerBaseProvider_0 extends _i1.SmartFake
|
||||
implements _i2.WgerBaseProvider {
|
||||
class _FakeWgerBaseProvider_0 extends _i1.SmartFake implements _i2.WgerBaseProvider {
|
||||
_FakeWgerBaseProvider_0(
|
||||
Object parent,
|
||||
Invocation parentInvocation,
|
||||
@@ -36,8 +35,7 @@ class _FakeWgerBaseProvider_0 extends _i1.SmartFake
|
||||
);
|
||||
}
|
||||
|
||||
class _FakeMeasurementCategory_1 extends _i1.SmartFake
|
||||
implements _i3.MeasurementCategory {
|
||||
class _FakeMeasurementCategory_1 extends _i1.SmartFake implements _i3.MeasurementCategory {
|
||||
_FakeMeasurementCategory_1(
|
||||
Object parent,
|
||||
Invocation parentInvocation,
|
||||
@@ -50,8 +48,7 @@ class _FakeMeasurementCategory_1 extends _i1.SmartFake
|
||||
/// A class which mocks [MeasurementProvider].
|
||||
///
|
||||
/// See the documentation for Mockito's code generation for more information.
|
||||
class MockMeasurementProvider extends _i1.Mock
|
||||
implements _i4.MeasurementProvider {
|
||||
class MockMeasurementProvider extends _i1.Mock implements _i4.MeasurementProvider {
|
||||
MockMeasurementProvider() {
|
||||
_i1.throwOnMissingStub(this);
|
||||
}
|
||||
@@ -132,8 +129,7 @@ class MockMeasurementProvider extends _i1.Mock
|
||||
) as _i5.Future<void>);
|
||||
|
||||
@override
|
||||
_i5.Future<void> addCategory(_i3.MeasurementCategory? category) =>
|
||||
(super.noSuchMethod(
|
||||
_i5.Future<void> addCategory(_i3.MeasurementCategory? category) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#addCategory,
|
||||
[category],
|
||||
|
||||
@@ -149,13 +149,13 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider {
|
||||
) as Uri);
|
||||
|
||||
@override
|
||||
_i5.Future<Map<String, dynamic>> fetch(Uri? uri) => (super.noSuchMethod(
|
||||
_i5.Future<dynamic> fetch(Uri? uri) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#fetch,
|
||||
[uri],
|
||||
),
|
||||
returnValue: _i5.Future<Map<String, dynamic>>.value(<String, dynamic>{}),
|
||||
) as _i5.Future<Map<String, dynamic>>);
|
||||
returnValue: _i5.Future<dynamic>.value(),
|
||||
) as _i5.Future<dynamic>);
|
||||
|
||||
@override
|
||||
_i5.Future<List<dynamic>> fetchPaginated(Uri? uri) => (super.noSuchMethod(
|
||||
|
||||
@@ -29,8 +29,7 @@ import 'package:wger/providers/nutrition.dart' as _i8;
|
||||
// ignore_for_file: camel_case_types
|
||||
// ignore_for_file: subtype_of_sealed_class
|
||||
|
||||
class _FakeWgerBaseProvider_0 extends _i1.SmartFake
|
||||
implements _i2.WgerBaseProvider {
|
||||
class _FakeWgerBaseProvider_0 extends _i1.SmartFake implements _i2.WgerBaseProvider {
|
||||
_FakeWgerBaseProvider_0(
|
||||
Object parent,
|
||||
Invocation parentInvocation,
|
||||
@@ -40,8 +39,7 @@ class _FakeWgerBaseProvider_0 extends _i1.SmartFake
|
||||
);
|
||||
}
|
||||
|
||||
class _FakeIngredientDatabase_1 extends _i1.SmartFake
|
||||
implements _i3.IngredientDatabase {
|
||||
class _FakeIngredientDatabase_1 extends _i1.SmartFake implements _i3.IngredientDatabase {
|
||||
_FakeIngredientDatabase_1(
|
||||
Object parent,
|
||||
Invocation parentInvocation,
|
||||
@@ -51,8 +49,7 @@ class _FakeIngredientDatabase_1 extends _i1.SmartFake
|
||||
);
|
||||
}
|
||||
|
||||
class _FakeNutritionalPlan_2 extends _i1.SmartFake
|
||||
implements _i4.NutritionalPlan {
|
||||
class _FakeNutritionalPlan_2 extends _i1.SmartFake implements _i4.NutritionalPlan {
|
||||
_FakeNutritionalPlan_2(
|
||||
Object parent,
|
||||
Invocation parentInvocation,
|
||||
@@ -95,8 +92,7 @@ class _FakeIngredient_5 extends _i1.SmartFake implements _i7.Ingredient {
|
||||
/// A class which mocks [NutritionPlansProvider].
|
||||
///
|
||||
/// See the documentation for Mockito's code generation for more information.
|
||||
class MockNutritionPlansProvider extends _i1.Mock
|
||||
implements _i8.NutritionPlansProvider {
|
||||
class MockNutritionPlansProvider extends _i1.Mock implements _i8.NutritionPlansProvider {
|
||||
MockNutritionPlansProvider() {
|
||||
_i1.throwOnMissingStub(this);
|
||||
}
|
||||
@@ -206,14 +202,12 @@ class MockNutritionPlansProvider extends _i1.Mock
|
||||
) as _i9.Future<void>);
|
||||
|
||||
@override
|
||||
_i9.Future<_i4.NutritionalPlan> fetchAndSetPlanSparse(int? planId) =>
|
||||
(super.noSuchMethod(
|
||||
_i9.Future<_i4.NutritionalPlan> fetchAndSetPlanSparse(int? planId) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#fetchAndSetPlanSparse,
|
||||
[planId],
|
||||
),
|
||||
returnValue:
|
||||
_i9.Future<_i4.NutritionalPlan>.value(_FakeNutritionalPlan_2(
|
||||
returnValue: _i9.Future<_i4.NutritionalPlan>.value(_FakeNutritionalPlan_2(
|
||||
this,
|
||||
Invocation.method(
|
||||
#fetchAndSetPlanSparse,
|
||||
@@ -223,14 +217,12 @@ class MockNutritionPlansProvider extends _i1.Mock
|
||||
) as _i9.Future<_i4.NutritionalPlan>);
|
||||
|
||||
@override
|
||||
_i9.Future<_i4.NutritionalPlan> fetchAndSetPlanFull(int? planId) =>
|
||||
(super.noSuchMethod(
|
||||
_i9.Future<_i4.NutritionalPlan> fetchAndSetPlanFull(int? planId) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#fetchAndSetPlanFull,
|
||||
[planId],
|
||||
),
|
||||
returnValue:
|
||||
_i9.Future<_i4.NutritionalPlan>.value(_FakeNutritionalPlan_2(
|
||||
returnValue: _i9.Future<_i4.NutritionalPlan>.value(_FakeNutritionalPlan_2(
|
||||
this,
|
||||
Invocation.method(
|
||||
#fetchAndSetPlanFull,
|
||||
@@ -240,14 +232,12 @@ class MockNutritionPlansProvider extends _i1.Mock
|
||||
) as _i9.Future<_i4.NutritionalPlan>);
|
||||
|
||||
@override
|
||||
_i9.Future<_i4.NutritionalPlan> addPlan(_i4.NutritionalPlan? planData) =>
|
||||
(super.noSuchMethod(
|
||||
_i9.Future<_i4.NutritionalPlan> addPlan(_i4.NutritionalPlan? planData) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#addPlan,
|
||||
[planData],
|
||||
),
|
||||
returnValue:
|
||||
_i9.Future<_i4.NutritionalPlan>.value(_FakeNutritionalPlan_2(
|
||||
returnValue: _i9.Future<_i4.NutritionalPlan>.value(_FakeNutritionalPlan_2(
|
||||
this,
|
||||
Invocation.method(
|
||||
#addPlan,
|
||||
@@ -352,8 +342,7 @@ class MockNutritionPlansProvider extends _i1.Mock
|
||||
) as _i9.Future<_i6.MealItem>);
|
||||
|
||||
@override
|
||||
_i9.Future<void> deleteMealItem(_i6.MealItem? mealItem) =>
|
||||
(super.noSuchMethod(
|
||||
_i9.Future<void> deleteMealItem(_i6.MealItem? mealItem) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#deleteMealItem,
|
||||
[mealItem],
|
||||
@@ -423,8 +412,7 @@ class MockNutritionPlansProvider extends _i1.Mock
|
||||
) as _i9.Future<List<_i10.IngredientApiSearchEntry>>);
|
||||
|
||||
@override
|
||||
_i9.Future<_i7.Ingredient?> searchIngredientWithCode(String? code) =>
|
||||
(super.noSuchMethod(
|
||||
_i9.Future<_i7.Ingredient?> searchIngredientWithCode(String? code) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#searchIngredientWithCode,
|
||||
[code],
|
||||
@@ -479,8 +467,7 @@ class MockNutritionPlansProvider extends _i1.Mock
|
||||
) as _i9.Future<void>);
|
||||
|
||||
@override
|
||||
_i9.Future<void> fetchAndSetLogs(_i4.NutritionalPlan? plan) =>
|
||||
(super.noSuchMethod(
|
||||
_i9.Future<void> fetchAndSetLogs(_i4.NutritionalPlan? plan) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#fetchAndSetLogs,
|
||||
[plan],
|
||||
|
||||
@@ -29,8 +29,7 @@ import 'package:wger/providers/nutrition.dart' as _i8;
|
||||
// ignore_for_file: camel_case_types
|
||||
// ignore_for_file: subtype_of_sealed_class
|
||||
|
||||
class _FakeWgerBaseProvider_0 extends _i1.SmartFake
|
||||
implements _i2.WgerBaseProvider {
|
||||
class _FakeWgerBaseProvider_0 extends _i1.SmartFake implements _i2.WgerBaseProvider {
|
||||
_FakeWgerBaseProvider_0(
|
||||
Object parent,
|
||||
Invocation parentInvocation,
|
||||
@@ -40,8 +39,7 @@ class _FakeWgerBaseProvider_0 extends _i1.SmartFake
|
||||
);
|
||||
}
|
||||
|
||||
class _FakeIngredientDatabase_1 extends _i1.SmartFake
|
||||
implements _i3.IngredientDatabase {
|
||||
class _FakeIngredientDatabase_1 extends _i1.SmartFake implements _i3.IngredientDatabase {
|
||||
_FakeIngredientDatabase_1(
|
||||
Object parent,
|
||||
Invocation parentInvocation,
|
||||
@@ -51,8 +49,7 @@ class _FakeIngredientDatabase_1 extends _i1.SmartFake
|
||||
);
|
||||
}
|
||||
|
||||
class _FakeNutritionalPlan_2 extends _i1.SmartFake
|
||||
implements _i4.NutritionalPlan {
|
||||
class _FakeNutritionalPlan_2 extends _i1.SmartFake implements _i4.NutritionalPlan {
|
||||
_FakeNutritionalPlan_2(
|
||||
Object parent,
|
||||
Invocation parentInvocation,
|
||||
@@ -95,8 +92,7 @@ class _FakeIngredient_5 extends _i1.SmartFake implements _i7.Ingredient {
|
||||
/// A class which mocks [NutritionPlansProvider].
|
||||
///
|
||||
/// See the documentation for Mockito's code generation for more information.
|
||||
class MockNutritionPlansProvider extends _i1.Mock
|
||||
implements _i8.NutritionPlansProvider {
|
||||
class MockNutritionPlansProvider extends _i1.Mock implements _i8.NutritionPlansProvider {
|
||||
MockNutritionPlansProvider() {
|
||||
_i1.throwOnMissingStub(this);
|
||||
}
|
||||
@@ -206,14 +202,12 @@ class MockNutritionPlansProvider extends _i1.Mock
|
||||
) as _i9.Future<void>);
|
||||
|
||||
@override
|
||||
_i9.Future<_i4.NutritionalPlan> fetchAndSetPlanSparse(int? planId) =>
|
||||
(super.noSuchMethod(
|
||||
_i9.Future<_i4.NutritionalPlan> fetchAndSetPlanSparse(int? planId) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#fetchAndSetPlanSparse,
|
||||
[planId],
|
||||
),
|
||||
returnValue:
|
||||
_i9.Future<_i4.NutritionalPlan>.value(_FakeNutritionalPlan_2(
|
||||
returnValue: _i9.Future<_i4.NutritionalPlan>.value(_FakeNutritionalPlan_2(
|
||||
this,
|
||||
Invocation.method(
|
||||
#fetchAndSetPlanSparse,
|
||||
@@ -223,14 +217,12 @@ class MockNutritionPlansProvider extends _i1.Mock
|
||||
) as _i9.Future<_i4.NutritionalPlan>);
|
||||
|
||||
@override
|
||||
_i9.Future<_i4.NutritionalPlan> fetchAndSetPlanFull(int? planId) =>
|
||||
(super.noSuchMethod(
|
||||
_i9.Future<_i4.NutritionalPlan> fetchAndSetPlanFull(int? planId) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#fetchAndSetPlanFull,
|
||||
[planId],
|
||||
),
|
||||
returnValue:
|
||||
_i9.Future<_i4.NutritionalPlan>.value(_FakeNutritionalPlan_2(
|
||||
returnValue: _i9.Future<_i4.NutritionalPlan>.value(_FakeNutritionalPlan_2(
|
||||
this,
|
||||
Invocation.method(
|
||||
#fetchAndSetPlanFull,
|
||||
@@ -240,14 +232,12 @@ class MockNutritionPlansProvider extends _i1.Mock
|
||||
) as _i9.Future<_i4.NutritionalPlan>);
|
||||
|
||||
@override
|
||||
_i9.Future<_i4.NutritionalPlan> addPlan(_i4.NutritionalPlan? planData) =>
|
||||
(super.noSuchMethod(
|
||||
_i9.Future<_i4.NutritionalPlan> addPlan(_i4.NutritionalPlan? planData) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#addPlan,
|
||||
[planData],
|
||||
),
|
||||
returnValue:
|
||||
_i9.Future<_i4.NutritionalPlan>.value(_FakeNutritionalPlan_2(
|
||||
returnValue: _i9.Future<_i4.NutritionalPlan>.value(_FakeNutritionalPlan_2(
|
||||
this,
|
||||
Invocation.method(
|
||||
#addPlan,
|
||||
@@ -352,8 +342,7 @@ class MockNutritionPlansProvider extends _i1.Mock
|
||||
) as _i9.Future<_i6.MealItem>);
|
||||
|
||||
@override
|
||||
_i9.Future<void> deleteMealItem(_i6.MealItem? mealItem) =>
|
||||
(super.noSuchMethod(
|
||||
_i9.Future<void> deleteMealItem(_i6.MealItem? mealItem) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#deleteMealItem,
|
||||
[mealItem],
|
||||
@@ -423,8 +412,7 @@ class MockNutritionPlansProvider extends _i1.Mock
|
||||
) as _i9.Future<List<_i10.IngredientApiSearchEntry>>);
|
||||
|
||||
@override
|
||||
_i9.Future<_i7.Ingredient?> searchIngredientWithCode(String? code) =>
|
||||
(super.noSuchMethod(
|
||||
_i9.Future<_i7.Ingredient?> searchIngredientWithCode(String? code) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#searchIngredientWithCode,
|
||||
[code],
|
||||
@@ -479,8 +467,7 @@ class MockNutritionPlansProvider extends _i1.Mock
|
||||
) as _i9.Future<void>);
|
||||
|
||||
@override
|
||||
_i9.Future<void> fetchAndSetLogs(_i4.NutritionalPlan? plan) =>
|
||||
(super.noSuchMethod(
|
||||
_i9.Future<void> fetchAndSetLogs(_i4.NutritionalPlan? plan) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#fetchAndSetLogs,
|
||||
[plan],
|
||||
|
||||
@@ -68,8 +68,7 @@ class _FakeResponse_3 extends _i1.SmartFake implements _i3.Response {
|
||||
);
|
||||
}
|
||||
|
||||
class _FakeStreamedResponse_4 extends _i1.SmartFake
|
||||
implements _i3.StreamedResponse {
|
||||
class _FakeStreamedResponse_4 extends _i1.SmartFake implements _i3.StreamedResponse {
|
||||
_FakeStreamedResponse_4(
|
||||
Object parent,
|
||||
Invocation parentInvocation,
|
||||
@@ -124,8 +123,7 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider {
|
||||
);
|
||||
|
||||
@override
|
||||
Map<String, String> getDefaultHeaders({bool? includeAuth = false}) =>
|
||||
(super.noSuchMethod(
|
||||
Map<String, String> getDefaultHeaders({bool? includeAuth = false}) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#getDefaultHeaders,
|
||||
[],
|
||||
@@ -166,14 +164,13 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider {
|
||||
) as Uri);
|
||||
|
||||
@override
|
||||
_i5.Future<Map<String, dynamic>> fetch(Uri? uri) => (super.noSuchMethod(
|
||||
_i5.Future<dynamic> fetch(Uri? uri) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#fetch,
|
||||
[uri],
|
||||
),
|
||||
returnValue:
|
||||
_i5.Future<Map<String, dynamic>>.value(<String, dynamic>{}),
|
||||
) as _i5.Future<Map<String, dynamic>>);
|
||||
returnValue: _i5.Future<dynamic>.value(),
|
||||
) as _i5.Future<dynamic>);
|
||||
|
||||
@override
|
||||
_i5.Future<List<dynamic>> fetchPaginated(Uri? uri) => (super.noSuchMethod(
|
||||
@@ -197,8 +194,7 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider {
|
||||
uri,
|
||||
],
|
||||
),
|
||||
returnValue:
|
||||
_i5.Future<Map<String, dynamic>>.value(<String, dynamic>{}),
|
||||
returnValue: _i5.Future<Map<String, dynamic>>.value(<String, dynamic>{}),
|
||||
) as _i5.Future<Map<String, dynamic>>);
|
||||
|
||||
@override
|
||||
@@ -214,8 +210,7 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider {
|
||||
uri,
|
||||
],
|
||||
),
|
||||
returnValue:
|
||||
_i5.Future<Map<String, dynamic>>.value(<String, dynamic>{}),
|
||||
returnValue: _i5.Future<Map<String, dynamic>>.value(<String, dynamic>{}),
|
||||
) as _i5.Future<Map<String, dynamic>>);
|
||||
|
||||
@override
|
||||
@@ -280,8 +275,7 @@ class MockAuthProvider extends _i1.Mock implements _i2.AuthProvider {
|
||||
);
|
||||
|
||||
@override
|
||||
set applicationVersion(_i6.PackageInfo? _applicationVersion) =>
|
||||
super.noSuchMethod(
|
||||
set applicationVersion(_i6.PackageInfo? _applicationVersion) => super.noSuchMethod(
|
||||
Invocation.setter(
|
||||
#applicationVersion,
|
||||
_applicationVersion,
|
||||
@@ -415,8 +409,7 @@ class MockAuthProvider extends _i1.Mock implements _i2.AuthProvider {
|
||||
#locale: locale,
|
||||
},
|
||||
),
|
||||
returnValue: _i5.Future<Map<String, _i2.LoginActions>>.value(
|
||||
<String, _i2.LoginActions>{}),
|
||||
returnValue: _i5.Future<Map<String, _i2.LoginActions>>.value(<String, _i2.LoginActions>{}),
|
||||
) as _i5.Future<Map<String, _i2.LoginActions>>);
|
||||
|
||||
@override
|
||||
@@ -434,8 +427,7 @@ class MockAuthProvider extends _i1.Mock implements _i2.AuthProvider {
|
||||
serverUrl,
|
||||
],
|
||||
),
|
||||
returnValue: _i5.Future<Map<String, _i2.LoginActions>>.value(
|
||||
<String, _i2.LoginActions>{}),
|
||||
returnValue: _i5.Future<Map<String, _i2.LoginActions>>.value(<String, _i2.LoginActions>{}),
|
||||
) as _i5.Future<Map<String, _i2.LoginActions>>);
|
||||
|
||||
@override
|
||||
@@ -735,14 +727,12 @@ class MockClient extends _i1.Mock implements _i3.Client {
|
||||
) as _i5.Future<_i10.Uint8List>);
|
||||
|
||||
@override
|
||||
_i5.Future<_i3.StreamedResponse> send(_i3.BaseRequest? request) =>
|
||||
(super.noSuchMethod(
|
||||
_i5.Future<_i3.StreamedResponse> send(_i3.BaseRequest? request) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#send,
|
||||
[request],
|
||||
),
|
||||
returnValue:
|
||||
_i5.Future<_i3.StreamedResponse>.value(_FakeStreamedResponse_4(
|
||||
returnValue: _i5.Future<_i3.StreamedResponse>.value(_FakeStreamedResponse_4(
|
||||
this,
|
||||
Invocation.method(
|
||||
#send,
|
||||
|
||||
@@ -68,8 +68,7 @@ class _FakeResponse_3 extends _i1.SmartFake implements _i2.Response {
|
||||
);
|
||||
}
|
||||
|
||||
class _FakeStreamedResponse_4 extends _i1.SmartFake
|
||||
implements _i2.StreamedResponse {
|
||||
class _FakeStreamedResponse_4 extends _i1.SmartFake implements _i2.StreamedResponse {
|
||||
_FakeStreamedResponse_4(
|
||||
Object parent,
|
||||
Invocation parentInvocation,
|
||||
@@ -115,8 +114,7 @@ class MockAuthProvider extends _i1.Mock implements _i3.AuthProvider {
|
||||
);
|
||||
|
||||
@override
|
||||
set applicationVersion(_i4.PackageInfo? _applicationVersion) =>
|
||||
super.noSuchMethod(
|
||||
set applicationVersion(_i4.PackageInfo? _applicationVersion) => super.noSuchMethod(
|
||||
Invocation.setter(
|
||||
#applicationVersion,
|
||||
_applicationVersion,
|
||||
@@ -250,8 +248,7 @@ class MockAuthProvider extends _i1.Mock implements _i3.AuthProvider {
|
||||
#locale: locale,
|
||||
},
|
||||
),
|
||||
returnValue: _i5.Future<Map<String, _i3.LoginActions>>.value(
|
||||
<String, _i3.LoginActions>{}),
|
||||
returnValue: _i5.Future<Map<String, _i3.LoginActions>>.value(<String, _i3.LoginActions>{}),
|
||||
) as _i5.Future<Map<String, _i3.LoginActions>>);
|
||||
|
||||
@override
|
||||
@@ -269,8 +266,7 @@ class MockAuthProvider extends _i1.Mock implements _i3.AuthProvider {
|
||||
serverUrl,
|
||||
],
|
||||
),
|
||||
returnValue: _i5.Future<Map<String, _i3.LoginActions>>.value(
|
||||
<String, _i3.LoginActions>{}),
|
||||
returnValue: _i5.Future<Map<String, _i3.LoginActions>>.value(<String, _i3.LoginActions>{}),
|
||||
) as _i5.Future<Map<String, _i3.LoginActions>>);
|
||||
|
||||
@override
|
||||
@@ -405,8 +401,7 @@ class MockWgerBaseProvider extends _i1.Mock implements _i8.WgerBaseProvider {
|
||||
);
|
||||
|
||||
@override
|
||||
Map<String, String> getDefaultHeaders({bool? includeAuth = false}) =>
|
||||
(super.noSuchMethod(
|
||||
Map<String, String> getDefaultHeaders({bool? includeAuth = false}) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#getDefaultHeaders,
|
||||
[],
|
||||
@@ -447,14 +442,13 @@ class MockWgerBaseProvider extends _i1.Mock implements _i8.WgerBaseProvider {
|
||||
) as Uri);
|
||||
|
||||
@override
|
||||
_i5.Future<Map<String, dynamic>> fetch(Uri? uri) => (super.noSuchMethod(
|
||||
_i5.Future<dynamic> fetch(Uri? uri) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#fetch,
|
||||
[uri],
|
||||
),
|
||||
returnValue:
|
||||
_i5.Future<Map<String, dynamic>>.value(<String, dynamic>{}),
|
||||
) as _i5.Future<Map<String, dynamic>>);
|
||||
returnValue: _i5.Future<dynamic>.value(),
|
||||
) as _i5.Future<dynamic>);
|
||||
|
||||
@override
|
||||
_i5.Future<List<dynamic>> fetchPaginated(Uri? uri) => (super.noSuchMethod(
|
||||
@@ -478,8 +472,7 @@ class MockWgerBaseProvider extends _i1.Mock implements _i8.WgerBaseProvider {
|
||||
uri,
|
||||
],
|
||||
),
|
||||
returnValue:
|
||||
_i5.Future<Map<String, dynamic>>.value(<String, dynamic>{}),
|
||||
returnValue: _i5.Future<Map<String, dynamic>>.value(<String, dynamic>{}),
|
||||
) as _i5.Future<Map<String, dynamic>>);
|
||||
|
||||
@override
|
||||
@@ -495,8 +488,7 @@ class MockWgerBaseProvider extends _i1.Mock implements _i8.WgerBaseProvider {
|
||||
uri,
|
||||
],
|
||||
),
|
||||
returnValue:
|
||||
_i5.Future<Map<String, dynamic>>.value(<String, dynamic>{}),
|
||||
returnValue: _i5.Future<Map<String, dynamic>>.value(<String, dynamic>{}),
|
||||
) as _i5.Future<Map<String, dynamic>>);
|
||||
|
||||
@override
|
||||
@@ -735,14 +727,12 @@ class MockClient extends _i1.Mock implements _i2.Client {
|
||||
) as _i5.Future<_i10.Uint8List>);
|
||||
|
||||
@override
|
||||
_i5.Future<_i2.StreamedResponse> send(_i2.BaseRequest? request) =>
|
||||
(super.noSuchMethod(
|
||||
_i5.Future<_i2.StreamedResponse> send(_i2.BaseRequest? request) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#send,
|
||||
[request],
|
||||
),
|
||||
returnValue:
|
||||
_i5.Future<_i2.StreamedResponse>.value(_FakeStreamedResponse_4(
|
||||
returnValue: _i5.Future<_i2.StreamedResponse>.value(_FakeStreamedResponse_4(
|
||||
this,
|
||||
Invocation.method(
|
||||
#send,
|
||||
|
||||
@@ -149,13 +149,13 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider {
|
||||
) as Uri);
|
||||
|
||||
@override
|
||||
_i5.Future<Map<String, dynamic>> fetch(Uri? uri) => (super.noSuchMethod(
|
||||
_i5.Future<dynamic> fetch(Uri? uri) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#fetch,
|
||||
[uri],
|
||||
),
|
||||
returnValue: _i5.Future<Map<String, dynamic>>.value(<String, dynamic>{}),
|
||||
) as _i5.Future<Map<String, dynamic>>);
|
||||
returnValue: _i5.Future<dynamic>.value(),
|
||||
) as _i5.Future<dynamic>);
|
||||
|
||||
@override
|
||||
_i5.Future<List<dynamic>> fetchPaginated(Uri? uri) => (super.noSuchMethod(
|
||||
|
||||
@@ -149,13 +149,13 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider {
|
||||
) as Uri);
|
||||
|
||||
@override
|
||||
_i5.Future<Map<String, dynamic>> fetch(Uri? uri) => (super.noSuchMethod(
|
||||
_i5.Future<dynamic> fetch(Uri? uri) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#fetch,
|
||||
[uri],
|
||||
),
|
||||
returnValue: _i5.Future<Map<String, dynamic>>.value(<String, dynamic>{}),
|
||||
) as _i5.Future<Map<String, dynamic>>);
|
||||
returnValue: _i5.Future<dynamic>.value(),
|
||||
) as _i5.Future<dynamic>);
|
||||
|
||||
@override
|
||||
_i5.Future<List<dynamic>> fetchPaginated(Uri? uri) => (super.noSuchMethod(
|
||||
|
||||
@@ -26,8 +26,7 @@ import 'package:wger/providers/user.dart' as _i7;
|
||||
// ignore_for_file: camel_case_types
|
||||
// ignore_for_file: subtype_of_sealed_class
|
||||
|
||||
class _FakeWgerBaseProvider_0 extends _i1.SmartFake
|
||||
implements _i2.WgerBaseProvider {
|
||||
class _FakeWgerBaseProvider_0 extends _i1.SmartFake implements _i2.WgerBaseProvider {
|
||||
_FakeWgerBaseProvider_0(
|
||||
Object parent,
|
||||
Invocation parentInvocation,
|
||||
@@ -50,8 +49,7 @@ class _FakeWeightEntry_1 extends _i1.SmartFake implements _i3.WeightEntry {
|
||||
/// A class which mocks [BodyWeightProvider].
|
||||
///
|
||||
/// See the documentation for Mockito's code generation for more information.
|
||||
class MockBodyWeightProvider extends _i1.Mock
|
||||
implements _i4.BodyWeightProvider {
|
||||
class MockBodyWeightProvider extends _i1.Mock implements _i4.BodyWeightProvider {
|
||||
MockBodyWeightProvider() {
|
||||
_i1.throwOnMissingStub(this);
|
||||
}
|
||||
@@ -111,8 +109,7 @@ class MockBodyWeightProvider extends _i1.Mock
|
||||
) as _i3.WeightEntry);
|
||||
|
||||
@override
|
||||
_i3.WeightEntry? findByDate(DateTime? date) =>
|
||||
(super.noSuchMethod(Invocation.method(
|
||||
_i3.WeightEntry? findByDate(DateTime? date) => (super.noSuchMethod(Invocation.method(
|
||||
#findByDate,
|
||||
[date],
|
||||
)) as _i3.WeightEntry?);
|
||||
@@ -123,13 +120,11 @@ class MockBodyWeightProvider extends _i1.Mock
|
||||
#fetchAndSetEntries,
|
||||
[],
|
||||
),
|
||||
returnValue:
|
||||
_i5.Future<List<_i3.WeightEntry>>.value(<_i3.WeightEntry>[]),
|
||||
returnValue: _i5.Future<List<_i3.WeightEntry>>.value(<_i3.WeightEntry>[]),
|
||||
) as _i5.Future<List<_i3.WeightEntry>>);
|
||||
|
||||
@override
|
||||
_i5.Future<_i3.WeightEntry> addEntry(_i3.WeightEntry? entry) =>
|
||||
(super.noSuchMethod(
|
||||
_i5.Future<_i3.WeightEntry> addEntry(_i3.WeightEntry? entry) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#addEntry,
|
||||
[entry],
|
||||
|
||||
@@ -44,8 +44,8 @@ void main() {
|
||||
final bases = getTestExercises();
|
||||
|
||||
Widget createHomeScreen({locale = 'en'}) {
|
||||
return ChangeNotifierProvider<WorkoutPlansProvider>(
|
||||
create: (context) => WorkoutPlansProvider(
|
||||
return ChangeNotifierProvider<RoutinesProvider>(
|
||||
create: (context) => RoutinesProvider(
|
||||
mockBaseProvider,
|
||||
mockExerciseProvider,
|
||||
[workoutPlan],
|
||||
|
||||
@@ -71,8 +71,7 @@ class _FakeResponse_3 extends _i1.SmartFake implements _i3.Response {
|
||||
);
|
||||
}
|
||||
|
||||
class _FakeWgerBaseProvider_4 extends _i1.SmartFake
|
||||
implements _i4.WgerBaseProvider {
|
||||
class _FakeWgerBaseProvider_4 extends _i1.SmartFake implements _i4.WgerBaseProvider {
|
||||
_FakeWgerBaseProvider_4(
|
||||
Object parent,
|
||||
Invocation parentInvocation,
|
||||
@@ -82,8 +81,7 @@ class _FakeWgerBaseProvider_4 extends _i1.SmartFake
|
||||
);
|
||||
}
|
||||
|
||||
class _FakeExerciseDatabase_5 extends _i1.SmartFake
|
||||
implements _i5.ExerciseDatabase {
|
||||
class _FakeExerciseDatabase_5 extends _i1.SmartFake implements _i5.ExerciseDatabase {
|
||||
_FakeExerciseDatabase_5(
|
||||
Object parent,
|
||||
Invocation parentInvocation,
|
||||
@@ -103,8 +101,7 @@ class _FakeExercise_6 extends _i1.SmartFake implements _i6.Exercise {
|
||||
);
|
||||
}
|
||||
|
||||
class _FakeExerciseCategory_7 extends _i1.SmartFake
|
||||
implements _i7.ExerciseCategory {
|
||||
class _FakeExerciseCategory_7 extends _i1.SmartFake implements _i7.ExerciseCategory {
|
||||
_FakeExerciseCategory_7(
|
||||
Object parent,
|
||||
Invocation parentInvocation,
|
||||
@@ -189,8 +186,7 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider {
|
||||
);
|
||||
|
||||
@override
|
||||
Map<String, String> getDefaultHeaders({bool? includeAuth = false}) =>
|
||||
(super.noSuchMethod(
|
||||
Map<String, String> getDefaultHeaders({bool? includeAuth = false}) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#getDefaultHeaders,
|
||||
[],
|
||||
@@ -231,14 +227,13 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider {
|
||||
) as Uri);
|
||||
|
||||
@override
|
||||
_i11.Future<Map<String, dynamic>> fetch(Uri? uri) => (super.noSuchMethod(
|
||||
_i11.Future<dynamic> fetch(Uri? uri) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#fetch,
|
||||
[uri],
|
||||
),
|
||||
returnValue:
|
||||
_i11.Future<Map<String, dynamic>>.value(<String, dynamic>{}),
|
||||
) as _i11.Future<Map<String, dynamic>>);
|
||||
returnValue: _i11.Future<dynamic>.value(),
|
||||
) as _i11.Future<dynamic>);
|
||||
|
||||
@override
|
||||
_i11.Future<List<dynamic>> fetchPaginated(Uri? uri) => (super.noSuchMethod(
|
||||
@@ -262,8 +257,7 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider {
|
||||
uri,
|
||||
],
|
||||
),
|
||||
returnValue:
|
||||
_i11.Future<Map<String, dynamic>>.value(<String, dynamic>{}),
|
||||
returnValue: _i11.Future<Map<String, dynamic>>.value(<String, dynamic>{}),
|
||||
) as _i11.Future<Map<String, dynamic>>);
|
||||
|
||||
@override
|
||||
@@ -279,8 +273,7 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider {
|
||||
uri,
|
||||
],
|
||||
),
|
||||
returnValue:
|
||||
_i11.Future<Map<String, dynamic>>.value(<String, dynamic>{}),
|
||||
returnValue: _i11.Future<Map<String, dynamic>>.value(<String, dynamic>{}),
|
||||
) as _i11.Future<Map<String, dynamic>>);
|
||||
|
||||
@override
|
||||
@@ -366,8 +359,7 @@ class MockExercisesProvider extends _i1.Mock implements _i12.ExercisesProvider {
|
||||
) as List<_i6.Exercise>);
|
||||
|
||||
@override
|
||||
set filteredExercises(List<_i6.Exercise>? newFilteredExercises) =>
|
||||
super.noSuchMethod(
|
||||
set filteredExercises(List<_i6.Exercise>? newFilteredExercises) => super.noSuchMethod(
|
||||
Invocation.setter(
|
||||
#filteredExercises,
|
||||
newFilteredExercises,
|
||||
@@ -376,8 +368,7 @@ class MockExercisesProvider extends _i1.Mock implements _i12.ExercisesProvider {
|
||||
);
|
||||
|
||||
@override
|
||||
Map<int, List<_i6.Exercise>> get exerciseBasesByVariation =>
|
||||
(super.noSuchMethod(
|
||||
Map<int, List<_i6.Exercise>> get exerciseBasesByVariation => (super.noSuchMethod(
|
||||
Invocation.getter(#exerciseBasesByVariation),
|
||||
returnValue: <int, List<_i6.Exercise>>{},
|
||||
) as Map<int, List<_i6.Exercise>>);
|
||||
@@ -589,8 +580,7 @@ class MockExercisesProvider extends _i1.Mock implements _i12.ExercisesProvider {
|
||||
) as _i11.Future<void>);
|
||||
|
||||
@override
|
||||
_i11.Future<_i6.Exercise> fetchAndSetExercise(int? exerciseId) =>
|
||||
(super.noSuchMethod(
|
||||
_i11.Future<_i6.Exercise> fetchAndSetExercise(int? exerciseId) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#fetchAndSetExercise,
|
||||
[exerciseId],
|
||||
@@ -630,8 +620,7 @@ class MockExercisesProvider extends _i1.Mock implements _i12.ExercisesProvider {
|
||||
) as _i11.Future<_i6.Exercise>);
|
||||
|
||||
@override
|
||||
_i11.Future<void> initCacheTimesLocalPrefs({dynamic forceInit = false}) =>
|
||||
(super.noSuchMethod(
|
||||
_i11.Future<void> initCacheTimesLocalPrefs({dynamic forceInit = false}) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#initCacheTimesLocalPrefs,
|
||||
[],
|
||||
@@ -677,8 +666,7 @@ class MockExercisesProvider extends _i1.Mock implements _i12.ExercisesProvider {
|
||||
) as _i11.Future<void>);
|
||||
|
||||
@override
|
||||
_i11.Future<void> updateExerciseCache(_i5.ExerciseDatabase? database) =>
|
||||
(super.noSuchMethod(
|
||||
_i11.Future<void> updateExerciseCache(_i5.ExerciseDatabase? database) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#updateExerciseCache,
|
||||
[database],
|
||||
@@ -688,8 +676,7 @@ class MockExercisesProvider extends _i1.Mock implements _i12.ExercisesProvider {
|
||||
) as _i11.Future<void>);
|
||||
|
||||
@override
|
||||
_i11.Future<void> fetchAndSetMuscles(_i5.ExerciseDatabase? database) =>
|
||||
(super.noSuchMethod(
|
||||
_i11.Future<void> fetchAndSetMuscles(_i5.ExerciseDatabase? database) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#fetchAndSetMuscles,
|
||||
[database],
|
||||
@@ -699,8 +686,7 @@ class MockExercisesProvider extends _i1.Mock implements _i12.ExercisesProvider {
|
||||
) as _i11.Future<void>);
|
||||
|
||||
@override
|
||||
_i11.Future<void> fetchAndSetCategories(_i5.ExerciseDatabase? database) =>
|
||||
(super.noSuchMethod(
|
||||
_i11.Future<void> fetchAndSetCategories(_i5.ExerciseDatabase? database) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#fetchAndSetCategories,
|
||||
[database],
|
||||
@@ -710,8 +696,7 @@ class MockExercisesProvider extends _i1.Mock implements _i12.ExercisesProvider {
|
||||
) as _i11.Future<void>);
|
||||
|
||||
@override
|
||||
_i11.Future<void> fetchAndSetLanguages(_i5.ExerciseDatabase? database) =>
|
||||
(super.noSuchMethod(
|
||||
_i11.Future<void> fetchAndSetLanguages(_i5.ExerciseDatabase? database) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#fetchAndSetLanguages,
|
||||
[database],
|
||||
@@ -721,8 +706,7 @@ class MockExercisesProvider extends _i1.Mock implements _i12.ExercisesProvider {
|
||||
) as _i11.Future<void>);
|
||||
|
||||
@override
|
||||
_i11.Future<void> fetchAndSetEquipments(_i5.ExerciseDatabase? database) =>
|
||||
(super.noSuchMethod(
|
||||
_i11.Future<void> fetchAndSetEquipments(_i5.ExerciseDatabase? database) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#fetchAndSetEquipments,
|
||||
[database],
|
||||
|
||||
@@ -30,9 +30,9 @@ import 'package:wger/widgets/workouts/forms.dart';
|
||||
|
||||
import 'repetition_unit_form_widget_test.mocks.dart';
|
||||
|
||||
@GenerateMocks([WorkoutPlansProvider])
|
||||
@GenerateMocks([RoutinesProvider])
|
||||
void main() {
|
||||
var mockWorkoutPlans = MockWorkoutPlansProvider();
|
||||
var mockWorkoutPlans = MockRoutinesProvider();
|
||||
|
||||
const unit1 = RepetitionUnit(id: 1, name: 'some rep unit');
|
||||
const unit2 = RepetitionUnit(id: 2, name: 'another name');
|
||||
@@ -45,7 +45,6 @@ void main() {
|
||||
exerciseId: 1,
|
||||
repetitionUnitId: 1,
|
||||
repetitionRounding: 0.25,
|
||||
reps: 2,
|
||||
weightUnitId: 1,
|
||||
weightRounding: 0.25,
|
||||
comment: 'comment',
|
||||
@@ -53,14 +52,14 @@ void main() {
|
||||
setting1.repetitionUnitObj = unit1;
|
||||
|
||||
setUp(() {
|
||||
mockWorkoutPlans = MockWorkoutPlansProvider();
|
||||
mockWorkoutPlans = MockRoutinesProvider();
|
||||
when(mockWorkoutPlans.repetitionUnits).thenAnswer((_) => [unit1, unit2, unit3]);
|
||||
});
|
||||
|
||||
Widget createHomeScreen() {
|
||||
final key = GlobalKey<NavigatorState>();
|
||||
|
||||
return ChangeNotifierProvider<WorkoutPlansProvider>(
|
||||
return ChangeNotifierProvider<RoutinesProvider>(
|
||||
create: (context) => mockWorkoutPlans,
|
||||
child: MaterialApp(
|
||||
localizationsDelegates: AppLocalizations.localizationsDelegates,
|
||||
|
||||
@@ -4,13 +4,14 @@
|
||||
|
||||
// ignore_for_file: no_leading_underscores_for_library_prefixes
|
||||
import 'dart:async' as _i12;
|
||||
import 'dart:ui' as _i16;
|
||||
import 'dart:ui' as _i17;
|
||||
|
||||
import 'package:mockito/mockito.dart' as _i1;
|
||||
import 'package:mockito/src/dummies.dart' as _i15;
|
||||
import 'package:wger/models/exercises/exercise.dart' as _i13;
|
||||
import 'package:wger/models/exercises/translation.dart' as _i14;
|
||||
import 'package:mockito/src/dummies.dart' as _i16;
|
||||
import 'package:wger/models/exercises/exercise.dart' as _i14;
|
||||
import 'package:wger/models/exercises/translation.dart' as _i15;
|
||||
import 'package:wger/models/workouts/day.dart' as _i6;
|
||||
import 'package:wger/models/workouts/day_data.dart' as _i13;
|
||||
import 'package:wger/models/workouts/log.dart' as _i10;
|
||||
import 'package:wger/models/workouts/repetition_unit.dart' as _i4;
|
||||
import 'package:wger/models/workouts/routine.dart' as _i5;
|
||||
@@ -34,8 +35,7 @@ import 'package:wger/providers/workout_plans.dart' as _i11;
|
||||
// ignore_for_file: camel_case_types
|
||||
// ignore_for_file: subtype_of_sealed_class
|
||||
|
||||
class _FakeWgerBaseProvider_0 extends _i1.SmartFake
|
||||
implements _i2.WgerBaseProvider {
|
||||
class _FakeWgerBaseProvider_0 extends _i1.SmartFake implements _i2.WgerBaseProvider {
|
||||
_FakeWgerBaseProvider_0(
|
||||
Object parent,
|
||||
Invocation parentInvocation,
|
||||
@@ -55,8 +55,7 @@ class _FakeWeightUnit_1 extends _i1.SmartFake implements _i3.WeightUnit {
|
||||
);
|
||||
}
|
||||
|
||||
class _FakeRepetitionUnit_2 extends _i1.SmartFake
|
||||
implements _i4.RepetitionUnit {
|
||||
class _FakeRepetitionUnit_2 extends _i1.SmartFake implements _i4.RepetitionUnit {
|
||||
_FakeRepetitionUnit_2(
|
||||
Object parent,
|
||||
Invocation parentInvocation,
|
||||
@@ -106,8 +105,7 @@ class _FakeSlotEntry_6 extends _i1.SmartFake implements _i8.SlotEntry {
|
||||
);
|
||||
}
|
||||
|
||||
class _FakeWorkoutSession_7 extends _i1.SmartFake
|
||||
implements _i9.WorkoutSession {
|
||||
class _FakeWorkoutSession_7 extends _i1.SmartFake implements _i9.WorkoutSession {
|
||||
_FakeWorkoutSession_7(
|
||||
Object parent,
|
||||
Invocation parentInvocation,
|
||||
@@ -127,12 +125,11 @@ class _FakeLog_8 extends _i1.SmartFake implements _i10.Log {
|
||||
);
|
||||
}
|
||||
|
||||
/// A class which mocks [WorkoutPlansProvider].
|
||||
/// A class which mocks [RoutinesProvider].
|
||||
///
|
||||
/// See the documentation for Mockito's code generation for more information.
|
||||
class MockWorkoutPlansProvider extends _i1.Mock
|
||||
implements _i11.WorkoutPlansProvider {
|
||||
MockWorkoutPlansProvider() {
|
||||
class MockRoutinesProvider extends _i1.Mock implements _i11.RoutinesProvider {
|
||||
MockRoutinesProvider() {
|
||||
_i1.throwOnMissingStub(this);
|
||||
}
|
||||
|
||||
@@ -268,8 +265,16 @@ class MockWorkoutPlansProvider extends _i1.Mock
|
||||
) as _i12.Future<void>);
|
||||
|
||||
@override
|
||||
_i12.Future<_i5.Routine> fetchAndSetPlanSparse(int? planId) =>
|
||||
(super.noSuchMethod(
|
||||
void setExerciseAndUnits(List<_i13.DayData>? entries) => super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#setExerciseAndUnits,
|
||||
[entries],
|
||||
),
|
||||
returnValueForMissingStub: null,
|
||||
);
|
||||
|
||||
@override
|
||||
_i12.Future<_i5.Routine> fetchAndSetPlanSparse(int? planId) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#fetchAndSetPlanSparse,
|
||||
[planId],
|
||||
@@ -284,33 +289,31 @@ class MockWorkoutPlansProvider extends _i1.Mock
|
||||
) as _i12.Future<_i5.Routine>);
|
||||
|
||||
@override
|
||||
_i12.Future<_i5.Routine> fetchAndSetWorkoutPlanFull(int? workoutId) =>
|
||||
(super.noSuchMethod(
|
||||
_i12.Future<_i5.Routine> fetchAndSetWorkoutPlanFull(int? routineId) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#fetchAndSetWorkoutPlanFull,
|
||||
[workoutId],
|
||||
[routineId],
|
||||
),
|
||||
returnValue: _i12.Future<_i5.Routine>.value(_FakeRoutine_3(
|
||||
this,
|
||||
Invocation.method(
|
||||
#fetchAndSetWorkoutPlanFull,
|
||||
[workoutId],
|
||||
[routineId],
|
||||
),
|
||||
)),
|
||||
) as _i12.Future<_i5.Routine>);
|
||||
|
||||
@override
|
||||
_i12.Future<_i5.Routine> addWorkout(_i5.Routine? workout) =>
|
||||
(super.noSuchMethod(
|
||||
_i12.Future<_i5.Routine> addRoutine(_i5.Routine? routine) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#addWorkout,
|
||||
[workout],
|
||||
#addRoutine,
|
||||
[routine],
|
||||
),
|
||||
returnValue: _i12.Future<_i5.Routine>.value(_FakeRoutine_3(
|
||||
this,
|
||||
Invocation.method(
|
||||
#addWorkout,
|
||||
[workout],
|
||||
#addRoutine,
|
||||
[routine],
|
||||
),
|
||||
)),
|
||||
) as _i12.Future<_i5.Routine>);
|
||||
@@ -338,7 +341,7 @@ class MockWorkoutPlansProvider extends _i1.Mock
|
||||
@override
|
||||
_i12.Future<Map<String, dynamic>> fetchLogData(
|
||||
_i5.Routine? workout,
|
||||
_i13.Exercise? base,
|
||||
_i14.Exercise? base,
|
||||
) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
@@ -348,8 +351,7 @@ class MockWorkoutPlansProvider extends _i1.Mock
|
||||
base,
|
||||
],
|
||||
),
|
||||
returnValue:
|
||||
_i12.Future<Map<String, dynamic>>.value(<String, dynamic>{}),
|
||||
returnValue: _i12.Future<Map<String, dynamic>>.value(<String, dynamic>{}),
|
||||
) as _i12.Future<Map<String, dynamic>>);
|
||||
|
||||
@override
|
||||
@@ -469,8 +471,7 @@ class MockWorkoutPlansProvider extends _i1.Mock
|
||||
) as _i12.Future<List<_i7.Slot>>);
|
||||
|
||||
@override
|
||||
_i12.Future<void> fetchComputedSettings(_i7.Slot? workoutSet) =>
|
||||
(super.noSuchMethod(
|
||||
_i12.Future<void> fetchComputedSettings(_i7.Slot? workoutSet) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#fetchComputedSettings,
|
||||
[workoutSet],
|
||||
@@ -482,7 +483,7 @@ class MockWorkoutPlansProvider extends _i1.Mock
|
||||
@override
|
||||
_i12.Future<String> fetchSmartText(
|
||||
_i7.Slot? workoutSet,
|
||||
_i14.Translation? exercise,
|
||||
_i15.Translation? exercise,
|
||||
) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
@@ -492,7 +493,7 @@ class MockWorkoutPlansProvider extends _i1.Mock
|
||||
exercise,
|
||||
],
|
||||
),
|
||||
returnValue: _i12.Future<String>.value(_i15.dummyValue<String>(
|
||||
returnValue: _i12.Future<String>.value(_i16.dummyValue<String>(
|
||||
this,
|
||||
Invocation.method(
|
||||
#fetchSmartText,
|
||||
@@ -505,18 +506,17 @@ class MockWorkoutPlansProvider extends _i1.Mock
|
||||
) as _i12.Future<String>);
|
||||
|
||||
@override
|
||||
_i12.Future<void> deleteSet(_i7.Slot? workoutSet) => (super.noSuchMethod(
|
||||
_i12.Future<void> deleteSet(int? setId) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#deleteSet,
|
||||
[workoutSet],
|
||||
[setId],
|
||||
),
|
||||
returnValue: _i12.Future<void>.value(),
|
||||
returnValueForMissingStub: _i12.Future<void>.value(),
|
||||
) as _i12.Future<void>);
|
||||
|
||||
@override
|
||||
_i12.Future<_i8.SlotEntry> addSetting(_i8.SlotEntry? workoutSetting) =>
|
||||
(super.noSuchMethod(
|
||||
_i12.Future<_i8.SlotEntry> addSetting(_i8.SlotEntry? workoutSetting) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#addSetting,
|
||||
[workoutSetting],
|
||||
@@ -540,14 +540,12 @@ class MockWorkoutPlansProvider extends _i1.Mock
|
||||
) as _i12.Future<dynamic>);
|
||||
|
||||
@override
|
||||
_i12.Future<_i9.WorkoutSession> addSession(_i9.WorkoutSession? session) =>
|
||||
(super.noSuchMethod(
|
||||
_i12.Future<_i9.WorkoutSession> addSession(_i9.WorkoutSession? session) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#addSession,
|
||||
[session],
|
||||
),
|
||||
returnValue:
|
||||
_i12.Future<_i9.WorkoutSession>.value(_FakeWorkoutSession_7(
|
||||
returnValue: _i12.Future<_i9.WorkoutSession>.value(_FakeWorkoutSession_7(
|
||||
this,
|
||||
Invocation.method(
|
||||
#addSession,
|
||||
@@ -582,7 +580,7 @@ class MockWorkoutPlansProvider extends _i1.Mock
|
||||
) as _i12.Future<void>);
|
||||
|
||||
@override
|
||||
void addListener(_i16.VoidCallback? listener) => super.noSuchMethod(
|
||||
void addListener(_i17.VoidCallback? listener) => super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#addListener,
|
||||
[listener],
|
||||
@@ -591,7 +589,7 @@ class MockWorkoutPlansProvider extends _i1.Mock
|
||||
);
|
||||
|
||||
@override
|
||||
void removeListener(_i16.VoidCallback? listener) => super.noSuchMethod(
|
||||
void removeListener(_i17.VoidCallback? listener) => super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#removeListener,
|
||||
[listener],
|
||||
|
||||
@@ -28,8 +28,6 @@ void main() {
|
||||
const weightUnit = WeightUnit(id: 1, name: 'mg');
|
||||
|
||||
final entry = SlotEntry.empty();
|
||||
entry.reps = 2;
|
||||
entry.weight = 30;
|
||||
entry.repetitionUnit = repUnit;
|
||||
entry.weightUnit = weightUnit;
|
||||
expect(entry.singleSettingRepText, '2 × 30 mg');
|
||||
@@ -40,8 +38,6 @@ void main() {
|
||||
const weightUnit = WeightUnit(id: 1, name: 'mg');
|
||||
|
||||
final entry = SlotEntry.empty();
|
||||
entry.reps = 2;
|
||||
entry.weight = 30;
|
||||
entry.repetitionUnit = repUnit;
|
||||
entry.weightUnit = weightUnit;
|
||||
expect(entry.singleSettingRepText, '2 × 30 mg \n (1.5 RiR)');
|
||||
@@ -52,8 +48,6 @@ void main() {
|
||||
const weightUnit = WeightUnit(id: 1, name: 'mg');
|
||||
|
||||
final entry = SlotEntry.empty();
|
||||
entry.reps = 2;
|
||||
entry.weight = null;
|
||||
entry.repetitionUnit = repUnit;
|
||||
entry.weightUnit = weightUnit;
|
||||
expect(entry.singleSettingRepText, '2 mol \n (1.5 RiR)');
|
||||
@@ -64,8 +58,6 @@ void main() {
|
||||
const weightUnit = WeightUnit(id: 2, name: 'mg');
|
||||
|
||||
final slotEntry = SlotEntry.empty();
|
||||
slotEntry.reps = 2;
|
||||
slotEntry.weight = 30;
|
||||
slotEntry.repetitionUnit = repUnit;
|
||||
slotEntry.weightUnit = weightUnit;
|
||||
expect(slotEntry.singleSettingRepText, '2 mol × 30 mg');
|
||||
@@ -76,8 +68,6 @@ void main() {
|
||||
const weightUnit = WeightUnit(id: 2, name: 'mg');
|
||||
|
||||
final slotEntry = SlotEntry.empty();
|
||||
slotEntry.reps = 2;
|
||||
slotEntry.weight = 30;
|
||||
slotEntry.repetitionUnit = repUnit;
|
||||
slotEntry.weightUnit = weightUnit;
|
||||
expect(slotEntry.singleSettingRepText, '2 mol × 30 mg \n (3 RiR)');
|
||||
|
||||
@@ -33,7 +33,7 @@ import './workout_form_test.mocks.dart';
|
||||
|
||||
@GenerateMocks([BodyWeightProvider])
|
||||
void main() {
|
||||
var mockWorkoutPlans = MockWorkoutPlansProvider();
|
||||
var mockWorkoutPlans = MockRoutinesProvider();
|
||||
|
||||
const unit1 = WeightUnit(id: 1, name: 'kg');
|
||||
const unit2 = WeightUnit(id: 2, name: 'donkeys');
|
||||
@@ -46,7 +46,6 @@ void main() {
|
||||
exerciseId: 1,
|
||||
repetitionUnitId: 1,
|
||||
repetitionRounding: 0.25,
|
||||
reps: 2,
|
||||
weightUnitId: 1,
|
||||
weightRounding: 0.25,
|
||||
comment: 'comment',
|
||||
@@ -54,14 +53,14 @@ void main() {
|
||||
setting1.weightUnitObj = unit1;
|
||||
|
||||
setUp(() {
|
||||
mockWorkoutPlans = MockWorkoutPlansProvider();
|
||||
mockWorkoutPlans = MockRoutinesProvider();
|
||||
when(mockWorkoutPlans.weightUnits).thenAnswer((_) => [unit1, unit2, unit3]);
|
||||
});
|
||||
|
||||
Widget createHomeScreen() {
|
||||
final key = GlobalKey<NavigatorState>();
|
||||
|
||||
return ChangeNotifierProvider<WorkoutPlansProvider>(
|
||||
return ChangeNotifierProvider<RoutinesProvider>(
|
||||
create: (context) => mockWorkoutPlans,
|
||||
child: MaterialApp(
|
||||
localizationsDelegates: AppLocalizations.localizationsDelegates,
|
||||
|
||||
@@ -24,8 +24,7 @@ import 'package:wger/providers/body_weight.dart' as _i4;
|
||||
// ignore_for_file: camel_case_types
|
||||
// ignore_for_file: subtype_of_sealed_class
|
||||
|
||||
class _FakeWgerBaseProvider_0 extends _i1.SmartFake
|
||||
implements _i2.WgerBaseProvider {
|
||||
class _FakeWgerBaseProvider_0 extends _i1.SmartFake implements _i2.WgerBaseProvider {
|
||||
_FakeWgerBaseProvider_0(
|
||||
Object parent,
|
||||
Invocation parentInvocation,
|
||||
@@ -48,8 +47,7 @@ class _FakeWeightEntry_1 extends _i1.SmartFake implements _i3.WeightEntry {
|
||||
/// A class which mocks [BodyWeightProvider].
|
||||
///
|
||||
/// See the documentation for Mockito's code generation for more information.
|
||||
class MockBodyWeightProvider extends _i1.Mock
|
||||
implements _i4.BodyWeightProvider {
|
||||
class MockBodyWeightProvider extends _i1.Mock implements _i4.BodyWeightProvider {
|
||||
MockBodyWeightProvider() {
|
||||
_i1.throwOnMissingStub(this);
|
||||
}
|
||||
@@ -109,8 +107,7 @@ class MockBodyWeightProvider extends _i1.Mock
|
||||
) as _i3.WeightEntry);
|
||||
|
||||
@override
|
||||
_i3.WeightEntry? findByDate(DateTime? date) =>
|
||||
(super.noSuchMethod(Invocation.method(
|
||||
_i3.WeightEntry? findByDate(DateTime? date) => (super.noSuchMethod(Invocation.method(
|
||||
#findByDate,
|
||||
[date],
|
||||
)) as _i3.WeightEntry?);
|
||||
@@ -121,13 +118,11 @@ class MockBodyWeightProvider extends _i1.Mock
|
||||
#fetchAndSetEntries,
|
||||
[],
|
||||
),
|
||||
returnValue:
|
||||
_i5.Future<List<_i3.WeightEntry>>.value(<_i3.WeightEntry>[]),
|
||||
returnValue: _i5.Future<List<_i3.WeightEntry>>.value(<_i3.WeightEntry>[]),
|
||||
) as _i5.Future<List<_i3.WeightEntry>>);
|
||||
|
||||
@override
|
||||
_i5.Future<_i3.WeightEntry> addEntry(_i3.WeightEntry? entry) =>
|
||||
(super.noSuchMethod(
|
||||
_i5.Future<_i3.WeightEntry> addEntry(_i3.WeightEntry? entry) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#addEntry,
|
||||
[entry],
|
||||
|
||||
@@ -31,20 +31,20 @@ import 'package:wger/widgets/workouts/forms.dart';
|
||||
import '../../test_data/routines.dart';
|
||||
import 'workout_day_form_test.mocks.dart';
|
||||
|
||||
@GenerateMocks([WorkoutPlansProvider])
|
||||
@GenerateMocks([RoutinesProvider])
|
||||
void main() {
|
||||
var mockWorkoutPlans = MockWorkoutPlansProvider();
|
||||
var mockWorkoutPlans = MockRoutinesProvider();
|
||||
Routine workoutPlan = Routine.empty();
|
||||
|
||||
setUp(() {
|
||||
workoutPlan = getWorkout();
|
||||
mockWorkoutPlans = MockWorkoutPlansProvider();
|
||||
mockWorkoutPlans = MockRoutinesProvider();
|
||||
});
|
||||
|
||||
Widget createHomeScreen({locale = 'en'}) {
|
||||
final key = GlobalKey<NavigatorState>();
|
||||
|
||||
return ChangeNotifierProvider<WorkoutPlansProvider>(
|
||||
return ChangeNotifierProvider<RoutinesProvider>(
|
||||
create: (context) => mockWorkoutPlans,
|
||||
child: MaterialApp(
|
||||
locale: Locale(locale),
|
||||
|
||||
@@ -4,13 +4,14 @@
|
||||
|
||||
// ignore_for_file: no_leading_underscores_for_library_prefixes
|
||||
import 'dart:async' as _i12;
|
||||
import 'dart:ui' as _i16;
|
||||
import 'dart:ui' as _i17;
|
||||
|
||||
import 'package:mockito/mockito.dart' as _i1;
|
||||
import 'package:mockito/src/dummies.dart' as _i15;
|
||||
import 'package:wger/models/exercises/exercise.dart' as _i13;
|
||||
import 'package:wger/models/exercises/translation.dart' as _i14;
|
||||
import 'package:mockito/src/dummies.dart' as _i16;
|
||||
import 'package:wger/models/exercises/exercise.dart' as _i14;
|
||||
import 'package:wger/models/exercises/translation.dart' as _i15;
|
||||
import 'package:wger/models/workouts/day.dart' as _i6;
|
||||
import 'package:wger/models/workouts/day_data.dart' as _i13;
|
||||
import 'package:wger/models/workouts/log.dart' as _i10;
|
||||
import 'package:wger/models/workouts/repetition_unit.dart' as _i4;
|
||||
import 'package:wger/models/workouts/routine.dart' as _i5;
|
||||
@@ -34,8 +35,7 @@ import 'package:wger/providers/workout_plans.dart' as _i11;
|
||||
// ignore_for_file: camel_case_types
|
||||
// ignore_for_file: subtype_of_sealed_class
|
||||
|
||||
class _FakeWgerBaseProvider_0 extends _i1.SmartFake
|
||||
implements _i2.WgerBaseProvider {
|
||||
class _FakeWgerBaseProvider_0 extends _i1.SmartFake implements _i2.WgerBaseProvider {
|
||||
_FakeWgerBaseProvider_0(
|
||||
Object parent,
|
||||
Invocation parentInvocation,
|
||||
@@ -55,8 +55,7 @@ class _FakeWeightUnit_1 extends _i1.SmartFake implements _i3.WeightUnit {
|
||||
);
|
||||
}
|
||||
|
||||
class _FakeRepetitionUnit_2 extends _i1.SmartFake
|
||||
implements _i4.RepetitionUnit {
|
||||
class _FakeRepetitionUnit_2 extends _i1.SmartFake implements _i4.RepetitionUnit {
|
||||
_FakeRepetitionUnit_2(
|
||||
Object parent,
|
||||
Invocation parentInvocation,
|
||||
@@ -106,8 +105,7 @@ class _FakeSlotEntry_6 extends _i1.SmartFake implements _i8.SlotEntry {
|
||||
);
|
||||
}
|
||||
|
||||
class _FakeWorkoutSession_7 extends _i1.SmartFake
|
||||
implements _i9.WorkoutSession {
|
||||
class _FakeWorkoutSession_7 extends _i1.SmartFake implements _i9.WorkoutSession {
|
||||
_FakeWorkoutSession_7(
|
||||
Object parent,
|
||||
Invocation parentInvocation,
|
||||
@@ -127,12 +125,11 @@ class _FakeLog_8 extends _i1.SmartFake implements _i10.Log {
|
||||
);
|
||||
}
|
||||
|
||||
/// A class which mocks [WorkoutPlansProvider].
|
||||
/// A class which mocks [RoutinesProvider].
|
||||
///
|
||||
/// See the documentation for Mockito's code generation for more information.
|
||||
class MockWorkoutPlansProvider extends _i1.Mock
|
||||
implements _i11.WorkoutPlansProvider {
|
||||
MockWorkoutPlansProvider() {
|
||||
class MockRoutinesProvider extends _i1.Mock implements _i11.RoutinesProvider {
|
||||
MockRoutinesProvider() {
|
||||
_i1.throwOnMissingStub(this);
|
||||
}
|
||||
|
||||
@@ -268,8 +265,16 @@ class MockWorkoutPlansProvider extends _i1.Mock
|
||||
) as _i12.Future<void>);
|
||||
|
||||
@override
|
||||
_i12.Future<_i5.Routine> fetchAndSetPlanSparse(int? planId) =>
|
||||
(super.noSuchMethod(
|
||||
void setExerciseAndUnits(List<_i13.DayData>? entries) => super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#setExerciseAndUnits,
|
||||
[entries],
|
||||
),
|
||||
returnValueForMissingStub: null,
|
||||
);
|
||||
|
||||
@override
|
||||
_i12.Future<_i5.Routine> fetchAndSetPlanSparse(int? planId) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#fetchAndSetPlanSparse,
|
||||
[planId],
|
||||
@@ -284,33 +289,31 @@ class MockWorkoutPlansProvider extends _i1.Mock
|
||||
) as _i12.Future<_i5.Routine>);
|
||||
|
||||
@override
|
||||
_i12.Future<_i5.Routine> fetchAndSetWorkoutPlanFull(int? workoutId) =>
|
||||
(super.noSuchMethod(
|
||||
_i12.Future<_i5.Routine> fetchAndSetWorkoutPlanFull(int? routineId) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#fetchAndSetWorkoutPlanFull,
|
||||
[workoutId],
|
||||
[routineId],
|
||||
),
|
||||
returnValue: _i12.Future<_i5.Routine>.value(_FakeRoutine_3(
|
||||
this,
|
||||
Invocation.method(
|
||||
#fetchAndSetWorkoutPlanFull,
|
||||
[workoutId],
|
||||
[routineId],
|
||||
),
|
||||
)),
|
||||
) as _i12.Future<_i5.Routine>);
|
||||
|
||||
@override
|
||||
_i12.Future<_i5.Routine> addWorkout(_i5.Routine? workout) =>
|
||||
(super.noSuchMethod(
|
||||
_i12.Future<_i5.Routine> addRoutine(_i5.Routine? routine) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#addWorkout,
|
||||
[workout],
|
||||
#addRoutine,
|
||||
[routine],
|
||||
),
|
||||
returnValue: _i12.Future<_i5.Routine>.value(_FakeRoutine_3(
|
||||
this,
|
||||
Invocation.method(
|
||||
#addWorkout,
|
||||
[workout],
|
||||
#addRoutine,
|
||||
[routine],
|
||||
),
|
||||
)),
|
||||
) as _i12.Future<_i5.Routine>);
|
||||
@@ -338,7 +341,7 @@ class MockWorkoutPlansProvider extends _i1.Mock
|
||||
@override
|
||||
_i12.Future<Map<String, dynamic>> fetchLogData(
|
||||
_i5.Routine? workout,
|
||||
_i13.Exercise? base,
|
||||
_i14.Exercise? base,
|
||||
) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
@@ -348,8 +351,7 @@ class MockWorkoutPlansProvider extends _i1.Mock
|
||||
base,
|
||||
],
|
||||
),
|
||||
returnValue:
|
||||
_i12.Future<Map<String, dynamic>>.value(<String, dynamic>{}),
|
||||
returnValue: _i12.Future<Map<String, dynamic>>.value(<String, dynamic>{}),
|
||||
) as _i12.Future<Map<String, dynamic>>);
|
||||
|
||||
@override
|
||||
@@ -469,8 +471,7 @@ class MockWorkoutPlansProvider extends _i1.Mock
|
||||
) as _i12.Future<List<_i7.Slot>>);
|
||||
|
||||
@override
|
||||
_i12.Future<void> fetchComputedSettings(_i7.Slot? workoutSet) =>
|
||||
(super.noSuchMethod(
|
||||
_i12.Future<void> fetchComputedSettings(_i7.Slot? workoutSet) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#fetchComputedSettings,
|
||||
[workoutSet],
|
||||
@@ -482,7 +483,7 @@ class MockWorkoutPlansProvider extends _i1.Mock
|
||||
@override
|
||||
_i12.Future<String> fetchSmartText(
|
||||
_i7.Slot? workoutSet,
|
||||
_i14.Translation? exercise,
|
||||
_i15.Translation? exercise,
|
||||
) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
@@ -492,7 +493,7 @@ class MockWorkoutPlansProvider extends _i1.Mock
|
||||
exercise,
|
||||
],
|
||||
),
|
||||
returnValue: _i12.Future<String>.value(_i15.dummyValue<String>(
|
||||
returnValue: _i12.Future<String>.value(_i16.dummyValue<String>(
|
||||
this,
|
||||
Invocation.method(
|
||||
#fetchSmartText,
|
||||
@@ -505,18 +506,17 @@ class MockWorkoutPlansProvider extends _i1.Mock
|
||||
) as _i12.Future<String>);
|
||||
|
||||
@override
|
||||
_i12.Future<void> deleteSet(_i7.Slot? workoutSet) => (super.noSuchMethod(
|
||||
_i12.Future<void> deleteSet(int? setId) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#deleteSet,
|
||||
[workoutSet],
|
||||
[setId],
|
||||
),
|
||||
returnValue: _i12.Future<void>.value(),
|
||||
returnValueForMissingStub: _i12.Future<void>.value(),
|
||||
) as _i12.Future<void>);
|
||||
|
||||
@override
|
||||
_i12.Future<_i8.SlotEntry> addSetting(_i8.SlotEntry? workoutSetting) =>
|
||||
(super.noSuchMethod(
|
||||
_i12.Future<_i8.SlotEntry> addSetting(_i8.SlotEntry? workoutSetting) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#addSetting,
|
||||
[workoutSetting],
|
||||
@@ -540,14 +540,12 @@ class MockWorkoutPlansProvider extends _i1.Mock
|
||||
) as _i12.Future<dynamic>);
|
||||
|
||||
@override
|
||||
_i12.Future<_i9.WorkoutSession> addSession(_i9.WorkoutSession? session) =>
|
||||
(super.noSuchMethod(
|
||||
_i12.Future<_i9.WorkoutSession> addSession(_i9.WorkoutSession? session) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#addSession,
|
||||
[session],
|
||||
),
|
||||
returnValue:
|
||||
_i12.Future<_i9.WorkoutSession>.value(_FakeWorkoutSession_7(
|
||||
returnValue: _i12.Future<_i9.WorkoutSession>.value(_FakeWorkoutSession_7(
|
||||
this,
|
||||
Invocation.method(
|
||||
#addSession,
|
||||
@@ -582,7 +580,7 @@ class MockWorkoutPlansProvider extends _i1.Mock
|
||||
) as _i12.Future<void>);
|
||||
|
||||
@override
|
||||
void addListener(_i16.VoidCallback? listener) => super.noSuchMethod(
|
||||
void addListener(_i17.VoidCallback? listener) => super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#addListener,
|
||||
[listener],
|
||||
@@ -591,7 +589,7 @@ class MockWorkoutPlansProvider extends _i1.Mock
|
||||
);
|
||||
|
||||
@override
|
||||
void removeListener(_i16.VoidCallback? listener) => super.noSuchMethod(
|
||||
void removeListener(_i17.VoidCallback? listener) => super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#removeListener,
|
||||
[listener],
|
||||
|
||||
@@ -30,9 +30,9 @@ import 'package:wger/widgets/workouts/forms.dart';
|
||||
|
||||
import './workout_form_test.mocks.dart';
|
||||
|
||||
@GenerateMocks([WorkoutPlansProvider])
|
||||
@GenerateMocks([RoutinesProvider])
|
||||
void main() {
|
||||
var mockWorkoutPlans = MockWorkoutPlansProvider();
|
||||
var mockWorkoutPlans = MockRoutinesProvider();
|
||||
|
||||
final existingPlan = Routine(
|
||||
id: 1,
|
||||
@@ -45,7 +45,7 @@ void main() {
|
||||
final newPlan = Routine.empty();
|
||||
|
||||
setUp(() {
|
||||
mockWorkoutPlans = MockWorkoutPlansProvider();
|
||||
mockWorkoutPlans = MockRoutinesProvider();
|
||||
when(mockWorkoutPlans.editWorkout(any)).thenAnswer((_) => Future.value(existingPlan));
|
||||
when(mockWorkoutPlans.fetchAndSetWorkoutPlanFull(any))
|
||||
.thenAnswer((_) => Future.value(existingPlan));
|
||||
@@ -54,7 +54,7 @@ void main() {
|
||||
Widget createHomeScreen(Routine workoutPlan, {locale = 'en'}) {
|
||||
final key = GlobalKey<NavigatorState>();
|
||||
|
||||
return ChangeNotifierProvider<WorkoutPlansProvider>(
|
||||
return ChangeNotifierProvider<RoutinesProvider>(
|
||||
create: (context) => mockWorkoutPlans,
|
||||
child: MaterialApp(
|
||||
locale: Locale(locale),
|
||||
@@ -96,7 +96,7 @@ void main() {
|
||||
|
||||
// Correct method was called
|
||||
verify(mockWorkoutPlans.editWorkout(any));
|
||||
verifyNever(mockWorkoutPlans.addWorkout(any));
|
||||
verifyNever(mockWorkoutPlans.addRoutine(any));
|
||||
|
||||
// TODO(x): edit calls Navigator.pop(), since the form can only be reached from the
|
||||
// detail page. The test needs to add the detail page to the stack so that
|
||||
@@ -116,7 +116,7 @@ void main() {
|
||||
name: 'New cool workout',
|
||||
);
|
||||
|
||||
when(mockWorkoutPlans.addWorkout(any)).thenAnswer((_) => Future.value(editWorkout));
|
||||
when(mockWorkoutPlans.addRoutine(any)).thenAnswer((_) => Future.value(editWorkout));
|
||||
|
||||
await tester.pumpWidget(createHomeScreen(newPlan));
|
||||
await tester.pumpAndSettle();
|
||||
@@ -126,7 +126,7 @@ void main() {
|
||||
await tester.tap(find.byKey(const Key(SUBMIT_BUTTON_KEY_NAME)));
|
||||
|
||||
verifyNever(mockWorkoutPlans.editWorkout(any));
|
||||
verify(mockWorkoutPlans.addWorkout(any));
|
||||
verify(mockWorkoutPlans.addRoutine(any));
|
||||
|
||||
// Detail page
|
||||
await tester.pumpAndSettle();
|
||||
@@ -142,7 +142,7 @@ void main() {
|
||||
name: 'My workout',
|
||||
description: 'Get yuuuge',
|
||||
);
|
||||
when(mockWorkoutPlans.addWorkout(any)).thenAnswer((_) => Future.value(editWorkout));
|
||||
when(mockWorkoutPlans.addRoutine(any)).thenAnswer((_) => Future.value(editWorkout));
|
||||
|
||||
await tester.pumpWidget(createHomeScreen(newPlan));
|
||||
await tester.pumpAndSettle();
|
||||
@@ -153,7 +153,7 @@ void main() {
|
||||
await tester.tap(find.byKey(const Key(SUBMIT_BUTTON_KEY_NAME)));
|
||||
|
||||
verifyNever(mockWorkoutPlans.editWorkout(any));
|
||||
verify(mockWorkoutPlans.addWorkout(any));
|
||||
verify(mockWorkoutPlans.addRoutine(any));
|
||||
|
||||
// Detail page
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
@@ -4,13 +4,14 @@
|
||||
|
||||
// ignore_for_file: no_leading_underscores_for_library_prefixes
|
||||
import 'dart:async' as _i12;
|
||||
import 'dart:ui' as _i16;
|
||||
import 'dart:ui' as _i17;
|
||||
|
||||
import 'package:mockito/mockito.dart' as _i1;
|
||||
import 'package:mockito/src/dummies.dart' as _i15;
|
||||
import 'package:wger/models/exercises/exercise.dart' as _i13;
|
||||
import 'package:wger/models/exercises/translation.dart' as _i14;
|
||||
import 'package:mockito/src/dummies.dart' as _i16;
|
||||
import 'package:wger/models/exercises/exercise.dart' as _i14;
|
||||
import 'package:wger/models/exercises/translation.dart' as _i15;
|
||||
import 'package:wger/models/workouts/day.dart' as _i6;
|
||||
import 'package:wger/models/workouts/day_data.dart' as _i13;
|
||||
import 'package:wger/models/workouts/log.dart' as _i10;
|
||||
import 'package:wger/models/workouts/repetition_unit.dart' as _i4;
|
||||
import 'package:wger/models/workouts/routine.dart' as _i5;
|
||||
@@ -34,8 +35,7 @@ import 'package:wger/providers/workout_plans.dart' as _i11;
|
||||
// ignore_for_file: camel_case_types
|
||||
// ignore_for_file: subtype_of_sealed_class
|
||||
|
||||
class _FakeWgerBaseProvider_0 extends _i1.SmartFake
|
||||
implements _i2.WgerBaseProvider {
|
||||
class _FakeWgerBaseProvider_0 extends _i1.SmartFake implements _i2.WgerBaseProvider {
|
||||
_FakeWgerBaseProvider_0(
|
||||
Object parent,
|
||||
Invocation parentInvocation,
|
||||
@@ -55,8 +55,7 @@ class _FakeWeightUnit_1 extends _i1.SmartFake implements _i3.WeightUnit {
|
||||
);
|
||||
}
|
||||
|
||||
class _FakeRepetitionUnit_2 extends _i1.SmartFake
|
||||
implements _i4.RepetitionUnit {
|
||||
class _FakeRepetitionUnit_2 extends _i1.SmartFake implements _i4.RepetitionUnit {
|
||||
_FakeRepetitionUnit_2(
|
||||
Object parent,
|
||||
Invocation parentInvocation,
|
||||
@@ -106,8 +105,7 @@ class _FakeSlotEntry_6 extends _i1.SmartFake implements _i8.SlotEntry {
|
||||
);
|
||||
}
|
||||
|
||||
class _FakeWorkoutSession_7 extends _i1.SmartFake
|
||||
implements _i9.WorkoutSession {
|
||||
class _FakeWorkoutSession_7 extends _i1.SmartFake implements _i9.WorkoutSession {
|
||||
_FakeWorkoutSession_7(
|
||||
Object parent,
|
||||
Invocation parentInvocation,
|
||||
@@ -127,12 +125,11 @@ class _FakeLog_8 extends _i1.SmartFake implements _i10.Log {
|
||||
);
|
||||
}
|
||||
|
||||
/// A class which mocks [WorkoutPlansProvider].
|
||||
/// A class which mocks [RoutinesProvider].
|
||||
///
|
||||
/// See the documentation for Mockito's code generation for more information.
|
||||
class MockWorkoutPlansProvider extends _i1.Mock
|
||||
implements _i11.WorkoutPlansProvider {
|
||||
MockWorkoutPlansProvider() {
|
||||
class MockRoutinesProvider extends _i1.Mock implements _i11.RoutinesProvider {
|
||||
MockRoutinesProvider() {
|
||||
_i1.throwOnMissingStub(this);
|
||||
}
|
||||
|
||||
@@ -268,8 +265,16 @@ class MockWorkoutPlansProvider extends _i1.Mock
|
||||
) as _i12.Future<void>);
|
||||
|
||||
@override
|
||||
_i12.Future<_i5.Routine> fetchAndSetPlanSparse(int? planId) =>
|
||||
(super.noSuchMethod(
|
||||
void setExerciseAndUnits(List<_i13.DayData>? entries) => super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#setExerciseAndUnits,
|
||||
[entries],
|
||||
),
|
||||
returnValueForMissingStub: null,
|
||||
);
|
||||
|
||||
@override
|
||||
_i12.Future<_i5.Routine> fetchAndSetPlanSparse(int? planId) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#fetchAndSetPlanSparse,
|
||||
[planId],
|
||||
@@ -284,33 +289,31 @@ class MockWorkoutPlansProvider extends _i1.Mock
|
||||
) as _i12.Future<_i5.Routine>);
|
||||
|
||||
@override
|
||||
_i12.Future<_i5.Routine> fetchAndSetWorkoutPlanFull(int? workoutId) =>
|
||||
(super.noSuchMethod(
|
||||
_i12.Future<_i5.Routine> fetchAndSetWorkoutPlanFull(int? routineId) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#fetchAndSetWorkoutPlanFull,
|
||||
[workoutId],
|
||||
[routineId],
|
||||
),
|
||||
returnValue: _i12.Future<_i5.Routine>.value(_FakeRoutine_3(
|
||||
this,
|
||||
Invocation.method(
|
||||
#fetchAndSetWorkoutPlanFull,
|
||||
[workoutId],
|
||||
[routineId],
|
||||
),
|
||||
)),
|
||||
) as _i12.Future<_i5.Routine>);
|
||||
|
||||
@override
|
||||
_i12.Future<_i5.Routine> addWorkout(_i5.Routine? workout) =>
|
||||
(super.noSuchMethod(
|
||||
_i12.Future<_i5.Routine> addRoutine(_i5.Routine? routine) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#addWorkout,
|
||||
[workout],
|
||||
#addRoutine,
|
||||
[routine],
|
||||
),
|
||||
returnValue: _i12.Future<_i5.Routine>.value(_FakeRoutine_3(
|
||||
this,
|
||||
Invocation.method(
|
||||
#addWorkout,
|
||||
[workout],
|
||||
#addRoutine,
|
||||
[routine],
|
||||
),
|
||||
)),
|
||||
) as _i12.Future<_i5.Routine>);
|
||||
@@ -338,7 +341,7 @@ class MockWorkoutPlansProvider extends _i1.Mock
|
||||
@override
|
||||
_i12.Future<Map<String, dynamic>> fetchLogData(
|
||||
_i5.Routine? workout,
|
||||
_i13.Exercise? base,
|
||||
_i14.Exercise? base,
|
||||
) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
@@ -348,8 +351,7 @@ class MockWorkoutPlansProvider extends _i1.Mock
|
||||
base,
|
||||
],
|
||||
),
|
||||
returnValue:
|
||||
_i12.Future<Map<String, dynamic>>.value(<String, dynamic>{}),
|
||||
returnValue: _i12.Future<Map<String, dynamic>>.value(<String, dynamic>{}),
|
||||
) as _i12.Future<Map<String, dynamic>>);
|
||||
|
||||
@override
|
||||
@@ -469,8 +471,7 @@ class MockWorkoutPlansProvider extends _i1.Mock
|
||||
) as _i12.Future<List<_i7.Slot>>);
|
||||
|
||||
@override
|
||||
_i12.Future<void> fetchComputedSettings(_i7.Slot? workoutSet) =>
|
||||
(super.noSuchMethod(
|
||||
_i12.Future<void> fetchComputedSettings(_i7.Slot? workoutSet) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#fetchComputedSettings,
|
||||
[workoutSet],
|
||||
@@ -482,7 +483,7 @@ class MockWorkoutPlansProvider extends _i1.Mock
|
||||
@override
|
||||
_i12.Future<String> fetchSmartText(
|
||||
_i7.Slot? workoutSet,
|
||||
_i14.Translation? exercise,
|
||||
_i15.Translation? exercise,
|
||||
) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
@@ -492,7 +493,7 @@ class MockWorkoutPlansProvider extends _i1.Mock
|
||||
exercise,
|
||||
],
|
||||
),
|
||||
returnValue: _i12.Future<String>.value(_i15.dummyValue<String>(
|
||||
returnValue: _i12.Future<String>.value(_i16.dummyValue<String>(
|
||||
this,
|
||||
Invocation.method(
|
||||
#fetchSmartText,
|
||||
@@ -505,18 +506,17 @@ class MockWorkoutPlansProvider extends _i1.Mock
|
||||
) as _i12.Future<String>);
|
||||
|
||||
@override
|
||||
_i12.Future<void> deleteSet(_i7.Slot? workoutSet) => (super.noSuchMethod(
|
||||
_i12.Future<void> deleteSet(int? setId) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#deleteSet,
|
||||
[workoutSet],
|
||||
[setId],
|
||||
),
|
||||
returnValue: _i12.Future<void>.value(),
|
||||
returnValueForMissingStub: _i12.Future<void>.value(),
|
||||
) as _i12.Future<void>);
|
||||
|
||||
@override
|
||||
_i12.Future<_i8.SlotEntry> addSetting(_i8.SlotEntry? workoutSetting) =>
|
||||
(super.noSuchMethod(
|
||||
_i12.Future<_i8.SlotEntry> addSetting(_i8.SlotEntry? workoutSetting) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#addSetting,
|
||||
[workoutSetting],
|
||||
@@ -540,14 +540,12 @@ class MockWorkoutPlansProvider extends _i1.Mock
|
||||
) as _i12.Future<dynamic>);
|
||||
|
||||
@override
|
||||
_i12.Future<_i9.WorkoutSession> addSession(_i9.WorkoutSession? session) =>
|
||||
(super.noSuchMethod(
|
||||
_i12.Future<_i9.WorkoutSession> addSession(_i9.WorkoutSession? session) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#addSession,
|
||||
[session],
|
||||
),
|
||||
returnValue:
|
||||
_i12.Future<_i9.WorkoutSession>.value(_FakeWorkoutSession_7(
|
||||
returnValue: _i12.Future<_i9.WorkoutSession>.value(_FakeWorkoutSession_7(
|
||||
this,
|
||||
Invocation.method(
|
||||
#addSession,
|
||||
@@ -582,7 +580,7 @@ class MockWorkoutPlansProvider extends _i1.Mock
|
||||
) as _i12.Future<void>);
|
||||
|
||||
@override
|
||||
void addListener(_i16.VoidCallback? listener) => super.noSuchMethod(
|
||||
void addListener(_i17.VoidCallback? listener) => super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#addListener,
|
||||
[listener],
|
||||
@@ -591,7 +589,7 @@ class MockWorkoutPlansProvider extends _i1.Mock
|
||||
);
|
||||
|
||||
@override
|
||||
void removeListener(_i16.VoidCallback? listener) => super.noSuchMethod(
|
||||
void removeListener(_i17.VoidCallback? listener) => super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#removeListener,
|
||||
[listener],
|
||||
|
||||
@@ -27,8 +27,8 @@ void main() {
|
||||
setUp(() {
|
||||
log1 = Log(
|
||||
id: 123,
|
||||
workoutPlan: 100,
|
||||
exerciseBaseId: 1,
|
||||
routineId: 100,
|
||||
exerciseId: 1,
|
||||
reps: 10,
|
||||
rir: '1.5',
|
||||
repetitionUnitId: 1,
|
||||
@@ -38,8 +38,8 @@ void main() {
|
||||
);
|
||||
log2 = Log(
|
||||
id: 9,
|
||||
workoutPlan: 42,
|
||||
exerciseBaseId: 1,
|
||||
routineId: 42,
|
||||
exerciseId: 1,
|
||||
reps: 10,
|
||||
rir: '1.5',
|
||||
repetitionUnitId: 1,
|
||||
|
||||
@@ -41,8 +41,8 @@ void main() {
|
||||
Widget createHomeScreen({locale = 'en'}) {
|
||||
final key = GlobalKey<NavigatorState>();
|
||||
|
||||
return ChangeNotifierProvider<WorkoutPlansProvider>(
|
||||
create: (context) => WorkoutPlansProvider(mockBaseProvider, exercisesProvider, []),
|
||||
return ChangeNotifierProvider<RoutinesProvider>(
|
||||
create: (context) => RoutinesProvider(mockBaseProvider, exercisesProvider, []),
|
||||
child: MaterialApp(
|
||||
locale: Locale(locale),
|
||||
localizationsDelegates: AppLocalizations.localizationsDelegates,
|
||||
|
||||
@@ -108,8 +108,7 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider {
|
||||
);
|
||||
|
||||
@override
|
||||
Map<String, String> getDefaultHeaders({bool? includeAuth = false}) =>
|
||||
(super.noSuchMethod(
|
||||
Map<String, String> getDefaultHeaders({bool? includeAuth = false}) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#getDefaultHeaders,
|
||||
[],
|
||||
@@ -150,14 +149,13 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider {
|
||||
) as Uri);
|
||||
|
||||
@override
|
||||
_i5.Future<Map<String, dynamic>> fetch(Uri? uri) => (super.noSuchMethod(
|
||||
_i5.Future<dynamic> fetch(Uri? uri) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#fetch,
|
||||
[uri],
|
||||
),
|
||||
returnValue:
|
||||
_i5.Future<Map<String, dynamic>>.value(<String, dynamic>{}),
|
||||
) as _i5.Future<Map<String, dynamic>>);
|
||||
returnValue: _i5.Future<dynamic>.value(),
|
||||
) as _i5.Future<dynamic>);
|
||||
|
||||
@override
|
||||
_i5.Future<List<dynamic>> fetchPaginated(Uri? uri) => (super.noSuchMethod(
|
||||
@@ -181,8 +179,7 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider {
|
||||
uri,
|
||||
],
|
||||
),
|
||||
returnValue:
|
||||
_i5.Future<Map<String, dynamic>>.value(<String, dynamic>{}),
|
||||
returnValue: _i5.Future<Map<String, dynamic>>.value(<String, dynamic>{}),
|
||||
) as _i5.Future<Map<String, dynamic>>);
|
||||
|
||||
@override
|
||||
@@ -198,8 +195,7 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider {
|
||||
uri,
|
||||
],
|
||||
),
|
||||
returnValue:
|
||||
_i5.Future<Map<String, dynamic>>.value(<String, dynamic>{}),
|
||||
returnValue: _i5.Future<Map<String, dynamic>>.value(<String, dynamic>{}),
|
||||
) as _i5.Future<Map<String, dynamic>>);
|
||||
|
||||
@override
|
||||
|
||||
@@ -57,8 +57,8 @@ void main() {
|
||||
when(mockBaseProvider.makeUrl('workout', query: anyNamed('query'))).thenReturn(uri);
|
||||
when(mockBaseProvider.deleteRequest(any, any)).thenAnswer((_) async => http.Response('', 204));
|
||||
|
||||
return ChangeNotifierProvider<WorkoutPlansProvider>(
|
||||
create: (context) => WorkoutPlansProvider(
|
||||
return ChangeNotifierProvider<RoutinesProvider>(
|
||||
create: (context) => RoutinesProvider(
|
||||
mockBaseProvider,
|
||||
testExercisesProvider,
|
||||
[
|
||||
|
||||
@@ -108,8 +108,7 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider {
|
||||
);
|
||||
|
||||
@override
|
||||
Map<String, String> getDefaultHeaders({bool? includeAuth = false}) =>
|
||||
(super.noSuchMethod(
|
||||
Map<String, String> getDefaultHeaders({bool? includeAuth = false}) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#getDefaultHeaders,
|
||||
[],
|
||||
@@ -150,14 +149,13 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider {
|
||||
) as Uri);
|
||||
|
||||
@override
|
||||
_i5.Future<Map<String, dynamic>> fetch(Uri? uri) => (super.noSuchMethod(
|
||||
_i5.Future<dynamic> fetch(Uri? uri) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#fetch,
|
||||
[uri],
|
||||
),
|
||||
returnValue:
|
||||
_i5.Future<Map<String, dynamic>>.value(<String, dynamic>{}),
|
||||
) as _i5.Future<Map<String, dynamic>>);
|
||||
returnValue: _i5.Future<dynamic>.value(),
|
||||
) as _i5.Future<dynamic>);
|
||||
|
||||
@override
|
||||
_i5.Future<List<dynamic>> fetchPaginated(Uri? uri) => (super.noSuchMethod(
|
||||
@@ -181,8 +179,7 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider {
|
||||
uri,
|
||||
],
|
||||
),
|
||||
returnValue:
|
||||
_i5.Future<Map<String, dynamic>>.value(<String, dynamic>{}),
|
||||
returnValue: _i5.Future<Map<String, dynamic>>.value(<String, dynamic>{}),
|
||||
) as _i5.Future<Map<String, dynamic>>);
|
||||
|
||||
@override
|
||||
@@ -198,8 +195,7 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider {
|
||||
uri,
|
||||
],
|
||||
),
|
||||
returnValue:
|
||||
_i5.Future<Map<String, dynamic>>.value(<String, dynamic>{}),
|
||||
returnValue: _i5.Future<Map<String, dynamic>>.value(<String, dynamic>{}),
|
||||
) as _i5.Future<Map<String, dynamic>>);
|
||||
|
||||
@override
|
||||
|
||||
@@ -64,7 +64,7 @@ void main() {
|
||||
);
|
||||
|
||||
// Load the entries
|
||||
final provider = WorkoutPlansProvider(mockBaseProvider, exercisesProvider, []);
|
||||
final provider = RoutinesProvider(mockBaseProvider, exercisesProvider, []);
|
||||
final plan = await provider.fetchAndSetPlanSparse(325397);
|
||||
final plans = provider.getPlans();
|
||||
|
||||
@@ -92,7 +92,7 @@ void main() {
|
||||
);
|
||||
|
||||
// Load the entries
|
||||
final provider = WorkoutPlansProvider(mockBaseProvider, exercisesProvider, []);
|
||||
final provider = RoutinesProvider(mockBaseProvider, exercisesProvider, []);
|
||||
|
||||
await provider.fetchAndSetPlanSparse(325397);
|
||||
await provider.deleteWorkout(325397);
|
||||
@@ -110,7 +110,7 @@ void main() {
|
||||
.thenAnswer((_) => Future.value(tRepetitionUnits['results']));
|
||||
|
||||
// Load the entries
|
||||
final provider = WorkoutPlansProvider(mockBaseProvider, exercisesProvider, []);
|
||||
final provider = RoutinesProvider(mockBaseProvider, exercisesProvider, []);
|
||||
await provider.fetchAndSetRepetitionUnits();
|
||||
final repetitionUnits = provider.repetitionUnits;
|
||||
|
||||
@@ -127,7 +127,7 @@ void main() {
|
||||
final ExercisesProvider testExercisesProvider = ExercisesProvider(mockBaseProvider);
|
||||
|
||||
// Load the entries
|
||||
final provider = WorkoutPlansProvider(mockBaseProvider, testExercisesProvider, []);
|
||||
final provider = RoutinesProvider(mockBaseProvider, testExercisesProvider, []);
|
||||
await provider.fetchAndSetWeightUnits();
|
||||
final weightUnits = provider.weightUnits;
|
||||
|
||||
@@ -154,7 +154,7 @@ void main() {
|
||||
final prefs = await SharedPreferences.getInstance();
|
||||
|
||||
// Load the entries
|
||||
final provider = WorkoutPlansProvider(mockBaseProvider, exercisesProvider, []);
|
||||
final provider = RoutinesProvider(mockBaseProvider, exercisesProvider, []);
|
||||
await provider.fetchAndSetUnits();
|
||||
final prefsJson = jsonDecode(prefs.getString(PREFS_WORKOUT_UNITS)!);
|
||||
|
||||
|
||||
@@ -108,8 +108,7 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider {
|
||||
);
|
||||
|
||||
@override
|
||||
Map<String, String> getDefaultHeaders({bool? includeAuth = false}) =>
|
||||
(super.noSuchMethod(
|
||||
Map<String, String> getDefaultHeaders({bool? includeAuth = false}) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#getDefaultHeaders,
|
||||
[],
|
||||
@@ -150,14 +149,13 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider {
|
||||
) as Uri);
|
||||
|
||||
@override
|
||||
_i5.Future<Map<String, dynamic>> fetch(Uri? uri) => (super.noSuchMethod(
|
||||
_i5.Future<dynamic> fetch(Uri? uri) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#fetch,
|
||||
[uri],
|
||||
),
|
||||
returnValue:
|
||||
_i5.Future<Map<String, dynamic>>.value(<String, dynamic>{}),
|
||||
) as _i5.Future<Map<String, dynamic>>);
|
||||
returnValue: _i5.Future<dynamic>.value(),
|
||||
) as _i5.Future<dynamic>);
|
||||
|
||||
@override
|
||||
_i5.Future<List<dynamic>> fetchPaginated(Uri? uri) => (super.noSuchMethod(
|
||||
@@ -181,8 +179,7 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider {
|
||||
uri,
|
||||
],
|
||||
),
|
||||
returnValue:
|
||||
_i5.Future<Map<String, dynamic>>.value(<String, dynamic>{}),
|
||||
returnValue: _i5.Future<Map<String, dynamic>>.value(<String, dynamic>{}),
|
||||
) as _i5.Future<Map<String, dynamic>>);
|
||||
|
||||
@override
|
||||
@@ -198,8 +195,7 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider {
|
||||
uri,
|
||||
],
|
||||
),
|
||||
returnValue:
|
||||
_i5.Future<Map<String, dynamic>>.value(<String, dynamic>{}),
|
||||
returnValue: _i5.Future<Map<String, dynamic>>.value(<String, dynamic>{}),
|
||||
) as _i5.Future<Map<String, dynamic>>);
|
||||
|
||||
@override
|
||||
|
||||
@@ -35,9 +35,9 @@ import '../../test_data/exercises.dart';
|
||||
import '../../test_data/routines.dart';
|
||||
import 'workout_set_form_test.mocks.dart';
|
||||
|
||||
@GenerateMocks([ExercisesProvider, WgerBaseProvider, WorkoutPlansProvider])
|
||||
@GenerateMocks([ExercisesProvider, WgerBaseProvider, RoutinesProvider])
|
||||
void main() {
|
||||
var mockWorkoutPlans = MockWorkoutPlansProvider();
|
||||
var mockWorkoutPlans = MockRoutinesProvider();
|
||||
final mockBaseProvider = MockWgerBaseProvider();
|
||||
final mockExerciseProvider = MockExercisesProvider();
|
||||
final workoutPlan = getWorkout();
|
||||
@@ -46,12 +46,12 @@ void main() {
|
||||
|
||||
setUp(() {
|
||||
day = workoutPlan.days.first;
|
||||
mockWorkoutPlans = MockWorkoutPlansProvider();
|
||||
mockWorkoutPlans = MockRoutinesProvider();
|
||||
});
|
||||
|
||||
Widget createHomeScreen({locale = 'en'}) {
|
||||
return ChangeNotifierProvider<WorkoutPlansProvider>(
|
||||
create: (context) => WorkoutPlansProvider(
|
||||
return ChangeNotifierProvider<RoutinesProvider>(
|
||||
create: (context) => RoutinesProvider(
|
||||
mockBaseProvider,
|
||||
mockExerciseProvider,
|
||||
[workoutPlan],
|
||||
|
||||
@@ -8,15 +8,16 @@ import 'dart:ui' as _i21;
|
||||
|
||||
import 'package:http/http.dart' as _i10;
|
||||
import 'package:mockito/mockito.dart' as _i1;
|
||||
import 'package:mockito/src/dummies.dart' as _i24;
|
||||
import 'package:mockito/src/dummies.dart' as _i25;
|
||||
import 'package:wger/database/exercises/exercise_database.dart' as _i3;
|
||||
import 'package:wger/models/exercises/category.dart' as _i5;
|
||||
import 'package:wger/models/exercises/equipment.dart' as _i6;
|
||||
import 'package:wger/models/exercises/exercise.dart' as _i4;
|
||||
import 'package:wger/models/exercises/language.dart' as _i8;
|
||||
import 'package:wger/models/exercises/muscle.dart' as _i7;
|
||||
import 'package:wger/models/exercises/translation.dart' as _i23;
|
||||
import 'package:wger/models/exercises/translation.dart' as _i24;
|
||||
import 'package:wger/models/workouts/day.dart' as _i14;
|
||||
import 'package:wger/models/workouts/day_data.dart' as _i23;
|
||||
import 'package:wger/models/workouts/log.dart' as _i18;
|
||||
import 'package:wger/models/workouts/repetition_unit.dart' as _i12;
|
||||
import 'package:wger/models/workouts/routine.dart' as _i13;
|
||||
@@ -42,8 +43,7 @@ import 'package:wger/providers/workout_plans.dart' as _i22;
|
||||
// ignore_for_file: camel_case_types
|
||||
// ignore_for_file: subtype_of_sealed_class
|
||||
|
||||
class _FakeWgerBaseProvider_0 extends _i1.SmartFake
|
||||
implements _i2.WgerBaseProvider {
|
||||
class _FakeWgerBaseProvider_0 extends _i1.SmartFake implements _i2.WgerBaseProvider {
|
||||
_FakeWgerBaseProvider_0(
|
||||
Object parent,
|
||||
Invocation parentInvocation,
|
||||
@@ -53,8 +53,7 @@ class _FakeWgerBaseProvider_0 extends _i1.SmartFake
|
||||
);
|
||||
}
|
||||
|
||||
class _FakeExerciseDatabase_1 extends _i1.SmartFake
|
||||
implements _i3.ExerciseDatabase {
|
||||
class _FakeExerciseDatabase_1 extends _i1.SmartFake implements _i3.ExerciseDatabase {
|
||||
_FakeExerciseDatabase_1(
|
||||
Object parent,
|
||||
Invocation parentInvocation,
|
||||
@@ -74,8 +73,7 @@ class _FakeExercise_2 extends _i1.SmartFake implements _i4.Exercise {
|
||||
);
|
||||
}
|
||||
|
||||
class _FakeExerciseCategory_3 extends _i1.SmartFake
|
||||
implements _i5.ExerciseCategory {
|
||||
class _FakeExerciseCategory_3 extends _i1.SmartFake implements _i5.ExerciseCategory {
|
||||
_FakeExerciseCategory_3(
|
||||
Object parent,
|
||||
Invocation parentInvocation,
|
||||
@@ -165,8 +163,7 @@ class _FakeWeightUnit_11 extends _i1.SmartFake implements _i11.WeightUnit {
|
||||
);
|
||||
}
|
||||
|
||||
class _FakeRepetitionUnit_12 extends _i1.SmartFake
|
||||
implements _i12.RepetitionUnit {
|
||||
class _FakeRepetitionUnit_12 extends _i1.SmartFake implements _i12.RepetitionUnit {
|
||||
_FakeRepetitionUnit_12(
|
||||
Object parent,
|
||||
Invocation parentInvocation,
|
||||
@@ -216,8 +213,7 @@ class _FakeSlotEntry_16 extends _i1.SmartFake implements _i16.SlotEntry {
|
||||
);
|
||||
}
|
||||
|
||||
class _FakeWorkoutSession_17 extends _i1.SmartFake
|
||||
implements _i17.WorkoutSession {
|
||||
class _FakeWorkoutSession_17 extends _i1.SmartFake implements _i17.WorkoutSession {
|
||||
_FakeWorkoutSession_17(
|
||||
Object parent,
|
||||
Invocation parentInvocation,
|
||||
@@ -294,8 +290,7 @@ class MockExercisesProvider extends _i1.Mock implements _i19.ExercisesProvider {
|
||||
) as List<_i4.Exercise>);
|
||||
|
||||
@override
|
||||
set filteredExercises(List<_i4.Exercise>? newFilteredExercises) =>
|
||||
super.noSuchMethod(
|
||||
set filteredExercises(List<_i4.Exercise>? newFilteredExercises) => super.noSuchMethod(
|
||||
Invocation.setter(
|
||||
#filteredExercises,
|
||||
newFilteredExercises,
|
||||
@@ -304,8 +299,7 @@ class MockExercisesProvider extends _i1.Mock implements _i19.ExercisesProvider {
|
||||
);
|
||||
|
||||
@override
|
||||
Map<int, List<_i4.Exercise>> get exerciseBasesByVariation =>
|
||||
(super.noSuchMethod(
|
||||
Map<int, List<_i4.Exercise>> get exerciseBasesByVariation => (super.noSuchMethod(
|
||||
Invocation.getter(#exerciseBasesByVariation),
|
||||
returnValue: <int, List<_i4.Exercise>>{},
|
||||
) as Map<int, List<_i4.Exercise>>);
|
||||
@@ -517,8 +511,7 @@ class MockExercisesProvider extends _i1.Mock implements _i19.ExercisesProvider {
|
||||
) as _i20.Future<void>);
|
||||
|
||||
@override
|
||||
_i20.Future<_i4.Exercise> fetchAndSetExercise(int? exerciseId) =>
|
||||
(super.noSuchMethod(
|
||||
_i20.Future<_i4.Exercise> fetchAndSetExercise(int? exerciseId) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#fetchAndSetExercise,
|
||||
[exerciseId],
|
||||
@@ -558,8 +551,7 @@ class MockExercisesProvider extends _i1.Mock implements _i19.ExercisesProvider {
|
||||
) as _i20.Future<_i4.Exercise>);
|
||||
|
||||
@override
|
||||
_i20.Future<void> initCacheTimesLocalPrefs({dynamic forceInit = false}) =>
|
||||
(super.noSuchMethod(
|
||||
_i20.Future<void> initCacheTimesLocalPrefs({dynamic forceInit = false}) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#initCacheTimesLocalPrefs,
|
||||
[],
|
||||
@@ -605,8 +597,7 @@ class MockExercisesProvider extends _i1.Mock implements _i19.ExercisesProvider {
|
||||
) as _i20.Future<void>);
|
||||
|
||||
@override
|
||||
_i20.Future<void> updateExerciseCache(_i3.ExerciseDatabase? database) =>
|
||||
(super.noSuchMethod(
|
||||
_i20.Future<void> updateExerciseCache(_i3.ExerciseDatabase? database) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#updateExerciseCache,
|
||||
[database],
|
||||
@@ -616,8 +607,7 @@ class MockExercisesProvider extends _i1.Mock implements _i19.ExercisesProvider {
|
||||
) as _i20.Future<void>);
|
||||
|
||||
@override
|
||||
_i20.Future<void> fetchAndSetMuscles(_i3.ExerciseDatabase? database) =>
|
||||
(super.noSuchMethod(
|
||||
_i20.Future<void> fetchAndSetMuscles(_i3.ExerciseDatabase? database) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#fetchAndSetMuscles,
|
||||
[database],
|
||||
@@ -627,8 +617,7 @@ class MockExercisesProvider extends _i1.Mock implements _i19.ExercisesProvider {
|
||||
) as _i20.Future<void>);
|
||||
|
||||
@override
|
||||
_i20.Future<void> fetchAndSetCategories(_i3.ExerciseDatabase? database) =>
|
||||
(super.noSuchMethod(
|
||||
_i20.Future<void> fetchAndSetCategories(_i3.ExerciseDatabase? database) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#fetchAndSetCategories,
|
||||
[database],
|
||||
@@ -638,8 +627,7 @@ class MockExercisesProvider extends _i1.Mock implements _i19.ExercisesProvider {
|
||||
) as _i20.Future<void>);
|
||||
|
||||
@override
|
||||
_i20.Future<void> fetchAndSetLanguages(_i3.ExerciseDatabase? database) =>
|
||||
(super.noSuchMethod(
|
||||
_i20.Future<void> fetchAndSetLanguages(_i3.ExerciseDatabase? database) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#fetchAndSetLanguages,
|
||||
[database],
|
||||
@@ -649,8 +637,7 @@ class MockExercisesProvider extends _i1.Mock implements _i19.ExercisesProvider {
|
||||
) as _i20.Future<void>);
|
||||
|
||||
@override
|
||||
_i20.Future<void> fetchAndSetEquipments(_i3.ExerciseDatabase? database) =>
|
||||
(super.noSuchMethod(
|
||||
_i20.Future<void> fetchAndSetEquipments(_i3.ExerciseDatabase? database) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#fetchAndSetEquipments,
|
||||
[database],
|
||||
@@ -759,8 +746,7 @@ class MockWgerBaseProvider extends _i1.Mock implements _i2.WgerBaseProvider {
|
||||
);
|
||||
|
||||
@override
|
||||
Map<String, String> getDefaultHeaders({bool? includeAuth = false}) =>
|
||||
(super.noSuchMethod(
|
||||
Map<String, String> getDefaultHeaders({bool? includeAuth = false}) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#getDefaultHeaders,
|
||||
[],
|
||||
@@ -801,14 +787,13 @@ class MockWgerBaseProvider extends _i1.Mock implements _i2.WgerBaseProvider {
|
||||
) as Uri);
|
||||
|
||||
@override
|
||||
_i20.Future<Map<String, dynamic>> fetch(Uri? uri) => (super.noSuchMethod(
|
||||
_i20.Future<dynamic> fetch(Uri? uri) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#fetch,
|
||||
[uri],
|
||||
),
|
||||
returnValue:
|
||||
_i20.Future<Map<String, dynamic>>.value(<String, dynamic>{}),
|
||||
) as _i20.Future<Map<String, dynamic>>);
|
||||
returnValue: _i20.Future<dynamic>.value(),
|
||||
) as _i20.Future<dynamic>);
|
||||
|
||||
@override
|
||||
_i20.Future<List<dynamic>> fetchPaginated(Uri? uri) => (super.noSuchMethod(
|
||||
@@ -832,8 +817,7 @@ class MockWgerBaseProvider extends _i1.Mock implements _i2.WgerBaseProvider {
|
||||
uri,
|
||||
],
|
||||
),
|
||||
returnValue:
|
||||
_i20.Future<Map<String, dynamic>>.value(<String, dynamic>{}),
|
||||
returnValue: _i20.Future<Map<String, dynamic>>.value(<String, dynamic>{}),
|
||||
) as _i20.Future<Map<String, dynamic>>);
|
||||
|
||||
@override
|
||||
@@ -849,8 +833,7 @@ class MockWgerBaseProvider extends _i1.Mock implements _i2.WgerBaseProvider {
|
||||
uri,
|
||||
],
|
||||
),
|
||||
returnValue:
|
||||
_i20.Future<Map<String, dynamic>>.value(<String, dynamic>{}),
|
||||
returnValue: _i20.Future<Map<String, dynamic>>.value(<String, dynamic>{}),
|
||||
) as _i20.Future<Map<String, dynamic>>);
|
||||
|
||||
@override
|
||||
@@ -879,12 +862,11 @@ class MockWgerBaseProvider extends _i1.Mock implements _i2.WgerBaseProvider {
|
||||
) as _i20.Future<_i10.Response>);
|
||||
}
|
||||
|
||||
/// A class which mocks [WorkoutPlansProvider].
|
||||
/// A class which mocks [RoutinesProvider].
|
||||
///
|
||||
/// See the documentation for Mockito's code generation for more information.
|
||||
class MockWorkoutPlansProvider extends _i1.Mock
|
||||
implements _i22.WorkoutPlansProvider {
|
||||
MockWorkoutPlansProvider() {
|
||||
class MockRoutinesProvider extends _i1.Mock implements _i22.RoutinesProvider {
|
||||
MockRoutinesProvider() {
|
||||
_i1.throwOnMissingStub(this);
|
||||
}
|
||||
|
||||
@@ -1020,8 +1002,16 @@ class MockWorkoutPlansProvider extends _i1.Mock
|
||||
) as _i20.Future<void>);
|
||||
|
||||
@override
|
||||
_i20.Future<_i13.Routine> fetchAndSetPlanSparse(int? planId) =>
|
||||
(super.noSuchMethod(
|
||||
void setExerciseAndUnits(List<_i23.DayData>? entries) => super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#setExerciseAndUnits,
|
||||
[entries],
|
||||
),
|
||||
returnValueForMissingStub: null,
|
||||
);
|
||||
|
||||
@override
|
||||
_i20.Future<_i13.Routine> fetchAndSetPlanSparse(int? planId) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#fetchAndSetPlanSparse,
|
||||
[planId],
|
||||
@@ -1036,33 +1026,31 @@ class MockWorkoutPlansProvider extends _i1.Mock
|
||||
) as _i20.Future<_i13.Routine>);
|
||||
|
||||
@override
|
||||
_i20.Future<_i13.Routine> fetchAndSetWorkoutPlanFull(int? workoutId) =>
|
||||
(super.noSuchMethod(
|
||||
_i20.Future<_i13.Routine> fetchAndSetWorkoutPlanFull(int? routineId) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#fetchAndSetWorkoutPlanFull,
|
||||
[workoutId],
|
||||
[routineId],
|
||||
),
|
||||
returnValue: _i20.Future<_i13.Routine>.value(_FakeRoutine_13(
|
||||
this,
|
||||
Invocation.method(
|
||||
#fetchAndSetWorkoutPlanFull,
|
||||
[workoutId],
|
||||
[routineId],
|
||||
),
|
||||
)),
|
||||
) as _i20.Future<_i13.Routine>);
|
||||
|
||||
@override
|
||||
_i20.Future<_i13.Routine> addWorkout(_i13.Routine? workout) =>
|
||||
(super.noSuchMethod(
|
||||
_i20.Future<_i13.Routine> addRoutine(_i13.Routine? routine) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#addWorkout,
|
||||
[workout],
|
||||
#addRoutine,
|
||||
[routine],
|
||||
),
|
||||
returnValue: _i20.Future<_i13.Routine>.value(_FakeRoutine_13(
|
||||
this,
|
||||
Invocation.method(
|
||||
#addWorkout,
|
||||
[workout],
|
||||
#addRoutine,
|
||||
[routine],
|
||||
),
|
||||
)),
|
||||
) as _i20.Future<_i13.Routine>);
|
||||
@@ -1100,8 +1088,7 @@ class MockWorkoutPlansProvider extends _i1.Mock
|
||||
base,
|
||||
],
|
||||
),
|
||||
returnValue:
|
||||
_i20.Future<Map<String, dynamic>>.value(<String, dynamic>{}),
|
||||
returnValue: _i20.Future<Map<String, dynamic>>.value(<String, dynamic>{}),
|
||||
) as _i20.Future<Map<String, dynamic>>);
|
||||
|
||||
@override
|
||||
@@ -1221,8 +1208,7 @@ class MockWorkoutPlansProvider extends _i1.Mock
|
||||
) as _i20.Future<List<_i15.Slot>>);
|
||||
|
||||
@override
|
||||
_i20.Future<void> fetchComputedSettings(_i15.Slot? workoutSet) =>
|
||||
(super.noSuchMethod(
|
||||
_i20.Future<void> fetchComputedSettings(_i15.Slot? workoutSet) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#fetchComputedSettings,
|
||||
[workoutSet],
|
||||
@@ -1234,7 +1220,7 @@ class MockWorkoutPlansProvider extends _i1.Mock
|
||||
@override
|
||||
_i20.Future<String> fetchSmartText(
|
||||
_i15.Slot? workoutSet,
|
||||
_i23.Translation? exercise,
|
||||
_i24.Translation? exercise,
|
||||
) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
@@ -1244,7 +1230,7 @@ class MockWorkoutPlansProvider extends _i1.Mock
|
||||
exercise,
|
||||
],
|
||||
),
|
||||
returnValue: _i20.Future<String>.value(_i24.dummyValue<String>(
|
||||
returnValue: _i20.Future<String>.value(_i25.dummyValue<String>(
|
||||
this,
|
||||
Invocation.method(
|
||||
#fetchSmartText,
|
||||
@@ -1257,18 +1243,17 @@ class MockWorkoutPlansProvider extends _i1.Mock
|
||||
) as _i20.Future<String>);
|
||||
|
||||
@override
|
||||
_i20.Future<void> deleteSet(_i15.Slot? workoutSet) => (super.noSuchMethod(
|
||||
_i20.Future<void> deleteSet(int? setId) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#deleteSet,
|
||||
[workoutSet],
|
||||
[setId],
|
||||
),
|
||||
returnValue: _i20.Future<void>.value(),
|
||||
returnValueForMissingStub: _i20.Future<void>.value(),
|
||||
) as _i20.Future<void>);
|
||||
|
||||
@override
|
||||
_i20.Future<_i16.SlotEntry> addSetting(_i16.SlotEntry? workoutSetting) =>
|
||||
(super.noSuchMethod(
|
||||
_i20.Future<_i16.SlotEntry> addSetting(_i16.SlotEntry? workoutSetting) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#addSetting,
|
||||
[workoutSetting],
|
||||
@@ -1292,14 +1277,12 @@ class MockWorkoutPlansProvider extends _i1.Mock
|
||||
) as _i20.Future<dynamic>);
|
||||
|
||||
@override
|
||||
_i20.Future<_i17.WorkoutSession> addSession(_i17.WorkoutSession? session) =>
|
||||
(super.noSuchMethod(
|
||||
_i20.Future<_i17.WorkoutSession> addSession(_i17.WorkoutSession? session) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#addSession,
|
||||
[session],
|
||||
),
|
||||
returnValue:
|
||||
_i20.Future<_i17.WorkoutSession>.value(_FakeWorkoutSession_17(
|
||||
returnValue: _i20.Future<_i17.WorkoutSession>.value(_FakeWorkoutSession_17(
|
||||
this,
|
||||
Invocation.method(
|
||||
#addSession,
|
||||
|
||||
@@ -42,7 +42,7 @@ Routine getWorkout({List<Exercise>? exercises}) {
|
||||
..rir = '1.5'
|
||||
..date = DateTime(2021, 5, 1)
|
||||
..reps = 10
|
||||
..workoutPlan = 1;
|
||||
..routineId = 1;
|
||||
log1.exerciseBase = testBases[0];
|
||||
log1.weightUnit = weightUnit1;
|
||||
log1.repetitionUnit = repetitionUnit1;
|
||||
@@ -53,7 +53,7 @@ Routine getWorkout({List<Exercise>? exercises}) {
|
||||
..rir = '2'
|
||||
..date = DateTime(2021, 5, 1)
|
||||
..reps = 12
|
||||
..workoutPlan = 1;
|
||||
..routineId = 1;
|
||||
log2.exerciseBase = testBases[0];
|
||||
log2.weightUnit = weightUnit1;
|
||||
log2.repetitionUnit = repetitionUnit1;
|
||||
@@ -64,7 +64,7 @@ Routine getWorkout({List<Exercise>? exercises}) {
|
||||
..rir = ''
|
||||
..date = DateTime(2021, 5, 2)
|
||||
..reps = 8
|
||||
..workoutPlan = 1;
|
||||
..routineId = 1;
|
||||
log3.exerciseBase = testBases[1];
|
||||
log3.weightUnit = weightUnit1;
|
||||
log3.repetitionUnit = repetitionUnit1;
|
||||
@@ -76,7 +76,6 @@ Routine getWorkout({List<Exercise>? exercises}) {
|
||||
exerciseId: 1,
|
||||
repetitionUnitId: 1,
|
||||
repetitionRounding: 0.25,
|
||||
reps: 6,
|
||||
weightUnitId: 1,
|
||||
weightRounding: 0.25,
|
||||
comment: 'ddd',
|
||||
@@ -84,7 +83,6 @@ Routine getWorkout({List<Exercise>? exercises}) {
|
||||
settingBenchPress.repetitionUnit = repetitionUnit1;
|
||||
settingBenchPress.weightUnit = weightUnit1;
|
||||
settingBenchPress.exercise = testBases[0];
|
||||
settingBenchPress.weight = 80;
|
||||
|
||||
final setBenchPress = Slot.withData(
|
||||
id: 1,
|
||||
@@ -104,7 +102,6 @@ Routine getWorkout({List<Exercise>? exercises}) {
|
||||
exerciseId: 8,
|
||||
repetitionUnitId: 1,
|
||||
repetitionRounding: 0.25,
|
||||
reps: 8,
|
||||
weightUnitId: 1,
|
||||
weightRounding: 0.25,
|
||||
comment: 'ddd',
|
||||
@@ -112,7 +109,6 @@ Routine getWorkout({List<Exercise>? exercises}) {
|
||||
settingSquat.repetitionUnit = repetitionUnit1;
|
||||
settingSquat.weightUnit = weightUnit1;
|
||||
settingSquat.exercise = testBases[4];
|
||||
settingSquat.weight = 120;
|
||||
|
||||
final setSquat = Slot.withData(id: 2, day: 1, sets: 3, order: 1);
|
||||
setSquat.addExerciseBase(testBases[4]);
|
||||
@@ -126,7 +122,6 @@ Routine getWorkout({List<Exercise>? exercises}) {
|
||||
exerciseId: 8,
|
||||
repetitionUnitId: 1,
|
||||
repetitionRounding: 0.25,
|
||||
reps: 12,
|
||||
weightUnitId: 1,
|
||||
weightRounding: 0.25,
|
||||
comment: 'ddd',
|
||||
@@ -134,7 +129,7 @@ Routine getWorkout({List<Exercise>? exercises}) {
|
||||
settingSideRaises.repetitionUnit = repetitionUnit1;
|
||||
settingSideRaises.weightUnit = weightUnit1;
|
||||
settingSideRaises.exercise = testBases[5];
|
||||
settingSideRaises.weight = 6;
|
||||
// settingSideRaises.weight = 6;
|
||||
|
||||
final setSideRaises = Slot.withData(id: 3, day: 1, sets: 3, order: 1);
|
||||
setSideRaises.addExerciseBase(testBases[5]);
|
||||
|
||||
Reference in New Issue
Block a user