mirror of
https://github.com/wger-project/flutter.git
synced 2026-02-18 23:42:00 +01:00
@@ -163,6 +163,9 @@ dart_code_metrics:
|
||||
- prefer-prefixed-global-constants: false # we don't really care for the 'k' prefix
|
||||
- prefer-single-widget-per-file: false
|
||||
- avoid-passing-self-as-argument: false # fairly harmless. and e.g. drift calls are like this
|
||||
- avoid-passing-async-when-sync-expected: false # we really like to do this in onTap() etc, and it seems harmless
|
||||
- prefer-match-file-name: false # dieter wants to enable this. but requires a lot of renames. what does roland think?
|
||||
|
||||
formatter:
|
||||
indent: 0
|
||||
line-length: 100
|
||||
|
||||
@@ -34,9 +34,9 @@ Widget createDashboardScreen({locale = 'en'}) {
|
||||
'date': '2022-12-01',
|
||||
'impression': '3',
|
||||
'time_start': '17:00',
|
||||
'time_end': '19:00'
|
||||
}
|
||||
]
|
||||
'time_end': '19:00',
|
||||
},
|
||||
],
|
||||
};
|
||||
when(mockWorkoutProvider.fetchSessionData()).thenAnswer((a) => Future.value(logs));
|
||||
|
||||
|
||||
@@ -36,9 +36,7 @@ Widget createWeightScreen({locale = 'en'}) {
|
||||
supportedLocales: AppLocalizations.supportedLocales,
|
||||
theme: wgerLightTheme,
|
||||
home: const WeightScreen(),
|
||||
routes: {
|
||||
FormScreen.routeName: (ctx) => const FormScreen(),
|
||||
},
|
||||
routes: {FormScreen.routeName: (ctx) => const FormScreen()},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ const languages = [
|
||||
'ru-RU',
|
||||
'tr-TR',
|
||||
'uk',
|
||||
'zh-CN'
|
||||
'zh-CN',
|
||||
];
|
||||
|
||||
void main() {
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
*/
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
import 'package:wger/helpers/json.dart';
|
||||
import 'package:wger/models/nutrition/image.dart';
|
||||
import 'package:wger/models/nutrition/ingredient_image.dart';
|
||||
import 'package:wger/models/nutrition/nutritional_values.dart';
|
||||
|
||||
part 'ingredient.g.dart';
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
*/
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
|
||||
part 'image.g.dart';
|
||||
part 'ingredient_image.g.dart';
|
||||
|
||||
@JsonSerializable()
|
||||
class IngredientImage {
|
||||
@@ -1,6 +1,6 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'image.dart';
|
||||
part of 'ingredient_image.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
@@ -134,6 +134,7 @@ class NutritionalGoals {
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
// ignore: avoid-nullable-interpolation
|
||||
return 'e: $energy, p: $protein, c: $carbohydrates, cS: $carbohydratesSugar, f: $fat, fS: $fatSaturated, fi: $fiber, s: $sodium';
|
||||
}
|
||||
|
||||
|
||||
@@ -25,8 +25,8 @@ import 'package:wger/exceptions/http_exception.dart';
|
||||
import 'package:wger/exceptions/no_such_entry_exception.dart';
|
||||
import 'package:wger/helpers/consts.dart';
|
||||
import 'package:wger/models/exercises/ingredient_api.dart';
|
||||
import 'package:wger/models/nutrition/image.dart';
|
||||
import 'package:wger/models/nutrition/ingredient.dart';
|
||||
import 'package:wger/models/nutrition/ingredient_image.dart';
|
||||
import 'package:wger/models/nutrition/log.dart';
|
||||
import 'package:wger/models/nutrition/meal.dart';
|
||||
import 'package:wger/models/nutrition/meal_item.dart';
|
||||
|
||||
@@ -34,7 +34,7 @@ class MeasurementCategoriesScreen extends StatelessWidget {
|
||||
appBar: AppBar(title: Text(AppLocalizations.of(context).measurements)),
|
||||
floatingActionButton: FloatingActionButton(
|
||||
child: const Icon(Icons.add, color: Colors.white),
|
||||
onPressed: () async {
|
||||
onPressed: () {
|
||||
Navigator.pushNamed(
|
||||
context,
|
||||
FormScreen.routeName,
|
||||
|
||||
@@ -122,7 +122,7 @@ class MeasurementEntriesScreen extends StatelessWidget {
|
||||
),
|
||||
floatingActionButton: FloatingActionButton(
|
||||
child: const Icon(Icons.add, color: Colors.white),
|
||||
onPressed: () async {
|
||||
onPressed: () {
|
||||
Navigator.pushNamed(
|
||||
context,
|
||||
FormScreen.routeName,
|
||||
|
||||
@@ -112,20 +112,23 @@ class NutritionalPlanScreen extends StatelessWidget {
|
||||
PopupMenuButton<NutritionalPlanOptions>(
|
||||
icon: const Icon(Icons.more_vert, color: appBarForeground),
|
||||
onSelected: (value) {
|
||||
if (value == NutritionalPlanOptions.edit) {
|
||||
Navigator.pushNamed(
|
||||
context,
|
||||
FormScreen.routeName,
|
||||
arguments: FormScreenArguments(
|
||||
AppLocalizations.of(context).edit,
|
||||
PlanForm(nutritionalPlan),
|
||||
hasListView: true,
|
||||
),
|
||||
);
|
||||
} else if (value == NutritionalPlanOptions.delete) {
|
||||
Provider.of<NutritionPlansProvider>(context, listen: false)
|
||||
.deletePlan(nutritionalPlan.id!);
|
||||
Navigator.of(context).pop();
|
||||
switch (value) {
|
||||
case NutritionalPlanOptions.edit:
|
||||
Navigator.pushNamed(
|
||||
context,
|
||||
FormScreen.routeName,
|
||||
arguments: FormScreenArguments(
|
||||
AppLocalizations.of(context).edit,
|
||||
PlanForm(nutritionalPlan),
|
||||
hasListView: true,
|
||||
),
|
||||
);
|
||||
break;
|
||||
case NutritionalPlanOptions.delete:
|
||||
Provider.of<NutritionPlansProvider>(context, listen: false)
|
||||
.deletePlan(nutritionalPlan.id!);
|
||||
Navigator.of(context).pop();
|
||||
break;
|
||||
}
|
||||
},
|
||||
itemBuilder: (BuildContext context) {
|
||||
|
||||
@@ -35,7 +35,7 @@ class NutritionalPlansScreen extends StatelessWidget {
|
||||
appBar: EmptyAppBar(AppLocalizations.of(context).nutritionalPlans),
|
||||
floatingActionButton: FloatingActionButton(
|
||||
child: const Icon(Icons.add, color: Colors.white),
|
||||
onPressed: () async {
|
||||
onPressed: () {
|
||||
Navigator.pushNamed(
|
||||
context,
|
||||
FormScreen.routeName,
|
||||
|
||||
@@ -194,7 +194,7 @@ class _DashboardWeightWidgetState extends State<DashboardWeightWidget> {
|
||||
MeasurementOverallChangeWidget(
|
||||
entries7dAvg.first,
|
||||
entries7dAvg.last,
|
||||
weightUnit(profile!.isMetric, context),
|
||||
weightUnit(profile.isMetric, context),
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
@@ -209,7 +209,7 @@ class _DashboardWeightWidgetState extends State<DashboardWeightWidget> {
|
||||
),
|
||||
IconButton(
|
||||
icon: const Icon(Icons.add),
|
||||
onPressed: () async {
|
||||
onPressed: () {
|
||||
Navigator.pushNamed(
|
||||
context,
|
||||
FormScreen.routeName,
|
||||
@@ -526,7 +526,7 @@ class NothingFound extends StatelessWidget {
|
||||
IconButton(
|
||||
iconSize: 30,
|
||||
icon: const Icon(Icons.add_box, color: wgerPrimaryButtonColor),
|
||||
onPressed: () async {
|
||||
onPressed: () {
|
||||
Navigator.pushNamed(
|
||||
context,
|
||||
FormScreen.routeName,
|
||||
|
||||
@@ -26,18 +26,6 @@ import 'package:wger/models/nutrition/nutritional_plan.dart';
|
||||
import 'package:wger/models/nutrition/nutritional_values.dart';
|
||||
import 'package:wger/widgets/measurements/charts.dart';
|
||||
|
||||
class FlNutritionalPlanGoalWidget extends StatefulWidget {
|
||||
const FlNutritionalPlanGoalWidget({
|
||||
super.key,
|
||||
required NutritionalPlan nutritionalPlan,
|
||||
}) : _nutritionalPlan = nutritionalPlan;
|
||||
|
||||
final NutritionalPlan _nutritionalPlan;
|
||||
|
||||
@override
|
||||
State<StatefulWidget> createState() => FlNutritionalPlanGoalWidgetState();
|
||||
}
|
||||
|
||||
// * fl_chart doesn't support horizontal bar charts yet.
|
||||
// see https://github.com/imaNNeo/fl_chart/issues/113
|
||||
// even if it did, i doubt it would let us put text between the gauges/bars
|
||||
@@ -45,7 +33,14 @@ class FlNutritionalPlanGoalWidget extends StatefulWidget {
|
||||
// using multiple colors to show multiple components such as surplus, deficit
|
||||
// * here we draw our own simple gauges that can go beyond 100%,
|
||||
// and support multiple segments
|
||||
class FlNutritionalPlanGoalWidgetState extends State<FlNutritionalPlanGoalWidget> {
|
||||
class FlNutritionalPlanGoalWidget extends StatelessWidget {
|
||||
const FlNutritionalPlanGoalWidget({
|
||||
super.key,
|
||||
required NutritionalPlan nutritionalPlan,
|
||||
}) : _nutritionalPlan = nutritionalPlan;
|
||||
|
||||
final NutritionalPlan _nutritionalPlan;
|
||||
|
||||
// normWidth is the width representing 100% completion
|
||||
// note that if val > plan, we will draw beyond this width
|
||||
// therefore, caller must set this width to accommodate surpluses.
|
||||
@@ -91,7 +86,7 @@ class FlNutritionalPlanGoalWidgetState extends State<FlNutritionalPlanGoalWidget
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final plan = widget._nutritionalPlan;
|
||||
final plan = _nutritionalPlan;
|
||||
final goals = plan.nutritionalGoals;
|
||||
final today = plan.loggedNutritionalValuesToday;
|
||||
|
||||
|
||||
@@ -379,13 +379,12 @@ class IngredientFormState extends State<IngredientForm> {
|
||||
style: const TextStyle(color: Colors.red),
|
||||
),
|
||||
);
|
||||
} else {
|
||||
return const SizedBox(
|
||||
width: 20,
|
||||
height: 20,
|
||||
child: CircularProgressIndicator(),
|
||||
);
|
||||
}
|
||||
return const SizedBox(
|
||||
width: 20,
|
||||
height: 20,
|
||||
child: CircularProgressIndicator(),
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
@@ -394,7 +393,7 @@ class IngredientFormState extends State<IngredientForm> {
|
||||
ElevatedButton(
|
||||
key: const Key(SUBMIT_BUTTON_KEY_NAME),
|
||||
child: Text(AppLocalizations.of(context).save),
|
||||
onPressed: () async {
|
||||
onPressed: () {
|
||||
if (!_form.currentState!.validate()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -105,7 +105,7 @@ void showIngredientDetails(BuildContext context, int id, {void Function()? selec
|
||||
builder: (context) => FutureBuilder<Ingredient>(
|
||||
future: Provider.of<NutritionPlansProvider>(context, listen: false).fetchIngredient(id),
|
||||
builder: (BuildContext context, AsyncSnapshot<Ingredient> snapshot) {
|
||||
return IngredientDetails(snapshot, select: select);
|
||||
return IngredientDetails(snapshot, onSelect: select);
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
@@ -21,8 +21,8 @@ Widget ingredientImage(String url, BuildContext context) {
|
||||
|
||||
class IngredientDetails extends StatelessWidget {
|
||||
final AsyncSnapshot<Ingredient> snapshot;
|
||||
final void Function()? select;
|
||||
const IngredientDetails(this.snapshot, {super.key, this.select});
|
||||
final void Function()? onSelect;
|
||||
const IngredientDetails(this.snapshot, {super.key, this.onSelect});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -76,12 +76,12 @@ class IngredientDetails extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
actions: [
|
||||
if (snapshot.hasData && select != null)
|
||||
if (snapshot.hasData && onSelect != null)
|
||||
TextButton(
|
||||
key: const Key('ingredient-details-continue-button'),
|
||||
child: Text(MaterialLocalizations.of(context).continueButtonLabel),
|
||||
onPressed: () {
|
||||
select!();
|
||||
onSelect!();
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
),
|
||||
@@ -100,9 +100,14 @@ class IngredientDetails extends StatelessWidget {
|
||||
class IngredientScanResultDialog extends StatelessWidget {
|
||||
final AsyncSnapshot<Ingredient?> snapshot;
|
||||
final String barcode;
|
||||
final Function(int id, String name, num? amount) selectIngredient;
|
||||
final Function(int id, String name, num? amount) onSelectIngredient;
|
||||
|
||||
const IngredientScanResultDialog(this.snapshot, this.barcode, this.selectIngredient, {super.key});
|
||||
const IngredientScanResultDialog(
|
||||
this.snapshot,
|
||||
this.barcode,
|
||||
this.onSelectIngredient, {
|
||||
super.key,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -181,7 +186,7 @@ class IngredientScanResultDialog extends StatelessWidget {
|
||||
key: const Key('ingredient-scan-result-dialog-confirm-button'),
|
||||
child: Text(MaterialLocalizations.of(context).continueButtonLabel),
|
||||
onPressed: () {
|
||||
selectIngredient(ingredient!.id, ingredient.name, null);
|
||||
onSelectIngredient(ingredient!.id, ingredient.name, null);
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
),
|
||||
|
||||
@@ -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);
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
@@ -35,10 +35,11 @@ void main() {
|
||||
return ChangeNotifierProvider<ExercisesProvider>(
|
||||
create: (context) => mockExerciseProvider,
|
||||
child: MaterialApp(
|
||||
locale: Locale(locale),
|
||||
localizationsDelegates: AppLocalizations.localizationsDelegates,
|
||||
supportedLocales: AppLocalizations.supportedLocales,
|
||||
home: const SettingsPage()),
|
||||
locale: Locale(locale),
|
||||
localizationsDelegates: AppLocalizations.localizationsDelegates,
|
||||
supportedLocales: AppLocalizations.supportedLocales,
|
||||
home: const SettingsPage(),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ void main() {
|
||||
await ServiceLocator().configure();
|
||||
});
|
||||
|
||||
setUp(() async {
|
||||
setUp(() {
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
driftRuntimeOptions.dontWarnAboutMultipleDatabases = true;
|
||||
|
||||
@@ -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));
|
||||
@@ -114,7 +110,7 @@ void main() {
|
||||
'1f5d2b2f-d4ea-4eeb-9377-56176465e08d',
|
||||
'ab645585-26ef-4992-a9ec-15425687ece9',
|
||||
'd8aa5990-bb47-4111-9823-e2fbd98fe07f',
|
||||
'49a159e1-1e00-409a-81c9-b4d4489fbd67'
|
||||
'49a159e1-1e00-409a-81c9-b4d4489fbd67',
|
||||
]);
|
||||
expect(exercise.videos.map((v) => v.uuid), ['63e996e9-a772-4ca5-9d09-8b4be03f6be4']);
|
||||
|
||||
|
||||
@@ -84,7 +84,7 @@ void main() {
|
||||
fixture('exercises/exercisebaseinfo_response.json'),
|
||||
);
|
||||
|
||||
setUpAll(() async {
|
||||
setUpAll(() {
|
||||
// Needs to be configured here, setUp runs on every test, setUpAll only once
|
||||
//await ServiceLocator().configure();
|
||||
});
|
||||
@@ -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])),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ void main() {
|
||||
);
|
||||
|
||||
group('Model tests', () {
|
||||
test('test getExercise', () async {
|
||||
test('test getExercise', () {
|
||||
// arrange and act
|
||||
final base = getTestExercises()[1];
|
||||
|
||||
@@ -57,7 +57,7 @@ void main() {
|
||||
'1f5d2b2f-d4ea-4eeb-9377-56176465e08d',
|
||||
'ab645585-26ef-4992-a9ec-15425687ece9',
|
||||
'd8aa5990-bb47-4111-9823-e2fbd98fe07f',
|
||||
'49a159e1-1e00-409a-81c9-b4d4489fbd67'
|
||||
'49a159e1-1e00-409a-81c9-b4d4489fbd67',
|
||||
]);
|
||||
expect(exercise.videos.map((v) => v.uuid), ['63e996e9-a772-4ca5-9d09-8b4be03f6be4']);
|
||||
|
||||
|
||||
@@ -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()),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -34,13 +34,14 @@ void main() {
|
||||
Uri.https('localhost', 'api/v2/gallery/'),
|
||||
headers: anyNamed('headers'),
|
||||
)).thenAnswer((_) async => http.Response(
|
||||
'{"count":1,"next":null,"previous":null,"results":['
|
||||
'{"id":58,'
|
||||
'"date":"2022-01-09",'
|
||||
'"image":"https://wger.de/media/gallery/170335/d2b9c9e0-d541-41ae-8786-a2ab459e3538.jpg",'
|
||||
'"description":"eggsaddjujuit\'ddayhadIforcanview",'
|
||||
'"height":1280,"width":960}]}',
|
||||
200));
|
||||
'{"count":1,"next":null,"previous":null,"results":['
|
||||
'{"id":58,'
|
||||
'"date":"2022-01-09",'
|
||||
'"image":"https://wger.de/media/gallery/170335/d2b9c9e0-d541-41ae-8786-a2ab459e3538.jpg",'
|
||||
'"description":"eggsaddjujuit\'ddayhadIforcanview",'
|
||||
'"height":1280,"width":960}]}',
|
||||
200,
|
||||
));
|
||||
|
||||
final galleryProvider = GalleryProvider(testAuthProvider, [], client);
|
||||
|
||||
@@ -57,20 +58,22 @@ void main() {
|
||||
Uri.https('localhost', 'api/v2/gallery/58/'),
|
||||
headers: anyNamed('headers'),
|
||||
)).thenAnswer((_) async => http.Response(
|
||||
'{"id":58,'
|
||||
'"date":"2022-01-09",'
|
||||
'"image":"https://wger.de/media/gallery/170335/d2b9c9e0-d541-41ae-8786-a2ab459e3538.jpg",'
|
||||
'"description":"eggsaddjujuit\'ddayhadIforcanview",'
|
||||
'"height":1280,"width":960}',
|
||||
200));
|
||||
'{"id":58,'
|
||||
'"date":"2022-01-09",'
|
||||
'"image":"https://wger.de/media/gallery/170335/d2b9c9e0-d541-41ae-8786-a2ab459e3538.jpg",'
|
||||
'"description":"eggsaddjujuit\'ddayhadIforcanview",'
|
||||
'"height":1280,"width":960}',
|
||||
200,
|
||||
));
|
||||
|
||||
final galleryProvider = GalleryProvider(testAuthProvider, [], client);
|
||||
|
||||
final image = gallery.Image(
|
||||
id: 58,
|
||||
date: DateTime(2022, 01, 09),
|
||||
url: 'https://wger.de/media/gallery/170335/d2b9c9e0-d541-41ae-8786-a2ab459e3538.jpg',
|
||||
description: "eggsaddjujuit'ddayhadIforcanview");
|
||||
id: 58,
|
||||
date: DateTime(2022, 01, 09),
|
||||
url: 'https://wger.de/media/gallery/170335/d2b9c9e0-d541-41ae-8786-a2ab459e3538.jpg',
|
||||
description: "eggsaddjujuit'ddayhadIforcanview",
|
||||
);
|
||||
|
||||
galleryProvider.images.add(image);
|
||||
|
||||
|
||||
@@ -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()},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ void main() {
|
||||
date: DateTime(2021, 7, 22),
|
||||
value: 83,
|
||||
notes: 'notes',
|
||||
)
|
||||
),
|
||||
];
|
||||
|
||||
final MeasurementEntry tMeasurementEntry = MeasurementEntry(
|
||||
@@ -35,7 +35,7 @@ void main() {
|
||||
'category': 123,
|
||||
'date': '2021-07-22',
|
||||
'value': 83,
|
||||
'notes': 'notes'
|
||||
'notes': 'notes',
|
||||
};
|
||||
|
||||
final Map<String, dynamic> tMeasurementCategoryMap = {
|
||||
|
||||
@@ -47,7 +47,12 @@ void main() {
|
||||
|
||||
// act
|
||||
final result = tMeasurementEntry.copyWith(
|
||||
id: 83, category: 17, date: DateTime(1960), value: 93, notes: 'Interesting');
|
||||
id: 83,
|
||||
category: 17,
|
||||
date: DateTime(1960),
|
||||
value: 93,
|
||||
notes: 'Interesting',
|
||||
);
|
||||
|
||||
// assert
|
||||
expect(result, tMeasurementEntryCopied);
|
||||
|
||||
@@ -38,7 +38,7 @@ void main() {
|
||||
MeasurementCategory(id: 1, name: 'Strength', unit: 'kN');
|
||||
final List<MeasurementCategory> tMeasurementCategories = [
|
||||
const MeasurementCategory(id: 1, name: 'Strength', unit: 'kN'),
|
||||
const MeasurementCategory(id: 2, name: 'Biceps', unit: 'cm')
|
||||
const MeasurementCategory(id: 2, name: 'Biceps', unit: 'cm'),
|
||||
];
|
||||
final Map<String, dynamic> tMeasurementCategoriesMap =
|
||||
jsonDecode(fixture('measurement/measurement_categories.json'));
|
||||
@@ -158,9 +158,9 @@ void main() {
|
||||
date: DateTime(2021, 7, 10),
|
||||
value: 15.00,
|
||||
notes: '',
|
||||
)
|
||||
),
|
||||
]),
|
||||
const MeasurementCategory(id: 2, name: 'Biceps', unit: 'cm')
|
||||
const MeasurementCategory(id: 2, name: 'Biceps', unit: 'cm'),
|
||||
];
|
||||
|
||||
// act
|
||||
@@ -197,17 +197,18 @@ void main() {
|
||||
});
|
||||
|
||||
test(
|
||||
'should add the result from the post call to the categories List and sort the list by alphabetical order',
|
||||
() async {
|
||||
// arrange
|
||||
await measurementProvider.fetchAndSetCategories();
|
||||
'should add the result from the post call to the categories List and sort the list by alphabetical order',
|
||||
() async {
|
||||
// arrange
|
||||
await measurementProvider.fetchAndSetCategories();
|
||||
|
||||
// act
|
||||
await measurementProvider.addCategory(tMeasurementCategoryWithoutId);
|
||||
// act
|
||||
await measurementProvider.addCategory(tMeasurementCategoryWithoutId);
|
||||
|
||||
// assert
|
||||
expect(measurementProvider.categories, tMeasurementCategoriesAdded);
|
||||
});
|
||||
// assert
|
||||
expect(measurementProvider.categories, tMeasurementCategoriesAdded);
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
group('deleteCategory()', () {
|
||||
@@ -215,23 +216,24 @@ void main() {
|
||||
await measurementProvider.fetchAndSetCategories();
|
||||
});
|
||||
test(
|
||||
'should remove a MeasurementCategory from the categories list for an id and call the api to remove the MeasurementCategory',
|
||||
() async {
|
||||
// arrange
|
||||
when(mockWgerBaseProvider.deleteRequest(any, any))
|
||||
.thenAnswer((realInvocation) => Future.value(Response('', 200)));
|
||||
'should remove a MeasurementCategory from the categories list for an id and call the api to remove the MeasurementCategory',
|
||||
() async {
|
||||
// arrange
|
||||
when(mockWgerBaseProvider.deleteRequest(any, any))
|
||||
.thenAnswer((realInvocation) => Future.value(Response('', 200)));
|
||||
|
||||
final List<MeasurementCategory> tMeasurementCategoriesOneDeleted = [
|
||||
const MeasurementCategory(id: 2, name: 'Biceps', unit: 'cm')
|
||||
];
|
||||
final List<MeasurementCategory> tMeasurementCategoriesOneDeleted = [
|
||||
const MeasurementCategory(id: 2, name: 'Biceps', unit: 'cm'),
|
||||
];
|
||||
|
||||
// act
|
||||
await measurementProvider.deleteCategory(tCategoryId);
|
||||
// act
|
||||
await measurementProvider.deleteCategory(tCategoryId);
|
||||
|
||||
// assert
|
||||
verify(mockWgerBaseProvider.deleteRequest('measurement-category', tCategoryId));
|
||||
expect(measurementProvider.categories, tMeasurementCategoriesOneDeleted);
|
||||
});
|
||||
// assert
|
||||
verify(mockWgerBaseProvider.deleteRequest('measurement-category', tCategoryId));
|
||||
expect(measurementProvider.categories, tMeasurementCategoriesOneDeleted);
|
||||
},
|
||||
);
|
||||
|
||||
test('should throw a NoSuchEntryException if no category is found', () {
|
||||
// act & assert
|
||||
@@ -239,16 +241,19 @@ void main() {
|
||||
});
|
||||
|
||||
test(
|
||||
'should re-add the "removed" MeasurementCategory and relay the exception on WgerHttpException',
|
||||
() async {
|
||||
// arrange
|
||||
when(mockWgerBaseProvider.deleteRequest(any, any)).thenThrow(WgerHttpException('{}'));
|
||||
'should re-add the "removed" MeasurementCategory and relay the exception on WgerHttpException',
|
||||
() {
|
||||
// arrange
|
||||
when(mockWgerBaseProvider.deleteRequest(any, any)).thenThrow(WgerHttpException('{}'));
|
||||
|
||||
// act & assert
|
||||
expect(() async => measurementProvider.deleteCategory(tCategoryId),
|
||||
throwsA(isA<WgerHttpException>()));
|
||||
expect(measurementProvider.categories, tMeasurementCategories);
|
||||
});
|
||||
// act & assert
|
||||
expect(
|
||||
() => measurementProvider.deleteCategory(tCategoryId),
|
||||
throwsA(isA<WgerHttpException>()),
|
||||
);
|
||||
expect(measurementProvider.categories, tMeasurementCategories);
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
group('editCategory()', () {
|
||||
@@ -280,9 +285,9 @@ void main() {
|
||||
test("should throw a NoSuchEntryException if category doesn't exist", () {
|
||||
// act & assert
|
||||
expect(
|
||||
() async =>
|
||||
measurementProvider.editCategory(83, tCategoryEditedName, tCategoryEditedUnit),
|
||||
throwsA(isA<NoSuchEntryException>()));
|
||||
() => measurementProvider.editCategory(83, tCategoryEditedName, tCategoryEditedUnit),
|
||||
throwsA(isA<NoSuchEntryException>()),
|
||||
);
|
||||
});
|
||||
|
||||
test('should call api to patch the category', () async {
|
||||
@@ -299,9 +304,13 @@ void main() {
|
||||
|
||||
// act & assert
|
||||
expect(
|
||||
() => measurementProvider.editCategory(
|
||||
tCategoryId, tCategoryEditedName, tCategoryEditedUnit),
|
||||
throwsA(isA<WgerHttpException>()));
|
||||
() => measurementProvider.editCategory(
|
||||
tCategoryId,
|
||||
tCategoryEditedName,
|
||||
tCategoryEditedUnit,
|
||||
),
|
||||
throwsA(isA<WgerHttpException>()),
|
||||
);
|
||||
expect(measurementProvider.categories, tMeasurementCategories);
|
||||
});
|
||||
});
|
||||
@@ -339,9 +348,9 @@ void main() {
|
||||
value: 15.00,
|
||||
notes: '',
|
||||
),
|
||||
tMeasurementEntry
|
||||
tMeasurementEntry,
|
||||
]),
|
||||
const MeasurementCategory(id: 2, name: 'Biceps', unit: 'cm')
|
||||
const MeasurementCategory(id: 2, name: 'Biceps', unit: 'cm'),
|
||||
];
|
||||
|
||||
setUp(() async {
|
||||
@@ -374,17 +383,18 @@ void main() {
|
||||
});
|
||||
|
||||
test(
|
||||
"should add MeasurementEntry to its MeasurementCategory in the categories List and sort the category's list by date",
|
||||
() async {
|
||||
// arrange
|
||||
await measurementProvider.fetchAndSetCategoryEntries(tCategoryId);
|
||||
"should add MeasurementEntry to its MeasurementCategory in the categories List and sort the category's list by date",
|
||||
() async {
|
||||
// arrange
|
||||
await measurementProvider.fetchAndSetCategoryEntries(tCategoryId);
|
||||
|
||||
// act
|
||||
await measurementProvider.addEntry(tMeasurementEntryWithoutId);
|
||||
// act
|
||||
await measurementProvider.addEntry(tMeasurementEntryWithoutId);
|
||||
|
||||
// assert
|
||||
expect(measurementProvider.categories, tMeasurementCategories);
|
||||
});
|
||||
// assert
|
||||
expect(measurementProvider.categories, tMeasurementCategories);
|
||||
},
|
||||
);
|
||||
|
||||
test('should throw a NoSuchEntryException if no category is found', () {
|
||||
// arrange
|
||||
@@ -401,8 +411,10 @@ void main() {
|
||||
.thenAnswer((realInvocation) => Future.value(measurementEntryMapWrongCategory));
|
||||
|
||||
// act & assert
|
||||
expect(() => measurementProvider.addEntry(tMeasurementEntryWrongCategory),
|
||||
throwsA(isA<NoSuchEntryException>()));
|
||||
expect(
|
||||
() => measurementProvider.addEntry(tMeasurementEntryWrongCategory),
|
||||
throwsA(isA<NoSuchEntryException>()),
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -418,7 +430,7 @@ void main() {
|
||||
notes: 'Some important notes',
|
||||
),
|
||||
]),
|
||||
const MeasurementCategory(id: 2, name: 'Biceps', unit: 'cm')
|
||||
const MeasurementCategory(id: 2, name: 'Biceps', unit: 'cm'),
|
||||
];
|
||||
|
||||
setUp(() async {
|
||||
@@ -439,17 +451,22 @@ void main() {
|
||||
|
||||
test("should throw a NoSuchEntryException if the category isn't found", () {
|
||||
// act & assert
|
||||
expect(() async => measurementProvider.deleteEntry(tEntryId, 83),
|
||||
throwsA(isA<NoSuchEntryException>()));
|
||||
expect(
|
||||
() => measurementProvider.deleteEntry(tEntryId, 83),
|
||||
throwsA(isA<NoSuchEntryException>()),
|
||||
);
|
||||
});
|
||||
|
||||
test(
|
||||
"should throw a NoSuchEntryException if the entry in the categories entries List isn't found",
|
||||
() {
|
||||
// act & assert
|
||||
expect(() => measurementProvider.deleteEntry(83, tCategoryId),
|
||||
throwsA(isA<NoSuchEntryException>()));
|
||||
});
|
||||
"should throw a NoSuchEntryException if the entry in the categories entries List isn't found",
|
||||
() {
|
||||
// act & assert
|
||||
expect(
|
||||
() => measurementProvider.deleteEntry(83, tCategoryId),
|
||||
throwsA(isA<NoSuchEntryException>()),
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
test('should call the api to remove the MeasurementEntry', () async {
|
||||
// act
|
||||
@@ -460,35 +477,38 @@ void main() {
|
||||
});
|
||||
|
||||
test(
|
||||
'should re-add the "removed" MeasurementEntry and throw a WgerHttpException if the api call fails',
|
||||
() async {
|
||||
// arrange
|
||||
final List<MeasurementCategory> tMeasurementCategories = [
|
||||
MeasurementCategory(id: 1, name: 'Strength', unit: 'kN', entries: [
|
||||
MeasurementEntry(
|
||||
id: 1,
|
||||
category: 1,
|
||||
date: DateTime(2021, 7, 21),
|
||||
value: 10,
|
||||
notes: 'Some important notes',
|
||||
),
|
||||
MeasurementEntry(
|
||||
id: 2,
|
||||
category: 1,
|
||||
date: DateTime(2021, 7, 10),
|
||||
value: 15.00,
|
||||
notes: '',
|
||||
),
|
||||
]),
|
||||
const MeasurementCategory(id: 2, name: 'Biceps', unit: 'cm')
|
||||
];
|
||||
when(mockWgerBaseProvider.deleteRequest(any, any)).thenThrow(WgerHttpException('{}'));
|
||||
'should re-add the "removed" MeasurementEntry and throw a WgerHttpException if the api call fails',
|
||||
() {
|
||||
// arrange
|
||||
final List<MeasurementCategory> tMeasurementCategories = [
|
||||
MeasurementCategory(id: 1, name: 'Strength', unit: 'kN', entries: [
|
||||
MeasurementEntry(
|
||||
id: 1,
|
||||
category: 1,
|
||||
date: DateTime(2021, 7, 21),
|
||||
value: 10,
|
||||
notes: 'Some important notes',
|
||||
),
|
||||
MeasurementEntry(
|
||||
id: 2,
|
||||
category: 1,
|
||||
date: DateTime(2021, 7, 10),
|
||||
value: 15.00,
|
||||
notes: '',
|
||||
),
|
||||
]),
|
||||
const MeasurementCategory(id: 2, name: 'Biceps', unit: 'cm'),
|
||||
];
|
||||
when(mockWgerBaseProvider.deleteRequest(any, any)).thenThrow(WgerHttpException('{}'));
|
||||
|
||||
// act & assert
|
||||
expect(() async => measurementProvider.deleteEntry(tEntryId, tCategoryId),
|
||||
throwsA(isA<WgerHttpException>()));
|
||||
expect(measurementProvider.categories, tMeasurementCategories);
|
||||
});
|
||||
// act & assert
|
||||
expect(
|
||||
() => measurementProvider.deleteEntry(tEntryId, tCategoryId),
|
||||
throwsA(isA<WgerHttpException>()),
|
||||
);
|
||||
expect(measurementProvider.categories, tMeasurementCategories);
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
group('editEntry()', () {
|
||||
@@ -527,9 +547,9 @@ void main() {
|
||||
date: DateTime(2021, 7, 10),
|
||||
value: 15.00,
|
||||
notes: '',
|
||||
)
|
||||
),
|
||||
]),
|
||||
const MeasurementCategory(id: 2, name: 'Biceps', unit: 'cm')
|
||||
const MeasurementCategory(id: 2, name: 'Biceps', unit: 'cm'),
|
||||
];
|
||||
|
||||
// act
|
||||
@@ -548,27 +568,29 @@ void main() {
|
||||
test("should throw a NoSuchEntryException if category doesn't exist", () {
|
||||
// act & assert
|
||||
expect(
|
||||
() => measurementProvider.editEntry(
|
||||
tEntryId,
|
||||
83,
|
||||
tEntryEditedValue,
|
||||
tEntryEditedNote,
|
||||
tEntryEditedDate,
|
||||
),
|
||||
throwsA(isA<NoSuchEntryException>()));
|
||||
() => measurementProvider.editEntry(
|
||||
tEntryId,
|
||||
83,
|
||||
tEntryEditedValue,
|
||||
tEntryEditedNote,
|
||||
tEntryEditedDate,
|
||||
),
|
||||
throwsA(isA<NoSuchEntryException>()),
|
||||
);
|
||||
});
|
||||
|
||||
test("should throw a NoSuchEntryException if entry doesn't exist", () {
|
||||
// act & assert
|
||||
expect(
|
||||
() => measurementProvider.editEntry(
|
||||
83,
|
||||
tCategoryId,
|
||||
tEntryEditedValue,
|
||||
tEntryEditedNote,
|
||||
tEntryEditedDate,
|
||||
),
|
||||
throwsA(isA<NoSuchEntryException>()));
|
||||
() => measurementProvider.editEntry(
|
||||
83,
|
||||
tCategoryId,
|
||||
tEntryEditedValue,
|
||||
tEntryEditedNote,
|
||||
tEntryEditedDate,
|
||||
),
|
||||
throwsA(isA<NoSuchEntryException>()),
|
||||
);
|
||||
});
|
||||
|
||||
test('should call api to patch the entry', () async {
|
||||
|
||||
@@ -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(),
|
||||
},
|
||||
|
||||
@@ -21,7 +21,6 @@ import 'package:wger/widgets/nutrition/forms.dart';
|
||||
|
||||
import '../../test_data/nutritional_plans.dart';
|
||||
import '../fixtures/fixture_reader.dart';
|
||||
import '../measurements/measurement_provider_test.mocks.dart';
|
||||
import '../other/base_provider_test.mocks.dart';
|
||||
import 'nutritional_plan_form_test.mocks.dart';
|
||||
|
||||
@@ -44,15 +43,9 @@ void main() {
|
||||
sodium: 0.5,
|
||||
);
|
||||
|
||||
late MockWgerBaseProvider mockWgerBaseProvider;
|
||||
|
||||
var mockNutrition = MockNutritionPlansProvider();
|
||||
final client = MockClient();
|
||||
|
||||
setUp(() {
|
||||
mockWgerBaseProvider = MockWgerBaseProvider();
|
||||
});
|
||||
|
||||
var plan1 = NutritionalPlan.empty();
|
||||
var meal1 = Meal();
|
||||
|
||||
@@ -81,12 +74,15 @@ void main() {
|
||||
when(mockNutrition.searchIngredientWithCode('123')).thenAnswer((_) => Future.value(ingredient));
|
||||
when(mockNutrition.searchIngredientWithCode('')).thenAnswer((_) => Future.value(null));
|
||||
when(mockNutrition.searchIngredientWithCode('222')).thenAnswer((_) => Future.value(null));
|
||||
when(mockNutrition.searchIngredient(any,
|
||||
languageCode: anyNamed('languageCode'), searchEnglish: anyNamed('searchEnglish')))
|
||||
.thenAnswer(
|
||||
when(mockNutrition.searchIngredient(
|
||||
any,
|
||||
languageCode: anyNamed('languageCode'),
|
||||
searchEnglish: anyNamed('searchEnglish'),
|
||||
)).thenAnswer(
|
||||
(_) => Future.value(
|
||||
IngredientApiSearch.fromJson(json.decode(fixture('nutrition/ingredient_suggestions')))
|
||||
.suggestions),
|
||||
IngredientApiSearch.fromJson(json.decode(fixture('nutrition/ingredient_suggestions')))
|
||||
.suggestions,
|
||||
),
|
||||
);
|
||||
|
||||
when(mockNutrition.addMealItem(any, meal1)).thenAnswer((_) => Future.value(mealItem));
|
||||
@@ -280,7 +276,7 @@ void main() {
|
||||
expect(find.text('Please enter a valid number'), findsOneWidget);
|
||||
});
|
||||
|
||||
//TODO: isn't this test just a duplicate of the above one? can be removed?
|
||||
//TODO: isn't this test just a duplicate of the above one? can be removed?
|
||||
testWidgets('save ingredient with incorrect weight input type', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(createMealItemFormScreen(meal1, '123', true));
|
||||
|
||||
@@ -298,38 +294,40 @@ void main() {
|
||||
expect(find.text('Please enter a valid number'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('save complete ingredient with correct weight input type',
|
||||
(WidgetTester tester) async {
|
||||
await tester.pumpWidget(createMealItemFormScreen(meal1, '123', true));
|
||||
testWidgets(
|
||||
'save complete ingredient with correct weight input type',
|
||||
(WidgetTester tester) async {
|
||||
await tester.pumpWidget(createMealItemFormScreen(meal1, '123', true));
|
||||
|
||||
final IngredientFormState formState = tester.state(find.byType(IngredientForm));
|
||||
final IngredientFormState formState = tester.state(find.byType(IngredientForm));
|
||||
|
||||
await tester.tap(find.byKey(const Key('scan-button')));
|
||||
await tester.pumpAndSettle();
|
||||
await tester.tap(find.byKey(const Key('scan-button')));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.byKey(const Key('ingredient-scan-result-dialog')), findsOneWidget);
|
||||
expect(find.byKey(const Key('ingredient-scan-result-dialog')), findsOneWidget);
|
||||
|
||||
await tester.tap(find.byKey(const Key('ingredient-scan-result-dialog-confirm-button')));
|
||||
await tester.pumpAndSettle();
|
||||
await tester.tap(find.byKey(const Key('ingredient-scan-result-dialog-confirm-button')));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(formState.ingredientIdController.text, '1');
|
||||
expect(formState.ingredientIdController.text, '1');
|
||||
|
||||
await tester.enterText(find.byKey(const Key('field-weight')), '2');
|
||||
await tester.enterText(find.byKey(const Key('field-weight')), '2');
|
||||
|
||||
// once ID and weight are set, it'll fetchIngredient and show macros preview and ingredient image
|
||||
when(mockNutrition.fetchIngredient(1)).thenAnswer((_) => Future.value(
|
||||
Ingredient.fromJson(jsonDecode(fixture('nutrition/ingredientinfo_59887.json'))),
|
||||
));
|
||||
await mockNetworkImagesFor(() => tester.pumpAndSettle());
|
||||
// once ID and weight are set, it'll fetchIngredient and show macros preview and ingredient image
|
||||
when(mockNutrition.fetchIngredient(1)).thenAnswer((_) => Future.value(
|
||||
Ingredient.fromJson(jsonDecode(fixture('nutrition/ingredientinfo_59887.json'))),
|
||||
));
|
||||
await mockNetworkImagesFor(() => tester.pumpAndSettle());
|
||||
|
||||
expect(find.byKey(const Key('ingredient-scan-result-dialog')), findsNothing);
|
||||
expect(find.byKey(const Key('ingredient-scan-result-dialog')), findsNothing);
|
||||
|
||||
await tester.tap(find.byKey(const Key(SUBMIT_BUTTON_KEY_NAME)));
|
||||
await tester.pumpAndSettle();
|
||||
await tester.tap(find.byKey(const Key(SUBMIT_BUTTON_KEY_NAME)));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(formState.mealItem.amount, 2);
|
||||
expect(formState.mealItem.amount, 2);
|
||||
|
||||
verify(mockNutrition.addMealItem(any, meal1));
|
||||
});
|
||||
verify(mockNutrition.addMealItem(any, meal1));
|
||||
},
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -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(),
|
||||
},
|
||||
|
||||
@@ -33,65 +33,70 @@ void main() {
|
||||
group('model tests', () {
|
||||
test('Test NutritionalPlan.nutritionalGoals based on meals', () {
|
||||
expect(
|
||||
plan.nutritionalGoals,
|
||||
NutritionalGoals(
|
||||
energy: 4118.75,
|
||||
protein: 32.75,
|
||||
carbohydrates: 347.5,
|
||||
carbohydratesSugar: 9.5,
|
||||
fat: 59.0,
|
||||
fatSaturated: 37.75,
|
||||
fiber: 52.5,
|
||||
sodium: 30.5));
|
||||
plan.nutritionalGoals,
|
||||
NutritionalGoals(
|
||||
energy: 4118.75,
|
||||
protein: 32.75,
|
||||
carbohydrates: 347.5,
|
||||
carbohydratesSugar: 9.5,
|
||||
fat: 59.0,
|
||||
fatSaturated: 37.75,
|
||||
fiber: 52.5,
|
||||
sodium: 30.5,
|
||||
),
|
||||
);
|
||||
});
|
||||
test('Test NutritionalPlan.nutritionalValues based on 3 macros and energy', () {
|
||||
expect(
|
||||
NutritionalPlan(
|
||||
description: '3 macros and energy defined',
|
||||
creationDate: DateTime(2024, 5, 4),
|
||||
goalProtein: 150,
|
||||
goalCarbohydrates: 100,
|
||||
goalFat: 100,
|
||||
goalEnergy: 1500,
|
||||
).nutritionalGoals,
|
||||
NutritionalGoals(
|
||||
energy: 1500,
|
||||
protein: 150,
|
||||
carbohydrates: 100,
|
||||
fat: 100,
|
||||
));
|
||||
NutritionalPlan(
|
||||
description: '3 macros and energy defined',
|
||||
creationDate: DateTime(2024, 5, 4),
|
||||
goalProtein: 150,
|
||||
goalCarbohydrates: 100,
|
||||
goalFat: 100,
|
||||
goalEnergy: 1500,
|
||||
).nutritionalGoals,
|
||||
NutritionalGoals(
|
||||
energy: 1500,
|
||||
protein: 150,
|
||||
carbohydrates: 100,
|
||||
fat: 100,
|
||||
),
|
||||
);
|
||||
});
|
||||
test('Test NutritionalPlan.nutritionalValues based on 2 macros and energy', () {
|
||||
expect(
|
||||
NutritionalPlan(
|
||||
description: '2 macros and energy defined',
|
||||
creationDate: DateTime(2024, 5, 4),
|
||||
goalProtein: 100,
|
||||
goalCarbohydrates: 100,
|
||||
goalEnergy: 1700,
|
||||
).nutritionalGoals,
|
||||
NutritionalGoals(
|
||||
energy: 1700,
|
||||
protein: 100,
|
||||
carbohydrates: 100,
|
||||
fat: 100, // inferred
|
||||
));
|
||||
NutritionalPlan(
|
||||
description: '2 macros and energy defined',
|
||||
creationDate: DateTime(2024, 5, 4),
|
||||
goalProtein: 100,
|
||||
goalCarbohydrates: 100,
|
||||
goalEnergy: 1700,
|
||||
).nutritionalGoals,
|
||||
NutritionalGoals(
|
||||
energy: 1700,
|
||||
protein: 100,
|
||||
carbohydrates: 100,
|
||||
fat: 100, // inferred
|
||||
),
|
||||
);
|
||||
});
|
||||
test('Test NutritionalPlan.nutritionalValues based on 3 macros only', () {
|
||||
expect(
|
||||
NutritionalPlan(
|
||||
description: '3 macros defined',
|
||||
creationDate: DateTime(2024, 5, 4),
|
||||
goalProtein: 100,
|
||||
goalCarbohydrates: 100,
|
||||
goalFat: 10,
|
||||
).nutritionalGoals,
|
||||
NutritionalGoals(
|
||||
energy: 890, // inferred
|
||||
protein: 100,
|
||||
carbohydrates: 100,
|
||||
fat: 10,
|
||||
));
|
||||
NutritionalPlan(
|
||||
description: '3 macros defined',
|
||||
creationDate: DateTime(2024, 5, 4),
|
||||
goalProtein: 100,
|
||||
goalCarbohydrates: 100,
|
||||
goalFat: 10,
|
||||
).nutritionalGoals,
|
||||
NutritionalGoals(
|
||||
energy: 890, // inferred
|
||||
protein: 100,
|
||||
carbohydrates: 100,
|
||||
fat: 10,
|
||||
),
|
||||
);
|
||||
});
|
||||
|
||||
test('Test the nutritionalValues method for meals', () {
|
||||
|
||||
@@ -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,7 +30,7 @@ import 'base_provider_test.mocks.dart';
|
||||
@GenerateMocks([http.Client])
|
||||
void main() {
|
||||
group('test base provider', () {
|
||||
test('Test the makeUrl helper', () async {
|
||||
test('Test the makeUrl helper', () {
|
||||
final WgerBaseProvider provider = WgerBaseProvider(testAuthProvider);
|
||||
|
||||
expect(
|
||||
@@ -63,7 +63,7 @@ void main() {
|
||||
);
|
||||
});
|
||||
|
||||
test('Test the makeUrl helper with sub url', () async {
|
||||
test('Test the makeUrl helper with sub url', () {
|
||||
// Trailing slash is removed when saving the server URL
|
||||
testAuthProvider.serverUrl = 'https://example.com/wger-url';
|
||||
final WgerBaseProvider provider = WgerBaseProvider(testAuthProvider);
|
||||
|
||||
@@ -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)),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ import 'package:wger/models/body_weight/weight_entry.dart';
|
||||
|
||||
void main() {
|
||||
group('fetchPost', () {
|
||||
test('Test that the weight entries are correctly converted to json', () async {
|
||||
test('Test that the weight entries are correctly converted to json', () {
|
||||
WeightEntry weightEntry = WeightEntry(id: 1, weight: 80, date: DateTime(2020, 12, 31));
|
||||
expect(weightEntry.toJson(), {'id': 1, 'weight': '80', 'date': '2020-12-31'});
|
||||
|
||||
@@ -29,7 +29,7 @@ void main() {
|
||||
expect(weightEntry.toJson(), {'id': 2, 'weight': '70.2', 'date': '2020-12-01'});
|
||||
});
|
||||
|
||||
test('Test that the weight entries are correctly converted from json', () async {
|
||||
test('Test that the weight entries are correctly converted from json', () {
|
||||
final WeightEntry weightEntryObj =
|
||||
WeightEntry(id: 1, weight: 80, date: DateTime(2020, 12, 31));
|
||||
final WeightEntry weightEntry = WeightEntry.fromJson({
|
||||
|
||||
@@ -93,14 +93,15 @@ void main() {
|
||||
);
|
||||
when(mockBaseProvider.makeUrl(any, query: anyNamed('query'))).thenReturn(uri);
|
||||
when(mockBaseProvider.deleteRequest('weightentry', 4)).thenAnswer(
|
||||
(_) => Future.value(Response("{'id': 4, 'date': '2021-01-01', 'weight': '80'}", 204)));
|
||||
(_) => Future.value(Response("{'id': 4, 'date': '2021-01-01', 'weight': '80'}", 204)),
|
||||
);
|
||||
|
||||
// DELETE the data from the server
|
||||
final BodyWeightProvider provider = BodyWeightProvider(mockBaseProvider);
|
||||
provider.items = [
|
||||
WeightEntry(id: 4, weight: 80, date: DateTime(2021, 1, 1)),
|
||||
WeightEntry(id: 2, weight: 100, date: DateTime(2021, 2, 2)),
|
||||
WeightEntry(id: 5, weight: 60, date: DateTime(2021, 2, 2))
|
||||
WeightEntry(id: 5, weight: 60, date: DateTime(2021, 2, 2)),
|
||||
];
|
||||
await provider.deleteEntry(4);
|
||||
|
||||
|
||||
@@ -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()},
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -22,7 +22,7 @@ import 'package:wger/helpers/gym_mode.dart';
|
||||
|
||||
void main() {
|
||||
group('Test the plate calculator', () {
|
||||
test('Regular weights', () async {
|
||||
test('Regular weights', () {
|
||||
expect(plateCalculator(40, BAR_WEIGHT, AVAILABLE_PLATES), [10]);
|
||||
expect(plateCalculator(100, BAR_WEIGHT, AVAILABLE_PLATES), [15, 15, 10]);
|
||||
expect(plateCalculator(102.5, BAR_WEIGHT, AVAILABLE_PLATES), [15, 15, 10, 1.25]);
|
||||
@@ -31,7 +31,7 @@ void main() {
|
||||
expect(plateCalculator(85, BAR_WEIGHT, AVAILABLE_PLATES), [15, 15, 2.5]);
|
||||
});
|
||||
|
||||
test('Exceptions', () async {
|
||||
test('Exceptions', () {
|
||||
expect(
|
||||
plateCalculator(10, BAR_WEIGHT, AVAILABLE_PLATES),
|
||||
[],
|
||||
@@ -47,7 +47,7 @@ void main() {
|
||||
});
|
||||
|
||||
group('Test the plate calculator group', () {
|
||||
test('Test groups', () async {
|
||||
test('Test groups', () {
|
||||
expect(groupPlates([15, 15, 15, 10, 10, 5]), {15: 3, 10: 2, 5: 1});
|
||||
expect(groupPlates([15, 10, 5, 1.25]), {15: 1, 10: 1, 5: 1, 1.25: 1});
|
||||
expect(groupPlates([10, 10, 10, 10, 10, 10, 10]), {10: 7});
|
||||
|
||||
@@ -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(),
|
||||
},
|
||||
|
||||
@@ -22,7 +22,7 @@ import '../../test_data/workouts.dart';
|
||||
|
||||
void main() {
|
||||
group('Test the getSmartTextRepr method for a set', () {
|
||||
test('Repetitions and weigh units', () async {
|
||||
test('Repetitions and weigh units', () {
|
||||
final workout = getWorkout();
|
||||
final set = workout.days.first.sets.first;
|
||||
final exercise1 = set.exerciseBasesObj[0];
|
||||
|
||||
@@ -23,7 +23,7 @@ import 'package:wger/models/workouts/weight_unit.dart';
|
||||
|
||||
void main() {
|
||||
group('Test the singleSettingRepText method', () {
|
||||
test('Default rep and weight units, no RiR', () async {
|
||||
test('Default rep and weight units, no RiR', () {
|
||||
const repUnit = RepetitionUnit(id: 1, name: 'mol');
|
||||
const weightUnit = WeightUnit(id: 1, name: 'mg');
|
||||
|
||||
@@ -36,7 +36,7 @@ void main() {
|
||||
expect(setting.singleSettingRepText, '2 × 30 mg');
|
||||
});
|
||||
|
||||
test('Default rep and weight units', () async {
|
||||
test('Default rep and weight units', () {
|
||||
const repUnit = RepetitionUnit(id: 1, name: 'mol');
|
||||
const weightUnit = WeightUnit(id: 1, name: 'mg');
|
||||
|
||||
@@ -49,7 +49,7 @@ void main() {
|
||||
expect(setting.singleSettingRepText, '2 × 30 mg \n (1.5 RiR)');
|
||||
});
|
||||
|
||||
test('No weight, default rep and weight units', () async {
|
||||
test('No weight, default rep and weight units', () {
|
||||
const repUnit = RepetitionUnit(id: 1, name: 'mol');
|
||||
const weightUnit = WeightUnit(id: 1, name: 'mg');
|
||||
|
||||
@@ -62,7 +62,7 @@ void main() {
|
||||
expect(setting.singleSettingRepText, '2 mol \n (1.5 RiR)');
|
||||
});
|
||||
|
||||
test('Custom rep and weight units, no RiR', () async {
|
||||
test('Custom rep and weight units, no RiR', () {
|
||||
const repUnit = RepetitionUnit(id: 2, name: 'mol');
|
||||
const weightUnit = WeightUnit(id: 2, name: 'mg');
|
||||
|
||||
@@ -75,7 +75,7 @@ void main() {
|
||||
expect(setting.singleSettingRepText, '2 mol × 30 mg');
|
||||
});
|
||||
|
||||
test('Custom rep and weight units, RiR', () async {
|
||||
test('Custom rep and weight units, RiR', () {
|
||||
const repUnit = RepetitionUnit(id: 2, name: 'mol');
|
||||
const weightUnit = WeightUnit(id: 2, name: 'mg');
|
||||
|
||||
|
||||
@@ -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(),
|
||||
},
|
||||
@@ -133,7 +131,11 @@ void main() {
|
||||
|
||||
testWidgets('Test creating a new workout - name and description', (WidgetTester tester) async {
|
||||
final editWorkout = WorkoutPlan(
|
||||
id: 2, creationDate: newPlan.creationDate, name: 'My workout', description: 'Get yuuuge');
|
||||
id: 2,
|
||||
creationDate: newPlan.creationDate,
|
||||
name: 'My workout',
|
||||
description: 'Get yuuuge',
|
||||
);
|
||||
when(mockWorkoutPlans.addWorkout(any)).thenAnswer((_) => Future.value(editWorkout));
|
||||
|
||||
await tester.pumpWidget(createHomeScreen(newPlan));
|
||||
|
||||
@@ -49,31 +49,31 @@ void main() {
|
||||
);
|
||||
});
|
||||
|
||||
test('Test equal values (besides Id, workoutPlan and date)', () async {
|
||||
test('Test equal values (besides Id, workoutPlan and date)', () {
|
||||
expect(log1, log2);
|
||||
});
|
||||
|
||||
test('Test different rir values', () async {
|
||||
test('Test different rir values', () {
|
||||
log1.rir = null;
|
||||
expect(log1, isNot(log2));
|
||||
});
|
||||
|
||||
test('Test different weight values', () async {
|
||||
test('Test different weight values', () {
|
||||
log1.weight = 100;
|
||||
expect(log1, isNot(log2));
|
||||
});
|
||||
|
||||
test('Test different weight units', () async {
|
||||
test('Test different weight units', () {
|
||||
log1.weightUnitId = 2;
|
||||
expect(log1, isNot(log2));
|
||||
});
|
||||
|
||||
test('Test different reps', () async {
|
||||
test('Test different reps', () {
|
||||
log1.reps = 99;
|
||||
expect(log1, isNot(log2));
|
||||
});
|
||||
|
||||
test('Test different rep units', () async {
|
||||
test('Test different rep units', () {
|
||||
log1.repetitionUnitId = 44;
|
||||
expect(log1, isNot(log2));
|
||||
});
|
||||
|
||||
@@ -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,14 +51,12 @@ 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',
|
||||
'creation_date': '2022-10-10',
|
||||
'description': 'Test workout abcd'
|
||||
'description': 'Test workout abcd',
|
||||
}),
|
||||
);
|
||||
|
||||
@@ -78,14 +76,12 @@ 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',
|
||||
'creation_date': '2022-10-10',
|
||||
'description': 'Test workout abcd'
|
||||
'description': 'Test workout abcd',
|
||||
}),
|
||||
);
|
||||
when(mockBaseProvider.deleteRequest('workout', 325397)).thenAnswer(
|
||||
|
||||
@@ -57,16 +57,15 @@ void main() {
|
||||
[workoutPlan],
|
||||
),
|
||||
child: ChangeNotifierProvider<ExercisesProvider>(
|
||||
create: (context) => mockExerciseProvider,
|
||||
child: MaterialApp(
|
||||
locale: Locale(locale),
|
||||
localizationsDelegates: AppLocalizations.localizationsDelegates,
|
||||
supportedLocales: AppLocalizations.supportedLocales,
|
||||
navigatorKey: GlobalKey<NavigatorState>(),
|
||||
home: Scaffold(
|
||||
body: SetFormWidget(day),
|
||||
),
|
||||
)),
|
||||
create: (context) => mockExerciseProvider,
|
||||
child: MaterialApp(
|
||||
locale: Locale(locale),
|
||||
localizationsDelegates: AppLocalizations.localizationsDelegates,
|
||||
supportedLocales: AppLocalizations.supportedLocales,
|
||||
navigatorKey: GlobalKey<NavigatorState>(),
|
||||
home: Scaffold(body: SetFormWidget(day)),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -89,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();
|
||||
|
||||
@@ -47,6 +47,6 @@ List<gallery.Image> getTestImages() {
|
||||
'https://raw.githubusercontent.com/wger-project/flutter/master/fastlane/metadata/android/en-US/images/phoneScreenshots/06%20-%20weight.png',
|
||||
description: '',
|
||||
date: DateTime(2021, 2, 22),
|
||||
)
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
@@ -202,7 +150,7 @@ final squatsTranslations = [
|
||||
squatsEN,
|
||||
squatsEL,
|
||||
squatsAR,
|
||||
squatsZH
|
||||
squatsZH,
|
||||
];
|
||||
|
||||
final benchPressDE = Translation(
|
||||
@@ -492,7 +440,7 @@ final crunchesTranslations = [
|
||||
crunchesRU,
|
||||
crunchesHE,
|
||||
crunchesAR,
|
||||
crunchesZH
|
||||
crunchesZH,
|
||||
];
|
||||
|
||||
final curlsEN = Translation(
|
||||
|
||||
@@ -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