mirror of
https://github.com/wger-project/flutter.git
synced 2026-11-29 09:20:56 +01:00
Run "dart fix --apply"
This commit is contained in:
@@ -122,7 +122,7 @@ Widget createDashboardScreen({Locale? locale}) {
|
||||
localizationsDelegates: AppLocalizations.localizationsDelegates,
|
||||
supportedLocales: AppLocalizations.supportedLocales,
|
||||
theme: wgerLightTheme,
|
||||
home: HomeTabsScreen(),
|
||||
home: const HomeTabsScreen(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -62,14 +62,11 @@ class LogItem {
|
||||
this.mealId,
|
||||
required this.ingredientId,
|
||||
this.weightUnitId,
|
||||
required num amount,
|
||||
required this.amount,
|
||||
required this.planId,
|
||||
required DateTime datetime,
|
||||
required this.datetime,
|
||||
this.comment,
|
||||
}) {
|
||||
this.amount = amount;
|
||||
this.datetime = datetime;
|
||||
}
|
||||
});
|
||||
|
||||
/// Builds a new log row from a meal-plan item, e.g. when the user taps
|
||||
/// "log this meal". The `id` stays null and is assigned by Drift on insert.
|
||||
@@ -89,12 +86,12 @@ class LogItem {
|
||||
return LogItemTableCompanion(
|
||||
id: id != null ? drift.Value(id!) : const drift.Value.absent(),
|
||||
planId: drift.Value(planId),
|
||||
mealId: mealId == null ? const drift.Value.absent() : drift.Value(mealId!),
|
||||
mealId: mealId == null ? const drift.Value.absent() : drift.Value(mealId),
|
||||
ingredientId: drift.Value(ingredientId),
|
||||
weightUnitId: weightUnitId == null ? const drift.Value.absent() : drift.Value(weightUnitId!),
|
||||
weightUnitId: weightUnitId == null ? const drift.Value.absent() : drift.Value(weightUnitId),
|
||||
datetime: drift.Value(datetime),
|
||||
amount: drift.Value(amount.toDouble()),
|
||||
comment: comment == null ? const drift.Value.absent() : drift.Value(comment!),
|
||||
comment: comment == null ? const drift.Value.absent() : drift.Value(comment),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -71,14 +71,11 @@ class Meal {
|
||||
/// by the repository hydration step.
|
||||
Meal.fromDrift({
|
||||
this.id,
|
||||
required String planId,
|
||||
required int order,
|
||||
required this.planId,
|
||||
required this.order,
|
||||
this.time,
|
||||
required String name,
|
||||
required this.name,
|
||||
}) {
|
||||
this.planId = planId;
|
||||
this.order = order;
|
||||
this.name = name;
|
||||
mealItems = [];
|
||||
diaryEntries = [];
|
||||
}
|
||||
@@ -108,7 +105,7 @@ class Meal {
|
||||
id: id != null ? drift.Value(id!) : const drift.Value.absent(),
|
||||
planId: drift.Value(planId),
|
||||
order: drift.Value(order),
|
||||
time: time == null ? const drift.Value.absent() : drift.Value(time!),
|
||||
time: time == null ? const drift.Value.absent() : drift.Value(time),
|
||||
name: drift.Value(name),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -73,17 +73,12 @@ class MealItem {
|
||||
/// after a JOIN; instances built here have only the FK ids set.
|
||||
MealItem.fromDrift({
|
||||
this.id,
|
||||
required String mealId,
|
||||
required int ingredientId,
|
||||
required this.mealId,
|
||||
required this.ingredientId,
|
||||
this.weightUnitId,
|
||||
required int order,
|
||||
required double amount,
|
||||
}) {
|
||||
this.mealId = mealId;
|
||||
this.ingredientId = ingredientId;
|
||||
this.amount = amount;
|
||||
this.order = order;
|
||||
}
|
||||
required this.order,
|
||||
required double this.amount,
|
||||
});
|
||||
|
||||
/// Drift companion for inserts/updates against `nutrition_mealitem`.
|
||||
///
|
||||
@@ -94,7 +89,7 @@ class MealItem {
|
||||
id: id != null ? drift.Value(id!) : const drift.Value.absent(),
|
||||
mealId: drift.Value(mealId),
|
||||
ingredientId: drift.Value(ingredientId),
|
||||
weightUnitId: weightUnitId == null ? const drift.Value.absent() : drift.Value(weightUnitId!),
|
||||
weightUnitId: weightUnitId == null ? const drift.Value.absent() : drift.Value(weightUnitId),
|
||||
order: drift.Value(order),
|
||||
amount: drift.Value(amount.toDouble()),
|
||||
);
|
||||
|
||||
@@ -279,10 +279,10 @@ class Routine {
|
||||
}
|
||||
|
||||
Routine replaceExercise(int oldExerciseId, Exercise newExercise) {
|
||||
final updatedRoutine = this.copyWith(
|
||||
sessions: List<WorkoutSession>.from(this.sessions),
|
||||
dayData: List<DayData>.from(this.dayData),
|
||||
dayDataGym: List<DayData>.from(this.dayDataGym),
|
||||
final updatedRoutine = copyWith(
|
||||
sessions: List<WorkoutSession>.from(sessions),
|
||||
dayData: List<DayData>.from(dayData),
|
||||
dayDataGym: List<DayData>.from(dayDataGym),
|
||||
);
|
||||
|
||||
for (final session in updatedRoutine.sessions) {
|
||||
|
||||
@@ -29,8 +29,6 @@ part 'add_exercise_state.freezed.dart';
|
||||
/// Transient form state for the "contribute a new exercise" flow.
|
||||
@freezed
|
||||
sealed class AddExerciseState with _$AddExerciseState {
|
||||
const AddExerciseState._();
|
||||
|
||||
const factory AddExerciseState({
|
||||
@Default('') String author,
|
||||
String? exerciseNameEn,
|
||||
@@ -49,6 +47,7 @@ sealed class AddExerciseState with _$AddExerciseState {
|
||||
@Default([]) List<Muscle> secondaryMuscles,
|
||||
@Default([]) List<ExerciseSubmissionImage> exerciseImages,
|
||||
}) = _AddExerciseState;
|
||||
const AddExerciseState._();
|
||||
|
||||
bool get newVariation => variationConnectToExercise != null;
|
||||
|
||||
|
||||
@@ -93,12 +93,12 @@ class ExerciseListFiltersNotifier extends _$ExerciseListFiltersNotifier {
|
||||
var filters = currentFilters;
|
||||
|
||||
if (filters.equipment.items.isEmpty && equipment.isNotEmpty) {
|
||||
final Map<Equipment, bool> items = {for (var e in equipment) e: false};
|
||||
final Map<Equipment, bool> items = {for (final e in equipment) e: false};
|
||||
filters = filters.copyWith(equipment: filters.equipment.copyWith(items: items));
|
||||
}
|
||||
|
||||
if (filters.exerciseCategories.items.isEmpty && categories.isNotEmpty) {
|
||||
final Map<ExerciseCategory, bool> items = {for (var c in categories) c: false};
|
||||
final Map<ExerciseCategory, bool> items = {for (final c in categories) c: false};
|
||||
filters = filters.copyWith(
|
||||
exerciseCategories: filters.exerciseCategories.copyWith(items: items),
|
||||
);
|
||||
|
||||
@@ -69,7 +69,7 @@ class WorkoutSessionRepository {
|
||||
});
|
||||
|
||||
final log = row.readTableOrNull(_db.workoutLogTable);
|
||||
if (log == null || seenLogs.contains(log.id!)) {
|
||||
if (log == null || seenLogs.contains(log.id)) {
|
||||
continue;
|
||||
}
|
||||
seenLogs.add(log.id!);
|
||||
|
||||
@@ -55,7 +55,7 @@ class RoutineListScreen extends riverpod.ConsumerWidget {
|
||||
: null,
|
||||
child: const Icon(Icons.add, color: Colors.white),
|
||||
),
|
||||
body: WidescreenWrapper(child: RoutinesList()),
|
||||
body: const WidescreenWrapper(child: RoutinesList()),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ class Step2Variations extends ConsumerWidget {
|
||||
),
|
||||
),
|
||||
Consumer(
|
||||
builder: (ctx, ref, __) {
|
||||
builder: (ctx, ref, _) {
|
||||
final state = ref.watch(addExerciseProvider);
|
||||
return Switch(
|
||||
value: state.variationGroup == key,
|
||||
@@ -91,7 +91,7 @@ class Step2Variations extends ConsumerWidget {
|
||||
),
|
||||
),
|
||||
Consumer(
|
||||
builder: (ctx, ref, __) {
|
||||
builder: (ctx, ref, _) {
|
||||
final state = ref.watch(addExerciseProvider);
|
||||
return Switch(
|
||||
value: state.variationConnectToExercise == base.id,
|
||||
|
||||
@@ -83,7 +83,7 @@ class _Step4TranslationState extends ConsumerState<Step4Translation> {
|
||||
title: '${i18n.name}*',
|
||||
validator: (name) => validateName(name, context),
|
||||
onChange: (v) => notifier.setExerciseNameTrans(v),
|
||||
onSaved: (String? name) => notifier.setExerciseNameTrans(name!),
|
||||
onSaved: (String? name) => notifier.setExerciseNameTrans(name),
|
||||
),
|
||||
AddExerciseTextArea(
|
||||
title: i18n.alternativeNames,
|
||||
@@ -108,7 +108,7 @@ class _Step4TranslationState extends ConsumerState<Step4Translation> {
|
||||
notifier.setAlternateNamesTrans(alternateName!.split('\n')),
|
||||
),
|
||||
Consumer(
|
||||
builder: (ctx, ref, __) {
|
||||
builder: (ctx, ref, _) {
|
||||
final descriptionTrans = ref.watch(
|
||||
addExerciseProvider.select((s) => s.descriptionTrans),
|
||||
);
|
||||
@@ -120,7 +120,7 @@ class _Step4TranslationState extends ConsumerState<Step4Translation> {
|
||||
helperText: i18n.enterTextInLanguage,
|
||||
isMultiline: true,
|
||||
validator: (name) => validateExerciseDescription(name, context),
|
||||
onSaved: (String? description) => notifier.setDescriptionTrans(description!),
|
||||
onSaved: (String? description) => notifier.setDescriptionTrans(description),
|
||||
);
|
||||
},
|
||||
),
|
||||
|
||||
@@ -176,7 +176,7 @@ class _Step5ImagesState extends ConsumerState<Step5Images> with ExerciseImagePic
|
||||
// Image picker or preview - shown when not entering metadata
|
||||
if (_currentImageToAdd == null)
|
||||
Consumer(
|
||||
builder: (ctx, ref, __) {
|
||||
builder: (ctx, ref, _) {
|
||||
final exerciseImages = ref.watch(
|
||||
addExerciseProvider.select((s) => s.exerciseImages),
|
||||
);
|
||||
|
||||
@@ -103,7 +103,7 @@ class _SessionFormState extends ConsumerState<SessionForm> {
|
||||
keyboardType: TextInputType.multiline,
|
||||
onFieldSubmitted: (_) {},
|
||||
onSaved: (newValue) {
|
||||
widget._session.notes = newValue!;
|
||||
widget._session.notes = newValue;
|
||||
},
|
||||
validator: (value) {
|
||||
if (value != null && value.length > WorkoutSession.maxNotesChars) {
|
||||
|
||||
@@ -54,19 +54,19 @@ void main() {
|
||||
// Two exercises share the 'chest' variationGroup, one is in 'legs', and
|
||||
// testCrunches has no variationGroup at all (so it should be excluded
|
||||
// from all variation lookups).
|
||||
final benchPress = Exercise(
|
||||
const benchPress = Exercise(
|
||||
id: 100,
|
||||
uuid: 'bench-uuid',
|
||||
category: testCategoryArms,
|
||||
variationGroup: 'chest',
|
||||
);
|
||||
final inclineBench = Exercise(
|
||||
const inclineBench = Exercise(
|
||||
id: 101,
|
||||
uuid: 'incline-uuid',
|
||||
category: testCategoryArms,
|
||||
variationGroup: 'chest',
|
||||
);
|
||||
final squat = Exercise(
|
||||
const squat = Exercise(
|
||||
id: 200,
|
||||
uuid: 'squat-uuid',
|
||||
category: testCategoryLegs,
|
||||
|
||||
@@ -116,7 +116,7 @@ void main() {
|
||||
final barChart = tester.widget<BarChart>(barChartFinder);
|
||||
|
||||
// Verify all bars are 0.0 as nothing has been logged
|
||||
for (var group in barChart.data.barGroups) {
|
||||
for (final group in barChart.data.barGroups) {
|
||||
expect(
|
||||
group.barRods.first.toY,
|
||||
0.0,
|
||||
@@ -164,7 +164,7 @@ void main() {
|
||||
final barChart = tester.widget<BarChart>(barChartFinder);
|
||||
|
||||
// Verify all bars fallback to 0.0 safely instead of Infinity
|
||||
for (var group in barChart.data.barGroups) {
|
||||
for (final group in barChart.data.barGroups) {
|
||||
expect(
|
||||
group.barRods.first.toY,
|
||||
0.0,
|
||||
@@ -194,7 +194,7 @@ void main() {
|
||||
expect(barChartFinder, findsOneWidget);
|
||||
|
||||
final barChart = tester.widget<BarChart>(barChartFinder);
|
||||
for (var group in barChart.data.barGroups) {
|
||||
for (final group in barChart.data.barGroups) {
|
||||
expect(group.barRods.first.toY, 0.0);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -125,7 +125,7 @@ void main() {
|
||||
});
|
||||
|
||||
test('MealItem nutritionalValues with weight unit', () {
|
||||
final unit = const IngredientWeightUnit(
|
||||
const unit = IngredientWeightUnit(
|
||||
id: 1,
|
||||
uuid: '00000000-0000-0000-0000-000000000001',
|
||||
ingredientId: 1,
|
||||
@@ -141,7 +141,7 @@ void main() {
|
||||
});
|
||||
|
||||
test('MealItem nutritionalValues with weight unit amount 1', () {
|
||||
final unit = const IngredientWeightUnit(
|
||||
const unit = IngredientWeightUnit(
|
||||
id: 2,
|
||||
uuid: '00000000-0000-0000-0000-000000000002',
|
||||
ingredientId: 1,
|
||||
|
||||
@@ -133,10 +133,10 @@ void main() {
|
||||
late Exercise exercise;
|
||||
|
||||
setUp(() {
|
||||
exercise = Exercise(
|
||||
exercise = const Exercise(
|
||||
id: 1,
|
||||
uuid: 'test-uuid',
|
||||
category: const ExerciseCategory(id: 1, name: 'Test'),
|
||||
category: ExerciseCategory(id: 1, name: 'Test'),
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import 'package:wger/models/user/account.dart';
|
||||
import 'package:wger/models/user/user_profile.dart';
|
||||
|
||||
final tAccount1 = Account(
|
||||
const tAccount1 = Account(
|
||||
username: 'super root',
|
||||
email: 'admin@google.com',
|
||||
emailVerified: true,
|
||||
|
||||
Reference in New Issue
Block a user