Merge branch 'fork/Sangharshdeveloper/feature-theme_customization#687'

# Conflicts:
#	pubspec.lock
This commit is contained in:
Roland Geider
2025-01-23 23:23:12 +01:00
61 changed files with 959 additions and 1192 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -3,24 +3,20 @@
part of 'ingredients_database.dart';
// ignore_for_file: type=lint
class $IngredientsTable extends Ingredients
with TableInfo<$IngredientsTable, IngredientTable> {
class $IngredientsTable extends Ingredients with TableInfo<$IngredientsTable, IngredientTable> {
@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,
late final GeneratedColumn<int> id = GeneratedColumn<int>('id', aliasedName, false,
type: DriftSqlType.int, requiredDuringInsert: true);
static const VerificationMeta _dataMeta = const VerificationMeta('data');
@override
late final GeneratedColumn<String> data = GeneratedColumn<String>(
'data', aliasedName, false,
late final GeneratedColumn<String> data = GeneratedColumn<String>('data', aliasedName, false,
type: DriftSqlType.string, requiredDuringInsert: true);
static const VerificationMeta _lastFetchedMeta =
const VerificationMeta('lastFetched');
static const VerificationMeta _lastFetchedMeta = const VerificationMeta('lastFetched');
@override
late final GeneratedColumn<DateTime> lastFetched = GeneratedColumn<DateTime>(
'last_fetched', aliasedName, false,
@@ -43,16 +39,13 @@ class $IngredientsTable extends Ingredients
context.missing(_idMeta);
}
if (data.containsKey('data')) {
context.handle(
_dataMeta, this.data.isAcceptableOrUnknown(data['data']!, _dataMeta));
context.handle(_dataMeta, this.data.isAcceptableOrUnknown(data['data']!, _dataMeta));
} else if (isInserting) {
context.missing(_dataMeta);
}
if (data.containsKey('last_fetched')) {
context.handle(
_lastFetchedMeta,
lastFetched.isAcceptableOrUnknown(
data['last_fetched']!, _lastFetchedMeta));
context.handle(_lastFetchedMeta,
lastFetched.isAcceptableOrUnknown(data['last_fetched']!, _lastFetchedMeta));
} else if (isInserting) {
context.missing(_lastFetchedMeta);
}
@@ -65,10 +58,8 @@ class $IngredientsTable extends Ingredients
IngredientTable map(Map<String, dynamic> data, {String? tablePrefix}) {
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
return IngredientTable(
id: attachedDatabase.typeMapping
.read(DriftSqlType.int, data['${effectivePrefix}id'])!,
data: attachedDatabase.typeMapping
.read(DriftSqlType.string, data['${effectivePrefix}data'])!,
id: attachedDatabase.typeMapping.read(DriftSqlType.int, data['${effectivePrefix}id'])!,
data: attachedDatabase.typeMapping.read(DriftSqlType.string, data['${effectivePrefix}data'])!,
lastFetched: attachedDatabase.typeMapping
.read(DriftSqlType.dateTime, data['${effectivePrefix}last_fetched'])!,
);
@@ -86,8 +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});
const IngredientTable({required this.id, required this.data, required this.lastFetched});
@override
Map<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
@@ -105,8 +95,7 @@ class IngredientTable extends DataClass implements Insertable<IngredientTable> {
);
}
factory IngredientTable.fromJson(Map<String, dynamic> json,
{ValueSerializer? serializer}) {
factory IngredientTable.fromJson(Map<String, dynamic> json, {ValueSerializer? serializer}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
return IngredientTable(
id: serializer.fromJson<int>(json['id']),
@@ -124,8 +113,7 @@ class IngredientTable extends DataClass implements Insertable<IngredientTable> {
};
}
IngredientTable copyWith({int? id, String? data, DateTime? lastFetched}) =>
IngredientTable(
IngredientTable copyWith({int? id, String? data, DateTime? lastFetched}) => IngredientTable(
id: id ?? this.id,
data: data ?? this.data,
lastFetched: lastFetched ?? this.lastFetched,
@@ -134,8 +122,7 @@ class IngredientTable extends DataClass implements Insertable<IngredientTable> {
return IngredientTable(
id: data.id.present ? data.id.value : this.id,
data: data.data.present ? data.data.value : this.data,
lastFetched:
data.lastFetched.present ? data.lastFetched.value : this.lastFetched,
lastFetched: data.lastFetched.present ? data.lastFetched.value : this.lastFetched,
);
}
@@ -194,10 +181,7 @@ class IngredientsCompanion extends UpdateCompanion<IngredientTable> {
}
IngredientsCompanion copyWith(
{Value<int>? id,
Value<String>? data,
Value<DateTime>? lastFetched,
Value<int>? rowid}) {
{Value<int>? id, Value<String>? data, Value<DateTime>? lastFetched, Value<int>? rowid}) {
return IngredientsCompanion(
id: id ?? this.id,
data: data ?? this.data,
@@ -247,23 +231,20 @@ abstract class _$IngredientDatabase extends GeneratedDatabase {
List<DatabaseSchemaEntity> get allSchemaEntities => [ingredients];
}
typedef $$IngredientsTableCreateCompanionBuilder = IngredientsCompanion
Function({
typedef $$IngredientsTableCreateCompanionBuilder = IngredientsCompanion Function({
required int id,
required String data,
required DateTime lastFetched,
Value<int> rowid,
});
typedef $$IngredientsTableUpdateCompanionBuilder = IngredientsCompanion
Function({
typedef $$IngredientsTableUpdateCompanionBuilder = IngredientsCompanion Function({
Value<int> id,
Value<String> data,
Value<DateTime> lastFetched,
Value<int> rowid,
});
class $$IngredientsTableFilterComposer
extends Composer<_$IngredientDatabase, $IngredientsTable> {
class $$IngredientsTableFilterComposer extends Composer<_$IngredientDatabase, $IngredientsTable> {
$$IngredientsTableFilterComposer({
required super.$db,
required super.$table,
@@ -271,18 +252,17 @@ class $$IngredientsTableFilterComposer
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
ColumnFilters<int> get id => $composableBuilder(
column: $table.id, builder: (column) => ColumnFilters(column));
ColumnFilters<int> get id =>
$composableBuilder(column: $table.id, builder: (column) => ColumnFilters(column));
ColumnFilters<String> get data => $composableBuilder(
column: $table.data, builder: (column) => ColumnFilters(column));
ColumnFilters<String> get data =>
$composableBuilder(column: $table.data, builder: (column) => ColumnFilters(column));
ColumnFilters<DateTime> get lastFetched => $composableBuilder(
column: $table.lastFetched, builder: (column) => ColumnFilters(column));
ColumnFilters<DateTime> get lastFetched =>
$composableBuilder(column: $table.lastFetched, builder: (column) => ColumnFilters(column));
}
class $$IngredientsTableOrderingComposer
extends Composer<_$IngredientDatabase, $IngredientsTable> {
class $$IngredientsTableOrderingComposer extends Composer<_$IngredientDatabase, $IngredientsTable> {
$$IngredientsTableOrderingComposer({
required super.$db,
required super.$table,
@@ -290,14 +270,14 @@ class $$IngredientsTableOrderingComposer
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
ColumnOrderings<int> get id => $composableBuilder(
column: $table.id, builder: (column) => ColumnOrderings(column));
ColumnOrderings<int> get id =>
$composableBuilder(column: $table.id, builder: (column) => ColumnOrderings(column));
ColumnOrderings<String> get data => $composableBuilder(
column: $table.data, builder: (column) => ColumnOrderings(column));
ColumnOrderings<String> get data =>
$composableBuilder(column: $table.data, builder: (column) => ColumnOrderings(column));
ColumnOrderings<DateTime> get lastFetched => $composableBuilder(
column: $table.lastFetched, builder: (column) => ColumnOrderings(column));
ColumnOrderings<DateTime> get lastFetched =>
$composableBuilder(column: $table.lastFetched, builder: (column) => ColumnOrderings(column));
}
class $$IngredientsTableAnnotationComposer
@@ -309,14 +289,13 @@ class $$IngredientsTableAnnotationComposer
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
GeneratedColumn<int> get id =>
$composableBuilder(column: $table.id, builder: (column) => column);
GeneratedColumn<int> get id => $composableBuilder(column: $table.id, builder: (column) => column);
GeneratedColumn<String> get data =>
$composableBuilder(column: $table.data, builder: (column) => column);
GeneratedColumn<DateTime> get lastFetched => $composableBuilder(
column: $table.lastFetched, builder: (column) => column);
GeneratedColumn<DateTime> get lastFetched =>
$composableBuilder(column: $table.lastFetched, builder: (column) => column);
}
class $$IngredientsTableTableManager extends RootTableManager<
@@ -328,21 +307,15 @@ class $$IngredientsTableTableManager extends RootTableManager<
$$IngredientsTableAnnotationComposer,
$$IngredientsTableCreateCompanionBuilder,
$$IngredientsTableUpdateCompanionBuilder,
(
IngredientTable,
BaseReferences<_$IngredientDatabase, $IngredientsTable, IngredientTable>
),
(IngredientTable, BaseReferences<_$IngredientDatabase, $IngredientsTable, IngredientTable>),
IngredientTable,
PrefetchHooks Function()> {
$$IngredientsTableTableManager(
_$IngredientDatabase db, $IngredientsTable table)
$$IngredientsTableTableManager(_$IngredientDatabase db, $IngredientsTable table)
: super(TableManagerState(
db: db,
table: table,
createFilteringComposer: () =>
$$IngredientsTableFilterComposer($db: db, $table: table),
createOrderingComposer: () =>
$$IngredientsTableOrderingComposer($db: db, $table: table),
createFilteringComposer: () => $$IngredientsTableFilterComposer($db: db, $table: table),
createOrderingComposer: () => $$IngredientsTableOrderingComposer($db: db, $table: table),
createComputedFieldComposer: () =>
$$IngredientsTableAnnotationComposer($db: db, $table: table),
updateCompanionCallback: ({
@@ -369,9 +342,8 @@ class $$IngredientsTableTableManager extends RootTableManager<
lastFetched: lastFetched,
rowid: rowid,
),
withReferenceMapper: (p0) => p0
.map((e) => (e.readTable(table), BaseReferences(db, table, e)))
.toList(),
withReferenceMapper: (p0) =>
p0.map((e) => (e.readTable(table), BaseReferences(db, table, e))).toList(),
prefetchHooksCallback: null,
));
}
@@ -385,10 +357,7 @@ typedef $$IngredientsTableProcessedTableManager = ProcessedTableManager<
$$IngredientsTableAnnotationComposer,
$$IngredientsTableCreateCompanionBuilder,
$$IngredientsTableUpdateCompanionBuilder,
(
IngredientTable,
BaseReferences<_$IngredientDatabase, $IngredientsTable, IngredientTable>
),
(IngredientTable, BaseReferences<_$IngredientDatabase, $IngredientsTable, IngredientTable>),
IngredientTable,
PrefetchHooks Function()>;

View File

@@ -62,6 +62,7 @@ const PREFS_LAST_UPDATED_LANGUAGES = 'lastUpdatedLanguages';
const PREFS_INGREDIENTS = 'ingredientData';
const PREFS_WORKOUT_UNITS = 'workoutUnits';
const PREFS_USER = 'userData';
const PREFS_USER_DARK_THEME = 'userDarkMode';
const PREFS_LAST_SERVER = 'lastServer';
const DEFAULT_ANIMATION_DURATION = Duration(milliseconds: 200);

View File

@@ -912,5 +912,9 @@
"indicatorAvg": "avg",
"@indicatorAvg": {
"description": "added for localization of Class Indicator's field text"
}
},
"themeMode": "Theme mode",
"darkMode": "Always dark mode",
"lightMode": "Always light mode",
"systemMode": "System settings"
}

View File

@@ -134,46 +134,48 @@ class MyApp extends StatelessWidget {
),
],
child: Consumer<AuthProvider>(
builder: (ctx, auth, _) => MaterialApp(
title: 'wger',
theme: wgerLightTheme,
darkTheme: wgerDarkTheme,
highContrastTheme: wgerLightThemeHc,
highContrastDarkTheme: wgerDarkThemeHc,
themeMode: ThemeMode.system,
home: auth.isAuth
? const HomeTabsScreen()
: FutureBuilder(
future: auth.tryAutoLogin(),
builder: (ctx, authResultSnapshot) =>
authResultSnapshot.connectionState == ConnectionState.waiting
? const SplashScreen()
: const AuthScreen(),
),
routes: {
DashboardScreen.routeName: (ctx) => const DashboardScreen(),
FormScreen.routeName: (ctx) => const FormScreen(),
GalleryScreen.routeName: (ctx) => const GalleryScreen(),
GymModeScreen.routeName: (ctx) => const GymModeScreen(),
HomeTabsScreen.routeName: (ctx) => const HomeTabsScreen(),
MeasurementCategoriesScreen.routeName: (ctx) => const MeasurementCategoriesScreen(),
MeasurementEntriesScreen.routeName: (ctx) => const MeasurementEntriesScreen(),
NutritionalPlansScreen.routeName: (ctx) => const NutritionalPlansScreen(),
NutritionalDiaryScreen.routeName: (ctx) => const NutritionalDiaryScreen(),
NutritionalPlanScreen.routeName: (ctx) => const NutritionalPlanScreen(),
LogMealsScreen.routeName: (ctx) => const LogMealsScreen(),
LogMealScreen.routeName: (ctx) => const LogMealScreen(),
WeightScreen.routeName: (ctx) => const WeightScreen(),
WorkoutPlanScreen.routeName: (ctx) => const WorkoutPlanScreen(),
WorkoutPlansScreen.routeName: (ctx) => const WorkoutPlansScreen(),
ExercisesScreen.routeName: (ctx) => const ExercisesScreen(),
ExerciseDetailScreen.routeName: (ctx) => const ExerciseDetailScreen(),
AddExerciseScreen.routeName: (ctx) => const AddExerciseScreen(),
AboutPage.routeName: (ctx) => const AboutPage(),
SettingsPage.routeName: (ctx) => const SettingsPage(),
},
localizationsDelegates: AppLocalizations.localizationsDelegates,
supportedLocales: AppLocalizations.supportedLocales,
builder: (ctx, auth, _) => Consumer<UserProvider>(
builder: (ctx, user, _) => MaterialApp(
title: 'wger',
theme: wgerLightTheme,
darkTheme: wgerDarkTheme,
highContrastTheme: wgerLightThemeHc,
highContrastDarkTheme: wgerDarkThemeHc,
themeMode: user.themeMode,
home: auth.isAuth
? const HomeTabsScreen()
: FutureBuilder(
future: auth.tryAutoLogin(),
builder: (ctx, authResultSnapshot) =>
authResultSnapshot.connectionState == ConnectionState.waiting
? const SplashScreen()
: const AuthScreen(),
),
routes: {
DashboardScreen.routeName: (ctx) => const DashboardScreen(),
FormScreen.routeName: (ctx) => const FormScreen(),
GalleryScreen.routeName: (ctx) => const GalleryScreen(),
GymModeScreen.routeName: (ctx) => const GymModeScreen(),
HomeTabsScreen.routeName: (ctx) => const HomeTabsScreen(),
MeasurementCategoriesScreen.routeName: (ctx) => const MeasurementCategoriesScreen(),
MeasurementEntriesScreen.routeName: (ctx) => const MeasurementEntriesScreen(),
NutritionalPlansScreen.routeName: (ctx) => const NutritionalPlansScreen(),
NutritionalDiaryScreen.routeName: (ctx) => const NutritionalDiaryScreen(),
NutritionalPlanScreen.routeName: (ctx) => const NutritionalPlanScreen(),
LogMealsScreen.routeName: (ctx) => const LogMealsScreen(),
LogMealScreen.routeName: (ctx) => const LogMealScreen(),
WeightScreen.routeName: (ctx) => const WeightScreen(),
WorkoutPlanScreen.routeName: (ctx) => const WorkoutPlanScreen(),
WorkoutPlansScreen.routeName: (ctx) => const WorkoutPlansScreen(),
ExercisesScreen.routeName: (ctx) => const ExercisesScreen(),
ExerciseDetailScreen.routeName: (ctx) => const ExerciseDetailScreen(),
AddExerciseScreen.routeName: (ctx) => const AddExerciseScreen(),
AboutPage.routeName: (ctx) => const AboutPage(),
SettingsPage.routeName: (ctx) => const SettingsPage(),
},
localizationsDelegates: AppLocalizations.localizationsDelegates,
supportedLocales: AppLocalizations.supportedLocales,
),
),
),
);

View File

@@ -18,8 +18,7 @@ WeightEntry _$WeightEntryFromJson(Map<String, dynamic> json) {
);
}
Map<String, dynamic> _$WeightEntryToJson(WeightEntry instance) =>
<String, dynamic>{
Map<String, dynamic> _$WeightEntryToJson(WeightEntry instance) => <String, dynamic>{
'id': instance.id,
'weight': numToString(instance.weight),
'date': toDate(instance.date),

View File

@@ -17,8 +17,7 @@ ExerciseCategory _$ExerciseCategoryFromJson(Map<String, dynamic> json) {
);
}
Map<String, dynamic> _$ExerciseCategoryToJson(ExerciseCategory instance) =>
<String, dynamic>{
Map<String, dynamic> _$ExerciseCategoryToJson(ExerciseCategory instance) => <String, dynamic>{
'id': instance.id,
'name': instance.name,
};

View File

@@ -25,12 +25,8 @@ Exercise _$ExerciseFromJson(Map<String, dynamic> json) {
return Exercise(
id: (json['id'] as num?)?.toInt(),
uuid: json['uuid'] as String?,
created: json['created'] == null
? null
: DateTime.parse(json['created'] as String),
lastUpdate: json['last_update'] == null
? null
: DateTime.parse(json['last_update'] as String),
created: json['created'] == null ? null : DateTime.parse(json['created'] as String),
lastUpdate: json['last_update'] == null ? null : DateTime.parse(json['last_update'] as String),
lastUpdateGlobal: json['last_update_global'] == null
? null
: DateTime.parse(json['last_update_global'] as String),
@@ -43,15 +39,10 @@ Exercise _$ExerciseFromJson(Map<String, dynamic> json) {
: ExerciseCategory.fromJson(json['categories'] as Map<String, dynamic>),
)
..categoryId = (json['category'] as num).toInt()
..musclesIds = (json['muscles'] as List<dynamic>)
.map((e) => (e as num).toInt())
.toList()
..musclesSecondaryIds = (json['muscles_secondary'] as List<dynamic>)
.map((e) => (e as num).toInt())
.toList()
..equipmentIds = (json['equipment'] as List<dynamic>)
.map((e) => (e as num).toInt())
.toList();
..musclesIds = (json['muscles'] as List<dynamic>).map((e) => (e as num).toInt()).toList()
..musclesSecondaryIds =
(json['muscles_secondary'] as List<dynamic>).map((e) => (e as num).toInt()).toList()
..equipmentIds = (json['equipment'] as List<dynamic>).map((e) => (e as num).toInt()).toList();
}
Map<String, dynamic> _$ExerciseToJson(Exercise instance) => <String, dynamic>{
@@ -65,7 +56,6 @@ Map<String, dynamic> _$ExerciseToJson(Exercise instance) => <String, dynamic>{
'categories': instance.category?.toJson(),
'muscles': instance.musclesIds,
'muscles_secondary': instance.musclesSecondaryIds,
'musclesSecondary':
instance.musclesSecondary.map((e) => e.toJson()).toList(),
'musclesSecondary': instance.musclesSecondary.map((e) => e.toJson()).toList(),
'equipment': instance.equipmentIds,
};

View File

@@ -21,14 +21,11 @@ ExerciseApiData _$ExerciseApiDataFromJson(Map<String, dynamic> json) {
/// @nodoc
mixin _$ExerciseApiData {
int get id => throw _privateConstructorUsedError;
String get uuid =>
throw _privateConstructorUsedError; // ignore: invalid_annotation_target
String get uuid => throw _privateConstructorUsedError; // ignore: invalid_annotation_target
@JsonKey(name: 'variations')
int? get variationId =>
throw _privateConstructorUsedError; // ignore: invalid_annotation_target
int? get variationId => throw _privateConstructorUsedError; // ignore: invalid_annotation_target
@JsonKey(name: 'created')
DateTime get created =>
throw _privateConstructorUsedError; // ignore: invalid_annotation_target
DateTime get created => throw _privateConstructorUsedError; // ignore: invalid_annotation_target
@JsonKey(name: 'last_update')
DateTime get lastUpdate =>
throw _privateConstructorUsedError; // ignore: invalid_annotation_target
@@ -45,8 +42,7 @@ mixin _$ExerciseApiData {
@JsonKey(name: 'exercises')
List<Translation> get translations => throw _privateConstructorUsedError;
List<ExerciseImage> get images => throw _privateConstructorUsedError;
List<Video> get videos =>
throw _privateConstructorUsedError; // ignore: invalid_annotation_target
List<Video> get videos => throw _privateConstructorUsedError; // ignore: invalid_annotation_target
@JsonKey(name: 'author_history')
List<String> get authors =>
throw _privateConstructorUsedError; // ignore: invalid_annotation_target
@@ -59,14 +55,12 @@ mixin _$ExerciseApiData {
/// Create a copy of ExerciseApiData
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$ExerciseApiDataCopyWith<ExerciseApiData> get copyWith =>
throw _privateConstructorUsedError;
$ExerciseApiDataCopyWith<ExerciseApiData> get copyWith => throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $ExerciseApiDataCopyWith<$Res> {
factory $ExerciseApiDataCopyWith(
ExerciseApiData value, $Res Function(ExerciseApiData) then) =
factory $ExerciseApiDataCopyWith(ExerciseApiData value, $Res Function(ExerciseApiData) then) =
_$ExerciseApiDataCopyWithImpl<$Res, ExerciseApiData>;
@useResult
$Res call(
@@ -184,10 +178,9 @@ class _$ExerciseApiDataCopyWithImpl<$Res, $Val extends ExerciseApiData>
}
/// @nodoc
abstract class _$$ExerciseBaseDataImplCopyWith<$Res>
implements $ExerciseApiDataCopyWith<$Res> {
factory _$$ExerciseBaseDataImplCopyWith(_$ExerciseBaseDataImpl value,
$Res Function(_$ExerciseBaseDataImpl) then) =
abstract class _$$ExerciseBaseDataImplCopyWith<$Res> implements $ExerciseApiDataCopyWith<$Res> {
factory _$$ExerciseBaseDataImplCopyWith(
_$ExerciseBaseDataImpl value, $Res Function(_$ExerciseBaseDataImpl) then) =
__$$ExerciseBaseDataImplCopyWithImpl<$Res>;
@override
@useResult
@@ -213,8 +206,8 @@ abstract class _$$ExerciseBaseDataImplCopyWith<$Res>
class __$$ExerciseBaseDataImplCopyWithImpl<$Res>
extends _$ExerciseApiDataCopyWithImpl<$Res, _$ExerciseBaseDataImpl>
implements _$$ExerciseBaseDataImplCopyWith<$Res> {
__$$ExerciseBaseDataImplCopyWithImpl(_$ExerciseBaseDataImpl _value,
$Res Function(_$ExerciseBaseDataImpl) _then)
__$$ExerciseBaseDataImplCopyWithImpl(
_$ExerciseBaseDataImpl _value, $Res Function(_$ExerciseBaseDataImpl) _then)
: super(_value, _then);
/// Create a copy of ExerciseApiData
@@ -315,15 +308,13 @@ class _$ExerciseBaseDataImpl implements _ExerciseBaseData {
@JsonKey(name: 'last_update_global') required this.lastUpdateGlobal,
required this.category,
required final List<Muscle> muscles,
@JsonKey(name: 'muscles_secondary')
required final List<Muscle> musclesSecondary,
@JsonKey(name: 'muscles_secondary') required final List<Muscle> musclesSecondary,
required final List<Equipment> equipment,
@JsonKey(name: 'exercises') required final List<Translation> translations,
required final List<ExerciseImage> images,
required final List<Video> videos,
@JsonKey(name: 'author_history') required final List<String> authors,
@JsonKey(name: 'total_authors_history')
required final List<String> authorsGlobal})
@JsonKey(name: 'total_authors_history') required final List<String> authorsGlobal})
: _muscles = muscles,
_musclesSecondary = musclesSecondary,
_equipment = equipment,
@@ -372,8 +363,7 @@ class _$ExerciseBaseDataImpl implements _ExerciseBaseData {
@override
@JsonKey(name: 'muscles_secondary')
List<Muscle> get musclesSecondary {
if (_musclesSecondary is EqualUnmodifiableListView)
return _musclesSecondary;
if (_musclesSecondary is EqualUnmodifiableListView) return _musclesSecondary;
// ignore: implicit_dynamic_type
return EqualUnmodifiableListView(_musclesSecondary);
}
@@ -449,27 +439,20 @@ class _$ExerciseBaseDataImpl implements _ExerciseBaseData {
other is _$ExerciseBaseDataImpl &&
(identical(other.id, id) || other.id == id) &&
(identical(other.uuid, uuid) || other.uuid == uuid) &&
(identical(other.variationId, variationId) ||
other.variationId == variationId) &&
(identical(other.variationId, variationId) || other.variationId == variationId) &&
(identical(other.created, created) || other.created == created) &&
(identical(other.lastUpdate, lastUpdate) ||
other.lastUpdate == lastUpdate) &&
(identical(other.lastUpdate, lastUpdate) || other.lastUpdate == lastUpdate) &&
(identical(other.lastUpdateGlobal, lastUpdateGlobal) ||
other.lastUpdateGlobal == lastUpdateGlobal) &&
(identical(other.category, category) ||
other.category == category) &&
(identical(other.category, category) || other.category == category) &&
const DeepCollectionEquality().equals(other._muscles, _muscles) &&
const DeepCollectionEquality()
.equals(other._musclesSecondary, _musclesSecondary) &&
const DeepCollectionEquality()
.equals(other._equipment, _equipment) &&
const DeepCollectionEquality()
.equals(other._translations, _translations) &&
const DeepCollectionEquality().equals(other._musclesSecondary, _musclesSecondary) &&
const DeepCollectionEquality().equals(other._equipment, _equipment) &&
const DeepCollectionEquality().equals(other._translations, _translations) &&
const DeepCollectionEquality().equals(other._images, _images) &&
const DeepCollectionEquality().equals(other._videos, _videos) &&
const DeepCollectionEquality().equals(other._authors, _authors) &&
const DeepCollectionEquality()
.equals(other._authorsGlobal, _authorsGlobal));
const DeepCollectionEquality().equals(other._authorsGlobal, _authorsGlobal));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@@ -498,8 +481,7 @@ class _$ExerciseBaseDataImpl implements _ExerciseBaseData {
@override
@pragma('vm:prefer-inline')
_$$ExerciseBaseDataImplCopyWith<_$ExerciseBaseDataImpl> get copyWith =>
__$$ExerciseBaseDataImplCopyWithImpl<_$ExerciseBaseDataImpl>(
this, _$identity);
__$$ExerciseBaseDataImplCopyWithImpl<_$ExerciseBaseDataImpl>(this, _$identity);
@override
Map<String, dynamic> toJson() {
@@ -511,27 +493,24 @@ class _$ExerciseBaseDataImpl implements _ExerciseBaseData {
abstract class _ExerciseBaseData implements ExerciseApiData {
factory _ExerciseBaseData(
{required final int id,
required final String uuid,
@JsonKey(name: 'variations') final int? variationId,
@JsonKey(name: 'created') required final DateTime created,
@JsonKey(name: 'last_update') required final DateTime lastUpdate,
@JsonKey(name: 'last_update_global')
required final DateTime lastUpdateGlobal,
required final ExerciseCategory category,
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,
required final List<ExerciseImage> images,
required final List<Video> videos,
@JsonKey(name: 'author_history') required final List<String> authors,
@JsonKey(name: 'total_authors_history')
required final List<String> authorsGlobal}) = _$ExerciseBaseDataImpl;
{required final int id,
required final String uuid,
@JsonKey(name: 'variations') final int? variationId,
@JsonKey(name: 'created') required final DateTime created,
@JsonKey(name: 'last_update') required final DateTime lastUpdate,
@JsonKey(name: 'last_update_global') required final DateTime lastUpdateGlobal,
required final ExerciseCategory category,
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,
required final List<ExerciseImage> images,
required final List<Video> videos,
@JsonKey(name: 'author_history') required final List<String> authors,
@JsonKey(name: 'total_authors_history') required final List<String> authorsGlobal}) =
_$ExerciseBaseDataImpl;
factory _ExerciseBaseData.fromJson(Map<String, dynamic> json) =
_$ExerciseBaseDataImpl.fromJson;
factory _ExerciseBaseData.fromJson(Map<String, dynamic> json) = _$ExerciseBaseDataImpl.fromJson;
@override
int get id;
@@ -580,8 +559,7 @@ abstract class _ExerciseBaseData implements ExerciseApiData {
throw _privateConstructorUsedError;
}
ExerciseSearchDetails _$ExerciseSearchDetailsFromJson(
Map<String, dynamic> json) {
ExerciseSearchDetails _$ExerciseSearchDetailsFromJson(Map<String, dynamic> json) {
return _ExerciseSearchDetails.fromJson(json);
}
@@ -589,14 +567,12 @@ ExerciseSearchDetails _$ExerciseSearchDetailsFromJson(
mixin _$ExerciseSearchDetails {
// ignore: invalid_annotation_target
@JsonKey(name: 'id')
int get translationId =>
throw _privateConstructorUsedError; // ignore: invalid_annotation_target
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
String? get image => throw _privateConstructorUsedError; // ignore: invalid_annotation_target
@JsonKey(name: 'image_thumbnail')
String? get imageThumbnail => throw _privateConstructorUsedError;
@@ -612,8 +588,8 @@ mixin _$ExerciseSearchDetails {
/// @nodoc
abstract class $ExerciseSearchDetailsCopyWith<$Res> {
factory $ExerciseSearchDetailsCopyWith(ExerciseSearchDetails value,
$Res Function(ExerciseSearchDetails) then) =
factory $ExerciseSearchDetailsCopyWith(
ExerciseSearchDetails value, $Res Function(ExerciseSearchDetails) then) =
_$ExerciseSearchDetailsCopyWithImpl<$Res, ExerciseSearchDetails>;
@useResult
$Res call(
@@ -626,8 +602,7 @@ abstract class $ExerciseSearchDetailsCopyWith<$Res> {
}
/// @nodoc
class _$ExerciseSearchDetailsCopyWithImpl<$Res,
$Val extends ExerciseSearchDetails>
class _$ExerciseSearchDetailsCopyWithImpl<$Res, $Val extends ExerciseSearchDetails>
implements $ExerciseSearchDetailsCopyWith<$Res> {
_$ExerciseSearchDetailsCopyWithImpl(this._value, this._then);
@@ -681,8 +656,7 @@ class _$ExerciseSearchDetailsCopyWithImpl<$Res,
abstract class _$$ExerciseSearchDetailsImplCopyWith<$Res>
implements $ExerciseSearchDetailsCopyWith<$Res> {
factory _$$ExerciseSearchDetailsImplCopyWith(
_$ExerciseSearchDetailsImpl value,
$Res Function(_$ExerciseSearchDetailsImpl) then) =
_$ExerciseSearchDetailsImpl value, $Res Function(_$ExerciseSearchDetailsImpl) then) =
__$$ExerciseSearchDetailsImplCopyWithImpl<$Res>;
@override
@useResult
@@ -697,11 +671,10 @@ abstract class _$$ExerciseSearchDetailsImplCopyWith<$Res>
/// @nodoc
class __$$ExerciseSearchDetailsImplCopyWithImpl<$Res>
extends _$ExerciseSearchDetailsCopyWithImpl<$Res,
_$ExerciseSearchDetailsImpl>
extends _$ExerciseSearchDetailsCopyWithImpl<$Res, _$ExerciseSearchDetailsImpl>
implements _$$ExerciseSearchDetailsImplCopyWith<$Res> {
__$$ExerciseSearchDetailsImplCopyWithImpl(_$ExerciseSearchDetailsImpl _value,
$Res Function(_$ExerciseSearchDetailsImpl) _then)
__$$ExerciseSearchDetailsImplCopyWithImpl(
_$ExerciseSearchDetailsImpl _value, $Res Function(_$ExerciseSearchDetailsImpl) _then)
: super(_value, _then);
/// Create a copy of ExerciseSearchDetails
@@ -790,11 +763,9 @@ class _$ExerciseSearchDetailsImpl implements _ExerciseSearchDetails {
other is _$ExerciseSearchDetailsImpl &&
(identical(other.translationId, translationId) ||
other.translationId == translationId) &&
(identical(other.exerciseId, exerciseId) ||
other.exerciseId == exerciseId) &&
(identical(other.exerciseId, exerciseId) || other.exerciseId == exerciseId) &&
(identical(other.name, name) || other.name == name) &&
(identical(other.category, category) ||
other.category == category) &&
(identical(other.category, category) || other.category == category) &&
(identical(other.image, image) || other.image == image) &&
(identical(other.imageThumbnail, imageThumbnail) ||
other.imageThumbnail == imageThumbnail));
@@ -802,17 +773,16 @@ class _$ExerciseSearchDetailsImpl implements _ExerciseSearchDetails {
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType, translationId, exerciseId, name,
category, image, imageThumbnail);
int get hashCode =>
Object.hash(runtimeType, translationId, exerciseId, name, category, image, imageThumbnail);
/// Create a copy of ExerciseSearchDetails
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$ExerciseSearchDetailsImplCopyWith<_$ExerciseSearchDetailsImpl>
get copyWith => __$$ExerciseSearchDetailsImplCopyWithImpl<
_$ExerciseSearchDetailsImpl>(this, _$identity);
_$$ExerciseSearchDetailsImplCopyWith<_$ExerciseSearchDetailsImpl> get copyWith =>
__$$ExerciseSearchDetailsImplCopyWithImpl<_$ExerciseSearchDetailsImpl>(this, _$identity);
@override
Map<String, dynamic> toJson() {
@@ -824,13 +794,13 @@ class _$ExerciseSearchDetailsImpl implements _ExerciseSearchDetails {
abstract class _ExerciseSearchDetails implements ExerciseSearchDetails {
factory _ExerciseSearchDetails(
{@JsonKey(name: 'id') required final int translationId,
@JsonKey(name: 'base_id') required final int exerciseId,
required final String name,
required final String category,
required final String? image,
@JsonKey(name: 'image_thumbnail')
required final String? imageThumbnail}) = _$ExerciseSearchDetailsImpl;
{@JsonKey(name: 'id') required final int translationId,
@JsonKey(name: 'base_id') required final int exerciseId,
required final String name,
required final String category,
required final String? image,
@JsonKey(name: 'image_thumbnail') required final String? imageThumbnail}) =
_$ExerciseSearchDetailsImpl;
factory _ExerciseSearchDetails.fromJson(Map<String, dynamic> json) =
_$ExerciseSearchDetailsImpl.fromJson;
@@ -856,8 +826,8 @@ abstract class _ExerciseSearchDetails implements ExerciseSearchDetails {
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
_$$ExerciseSearchDetailsImplCopyWith<_$ExerciseSearchDetailsImpl>
get copyWith => throw _privateConstructorUsedError;
_$$ExerciseSearchDetailsImplCopyWith<_$ExerciseSearchDetailsImpl> get copyWith =>
throw _privateConstructorUsedError;
}
ExerciseSearchEntry _$ExerciseSearchEntryFromJson(Map<String, dynamic> json) {
@@ -934,8 +904,8 @@ class _$ExerciseSearchEntryCopyWithImpl<$Res, $Val extends ExerciseSearchEntry>
/// @nodoc
abstract class _$$ExerciseSearchEntryImplCopyWith<$Res>
implements $ExerciseSearchEntryCopyWith<$Res> {
factory _$$ExerciseSearchEntryImplCopyWith(_$ExerciseSearchEntryImpl value,
$Res Function(_$ExerciseSearchEntryImpl) then) =
factory _$$ExerciseSearchEntryImplCopyWith(
_$ExerciseSearchEntryImpl value, $Res Function(_$ExerciseSearchEntryImpl) then) =
__$$ExerciseSearchEntryImplCopyWithImpl<$Res>;
@override
@useResult
@@ -949,8 +919,8 @@ abstract class _$$ExerciseSearchEntryImplCopyWith<$Res>
class __$$ExerciseSearchEntryImplCopyWithImpl<$Res>
extends _$ExerciseSearchEntryCopyWithImpl<$Res, _$ExerciseSearchEntryImpl>
implements _$$ExerciseSearchEntryImplCopyWith<$Res> {
__$$ExerciseSearchEntryImplCopyWithImpl(_$ExerciseSearchEntryImpl _value,
$Res Function(_$ExerciseSearchEntryImpl) _then)
__$$ExerciseSearchEntryImplCopyWithImpl(
_$ExerciseSearchEntryImpl _value, $Res Function(_$ExerciseSearchEntryImpl) _then)
: super(_value, _then);
/// Create a copy of ExerciseSearchEntry
@@ -1011,8 +981,7 @@ class _$ExerciseSearchEntryImpl implements _ExerciseSearchEntry {
@override
@pragma('vm:prefer-inline')
_$$ExerciseSearchEntryImplCopyWith<_$ExerciseSearchEntryImpl> get copyWith =>
__$$ExerciseSearchEntryImplCopyWithImpl<_$ExerciseSearchEntryImpl>(
this, _$identity);
__$$ExerciseSearchEntryImplCopyWithImpl<_$ExerciseSearchEntryImpl>(this, _$identity);
@override
Map<String, dynamic> toJson() {
@@ -1049,8 +1018,7 @@ ExerciseApiSearch _$ExerciseApiSearchFromJson(Map<String, dynamic> json) {
/// @nodoc
mixin _$ExerciseApiSearch {
List<ExerciseSearchEntry> get suggestions =>
throw _privateConstructorUsedError;
List<ExerciseSearchEntry> get suggestions => throw _privateConstructorUsedError;
/// Serializes this ExerciseApiSearch to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
@@ -1058,8 +1026,7 @@ mixin _$ExerciseApiSearch {
/// Create a copy of ExerciseApiSearch
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$ExerciseApiSearchCopyWith<ExerciseApiSearch> get copyWith =>
throw _privateConstructorUsedError;
$ExerciseApiSearchCopyWith<ExerciseApiSearch> get copyWith => throw _privateConstructorUsedError;
}
/// @nodoc
@@ -1098,10 +1065,9 @@ class _$ExerciseApiSearchCopyWithImpl<$Res, $Val extends ExerciseApiSearch>
}
/// @nodoc
abstract class _$$ExerciseApiSearchImplCopyWith<$Res>
implements $ExerciseApiSearchCopyWith<$Res> {
factory _$$ExerciseApiSearchImplCopyWith(_$ExerciseApiSearchImpl value,
$Res Function(_$ExerciseApiSearchImpl) then) =
abstract class _$$ExerciseApiSearchImplCopyWith<$Res> implements $ExerciseApiSearchCopyWith<$Res> {
factory _$$ExerciseApiSearchImplCopyWith(
_$ExerciseApiSearchImpl value, $Res Function(_$ExerciseApiSearchImpl) then) =
__$$ExerciseApiSearchImplCopyWithImpl<$Res>;
@override
@useResult
@@ -1112,8 +1078,8 @@ abstract class _$$ExerciseApiSearchImplCopyWith<$Res>
class __$$ExerciseApiSearchImplCopyWithImpl<$Res>
extends _$ExerciseApiSearchCopyWithImpl<$Res, _$ExerciseApiSearchImpl>
implements _$$ExerciseApiSearchImplCopyWith<$Res> {
__$$ExerciseApiSearchImplCopyWithImpl(_$ExerciseApiSearchImpl _value,
$Res Function(_$ExerciseApiSearchImpl) _then)
__$$ExerciseApiSearchImplCopyWithImpl(
_$ExerciseApiSearchImpl _value, $Res Function(_$ExerciseApiSearchImpl) _then)
: super(_value, _then);
/// Create a copy of ExerciseApiSearch
@@ -1135,8 +1101,7 @@ class __$$ExerciseApiSearchImplCopyWithImpl<$Res>
/// @nodoc
@JsonSerializable()
class _$ExerciseApiSearchImpl implements _ExerciseApiSearch {
_$ExerciseApiSearchImpl(
{required final List<ExerciseSearchEntry> suggestions})
_$ExerciseApiSearchImpl({required final List<ExerciseSearchEntry> suggestions})
: _suggestions = suggestions;
factory _$ExerciseApiSearchImpl.fromJson(Map<String, dynamic> json) =>
@@ -1160,14 +1125,12 @@ class _$ExerciseApiSearchImpl implements _ExerciseApiSearch {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$ExerciseApiSearchImpl &&
const DeepCollectionEquality()
.equals(other._suggestions, _suggestions));
const DeepCollectionEquality().equals(other._suggestions, _suggestions));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(
runtimeType, const DeepCollectionEquality().hash(_suggestions));
int get hashCode => Object.hash(runtimeType, const DeepCollectionEquality().hash(_suggestions));
/// Create a copy of ExerciseApiSearch
/// with the given fields replaced by the non-null parameter values.
@@ -1175,8 +1138,7 @@ class _$ExerciseApiSearchImpl implements _ExerciseApiSearch {
@override
@pragma('vm:prefer-inline')
_$$ExerciseApiSearchImplCopyWith<_$ExerciseApiSearchImpl> get copyWith =>
__$$ExerciseApiSearchImplCopyWithImpl<_$ExerciseApiSearchImpl>(
this, _$identity);
__$$ExerciseApiSearchImplCopyWithImpl<_$ExerciseApiSearchImpl>(this, _$identity);
@override
Map<String, dynamic> toJson() {
@@ -1187,12 +1149,10 @@ class _$ExerciseApiSearchImpl implements _ExerciseApiSearch {
}
abstract class _ExerciseApiSearch implements ExerciseApiSearch {
factory _ExerciseApiSearch(
{required final List<ExerciseSearchEntry> suggestions}) =
factory _ExerciseApiSearch({required final List<ExerciseSearchEntry> suggestions}) =
_$ExerciseApiSearchImpl;
factory _ExerciseApiSearch.fromJson(Map<String, dynamic> json) =
_$ExerciseApiSearchImpl.fromJson;
factory _ExerciseApiSearch.fromJson(Map<String, dynamic> json) = _$ExerciseApiSearchImpl.fromJson;
@override
List<ExerciseSearchEntry> get suggestions;

View File

@@ -6,8 +6,7 @@ part of 'exercise_api.dart';
// JsonSerializableGenerator
// **************************************************************************
_$ExerciseBaseDataImpl _$$ExerciseBaseDataImplFromJson(
Map<String, dynamic> json) =>
_$ExerciseBaseDataImpl _$$ExerciseBaseDataImplFromJson(Map<String, dynamic> json) =>
_$ExerciseBaseDataImpl(
id: (json['id'] as num).toInt(),
uuid: json['uuid'] as String,
@@ -15,8 +14,7 @@ _$ExerciseBaseDataImpl _$$ExerciseBaseDataImplFromJson(
created: DateTime.parse(json['created'] as String),
lastUpdate: DateTime.parse(json['last_update'] as String),
lastUpdateGlobal: DateTime.parse(json['last_update_global'] as String),
category:
ExerciseCategory.fromJson(json['category'] as Map<String, dynamic>),
category: ExerciseCategory.fromJson(json['category'] as Map<String, dynamic>),
muscles: (json['muscles'] as List<dynamic>)
.map((e) => Muscle.fromJson(e as Map<String, dynamic>))
.toList(),
@@ -35,16 +33,12 @@ _$ExerciseBaseDataImpl _$$ExerciseBaseDataImplFromJson(
videos: (json['videos'] as List<dynamic>)
.map((e) => Video.fromJson(e as Map<String, dynamic>))
.toList(),
authors: (json['author_history'] as List<dynamic>)
.map((e) => e as String)
.toList(),
authorsGlobal: (json['total_authors_history'] as List<dynamic>)
.map((e) => e as String)
.toList(),
authors: (json['author_history'] as List<dynamic>).map((e) => e as String).toList(),
authorsGlobal:
(json['total_authors_history'] as List<dynamic>).map((e) => e as String).toList(),
);
Map<String, dynamic> _$$ExerciseBaseDataImplToJson(
_$ExerciseBaseDataImpl instance) =>
Map<String, dynamic> _$$ExerciseBaseDataImplToJson(_$ExerciseBaseDataImpl instance) =>
<String, dynamic>{
'id': instance.id,
'uuid': instance.uuid,
@@ -63,8 +57,7 @@ Map<String, dynamic> _$$ExerciseBaseDataImplToJson(
'total_authors_history': instance.authorsGlobal,
};
_$ExerciseSearchDetailsImpl _$$ExerciseSearchDetailsImplFromJson(
Map<String, dynamic> json) =>
_$ExerciseSearchDetailsImpl _$$ExerciseSearchDetailsImplFromJson(Map<String, dynamic> json) =>
_$ExerciseSearchDetailsImpl(
translationId: (json['id'] as num).toInt(),
exerciseId: (json['base_id'] as num).toInt(),
@@ -74,8 +67,7 @@ _$ExerciseSearchDetailsImpl _$$ExerciseSearchDetailsImplFromJson(
imageThumbnail: json['image_thumbnail'] as String?,
);
Map<String, dynamic> _$$ExerciseSearchDetailsImplToJson(
_$ExerciseSearchDetailsImpl instance) =>
Map<String, dynamic> _$$ExerciseSearchDetailsImplToJson(_$ExerciseSearchDetailsImpl instance) =>
<String, dynamic>{
'id': instance.translationId,
'base_id': instance.exerciseId,
@@ -85,31 +77,26 @@ Map<String, dynamic> _$$ExerciseSearchDetailsImplToJson(
'image_thumbnail': instance.imageThumbnail,
};
_$ExerciseSearchEntryImpl _$$ExerciseSearchEntryImplFromJson(
Map<String, dynamic> json) =>
_$ExerciseSearchEntryImpl _$$ExerciseSearchEntryImplFromJson(Map<String, dynamic> json) =>
_$ExerciseSearchEntryImpl(
value: json['value'] as String,
data:
ExerciseSearchDetails.fromJson(json['data'] as Map<String, dynamic>),
data: ExerciseSearchDetails.fromJson(json['data'] as Map<String, dynamic>),
);
Map<String, dynamic> _$$ExerciseSearchEntryImplToJson(
_$ExerciseSearchEntryImpl instance) =>
Map<String, dynamic> _$$ExerciseSearchEntryImplToJson(_$ExerciseSearchEntryImpl instance) =>
<String, dynamic>{
'value': instance.value,
'data': instance.data,
};
_$ExerciseApiSearchImpl _$$ExerciseApiSearchImplFromJson(
Map<String, dynamic> json) =>
_$ExerciseApiSearchImpl _$$ExerciseApiSearchImplFromJson(Map<String, dynamic> json) =>
_$ExerciseApiSearchImpl(
suggestions: (json['suggestions'] as List<dynamic>)
.map((e) => ExerciseSearchEntry.fromJson(e as Map<String, dynamic>))
.toList(),
);
Map<String, dynamic> _$$ExerciseApiSearchImplToJson(
_$ExerciseApiSearchImpl instance) =>
Map<String, dynamic> _$$ExerciseApiSearchImplToJson(_$ExerciseApiSearchImpl instance) =>
<String, dynamic>{
'suggestions': instance.suggestions,
};

View File

@@ -20,8 +20,7 @@ ExerciseImage _$ExerciseImageFromJson(Map<String, dynamic> json) {
);
}
Map<String, dynamic> _$ExerciseImageToJson(ExerciseImage instance) =>
<String, dynamic>{
Map<String, dynamic> _$ExerciseImageToJson(ExerciseImage instance) => <String, dynamic>{
'id': instance.id,
'uuid': instance.uuid,
'exercise_base': instance.exerciseBaseId,

View File

@@ -14,8 +14,7 @@ T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
IngredientApiSearchDetails _$IngredientApiSearchDetailsFromJson(
Map<String, dynamic> json) {
IngredientApiSearchDetails _$IngredientApiSearchDetailsFromJson(Map<String, dynamic> json) {
return _IngredientApiSearchDetails.fromJson(json);
}
@@ -23,8 +22,7 @@ IngredientApiSearchDetails _$IngredientApiSearchDetailsFromJson(
mixin _$IngredientApiSearchDetails {
int get id => throw _privateConstructorUsedError;
String get name => throw _privateConstructorUsedError;
String? get image =>
throw _privateConstructorUsedError; // ignore: invalid_annotation_target
String? get image => throw _privateConstructorUsedError; // ignore: invalid_annotation_target
@JsonKey(name: 'image_thumbnail')
String? get imageThumbnail => throw _privateConstructorUsedError;
@@ -34,16 +32,15 @@ mixin _$IngredientApiSearchDetails {
/// Create a copy of IngredientApiSearchDetails
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$IngredientApiSearchDetailsCopyWith<IngredientApiSearchDetails>
get copyWith => throw _privateConstructorUsedError;
$IngredientApiSearchDetailsCopyWith<IngredientApiSearchDetails> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $IngredientApiSearchDetailsCopyWith<$Res> {
factory $IngredientApiSearchDetailsCopyWith(IngredientApiSearchDetails value,
$Res Function(IngredientApiSearchDetails) then) =
_$IngredientApiSearchDetailsCopyWithImpl<$Res,
IngredientApiSearchDetails>;
factory $IngredientApiSearchDetailsCopyWith(
IngredientApiSearchDetails value, $Res Function(IngredientApiSearchDetails) then) =
_$IngredientApiSearchDetailsCopyWithImpl<$Res, IngredientApiSearchDetails>;
@useResult
$Res call(
{int id,
@@ -53,8 +50,7 @@ abstract class $IngredientApiSearchDetailsCopyWith<$Res> {
}
/// @nodoc
class _$IngredientApiSearchDetailsCopyWithImpl<$Res,
$Val extends IngredientApiSearchDetails>
class _$IngredientApiSearchDetailsCopyWithImpl<$Res, $Val extends IngredientApiSearchDetails>
implements $IngredientApiSearchDetailsCopyWith<$Res> {
_$IngredientApiSearchDetailsCopyWithImpl(this._value, this._then);
@@ -97,8 +93,7 @@ class _$IngredientApiSearchDetailsCopyWithImpl<$Res,
/// @nodoc
abstract class _$$IngredientApiSearchDetailsImplCopyWith<$Res>
implements $IngredientApiSearchDetailsCopyWith<$Res> {
factory _$$IngredientApiSearchDetailsImplCopyWith(
_$IngredientApiSearchDetailsImpl value,
factory _$$IngredientApiSearchDetailsImplCopyWith(_$IngredientApiSearchDetailsImpl value,
$Res Function(_$IngredientApiSearchDetailsImpl) then) =
__$$IngredientApiSearchDetailsImplCopyWithImpl<$Res>;
@override
@@ -112,11 +107,9 @@ abstract class _$$IngredientApiSearchDetailsImplCopyWith<$Res>
/// @nodoc
class __$$IngredientApiSearchDetailsImplCopyWithImpl<$Res>
extends _$IngredientApiSearchDetailsCopyWithImpl<$Res,
_$IngredientApiSearchDetailsImpl>
extends _$IngredientApiSearchDetailsCopyWithImpl<$Res, _$IngredientApiSearchDetailsImpl>
implements _$$IngredientApiSearchDetailsImplCopyWith<$Res> {
__$$IngredientApiSearchDetailsImplCopyWithImpl(
_$IngredientApiSearchDetailsImpl _value,
__$$IngredientApiSearchDetailsImplCopyWithImpl(_$IngredientApiSearchDetailsImpl _value,
$Res Function(_$IngredientApiSearchDetailsImpl) _then)
: super(_value, _then);
@@ -160,8 +153,7 @@ class _$IngredientApiSearchDetailsImpl implements _IngredientApiSearchDetails {
required this.image,
@JsonKey(name: 'image_thumbnail') required this.imageThumbnail});
factory _$IngredientApiSearchDetailsImpl.fromJson(
Map<String, dynamic> json) =>
factory _$IngredientApiSearchDetailsImpl.fromJson(Map<String, dynamic> json) =>
_$$IngredientApiSearchDetailsImplFromJson(json);
@override
@@ -201,9 +193,9 @@ class _$IngredientApiSearchDetailsImpl implements _IngredientApiSearchDetails {
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$IngredientApiSearchDetailsImplCopyWith<_$IngredientApiSearchDetailsImpl>
get copyWith => __$$IngredientApiSearchDetailsImplCopyWithImpl<
_$IngredientApiSearchDetailsImpl>(this, _$identity);
_$$IngredientApiSearchDetailsImplCopyWith<_$IngredientApiSearchDetailsImpl> get copyWith =>
__$$IngredientApiSearchDetailsImplCopyWithImpl<_$IngredientApiSearchDetailsImpl>(
this, _$identity);
@override
Map<String, dynamic> toJson() {
@@ -213,14 +205,12 @@ class _$IngredientApiSearchDetailsImpl implements _IngredientApiSearchDetails {
}
}
abstract class _IngredientApiSearchDetails
implements IngredientApiSearchDetails {
abstract class _IngredientApiSearchDetails implements IngredientApiSearchDetails {
factory _IngredientApiSearchDetails(
{required final int id,
required final String name,
required final String? image,
@JsonKey(name: 'image_thumbnail')
required final String? imageThumbnail}) =
@JsonKey(name: 'image_thumbnail') required final String? imageThumbnail}) =
_$IngredientApiSearchDetailsImpl;
factory _IngredientApiSearchDetails.fromJson(Map<String, dynamic> json) =
@@ -240,12 +230,11 @@ abstract class _IngredientApiSearchDetails
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
_$$IngredientApiSearchDetailsImplCopyWith<_$IngredientApiSearchDetailsImpl>
get copyWith => throw _privateConstructorUsedError;
_$$IngredientApiSearchDetailsImplCopyWith<_$IngredientApiSearchDetailsImpl> get copyWith =>
throw _privateConstructorUsedError;
}
IngredientApiSearchEntry _$IngredientApiSearchEntryFromJson(
Map<String, dynamic> json) {
IngredientApiSearchEntry _$IngredientApiSearchEntryFromJson(Map<String, dynamic> json) {
return _IngredientApiSearchEntry.fromJson(json);
}
@@ -266,8 +255,8 @@ mixin _$IngredientApiSearchEntry {
/// @nodoc
abstract class $IngredientApiSearchEntryCopyWith<$Res> {
factory $IngredientApiSearchEntryCopyWith(IngredientApiSearchEntry value,
$Res Function(IngredientApiSearchEntry) then) =
factory $IngredientApiSearchEntryCopyWith(
IngredientApiSearchEntry value, $Res Function(IngredientApiSearchEntry) then) =
_$IngredientApiSearchEntryCopyWithImpl<$Res, IngredientApiSearchEntry>;
@useResult
$Res call({String value, IngredientApiSearchDetails data});
@@ -276,8 +265,7 @@ abstract class $IngredientApiSearchEntryCopyWith<$Res> {
}
/// @nodoc
class _$IngredientApiSearchEntryCopyWithImpl<$Res,
$Val extends IngredientApiSearchEntry>
class _$IngredientApiSearchEntryCopyWithImpl<$Res, $Val extends IngredientApiSearchEntry>
implements $IngredientApiSearchEntryCopyWith<$Res> {
_$IngredientApiSearchEntryCopyWithImpl(this._value, this._then);
@@ -320,8 +308,7 @@ class _$IngredientApiSearchEntryCopyWithImpl<$Res,
/// @nodoc
abstract class _$$IngredientApiSearchEntryImplCopyWith<$Res>
implements $IngredientApiSearchEntryCopyWith<$Res> {
factory _$$IngredientApiSearchEntryImplCopyWith(
_$IngredientApiSearchEntryImpl value,
factory _$$IngredientApiSearchEntryImplCopyWith(_$IngredientApiSearchEntryImpl value,
$Res Function(_$IngredientApiSearchEntryImpl) then) =
__$$IngredientApiSearchEntryImplCopyWithImpl<$Res>;
@override
@@ -334,12 +321,10 @@ abstract class _$$IngredientApiSearchEntryImplCopyWith<$Res>
/// @nodoc
class __$$IngredientApiSearchEntryImplCopyWithImpl<$Res>
extends _$IngredientApiSearchEntryCopyWithImpl<$Res,
_$IngredientApiSearchEntryImpl>
extends _$IngredientApiSearchEntryCopyWithImpl<$Res, _$IngredientApiSearchEntryImpl>
implements _$$IngredientApiSearchEntryImplCopyWith<$Res> {
__$$IngredientApiSearchEntryImplCopyWithImpl(
_$IngredientApiSearchEntryImpl _value,
$Res Function(_$IngredientApiSearchEntryImpl) _then)
_$IngredientApiSearchEntryImpl _value, $Res Function(_$IngredientApiSearchEntryImpl) _then)
: super(_value, _then);
/// Create a copy of IngredientApiSearchEntry
@@ -399,9 +384,9 @@ class _$IngredientApiSearchEntryImpl implements _IngredientApiSearchEntry {
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$IngredientApiSearchEntryImplCopyWith<_$IngredientApiSearchEntryImpl>
get copyWith => __$$IngredientApiSearchEntryImplCopyWithImpl<
_$IngredientApiSearchEntryImpl>(this, _$identity);
_$$IngredientApiSearchEntryImplCopyWith<_$IngredientApiSearchEntryImpl> get copyWith =>
__$$IngredientApiSearchEntryImplCopyWithImpl<_$IngredientApiSearchEntryImpl>(
this, _$identity);
@override
Map<String, dynamic> toJson() {
@@ -413,9 +398,8 @@ class _$IngredientApiSearchEntryImpl implements _IngredientApiSearchEntry {
abstract class _IngredientApiSearchEntry implements IngredientApiSearchEntry {
factory _IngredientApiSearchEntry(
{required final String value,
required final IngredientApiSearchDetails data}) =
_$IngredientApiSearchEntryImpl;
{required final String value,
required final IngredientApiSearchDetails data}) = _$IngredientApiSearchEntryImpl;
factory _IngredientApiSearchEntry.fromJson(Map<String, dynamic> json) =
_$IngredientApiSearchEntryImpl.fromJson;
@@ -429,8 +413,8 @@ abstract class _IngredientApiSearchEntry implements IngredientApiSearchEntry {
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
_$$IngredientApiSearchEntryImplCopyWith<_$IngredientApiSearchEntryImpl>
get copyWith => throw _privateConstructorUsedError;
_$$IngredientApiSearchEntryImplCopyWith<_$IngredientApiSearchEntryImpl> get copyWith =>
throw _privateConstructorUsedError;
}
IngredientApiSearch _$IngredientApiSearchFromJson(Map<String, dynamic> json) {
@@ -439,8 +423,7 @@ IngredientApiSearch _$IngredientApiSearchFromJson(Map<String, dynamic> json) {
/// @nodoc
mixin _$IngredientApiSearch {
List<IngredientApiSearchEntry> get suggestions =>
throw _privateConstructorUsedError;
List<IngredientApiSearchEntry> get suggestions => throw _privateConstructorUsedError;
/// Serializes this IngredientApiSearch to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
@@ -490,8 +473,8 @@ class _$IngredientApiSearchCopyWithImpl<$Res, $Val extends IngredientApiSearch>
/// @nodoc
abstract class _$$IngredientApiSearchImplCopyWith<$Res>
implements $IngredientApiSearchCopyWith<$Res> {
factory _$$IngredientApiSearchImplCopyWith(_$IngredientApiSearchImpl value,
$Res Function(_$IngredientApiSearchImpl) then) =
factory _$$IngredientApiSearchImplCopyWith(
_$IngredientApiSearchImpl value, $Res Function(_$IngredientApiSearchImpl) then) =
__$$IngredientApiSearchImplCopyWithImpl<$Res>;
@override
@useResult
@@ -502,8 +485,8 @@ abstract class _$$IngredientApiSearchImplCopyWith<$Res>
class __$$IngredientApiSearchImplCopyWithImpl<$Res>
extends _$IngredientApiSearchCopyWithImpl<$Res, _$IngredientApiSearchImpl>
implements _$$IngredientApiSearchImplCopyWith<$Res> {
__$$IngredientApiSearchImplCopyWithImpl(_$IngredientApiSearchImpl _value,
$Res Function(_$IngredientApiSearchImpl) _then)
__$$IngredientApiSearchImplCopyWithImpl(
_$IngredientApiSearchImpl _value, $Res Function(_$IngredientApiSearchImpl) _then)
: super(_value, _then);
/// Create a copy of IngredientApiSearch
@@ -525,8 +508,7 @@ class __$$IngredientApiSearchImplCopyWithImpl<$Res>
/// @nodoc
@JsonSerializable()
class _$IngredientApiSearchImpl implements _IngredientApiSearch {
_$IngredientApiSearchImpl(
{required final List<IngredientApiSearchEntry> suggestions})
_$IngredientApiSearchImpl({required final List<IngredientApiSearchEntry> suggestions})
: _suggestions = suggestions;
factory _$IngredientApiSearchImpl.fromJson(Map<String, dynamic> json) =>
@@ -550,14 +532,12 @@ class _$IngredientApiSearchImpl implements _IngredientApiSearch {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$IngredientApiSearchImpl &&
const DeepCollectionEquality()
.equals(other._suggestions, _suggestions));
const DeepCollectionEquality().equals(other._suggestions, _suggestions));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(
runtimeType, const DeepCollectionEquality().hash(_suggestions));
int get hashCode => Object.hash(runtimeType, const DeepCollectionEquality().hash(_suggestions));
/// Create a copy of IngredientApiSearch
/// with the given fields replaced by the non-null parameter values.
@@ -565,8 +545,7 @@ class _$IngredientApiSearchImpl implements _IngredientApiSearch {
@override
@pragma('vm:prefer-inline')
_$$IngredientApiSearchImplCopyWith<_$IngredientApiSearchImpl> get copyWith =>
__$$IngredientApiSearchImplCopyWithImpl<_$IngredientApiSearchImpl>(
this, _$identity);
__$$IngredientApiSearchImplCopyWithImpl<_$IngredientApiSearchImpl>(this, _$identity);
@override
Map<String, dynamic> toJson() {
@@ -577,8 +556,7 @@ class _$IngredientApiSearchImpl implements _IngredientApiSearch {
}
abstract class _IngredientApiSearch implements IngredientApiSearch {
factory _IngredientApiSearch(
{required final List<IngredientApiSearchEntry> suggestions}) =
factory _IngredientApiSearch({required final List<IngredientApiSearchEntry> suggestions}) =
_$IngredientApiSearchImpl;
factory _IngredientApiSearch.fromJson(Map<String, dynamic> json) =

View File

@@ -24,12 +24,10 @@ Map<String, dynamic> _$$IngredientApiSearchDetailsImplToJson(
'image_thumbnail': instance.imageThumbnail,
};
_$IngredientApiSearchEntryImpl _$$IngredientApiSearchEntryImplFromJson(
Map<String, dynamic> json) =>
_$IngredientApiSearchEntryImpl _$$IngredientApiSearchEntryImplFromJson(Map<String, dynamic> json) =>
_$IngredientApiSearchEntryImpl(
value: json['value'] as String,
data: IngredientApiSearchDetails.fromJson(
json['data'] as Map<String, dynamic>),
data: IngredientApiSearchDetails.fromJson(json['data'] as Map<String, dynamic>),
);
Map<String, dynamic> _$$IngredientApiSearchEntryImplToJson(
@@ -39,17 +37,14 @@ Map<String, dynamic> _$$IngredientApiSearchEntryImplToJson(
'data': instance.data,
};
_$IngredientApiSearchImpl _$$IngredientApiSearchImplFromJson(
Map<String, dynamic> json) =>
_$IngredientApiSearchImpl _$$IngredientApiSearchImplFromJson(Map<String, dynamic> json) =>
_$IngredientApiSearchImpl(
suggestions: (json['suggestions'] as List<dynamic>)
.map((e) =>
IngredientApiSearchEntry.fromJson(e as Map<String, dynamic>))
.map((e) => IngredientApiSearchEntry.fromJson(e as Map<String, dynamic>))
.toList(),
);
Map<String, dynamic> _$$IngredientApiSearchImplToJson(
_$IngredientApiSearchImpl instance) =>
Map<String, dynamic> _$$IngredientApiSearchImplToJson(_$IngredientApiSearchImpl instance) =>
<String, dynamic>{
'suggestions': instance.suggestions,
};

View File

@@ -22,9 +22,7 @@ Translation _$TranslationFromJson(Map<String, dynamic> json) {
return Translation(
id: (json['id'] as num?)?.toInt(),
uuid: json['uuid'] as String?,
created: json['created'] == null
? null
: DateTime.parse(json['created'] as String),
created: json['created'] == null ? null : DateTime.parse(json['created'] as String),
name: json['name'] as String,
description: json['description'] as String,
exerciseId: (json['exercise_base'] as num?)?.toInt(),
@@ -38,8 +36,7 @@ Translation _$TranslationFromJson(Map<String, dynamic> json) {
.toList();
}
Map<String, dynamic> _$TranslationToJson(Translation instance) =>
<String, dynamic>{
Map<String, dynamic> _$TranslationToJson(Translation instance) => <String, dynamic>{
'id': instance.id,
'uuid': instance.uuid,
'language': instance.languageId,

View File

@@ -22,9 +22,7 @@ MeasurementCategory _$MeasurementCategoryFromJson(Map<String, dynamic> json) {
);
}
Map<String, dynamic> _$MeasurementCategoryToJson(
MeasurementCategory instance) =>
<String, dynamic>{
Map<String, dynamic> _$MeasurementCategoryToJson(MeasurementCategory instance) => <String, dynamic>{
'id': instance.id,
'name': instance.name,
'unit': instance.unit,

View File

@@ -20,8 +20,7 @@ MeasurementEntry _$MeasurementEntryFromJson(Map<String, dynamic> json) {
);
}
Map<String, dynamic> _$MeasurementEntryToJson(MeasurementEntry instance) =>
<String, dynamic>{
Map<String, dynamic> _$MeasurementEntryToJson(MeasurementEntry instance) => <String, dynamic>{
'id': instance.id,
'category': instance.category,
'date': toDate(instance.date),

View File

@@ -51,8 +51,7 @@ Ingredient _$IngredientFromJson(Map<String, dynamic> json) {
);
}
Map<String, dynamic> _$IngredientToJson(Ingredient instance) =>
<String, dynamic>{
Map<String, dynamic> _$IngredientToJson(Ingredient instance) => <String, dynamic>{
'id': instance.id,
'remote_id': instance.remoteId,
'source_name': instance.sourceName,

View File

@@ -38,8 +38,7 @@ IngredientImage _$IngredientImageFromJson(Map<String, dynamic> json) {
);
}
Map<String, dynamic> _$IngredientImageToJson(IngredientImage instance) =>
<String, dynamic>{
Map<String, dynamic> _$IngredientImageToJson(IngredientImage instance) => <String, dynamic>{
'id': instance.id,
'uuid': instance.uuid,
'ingredient_id': instance.ingredientId,

View File

@@ -13,16 +13,14 @@ IngredientWeightUnit _$IngredientWeightUnitFromJson(Map<String, dynamic> json) {
);
return IngredientWeightUnit(
id: (json['id'] as num).toInt(),
weightUnit:
WeightUnit.fromJson(json['weight_unit'] as Map<String, dynamic>),
weightUnit: WeightUnit.fromJson(json['weight_unit'] as Map<String, dynamic>),
ingredient: Ingredient.fromJson(json['ingredient'] as Map<String, dynamic>),
grams: (json['grams'] as num).toInt(),
amount: (json['amount'] as num).toDouble(),
);
}
Map<String, dynamic> _$IngredientWeightUnitToJson(
IngredientWeightUnit instance) =>
Map<String, dynamic> _$IngredientWeightUnitToJson(IngredientWeightUnit instance) =>
<String, dynamic>{
'id': instance.id,
'weight_unit': instance.weightUnit,

View File

@@ -9,14 +9,7 @@ part of 'log.dart';
Log _$LogFromJson(Map<String, dynamic> json) {
$checkKeys(
json,
requiredKeys: const [
'id',
'plan',
'datetime',
'ingredient',
'weight_unit',
'amount'
],
requiredKeys: const ['id', 'plan', 'datetime', 'ingredient', 'weight_unit', 'amount'],
);
return Log(
id: (json['id'] as num?)?.toInt(),

View File

@@ -34,8 +34,7 @@ NutritionalPlan _$NutritionalPlanFromJson(Map<String, dynamic> json) {
);
}
Map<String, dynamic> _$NutritionalPlanToJson(NutritionalPlan instance) =>
<String, dynamic>{
Map<String, dynamic> _$NutritionalPlanToJson(NutritionalPlan instance) => <String, dynamic>{
'id': instance.id,
'description': instance.description,
'creation_date': toDate(instance.creationDate),

View File

@@ -17,8 +17,7 @@ WeightUnit _$WeightUnitFromJson(Map<String, dynamic> json) {
);
}
Map<String, dynamic> _$WeightUnitToJson(WeightUnit instance) =>
<String, dynamic>{
Map<String, dynamic> _$WeightUnitToJson(WeightUnit instance) => <String, dynamic>{
'id': instance.id,
'name': instance.name,
};

View File

@@ -9,13 +9,7 @@ part of 'profile.dart';
Profile _$ProfileFromJson(Map<String, dynamic> json) {
$checkKeys(
json,
requiredKeys: const [
'username',
'email_verified',
'is_trustworthy',
'weight_unit',
'email'
],
requiredKeys: const ['username', 'email_verified', 'is_trustworthy', 'weight_unit', 'email'],
);
return Profile(
username: json['username'] as String,

View File

@@ -15,8 +15,7 @@ Day _$DayFromJson(Map<String, dynamic> json) {
..id = (json['id'] as num?)?.toInt()
..workoutId = (json['training'] as num).toInt()
..description = json['description'] as String
..daysOfWeek =
(json['day'] as List<dynamic>).map((e) => (e as num).toInt()).toList();
..daysOfWeek = (json['day'] as List<dynamic>).map((e) => (e as num).toInt()).toList();
}
Map<String, dynamic> _$DayToJson(Day instance) => <String, dynamic>{

View File

@@ -17,8 +17,7 @@ RepetitionUnit _$RepetitionUnitFromJson(Map<String, dynamic> json) {
);
}
Map<String, dynamic> _$RepetitionUnitToJson(RepetitionUnit instance) =>
<String, dynamic>{
Map<String, dynamic> _$RepetitionUnitToJson(RepetitionUnit instance) => <String, dynamic>{
'id': instance.id,
'name': instance.name,
};

View File

@@ -9,14 +9,7 @@ part of 'session.dart';
WorkoutSession _$WorkoutSessionFromJson(Map<String, dynamic> json) {
$checkKeys(
json,
requiredKeys: const [
'id',
'workout',
'date',
'impression',
'time_start',
'time_end'
],
requiredKeys: const ['id', 'workout', 'date', 'impression', 'time_start', 'time_end'],
);
return WorkoutSession()
..id = (json['id'] as num?)?.toInt()
@@ -28,8 +21,7 @@ WorkoutSession _$WorkoutSessionFromJson(Map<String, dynamic> json) {
..timeEnd = stringToTime(json['time_end'] as String?);
}
Map<String, dynamic> _$WorkoutSessionToJson(WorkoutSession instance) =>
<String, dynamic>{
Map<String, dynamic> _$WorkoutSessionToJson(WorkoutSession instance) => <String, dynamic>{
'id': instance.id,
'workout': instance.workoutId,
'date': toDate(instance.date),

View File

@@ -17,8 +17,7 @@ WeightUnit _$WeightUnitFromJson(Map<String, dynamic> json) {
);
}
Map<String, dynamic> _$WeightUnitToJson(WeightUnit instance) =>
<String, dynamic>{
Map<String, dynamic> _$WeightUnitToJson(WeightUnit instance) => <String, dynamic>{
'id': instance.id,
'name': instance.name,
};

View File

@@ -19,8 +19,7 @@ WorkoutPlan _$WorkoutPlanFromJson(Map<String, dynamic> json) {
);
}
Map<String, dynamic> _$WorkoutPlanToJson(WorkoutPlan instance) =>
<String, dynamic>{
Map<String, dynamic> _$WorkoutPlanToJson(WorkoutPlan instance) => <String, dynamic>{
'id': instance.id,
'creation_date': instance.creationDate.toIso8601String(),
'name': instance.name,

View File

@@ -22,6 +22,7 @@ import 'dart:developer';
import 'dart:io';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:http/http.dart' as http;
import 'package:package_info_plus/package_info_plus.dart';

View File

@@ -19,12 +19,18 @@
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:wger/helpers/consts.dart';
import 'package:wger/models/user/profile.dart';
import 'package:wger/providers/base_provider.dart';
class UserProvider with ChangeNotifier {
ThemeMode themeMode = ThemeMode.system;
final WgerBaseProvider baseProvider;
UserProvider(this.baseProvider);
UserProvider(this.baseProvider) {
_loadThemeMode();
}
static const PROFILE_URL = 'userprofile';
static const VERIFY_EMAIL = 'verify-email';
@@ -36,6 +42,35 @@ class UserProvider with ChangeNotifier {
profile = null;
}
// Load theme mode from SharedPreferences
Future<void> _loadThemeMode() async {
final prefs = SharedPreferencesAsync();
final prefsDarkMode = await prefs.getBool(PREFS_USER_DARK_THEME);
if (prefsDarkMode == null) {
themeMode = ThemeMode.system;
} else {
themeMode = prefsDarkMode ? ThemeMode.dark : ThemeMode.light;
}
notifyListeners();
}
// Change mode on switch button click
void setThemeMode(ThemeMode mode) async {
themeMode = mode;
// Save to SharedPreferences
final prefs = SharedPreferencesAsync();
if (themeMode == ThemeMode.system) {
await prefs.remove(PREFS_USER_DARK_THEME);
} else {
await prefs.setBool(PREFS_USER_DARK_THEME, themeMode == ThemeMode.dark);
}
notifyListeners();
}
/// Fetch the current user's profile
Future<void> fetchAndSetProfile() async {
final userData = await baseProvider.fetch(baseProvider.makeUrl(PROFILE_URL));

View File

@@ -22,6 +22,7 @@ import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:provider/provider.dart';
import 'package:wger/providers/exercises.dart';
import 'package:wger/providers/nutrition.dart';
import 'package:wger/providers/user.dart';
class SettingsPage extends StatelessWidget {
static String routeName = '/SettingsPage';
@@ -32,15 +33,15 @@ class SettingsPage extends StatelessWidget {
Widget build(BuildContext context) {
final exerciseProvider = Provider.of<ExercisesProvider>(context, listen: false);
final nutritionProvider = Provider.of<NutritionPlansProvider>(context, listen: false);
final userProvider = Provider.of<UserProvider>(context);
final i18n = AppLocalizations.of(context);
return Scaffold(
appBar: AppBar(
title: Text(AppLocalizations.of(context).settingsTitle),
),
appBar: AppBar(title: Text(i18n.settingsTitle)),
body: ListView(
children: [
ListTile(
title: Text(AppLocalizations.of(context).settingsExerciseCacheDescription),
title: Text(i18n.settingsExerciseCacheDescription),
trailing: IconButton(
key: const ValueKey('cacheIconExercises'),
icon: const Icon(Icons.delete),
@@ -49,7 +50,7 @@ class SettingsPage extends StatelessWidget {
if (context.mounted) {
final snackBar = SnackBar(
content: Text(AppLocalizations.of(context).settingsCacheDeletedSnackbar),
content: Text(i18n.settingsCacheDeletedSnackbar),
);
ScaffoldMessenger.of(context).showSnackBar(snackBar);
@@ -58,7 +59,7 @@ class SettingsPage extends StatelessWidget {
),
),
ListTile(
title: Text(AppLocalizations.of(context).settingsIngredientCacheDescription),
title: Text(i18n.settingsIngredientCacheDescription),
trailing: IconButton(
key: const ValueKey('cacheIconIngredients'),
icon: const Icon(Icons.delete),
@@ -67,7 +68,7 @@ class SettingsPage extends StatelessWidget {
if (context.mounted) {
final snackBar = SnackBar(
content: Text(AppLocalizations.of(context).settingsCacheDeletedSnackbar),
content: Text(i18n.settingsCacheDeletedSnackbar),
);
ScaffoldMessenger.of(context).showSnackBar(snackBar);
@@ -75,6 +76,35 @@ class SettingsPage extends StatelessWidget {
},
),
),
ListTile(
title: Text(i18n.themeMode),
trailing: DropdownButton<ThemeMode>(
key: const ValueKey('themeModeDropdown'),
value: userProvider.themeMode,
onChanged: (ThemeMode? newValue) {
if (newValue != null) {
userProvider.setThemeMode(newValue);
}
},
items: ThemeMode.values.map<DropdownMenuItem<ThemeMode>>((ThemeMode value) {
final label = (() {
switch (value) {
case ThemeMode.system:
return i18n.systemMode;
case ThemeMode.light:
return i18n.lightMode;
case ThemeMode.dark:
return i18n.darkMode;
}
})();
return DropdownMenuItem<ThemeMode>(
value: value,
child: Text(label),
);
}).toList(),
),
),
],
),
);

View File

@@ -77,8 +77,14 @@ List<Widget> getOverviewWidgetsSeries(
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Indicator(color: Theme.of(context).colorScheme.primary, text: AppLocalizations.of(context).indicatorRaw, isSquare: true),
Indicator(color: Theme.of(context).colorScheme.tertiary, text: AppLocalizations.of(context).indicatorAvg, isSquare: true),
Indicator(
color: Theme.of(context).colorScheme.primary,
text: AppLocalizations.of(context).indicatorRaw,
isSquare: true),
Indicator(
color: Theme.of(context).colorScheme.tertiary,
text: AppLocalizations.of(context).indicatorAvg,
isSquare: true),
],
),
];