mirror of
https://github.com/wger-project/flutter.git
synced 2026-02-18 00:17:48 +01:00
dcm fix --only-rules=unnecessary-trailing-comma lib test test_data
This commit is contained in:
@@ -32,10 +32,7 @@ class MealItemValuesTile extends StatelessWidget {
|
||||
trailing: IconButton(
|
||||
icon: const Icon(Icons.info_outline),
|
||||
onPressed: () {
|
||||
showIngredientDetails(
|
||||
context,
|
||||
ingredient.id,
|
||||
);
|
||||
showIngredientDetails(context, ingredient.id);
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
@@ -54,12 +54,8 @@ void main() {
|
||||
provider.languages = [tLanguage1, tLanguage2, tLanguage3];
|
||||
|
||||
// Mock base info response
|
||||
when(
|
||||
mockBaseProvider.makeUrl(exerciseBaseInfoUrl, id: 9),
|
||||
).thenReturn(tExerciseBaseInfoUri);
|
||||
when(
|
||||
mockBaseProvider.makeUrl(exerciseBaseInfoUrl, id: 1),
|
||||
).thenReturn(tExerciseBaseInfoUri2);
|
||||
when(mockBaseProvider.makeUrl(exerciseBaseInfoUrl, id: 9)).thenReturn(tExerciseBaseInfoUri);
|
||||
when(mockBaseProvider.makeUrl(exerciseBaseInfoUrl, id: 1)).thenReturn(tExerciseBaseInfoUri2);
|
||||
|
||||
when(mockBaseProvider.fetch(tExerciseBaseInfoUri))
|
||||
.thenAnswer((_) => Future.value(tExerciseInfoMap));
|
||||
|
||||
@@ -236,10 +236,7 @@ void main() {
|
||||
// assert
|
||||
verifyNever(provider.baseProvider.fetch(tSearchByNameUri));
|
||||
|
||||
expect(
|
||||
provider.filteredExercises,
|
||||
data.getTestExercises(),
|
||||
);
|
||||
expect(provider.filteredExercises, data.getTestExercises());
|
||||
});
|
||||
|
||||
test('A muscle is selected with no search term. Should find results', () async {
|
||||
|
||||
@@ -37,9 +37,7 @@ void main() {
|
||||
localizationsDelegates: AppLocalizations.localizationsDelegates,
|
||||
supportedLocales: AppLocalizations.supportedLocales,
|
||||
navigatorKey: GlobalKey<NavigatorState>(),
|
||||
home: Scaffold(
|
||||
body: ExerciseDetail(getTestExercises()[0]),
|
||||
),
|
||||
home: Scaffold(body: ExerciseDetail(getTestExercises()[0])),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -46,9 +46,7 @@ void main() {
|
||||
locale: Locale(locale),
|
||||
localizationsDelegates: AppLocalizations.localizationsDelegates,
|
||||
supportedLocales: AppLocalizations.supportedLocales,
|
||||
home: Scaffold(
|
||||
body: useImage ? ImageForm(image) : ImageForm(),
|
||||
),
|
||||
home: Scaffold(body: useImage ? ImageForm(image) : ImageForm()),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -48,9 +48,7 @@ void main() {
|
||||
localizationsDelegates: AppLocalizations.localizationsDelegates,
|
||||
supportedLocales: AppLocalizations.supportedLocales,
|
||||
home: const Gallery(),
|
||||
routes: {
|
||||
FormScreen.routeName: (ctx) => const FormScreen(),
|
||||
},
|
||||
routes: {FormScreen.routeName: (ctx) => const FormScreen()},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -60,9 +60,7 @@ void main() {
|
||||
localizationsDelegates: AppLocalizations.localizationsDelegates,
|
||||
supportedLocales: AppLocalizations.supportedLocales,
|
||||
navigatorKey: key,
|
||||
home: Scaffold(
|
||||
body: MealForm(1, meal),
|
||||
),
|
||||
home: Scaffold(body: MealForm(1, meal)),
|
||||
routes: {
|
||||
NutritionalPlanScreen.routeName: (ctx) => const NutritionalPlanScreen(),
|
||||
},
|
||||
|
||||
@@ -58,9 +58,7 @@ void main() {
|
||||
localizationsDelegates: AppLocalizations.localizationsDelegates,
|
||||
supportedLocales: AppLocalizations.supportedLocales,
|
||||
navigatorKey: key,
|
||||
home: Scaffold(
|
||||
body: PlanForm(plan),
|
||||
),
|
||||
home: Scaffold(body: PlanForm(plan)),
|
||||
routes: {
|
||||
NutritionalPlanScreen.routeName: (ctx) => const NutritionalPlanScreen(),
|
||||
},
|
||||
|
||||
@@ -72,13 +72,9 @@ void main() {
|
||||
await loadAppFonts();
|
||||
final globalKey = GlobalKey();
|
||||
await tester.pumpWidgetBuilder(
|
||||
Material(
|
||||
key: globalKey,
|
||||
),
|
||||
Material(key: globalKey),
|
||||
wrapper: materialAppWrapper(
|
||||
localizations: [
|
||||
AppLocalizations.delegate,
|
||||
],
|
||||
localizations: [AppLocalizations.delegate],
|
||||
),
|
||||
surfaceSize: const Size(500, 1000),
|
||||
);
|
||||
|
||||
@@ -40,10 +40,8 @@ void main() {
|
||||
final client = MockClient();
|
||||
|
||||
Widget createHomeScreen({locale = 'en'}) {
|
||||
when(client.delete(
|
||||
any,
|
||||
headers: anyNamed('headers'),
|
||||
)).thenAnswer((_) async => http.Response('', 200));
|
||||
when(client.delete(any, headers: anyNamed('headers')))
|
||||
.thenAnswer((_) async => http.Response('', 200));
|
||||
|
||||
when(mockBaseProvider.deleteRequest(any, any)).thenAnswer(
|
||||
(_) async => http.Response('', 200),
|
||||
@@ -74,9 +72,7 @@ void main() {
|
||||
localizationsDelegates: AppLocalizations.localizationsDelegates,
|
||||
supportedLocales: AppLocalizations.supportedLocales,
|
||||
home: const NutritionalPlansScreen(),
|
||||
routes: {
|
||||
FormScreen.routeName: (ctx) => const FormScreen(),
|
||||
},
|
||||
routes: {FormScreen.routeName: (ctx) => const FormScreen()},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -30,9 +30,7 @@ void main() {
|
||||
locale: Locale(locale),
|
||||
localizationsDelegates: AppLocalizations.localizationsDelegates,
|
||||
supportedLocales: AppLocalizations.supportedLocales,
|
||||
home: Scaffold(
|
||||
body: WeightForm(weightEntry),
|
||||
),
|
||||
home: Scaffold(body: WeightForm(weightEntry)),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -65,9 +65,7 @@ void main() {
|
||||
localizationsDelegates: AppLocalizations.localizationsDelegates,
|
||||
supportedLocales: AppLocalizations.supportedLocales,
|
||||
home: const WeightScreen(),
|
||||
routes: {
|
||||
FormScreen.routeName: (_) => const FormScreen(),
|
||||
},
|
||||
routes: {FormScreen.routeName: (_) => const FormScreen()},
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -64,9 +64,7 @@ void main() {
|
||||
localizationsDelegates: AppLocalizations.localizationsDelegates,
|
||||
supportedLocales: AppLocalizations.supportedLocales,
|
||||
navigatorKey: key,
|
||||
home: Scaffold(
|
||||
body: RepetitionUnitInputWidget(setting1),
|
||||
),
|
||||
home: Scaffold(body: RepetitionUnitInputWidget(setting1)),
|
||||
routes: {
|
||||
WorkoutPlanScreen.routeName: (ctx) => const WorkoutPlanScreen(),
|
||||
},
|
||||
|
||||
@@ -65,9 +65,7 @@ void main() {
|
||||
localizationsDelegates: AppLocalizations.localizationsDelegates,
|
||||
supportedLocales: AppLocalizations.supportedLocales,
|
||||
navigatorKey: key,
|
||||
home: Scaffold(
|
||||
body: WeightUnitInputWidget(setting1),
|
||||
),
|
||||
home: Scaffold(body: WeightUnitInputWidget(setting1)),
|
||||
routes: {
|
||||
WorkoutPlanScreen.routeName: (ctx) => const WorkoutPlanScreen(),
|
||||
},
|
||||
|
||||
@@ -51,9 +51,7 @@ void main() {
|
||||
localizationsDelegates: AppLocalizations.localizationsDelegates,
|
||||
supportedLocales: AppLocalizations.supportedLocales,
|
||||
navigatorKey: key,
|
||||
home: Scaffold(
|
||||
body: DayFormWidget(workoutPlan),
|
||||
),
|
||||
home: Scaffold(body: DayFormWidget(workoutPlan)),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -59,9 +59,7 @@ void main() {
|
||||
localizationsDelegates: AppLocalizations.localizationsDelegates,
|
||||
supportedLocales: AppLocalizations.supportedLocales,
|
||||
navigatorKey: key,
|
||||
home: Scaffold(
|
||||
body: WorkoutForm(workoutPlan),
|
||||
),
|
||||
home: Scaffold(body: WorkoutForm(workoutPlan)),
|
||||
routes: {
|
||||
WorkoutPlanScreen.routeName: (ctx) => const WorkoutPlanScreen(),
|
||||
},
|
||||
|
||||
@@ -71,9 +71,7 @@ void main() {
|
||||
localizationsDelegates: AppLocalizations.localizationsDelegates,
|
||||
supportedLocales: AppLocalizations.supportedLocales,
|
||||
home: const WorkoutPlansScreen(),
|
||||
routes: {
|
||||
FormScreen.routeName: (ctx) => const FormScreen(),
|
||||
},
|
||||
routes: {FormScreen.routeName: (ctx) => const FormScreen()},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -51,9 +51,7 @@ void main() {
|
||||
|
||||
final uri = Uri.https('localhost', 'api/v2/workout/325397/');
|
||||
when(mockBaseProvider.makeUrl('workout', id: 325397)).thenReturn(uri);
|
||||
when(mockBaseProvider.fetch(
|
||||
uri,
|
||||
)).thenAnswer(
|
||||
when(mockBaseProvider.fetch(uri)).thenAnswer(
|
||||
(_) async => Future.value({
|
||||
'id': 325397,
|
||||
'name': 'Test workout',
|
||||
@@ -78,9 +76,7 @@ void main() {
|
||||
final exercisesProvider = ExercisesProvider(mockBaseProvider);
|
||||
final uri = Uri.https('localhost', 'api/v2/workout/325397/');
|
||||
when(mockBaseProvider.makeUrl('workout', id: 325397)).thenReturn(uri);
|
||||
when(mockBaseProvider.fetch(
|
||||
uri,
|
||||
)).thenAnswer(
|
||||
when(mockBaseProvider.fetch(uri)).thenAnswer(
|
||||
(_) async => Future.value({
|
||||
'id': 325397,
|
||||
'name': 'Test workout',
|
||||
|
||||
@@ -63,9 +63,7 @@ void main() {
|
||||
localizationsDelegates: AppLocalizations.localizationsDelegates,
|
||||
supportedLocales: AppLocalizations.supportedLocales,
|
||||
navigatorKey: GlobalKey<NavigatorState>(),
|
||||
home: Scaffold(
|
||||
body: SetFormWidget(day),
|
||||
),
|
||||
home: Scaffold(body: SetFormWidget(day)),
|
||||
),
|
||||
),
|
||||
);
|
||||
@@ -90,9 +88,7 @@ void main() {
|
||||
any,
|
||||
languageCode: anyNamed('languageCode'),
|
||||
searchEnglish: anyNamed('searchEnglish'),
|
||||
)).thenAnswer(
|
||||
(_) => Future.value([getTestExercises().first]),
|
||||
);
|
||||
)).thenAnswer((_) => Future.value([getTestExercises().first]));
|
||||
|
||||
await tester.pumpWidget(createHomeScreen());
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
@@ -146,22 +146,13 @@ final cake = Ingredient(
|
||||
);
|
||||
|
||||
NutritionalPlan getNutritionalPlan() {
|
||||
final mealItem1 = MealItem(
|
||||
ingredientId: 1,
|
||||
amount: 100,
|
||||
);
|
||||
final mealItem1 = MealItem(ingredientId: 1, amount: 100);
|
||||
mealItem1.ingredient = ingredient1;
|
||||
|
||||
final mealItem2 = MealItem(
|
||||
ingredientId: 2,
|
||||
amount: 75,
|
||||
);
|
||||
final mealItem2 = MealItem(ingredientId: 2, amount: 75);
|
||||
mealItem2.ingredient = ingredient2;
|
||||
|
||||
final mealItem3 = MealItem(
|
||||
ingredientId: 3,
|
||||
amount: 300,
|
||||
);
|
||||
final mealItem3 = MealItem(ingredientId: 3, amount: 300);
|
||||
mealItem3.ingredient = ingredient3;
|
||||
|
||||
final meal1 = Meal(
|
||||
|
||||
@@ -2,86 +2,34 @@
|
||||
import 'package:wger/models/exercises/language.dart';
|
||||
import 'package:wger/models/exercises/translation.dart';
|
||||
|
||||
const tLanguage21 = Language(
|
||||
id: 21,
|
||||
shortName: 'he',
|
||||
fullName: 'עברית',
|
||||
);
|
||||
const tLanguage5 = Language(
|
||||
id: 5,
|
||||
shortName: 'ru',
|
||||
fullName: 'Русский',
|
||||
);
|
||||
const tLanguage16 = Language(
|
||||
id: 16,
|
||||
shortName: 'tr',
|
||||
fullName: 'Türkçe',
|
||||
);
|
||||
const tLanguage21 = Language(id: 21, shortName: 'he', fullName: 'עברית');
|
||||
const tLanguage5 = Language(id: 5, shortName: 'ru', fullName: 'Русский');
|
||||
const tLanguage16 = Language(id: 16, shortName: 'tr', fullName: 'Türkçe');
|
||||
const tLanguage22 = Language(
|
||||
id: 22,
|
||||
shortName: 'hr',
|
||||
fullName: 'Hrvatski jezik',
|
||||
);
|
||||
const tLanguage9 = Language(
|
||||
id: 9,
|
||||
shortName: 'cs',
|
||||
fullName: 'Čeština',
|
||||
);
|
||||
const tLanguage4 = Language(
|
||||
id: 4,
|
||||
shortName: 'es',
|
||||
fullName: 'Español',
|
||||
);
|
||||
const tLanguage24 = Language(
|
||||
id: 24,
|
||||
shortName: 'zh',
|
||||
fullName: '漢語',
|
||||
);
|
||||
const tLanguage9 = Language(id: 9, shortName: 'cs', fullName: 'Čeština');
|
||||
const tLanguage4 = Language(id: 4, shortName: 'es', fullName: 'Español');
|
||||
const tLanguage24 = Language(id: 24, shortName: 'zh', fullName: '漢語');
|
||||
const tLanguage17 = Language(
|
||||
id: 17,
|
||||
shortName: 'ar',
|
||||
fullName: 'اَللُّغَةُ اَلْعَرَبِيَّة',
|
||||
);
|
||||
const tLanguage8 = Language(
|
||||
id: 8,
|
||||
shortName: 'el',
|
||||
fullName: 'Ελληνικά',
|
||||
);
|
||||
const tLanguage2 = Language(
|
||||
id: 2,
|
||||
shortName: 'en',
|
||||
fullName: 'English',
|
||||
);
|
||||
const tLanguage13 = Language(
|
||||
id: 13,
|
||||
shortName: 'it',
|
||||
fullName: 'Italian',
|
||||
);
|
||||
const tLanguage12 = Language(
|
||||
id: 12,
|
||||
shortName: 'fr',
|
||||
fullName: 'Français',
|
||||
);
|
||||
const tLanguage1 = Language(
|
||||
id: 1,
|
||||
shortName: 'de',
|
||||
fullName: 'Deutsch',
|
||||
);
|
||||
const tLanguage8 = Language(id: 8, shortName: 'el', fullName: 'Ελληνικά');
|
||||
const tLanguage2 = Language(id: 2, shortName: 'en', fullName: 'English');
|
||||
const tLanguage13 = Language(id: 13, shortName: 'it', fullName: 'Italian');
|
||||
const tLanguage12 = Language(id: 12, shortName: 'fr', fullName: 'Français');
|
||||
const tLanguage1 = Language(id: 1, shortName: 'de', fullName: 'Deutsch');
|
||||
const tLanguage23 = Language(
|
||||
id: 23,
|
||||
shortName: 'id',
|
||||
fullName: 'Bahasa Indonesia',
|
||||
);
|
||||
const tLanguage6 = Language(
|
||||
id: 6,
|
||||
shortName: 'nl',
|
||||
fullName: 'Nederlands',
|
||||
);
|
||||
const tLanguage7 = Language(
|
||||
id: 7,
|
||||
shortName: 'pt',
|
||||
fullName: 'Português',
|
||||
);
|
||||
const tLanguage6 = Language(id: 6, shortName: 'nl', fullName: 'Nederlands');
|
||||
const tLanguage7 = Language(id: 7, shortName: 'pt', fullName: 'Português');
|
||||
|
||||
final squatsPT = Translation(
|
||||
id: 1598,
|
||||
|
||||
@@ -110,12 +110,7 @@ WorkoutPlan getWorkout({List<Exercise>? exercises}) {
|
||||
settingSquat.exercise = testBases[4];
|
||||
settingSquat.weight = 120;
|
||||
|
||||
final setSquat = Set.withData(
|
||||
id: 2,
|
||||
day: 1,
|
||||
sets: 3,
|
||||
order: 1,
|
||||
);
|
||||
final setSquat = Set.withData(id: 2, day: 1, sets: 3, order: 1);
|
||||
setSquat.addExerciseBase(testBases[4]);
|
||||
setSquat.settings.add(settingSquat);
|
||||
setSquat.settingsComputed = [settingSquat, settingSquat];
|
||||
@@ -135,12 +130,7 @@ WorkoutPlan getWorkout({List<Exercise>? exercises}) {
|
||||
settingSideRaises.exercise = testBases[5];
|
||||
settingSideRaises.weight = 6;
|
||||
|
||||
final setSideRaises = Set.withData(
|
||||
id: 3,
|
||||
day: 1,
|
||||
sets: 3,
|
||||
order: 1,
|
||||
);
|
||||
final setSideRaises = Set.withData(id: 3, day: 1, sets: 3, order: 1);
|
||||
setSideRaises.addExerciseBase(testBases[5]);
|
||||
setSideRaises.settings.add(settingSideRaises);
|
||||
setSideRaises.settingsComputed = [settingSideRaises, settingSideRaises];
|
||||
|
||||
Reference in New Issue
Block a user