diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b77669497..c79d98976 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,32 +5,32 @@ on: - '**.dart' - 'pubspec.yaml' pull_request: - branches: [ pull_request, master ] + branches: [ master, ] paths: - '**.dart' - 'pubspec.yaml' jobs: test: runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v1 + steps: + - uses: actions/checkout@v1 - - name: Install Flutter - uses: subosito/flutter-action@v1 - with: - channel: 'stable' - flutter-version: '3.7.x' + - name: Install Flutter + uses: subosito/flutter-action@v1 + with: + channel: 'stable' + flutter-version: '3.13.x' - - run: dart --version - - run: flutter --version + - run: dart --version + - run: flutter --version - - name: Install app dependencies - run: flutter pub get + - name: Install app dependencies + run: flutter pub get - - name: Test app - run: flutter test --coverage + - name: Test app + run: flutter test --coverage - - name: Coveralls - uses: coverallsapp/github-action@master - with: - github-token: ${{ secrets.GITHUB_TOKEN }} + - name: Coveralls + uses: coverallsapp/github-action@master + with: + github-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml index fd9879480..8ce6ddbad 100644 --- a/.github/workflows/linter.yml +++ b/.github/workflows/linter.yml @@ -20,7 +20,7 @@ jobs: uses: subosito/flutter-action@v1 with: channel: 'stable' - flutter-version: '3.7.x' + flutter-version: '3.13.x' - name: Get dependencies run: flutter pub get diff --git a/README.md b/README.md index 0e22ef2db..493c0a1c6 100644 --- a/README.md +++ b/README.md @@ -38,13 +38,12 @@ Alternatively, you can use the test server (the db is reset every day): * password: `flutteruser` * API key: `31e2ea0322c07b9df583a9b6d1e794f7139e78d4` - ### 2 Install Flutter, and all its dependencies, and create a new virtual device: . -The app currently uses flutter 3.7 +The app currently uses flutter 3.13 ### 3 diff --git a/android/build.gradle b/android/build.gradle index 58a8c74b1..713d7f6e6 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -26,6 +26,6 @@ subprojects { project.evaluationDependsOn(':app') } -task clean(type: Delete) { +tasks.register("clean", Delete) { delete rootProject.buildDir } diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 8169503c4..d8fa7f919 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -61,7 +61,7 @@ SPEC CHECKSUMS: image_picker_ios: 4a8aadfbb6dc30ad5141a2ce3832af9214a705b5 integration_test: a1e7d09bd98eca2fc37aefd79d4f41ad37bdbbe5 package_info_plus: 6c92f08e1f853dc01228d6f553146438dafcd14e - rive_common: 60ae7896ab40f9513974f36f015de33f70d2c5c5 + rive_common: b5b1aa30c63b8f0f00f32cddc9ea394d3d3473b5 shared_preferences_foundation: 986fc17f3d3251412d18b0265f9c64113a8c2472 url_launcher_ios: 08a3dfac5fb39e8759aeb0abbd5d9480f30fc8b4 video_player_avfoundation: 81e49bb3d9fb63dccf9fa0f6d877dc3ddbeac126 diff --git a/lib/exceptions/http_exception.dart b/lib/exceptions/http_exception.dart index 01be9d444..b442e34a2 100644 --- a/lib/exceptions/http_exception.dart +++ b/lib/exceptions/http_exception.dart @@ -29,12 +29,11 @@ class WgerHttpException implements Exception { errors = {'unknown_error': 'An unknown error occurred, no further information available'}; } else { try { - errors = json.decode(responseBody); + errors = {'unknown_error': json.decode(responseBody)}; } catch (e) { - errors = responseBody; + errors = {'unknown_error': responseBody}; } } - errors = errors; } @override diff --git a/lib/helpers/charts.dart b/lib/helpers/charts.dart new file mode 100644 index 000000000..64a0b6e84 --- /dev/null +++ b/lib/helpers/charts.dart @@ -0,0 +1,5 @@ +double chartGetInterval(DateTime first, DateTime last, {divider = 3}) { + final dayDiff = last.difference(first); + + return dayDiff.inMilliseconds == 0 ? 1000 : dayDiff.inMilliseconds.abs() / divider; +} diff --git a/lib/helpers/colors.dart b/lib/helpers/colors.dart new file mode 100644 index 000000000..62cb1cf49 --- /dev/null +++ b/lib/helpers/colors.dart @@ -0,0 +1,43 @@ +import 'dart:math'; +import 'dart:ui'; + +const LIST_OF_COLORS8 = [ + Color(0xFF2A4C7D), + Color(0xFF5B5291), + Color(0xFF8E5298), + Color(0xFFBF5092), + Color(0xFFE7537E), + Color(0xFFFF6461), + Color(0xFFFF813D), + Color(0xFFFFA600), +]; + +const LIST_OF_COLORS5 = [ + Color(0xFF2A4C7D), + Color(0xFF825298), + Color(0xFFD45089), + Color(0xFFFF6A59), + Color(0xFFFFA600), +]; + +const LIST_OF_COLORS3 = [ + Color(0xFF2A4C7D), + Color(0xFFD45089), + Color(0xFFFFA600), +]; + +Iterable generateChartColors(int nrOfItems) sync* { + final List colors; + + if (nrOfItems <= 3) { + colors = LIST_OF_COLORS3; + } else if (nrOfItems <= 5) { + colors = LIST_OF_COLORS5; + } else { + colors = LIST_OF_COLORS8; + } + + for (final color in colors) { + yield color; + } +} \ No newline at end of file diff --git a/lib/models/body_weight/weight_entry.g.dart b/lib/models/body_weight/weight_entry.g.dart index d1152d20e..60ee02c9b 100644 --- a/lib/models/body_weight/weight_entry.g.dart +++ b/lib/models/body_weight/weight_entry.g.dart @@ -18,7 +18,8 @@ WeightEntry _$WeightEntryFromJson(Map json) { ); } -Map _$WeightEntryToJson(WeightEntry instance) => { +Map _$WeightEntryToJson(WeightEntry instance) => + { 'id': instance.id, 'weight': numToString(instance.weight), 'date': toDate(instance.date), diff --git a/lib/models/exercises/base.g.dart b/lib/models/exercises/base.g.dart index d9f7c36ee..b57b9ebfa 100644 --- a/lib/models/exercises/base.g.dart +++ b/lib/models/exercises/base.g.dart @@ -24,18 +24,26 @@ ExerciseBase _$ExerciseBaseFromJson(Map json) { return ExerciseBase( id: json['id'] as int?, 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), variationId: json['variations'] as int?, ) ..categoryId = json['category'] as int - ..musclesIds = (json['muscles'] as List).map((e) => e as int).toList() - ..musclesSecondaryIds = - (json['muscles_secondary'] as List).map((e) => e as int).toList() - ..equipmentIds = (json['equipment'] as List).map((e) => e as int).toList(); + ..musclesIds = + (json['muscles'] as List).map((e) => e as int).toList() + ..musclesSecondaryIds = (json['muscles_secondary'] as List) + .map((e) => e as int) + .toList() + ..equipmentIds = + (json['equipment'] as List).map((e) => e as int).toList(); } -Map _$ExerciseBaseToJson(ExerciseBase instance) => { +Map _$ExerciseBaseToJson(ExerciseBase instance) => + { 'id': instance.id, 'uuid': instance.uuid, 'variations': instance.variationId, diff --git a/lib/models/exercises/category.g.dart b/lib/models/exercises/category.g.dart index 915120d13..19383107b 100644 --- a/lib/models/exercises/category.g.dart +++ b/lib/models/exercises/category.g.dart @@ -17,7 +17,8 @@ ExerciseCategory _$ExerciseCategoryFromJson(Map json) { ); } -Map _$ExerciseCategoryToJson(ExerciseCategory instance) => { +Map _$ExerciseCategoryToJson(ExerciseCategory instance) => + { 'id': instance.id, 'name': instance.name, }; diff --git a/lib/models/exercises/image.g.dart b/lib/models/exercises/image.g.dart index 6ef7c62e4..1240dc38d 100644 --- a/lib/models/exercises/image.g.dart +++ b/lib/models/exercises/image.g.dart @@ -20,7 +20,8 @@ ExerciseImage _$ExerciseImageFromJson(Map json) { ); } -Map _$ExerciseImageToJson(ExerciseImage instance) => { +Map _$ExerciseImageToJson(ExerciseImage instance) => + { 'id': instance.id, 'uuid': instance.uuid, 'exercise_base': instance.exerciseBaseId, diff --git a/lib/models/exercises/translation.g.dart b/lib/models/exercises/translation.g.dart index 642c2e7f2..d40525477 100644 --- a/lib/models/exercises/translation.g.dart +++ b/lib/models/exercises/translation.g.dart @@ -22,14 +22,17 @@ Translation _$TranslationFromJson(Map json) { return Translation( id: json['id'] as int?, 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, baseId: json['exercise_base'] as int?, )..languageId = json['language'] as int; } -Map _$TranslationToJson(Translation instance) => { +Map _$TranslationToJson(Translation instance) => + { 'id': instance.id, 'uuid': instance.uuid, 'language': instance.languageId, diff --git a/lib/models/measurements/measurement_category.g.dart b/lib/models/measurements/measurement_category.g.dart index eb887b2e7..ef4ebcd30 100644 --- a/lib/models/measurements/measurement_category.g.dart +++ b/lib/models/measurements/measurement_category.g.dart @@ -22,7 +22,9 @@ MeasurementCategory _$MeasurementCategoryFromJson(Map json) { ); } -Map _$MeasurementCategoryToJson(MeasurementCategory instance) => { +Map _$MeasurementCategoryToJson( + MeasurementCategory instance) => + { 'id': instance.id, 'name': instance.name, 'unit': instance.unit, diff --git a/lib/models/measurements/measurement_entry.g.dart b/lib/models/measurements/measurement_entry.g.dart index 7f6e346ad..4b0969600 100644 --- a/lib/models/measurements/measurement_entry.g.dart +++ b/lib/models/measurements/measurement_entry.g.dart @@ -20,7 +20,8 @@ MeasurementEntry _$MeasurementEntryFromJson(Map json) { ); } -Map _$MeasurementEntryToJson(MeasurementEntry instance) => { +Map _$MeasurementEntryToJson(MeasurementEntry instance) => + { 'id': instance.id, 'category': instance.category, 'date': toDate(instance.date), diff --git a/lib/models/nutrition/image.g.dart b/lib/models/nutrition/image.g.dart index 0bd0771d9..39272d16a 100644 --- a/lib/models/nutrition/image.g.dart +++ b/lib/models/nutrition/image.g.dart @@ -38,7 +38,8 @@ IngredientImage _$IngredientImageFromJson(Map json) { ); } -Map _$IngredientImageToJson(IngredientImage instance) => { +Map _$IngredientImageToJson(IngredientImage instance) => + { 'id': instance.id, 'uuid': instance.uuid, 'ingredient_id': instance.ingredientId, diff --git a/lib/models/nutrition/ingredient.g.dart b/lib/models/nutrition/ingredient.g.dart index d0ea8cfac..fcff133a6 100644 --- a/lib/models/nutrition/ingredient.g.dart +++ b/lib/models/nutrition/ingredient.g.dart @@ -43,7 +43,8 @@ Ingredient _$IngredientFromJson(Map json) { ); } -Map _$IngredientToJson(Ingredient instance) => { +Map _$IngredientToJson(Ingredient instance) => + { 'id': instance.id, 'code': instance.code, 'name': instance.name, diff --git a/lib/models/nutrition/ingredient_weight_unit.g.dart b/lib/models/nutrition/ingredient_weight_unit.g.dart index f147a2ee1..74b1f1015 100644 --- a/lib/models/nutrition/ingredient_weight_unit.g.dart +++ b/lib/models/nutrition/ingredient_weight_unit.g.dart @@ -13,14 +13,16 @@ IngredientWeightUnit _$IngredientWeightUnitFromJson(Map json) { ); return IngredientWeightUnit( id: json['id'] as int, - weightUnit: WeightUnit.fromJson(json['weight_unit'] as Map), + weightUnit: + WeightUnit.fromJson(json['weight_unit'] as Map), ingredient: Ingredient.fromJson(json['ingredient'] as Map), grams: json['grams'] as int, amount: (json['amount'] as num).toDouble(), ); } -Map _$IngredientWeightUnitToJson(IngredientWeightUnit instance) => +Map _$IngredientWeightUnitToJson( + IngredientWeightUnit instance) => { 'id': instance.id, 'weight_unit': instance.weightUnit, diff --git a/lib/models/nutrition/log.g.dart b/lib/models/nutrition/log.g.dart index 616901551..390687681 100644 --- a/lib/models/nutrition/log.g.dart +++ b/lib/models/nutrition/log.g.dart @@ -9,7 +9,14 @@ part of 'log.dart'; Log _$LogFromJson(Map 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 int?, diff --git a/lib/models/nutrition/nutritional_plan.dart b/lib/models/nutrition/nutritional_plan.dart index 053fecc28..978304c23 100644 --- a/lib/models/nutrition/nutritional_plan.dart +++ b/lib/models/nutrition/nutritional_plan.dart @@ -82,6 +82,30 @@ class NutritionalPlan { return out; } + NutritionalValues get nutritionalValuesToday { + final now = DateTime.now(); + final today = DateTime(now.year, now.month, now.day); + + return logEntriesValues.containsKey(today) ? logEntriesValues[today]! : NutritionalValues(); + } + + NutritionalValues get nutritionalValues7DayAvg { + final currentDate = DateTime.now(); + final sevenDaysAgo = currentDate.subtract(Duration(days: 7)); + + final entries = logs.where((obj) { + DateTime objDate = obj.datetime; + return objDate.isAfter(sevenDaysAgo) && objDate.isBefore(currentDate); + }).toList(); + + var out = NutritionalValues(); + entries.forEach((log) { + out = out + log.nutritionalValues; + }); + + return out; + } + /// Calculates the percentage each macro nutrient adds to the total energy BaseNutritionalValues energyPercentage(NutritionalValues values) { return BaseNutritionalValues( diff --git a/lib/models/nutrition/nutritional_plan.g.dart b/lib/models/nutrition/nutritional_plan.g.dart index 661a9f47a..9b10d8a5a 100644 --- a/lib/models/nutrition/nutritional_plan.g.dart +++ b/lib/models/nutrition/nutritional_plan.g.dart @@ -18,7 +18,8 @@ NutritionalPlan _$NutritionalPlanFromJson(Map json) { ); } -Map _$NutritionalPlanToJson(NutritionalPlan instance) => { +Map _$NutritionalPlanToJson(NutritionalPlan instance) => + { 'id': instance.id, 'description': instance.description, 'creation_date': toDate(instance.creationDate), diff --git a/lib/models/nutrition/weight_unit.g.dart b/lib/models/nutrition/weight_unit.g.dart index 6f2b9607e..74e1f0cfb 100644 --- a/lib/models/nutrition/weight_unit.g.dart +++ b/lib/models/nutrition/weight_unit.g.dart @@ -17,7 +17,8 @@ WeightUnit _$WeightUnitFromJson(Map json) { ); } -Map _$WeightUnitToJson(WeightUnit instance) => { +Map _$WeightUnitToJson(WeightUnit instance) => + { 'id': instance.id, 'name': instance.name, }; diff --git a/lib/models/user/profile.g.dart b/lib/models/user/profile.g.dart index fc05b9cf2..d9147ebe9 100644 --- a/lib/models/user/profile.g.dart +++ b/lib/models/user/profile.g.dart @@ -9,7 +9,12 @@ part of 'profile.dart'; Profile _$ProfileFromJson(Map json) { $checkKeys( json, - requiredKeys: const ['username', 'email_verified', 'is_trustworthy', 'email'], + requiredKeys: const [ + 'username', + 'email_verified', + 'is_trustworthy', + 'email' + ], ); return Profile( username: json['username'] as String, diff --git a/lib/models/workouts/repetition_unit.g.dart b/lib/models/workouts/repetition_unit.g.dart index 33e6a815e..115dc338c 100644 --- a/lib/models/workouts/repetition_unit.g.dart +++ b/lib/models/workouts/repetition_unit.g.dart @@ -17,7 +17,8 @@ RepetitionUnit _$RepetitionUnitFromJson(Map json) { ); } -Map _$RepetitionUnitToJson(RepetitionUnit instance) => { +Map _$RepetitionUnitToJson(RepetitionUnit instance) => + { 'id': instance.id, 'name': instance.name, }; diff --git a/lib/models/workouts/session.g.dart b/lib/models/workouts/session.g.dart index 79f4fee41..e16affadb 100644 --- a/lib/models/workouts/session.g.dart +++ b/lib/models/workouts/session.g.dart @@ -9,7 +9,14 @@ part of 'session.dart'; WorkoutSession _$WorkoutSessionFromJson(Map 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 int? @@ -21,7 +28,8 @@ WorkoutSession _$WorkoutSessionFromJson(Map json) { ..timeEnd = stringToTime(json['time_end'] as String?); } -Map _$WorkoutSessionToJson(WorkoutSession instance) => { +Map _$WorkoutSessionToJson(WorkoutSession instance) => + { 'id': instance.id, 'workout': instance.workoutId, 'date': toDate(instance.date), diff --git a/lib/models/workouts/weight_unit.g.dart b/lib/models/workouts/weight_unit.g.dart index 6f2b9607e..74e1f0cfb 100644 --- a/lib/models/workouts/weight_unit.g.dart +++ b/lib/models/workouts/weight_unit.g.dart @@ -17,7 +17,8 @@ WeightUnit _$WeightUnitFromJson(Map json) { ); } -Map _$WeightUnitToJson(WeightUnit instance) => { +Map _$WeightUnitToJson(WeightUnit instance) => + { 'id': instance.id, 'name': instance.name, }; diff --git a/lib/models/workouts/workout_plan.g.dart b/lib/models/workouts/workout_plan.g.dart index ac1d6fa9f..ef156e3e0 100644 --- a/lib/models/workouts/workout_plan.g.dart +++ b/lib/models/workouts/workout_plan.g.dart @@ -19,7 +19,8 @@ WorkoutPlan _$WorkoutPlanFromJson(Map json) { ); } -Map _$WorkoutPlanToJson(WorkoutPlan instance) => { +Map _$WorkoutPlanToJson(WorkoutPlan instance) => + { 'id': instance.id, 'creation_date': instance.creationDate.toIso8601String(), 'name': instance.name, diff --git a/lib/providers/nutrition.dart b/lib/providers/nutrition.dart index f6f17e8f9..789008a30 100644 --- a/lib/providers/nutrition.dart +++ b/lib/providers/nutrition.dart @@ -415,7 +415,7 @@ class NutritionPlansProvider with ChangeNotifier { final data = await baseProvider.fetchPaginated( baseProvider.makeUrl( _nutritionDiaryPath, - query: {'plan': plan.id.toString(), 'limit': '999'}, + query: {'plan': plan.id.toString(), 'limit': '999', 'ordering': 'datetime'}, ), ); diff --git a/lib/theme/theme.dart b/lib/theme/theme.dart index 042a98138..1ba04fac7 100644 --- a/lib/theme/theme.dart +++ b/lib/theme/theme.dart @@ -16,7 +16,6 @@ * along with this program. If not, see . */ -import 'package:community_charts_flutter/community_charts_flutter.dart' as charts; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:table_calendar/table_calendar.dart'; @@ -30,8 +29,6 @@ const Color wgerTextMuted = Colors.black38; const Color wgerBackground = Color(0xfff4f4f6); // Chart colors -const charts.Color wgerChartPrimaryColor = charts.Color(r: 0x2a, g: 0x4c, b: 0x7d); -const charts.Color wgerChartSecondaryColor = charts.Color(r: 0xe6, g: 0x39, b: 0x46); /// Original sizes for the material text theme /// https://api.flutter.dev/flutter/material/TextTheme-class.html diff --git a/lib/widgets/core/charts.dart b/lib/widgets/core/charts.dart deleted file mode 100644 index d2f335450..000000000 --- a/lib/widgets/core/charts.dart +++ /dev/null @@ -1,59 +0,0 @@ -/* - * This file is part of wger Workout Manager . - * Copyright (C) 2020, 2021 wger Team - * - * wger Workout Manager is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * wger Workout Manager is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -import 'package:community_charts_flutter/community_charts_flutter.dart' as charts; -import 'package:flutter/widgets.dart'; -import 'package:wger/theme/theme.dart'; - -class MeasurementChartEntry { - num value; - DateTime date; - - MeasurementChartEntry(this.value, this.date); -} - -/// Weight chart widget -class MeasurementChartWidget extends StatelessWidget { - final List _entries; - final String unit; - - /// [_entries] is a list of [MeasurementChartEntry] - const MeasurementChartWidget(this._entries, {this.unit = 'kg'}); - - @override - Widget build(BuildContext context) { - final unitTickFormatter = charts.BasicNumericTickFormatterSpec((num? value) => '$value $unit'); - - return charts.TimeSeriesChart( - [ - charts.Series( - id: 'Measurement', - colorFn: (_, __) => wgerChartSecondaryColor, - domainFn: (MeasurementChartEntry entry, _) => entry.date, - measureFn: (MeasurementChartEntry entry, _) => entry.value, - data: _entries, - ) - ], - defaultRenderer: charts.LineRendererConfig(includePoints: true), - primaryMeasureAxis: charts.NumericAxisSpec( - tickProviderSpec: const charts.BasicNumericTickProviderSpec(zeroBound: false), - tickFormatterSpec: unitTickFormatter, - ), - ); - } -} diff --git a/lib/widgets/dashboard/widgets.dart b/lib/widgets/dashboard/widgets.dart index be6f74cea..c1e02b026 100644 --- a/lib/widgets/dashboard/widgets.dart +++ b/lib/widgets/dashboard/widgets.dart @@ -35,7 +35,7 @@ import 'package:wger/screens/nutritional_plan_screen.dart'; import 'package:wger/screens/weight_screen.dart'; import 'package:wger/screens/workout_plan_screen.dart'; import 'package:wger/theme/theme.dart'; -import 'package:wger/widgets/core/charts.dart'; +import 'package:wger/widgets/measurements/charts.dart'; import 'package:wger/widgets/core/core.dart'; import 'package:wger/widgets/measurements/categories_card.dart'; import 'package:wger/widgets/measurements/forms.dart'; @@ -182,18 +182,15 @@ class _DashboardNutritionWidgetState extends State { }, ), if (_hasContent) - Container( - padding: const EdgeInsets.only(left: 10), - child: Column( - children: [ - ...getContent(), - Container( - padding: const EdgeInsets.all(15), - height: 180, - child: NutritionalPlanPieChartWidget(_plan!.nutritionalValues), - ) - ], - ), + Column( + children: [ + ...getContent(), + Container( + padding: const EdgeInsets.all(15), + height: 180, + child: FlNutritionalPlanPieChartWidget(_plan!.nutritionalValues), + ) + ], ) else NothingFound( @@ -267,9 +264,8 @@ class _DashboardWeightWidgetState extends State { Column( children: [ Container( - padding: const EdgeInsets.all(15), - height: 180, - child: MeasurementChartWidget(weightEntriesData.items + height: 200, + child: MeasurementChartWidgetFl(weightEntriesData.items .map((e) => MeasurementChartEntry(e.weight, e.date)) .toList()), ), @@ -344,81 +340,82 @@ class _DashboardMeasurementWidgetState extends State ); } return Consumer( - builder: (context, workoutProvider, child) => Card( - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - ListTile( - title: Text( - AppLocalizations.of(context).measurements, - style: Theme.of(context).textTheme.headline4, - ), - leading: const FaIcon( - FontAwesomeIcons.weight, - color: Colors.black, - ), - trailing: IconButton( - icon: const Icon(Icons.arrow_forward), - onPressed: () => Navigator.pushNamed( - context, - MeasurementCategoriesScreen.routeName, - ), - ), - ), - Column( - children: [ - if (items.isNotEmpty) - Column(children: [ - CarouselSlider( - items: items, - carouselController: _controller, - options: CarouselOptions( - autoPlay: false, - enlargeCenterPage: false, - viewportFraction: 1, - enableInfiniteScroll: false, - aspectRatio: 1.1, - onPageChanged: (index, reason) { - setState(() { - _current = index; - }); - }), + builder: (context, workoutProvider, child) => Card( + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + ListTile( + title: Text( + AppLocalizations.of(context).measurements, + style: Theme.of(context).textTheme.headline4, ), - Padding( - padding: const EdgeInsets.only(bottom: 10), - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: items.asMap().entries.map((entry) { - return GestureDetector( - onTap: () => _controller.animateToPage(entry.key), - child: Container( - width: 12.0, - height: 12.0, - margin: const EdgeInsets.symmetric(vertical: 8.0, horizontal: 4.0), - decoration: BoxDecoration( - shape: BoxShape.circle, - color: (Theme.of(context).brightness == Brightness.dark - ? Colors.white - : wgerPrimaryColor) - .withOpacity(_current == entry.key ? 0.9 : 0.4)), - ), - ); - }).toList(), + leading: const FaIcon( + FontAwesomeIcons.weight, + color: Colors.black, + ), + trailing: IconButton( + icon: const Icon(Icons.arrow_forward), + onPressed: () => Navigator.pushNamed( + context, + MeasurementCategoriesScreen.routeName, ), ), - ]) - else - NothingFound( - AppLocalizations.of(context).noMeasurementEntries, - AppLocalizations.of(context).newEntry, - MeasurementCategoryForm(), ), - ], - ), - ], - ), - ), - ); + Column( + children: [ + if (items.isNotEmpty) + Column(children: [ + CarouselSlider( + items: items, + carouselController: _controller, + options: CarouselOptions( + autoPlay: false, + enlargeCenterPage: false, + viewportFraction: 1, + enableInfiniteScroll: false, + aspectRatio: 1.1, + onPageChanged: (index, reason) { + setState(() { + _current = index; + }); + }), + ), + Padding( + padding: const EdgeInsets.only(bottom: 10), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: items.asMap().entries.map( + (entry) { + return GestureDetector( + onTap: () => _controller.animateToPage(entry.key), + child: Container( + width: 12.0, + height: 12.0, + margin: EdgeInsets.symmetric(vertical: 8.0, horizontal: 4.0), + decoration: BoxDecoration( + shape: BoxShape.circle, + color: (Theme.of(context).brightness == Brightness.dark + ? Colors.white + : wgerPrimaryColor) + .withOpacity(_current == entry.key ? 0.9 : 0.4)), + ), + ); + }, + ).toList(), + ), + ), + ]) + else + NothingFound( + AppLocalizations.of(context).noMeasurementEntries, + AppLocalizations.of(context).newEntry, + MeasurementCategoryForm(), + ), + ], + ), + ], + ), + )); } } diff --git a/lib/widgets/measurements/categories_card.dart b/lib/widgets/measurements/categories_card.dart index e42dd068f..bbe89cfc3 100644 --- a/lib/widgets/measurements/categories_card.dart +++ b/lib/widgets/measurements/categories_card.dart @@ -4,7 +4,7 @@ import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import '../../models/measurements/measurement_category.dart'; import '../../screens/form_screen.dart'; import '../../screens/measurement_entries_screen.dart'; -import '../core/charts.dart'; +import 'charts.dart'; import 'forms.dart'; class CategoriesCard extends StatelessWidget { @@ -27,10 +27,9 @@ class CategoriesCard extends StatelessWidget { ), ), Container( - color: Colors.white, padding: const EdgeInsets.all(10), height: 220, - child: MeasurementChartWidget( + child: MeasurementChartWidgetFl( currentCategory.entries.map((e) => MeasurementChartEntry(e.value, e.date)).toList(), unit: currentCategory.unit, ), diff --git a/lib/widgets/measurements/charts.dart b/lib/widgets/measurements/charts.dart new file mode 100644 index 000000000..fdbae75f4 --- /dev/null +++ b/lib/widgets/measurements/charts.dart @@ -0,0 +1,200 @@ +/* + * This file is part of wger Workout Manager . + * Copyright (C) 2020, 2021 wger Team + * + * wger Workout Manager is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * wger Workout Manager is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +import 'package:fl_chart/fl_chart.dart'; +import 'package:flutter/material.dart'; +import 'package:intl/intl.dart'; +import 'package:wger/helpers/charts.dart'; +import 'package:wger/theme/theme.dart'; + +class MeasurementChartWidgetFl extends StatefulWidget { + final List _entries; + final String unit; + + const MeasurementChartWidgetFl(this._entries, {this.unit = 'kg'}); + + @override + State createState() => _MeasurementChartWidgetFlState(); +} + +class _MeasurementChartWidgetFlState extends State { + @override + Widget build(BuildContext context) { + return AspectRatio( + aspectRatio: 1.70, + child: Padding( + padding: const EdgeInsets.only( + right: 18, + left: 12, + top: 24, + bottom: 12, + ), + child: LineChart( + mainData(), + ), + ), + ); + } + + LineTouchData tooltipData() { + return LineTouchData(touchTooltipData: LineTouchTooltipData(getTooltipItems: (touchedSpots) { + return touchedSpots.map((touchedSpot) { + return LineTooltipItem( + '${touchedSpot.y} kg', + const TextStyle(color: Colors.red, fontWeight: FontWeight.bold), + ); + }).toList(); + })); + } + + LineChartData mainData() { + return LineChartData( + lineTouchData: tooltipData(), + gridData: FlGridData( + show: true, + drawVerticalLine: true, + //horizontalInterval: 1, + //verticalInterval: interval, + getDrawingHorizontalLine: (value) { + return FlLine( + color: Colors.grey, + strokeWidth: 1, + ); + }, + getDrawingVerticalLine: (value) { + return FlLine( + color: Colors.grey, + strokeWidth: 1, + ); + }, + ), + titlesData: FlTitlesData( + show: true, + rightTitles: AxisTitles( + sideTitles: SideTitles(showTitles: false), + ), + topTitles: AxisTitles( + sideTitles: SideTitles(showTitles: false), + ), + bottomTitles: AxisTitles( + sideTitles: SideTitles( + showTitles: true, + getTitlesWidget: (value, meta) { + // Don't show the first and last entries, otherwise they'll overlap with the + // calculated interval + if (value == meta.min || value == meta.max) { + return const Text(''); + } + final DateTime date = DateTime.fromMillisecondsSinceEpoch(value.toInt()); + return Text( + DateFormat.yMd(Localizations.localeOf(context).languageCode).format(date), + ); + }, + interval: widget._entries.isNotEmpty + ? chartGetInterval(widget._entries.last.date, widget._entries.first.date) + : 1000, + ), + ), + leftTitles: AxisTitles( + sideTitles: SideTitles( + showTitles: true, + reservedSize: 65, + getTitlesWidget: (value, meta) { + return Text( + '$value ${widget.unit}', + ); + }, + ), + ), + ), + borderData: FlBorderData( + show: true, + border: Border.all(color: const Color(0xff37434d)), + ), + lineBarsData: [ + LineChartBarData( + spots: [ + ...widget._entries + .map((e) => FlSpot(e.date.millisecondsSinceEpoch.toDouble(), e.value.toDouble())) + ], + isCurved: false, + color: wgerSecondaryColor, + barWidth: 2, + isStrokeCapRound: true, + dotData: FlDotData( + show: true, + ), + ), + ], + ); + } +} + +class MeasurementChartEntry { + num value; + DateTime date; + + MeasurementChartEntry(this.value, this.date); +} + +class Indicator extends StatelessWidget { + const Indicator({ + super.key, + required this.color, + required this.text, + required this.isSquare, + this.size = 16, + this.marginRight = 15, + this.textColor, + }); + + final Color color; + final String text; + final bool isSquare; + final double size; + final double marginRight; + final Color? textColor; + + @override + Widget build(BuildContext context) { + return Row( + children: [ + Container( + width: size, + height: size, + decoration: BoxDecoration( + shape: isSquare ? BoxShape.rectangle : BoxShape.circle, + color: color, + ), + ), + const SizedBox( + width: 4, + ), + Text( + text, + style: TextStyle( + color: textColor, + ), + ), + SizedBox( + width: marginRight, + ), + ], + ); + } +} diff --git a/lib/widgets/measurements/entries.dart b/lib/widgets/measurements/entries.dart index 416159ed0..55b2023f2 100644 --- a/lib/widgets/measurements/entries.dart +++ b/lib/widgets/measurements/entries.dart @@ -24,7 +24,7 @@ import 'package:wger/models/measurements/measurement_category.dart'; import 'package:wger/providers/measurement.dart'; import 'package:wger/screens/form_screen.dart'; import 'package:wger/theme/theme.dart'; -import 'package:wger/widgets/core/charts.dart'; +import 'package:wger/widgets/measurements/charts.dart'; import 'forms.dart'; @@ -40,7 +40,7 @@ class EntriesList extends StatelessWidget { color: Theme.of(context).cardColor, padding: const EdgeInsets.all(10), height: 220, - child: MeasurementChartWidget( + child: MeasurementChartWidgetFl( _category.entries.map((e) => MeasurementChartEntry(e.value, e.date)).toList(), unit: _category.unit, ), diff --git a/lib/widgets/nutrition/charts.dart b/lib/widgets/nutrition/charts.dart index 1873c5cf0..24e605ad0 100644 --- a/lib/widgets/nutrition/charts.dart +++ b/lib/widgets/nutrition/charts.dart @@ -16,13 +16,14 @@ * along with this program. If not, see . */ -import 'package:collection/collection.dart'; -import 'package:community_charts_flutter/community_charts_flutter.dart' as charts; -import 'package:flutter/widgets.dart'; +import 'package:fl_chart/fl_chart.dart'; +import 'package:flutter/material.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; +import 'package:intl/intl.dart'; +import 'package:wger/helpers/colors.dart'; import 'package:wger/models/nutrition/nutritional_plan.dart'; import 'package:wger/models/nutrition/nutritional_values.dart'; -import 'package:wger/theme/theme.dart'; +import 'package:wger/widgets/measurements/charts.dart'; class NutritionData { final String name; @@ -31,61 +32,130 @@ class NutritionData { NutritionData(this.name, this.value); } -/// Nutritional plan pie chart widget -class NutritionalPlanPieChartWidget extends StatelessWidget { - final NutritionalValues _nutritionalValues; +class FlNutritionalPlanPieChartWidget extends StatefulWidget { + final NutritionalValues nutritionalValues; - /// [_nutritionalValues] are the calculated [NutritionalValues] for the wanted - /// plan. - const NutritionalPlanPieChartWidget(this._nutritionalValues); + const FlNutritionalPlanPieChartWidget(this.nutritionalValues); @override - Widget build(BuildContext context) { - if (_nutritionalValues.energy == 0) { - return Container(); - } + State createState() => FlNutritionalPlanPieChartState(); +} - return charts.PieChart([ - charts.Series( - id: 'NutritionalValues', - domainFn: (nutritionEntry, index) => nutritionEntry.name, - measureFn: (nutritionEntry, index) => nutritionEntry.value, - data: [ - NutritionData( - AppLocalizations.of(context).protein, - _nutritionalValues.protein, - ), - NutritionData( - AppLocalizations.of(context).fat, - _nutritionalValues.fat, - ), - NutritionData( - AppLocalizations.of(context).carbohydrates, - _nutritionalValues.carbohydrates, +class FlNutritionalPlanPieChartState extends State { + int touchedIndex = -1; + + @override + Widget build(BuildContext context) { + return Row( + children: [ + const SizedBox( + height: 18, + ), + Expanded( + child: AspectRatio( + aspectRatio: 1, + child: PieChart( + PieChartData( + pieTouchData: PieTouchData( + touchCallback: (FlTouchEvent event, pieTouchResponse) { + setState(() { + if (!event.isInterestedForInteractions || + pieTouchResponse == null || + pieTouchResponse.touchedSection == null) { + touchedIndex = -1; + return; + } + touchedIndex = pieTouchResponse.touchedSection!.touchedSectionIndex; + }); + }, + ), + borderData: FlBorderData( + show: false, + ), + sectionsSpace: 0, + centerSpaceRadius: 0, + sections: showingSections(), + ), + ), ), - ], - labelAccessorFn: (NutritionData row, _) => - '${row.name}\n${row.value.toStringAsFixed(0)}${AppLocalizations.of(context).g}', - ) - ], - defaultRenderer: charts.ArcRendererConfig(arcWidth: 60, arcRendererDecorators: [ - charts.ArcLabelDecorator( - labelPosition: charts.ArcLabelPosition.outside, - ) - ]) - /* - defaultRenderer: new charts.ArcRendererConfig( - arcWidth: 60, - arcRendererDecorators: [new charts.ArcLabelDecorator()], - ), + ), + Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Indicator( + color: LIST_OF_COLORS3[0], + text: AppLocalizations.of(context).fat, + isSquare: true, + ), + const SizedBox( + height: 4, + ), + Indicator( + color: LIST_OF_COLORS3[1], + text: AppLocalizations.of(context).protein, + isSquare: true, + ), + const SizedBox( + height: 4, + ), + Indicator( + color: LIST_OF_COLORS3[2], + text: AppLocalizations.of(context).carbohydrates, + isSquare: true, + ), + ], + ), + const SizedBox( + width: 28, + ), + ], + ); + } - */ - ); + List showingSections() { + final colors = generateChartColors(3).iterator; + + return List.generate(3, (i) { + final isTouched = i == touchedIndex; + final radius = isTouched ? 92.0 : 80.0; + colors.moveNext(); + + switch (i) { + case 0: + return PieChartSectionData( + color: colors.current, + value: widget.nutritionalValues.fat, + title: '${widget.nutritionalValues.fat.toStringAsFixed(0)}g', + titlePositionPercentageOffset: 0.5, + radius: radius, + titleStyle: const TextStyle(color: Colors.white70)); + case 1: + return PieChartSectionData( + color: colors.current, + value: widget.nutritionalValues.protein, + title: '${widget.nutritionalValues.protein.toStringAsFixed(0)}g', + titlePositionPercentageOffset: 0.5, + radius: radius, + ); + case 2: + return PieChartSectionData( + color: colors.current, + value: widget.nutritionalValues.carbohydrates, + title: '${widget.nutritionalValues.carbohydrates.toStringAsFixed(0)}g', + titlePositionPercentageOffset: 0.5, + radius: radius, + ); + + default: + throw Error(); + } + }); } } -class NutritionalDiaryChartWidget extends StatelessWidget { - const NutritionalDiaryChartWidget({ +class NutritionalDiaryChartWidgetFl extends StatefulWidget { + const NutritionalDiaryChartWidgetFl({ Key? key, required NutritionalPlan nutritionalPlan, }) : _nutritionalPlan = nutritionalPlan, @@ -94,337 +164,421 @@ class NutritionalDiaryChartWidget extends StatelessWidget { final NutritionalPlan _nutritionalPlan; @override - Widget build(BuildContext context) { - return charts.TimeSeriesChart( - [ - charts.Series, DateTime>( - id: 'NutritionDiary', - colorFn: (datum, index) => wgerChartSecondaryColor, - domainFn: (datum, index) => datum[1], - measureFn: (datum, index) => datum[0].energy, - data: _nutritionalPlan.logEntriesValues.keys - .map((e) => [_nutritionalPlan.logEntriesValues[e], e]) - .toList(), - ) - ], - defaultRenderer: charts.BarRendererConfig(), - behaviors: [ - charts.RangeAnnotation([ - charts.LineAnnotationSegment( - _nutritionalPlan.nutritionalValues.energy, - charts.RangeAnnotationAxisType.measure, - strokeWidthPx: 2, - color: charts.MaterialPalette.gray.shade600, - ), - ]), - ], - ); - } + State createState() => NutritionalDiaryChartWidgetFlState(); } -/// Nutritional plan hatch bar chart widget -class NutritionalPlanHatchBarChartWidget extends StatelessWidget { - final NutritionalPlan _nutritionalPlan; - - /// [_nutritionalPlan] is current opened nutrition plan as plan detail. - const NutritionalPlanHatchBarChartWidget(this._nutritionalPlan); - - NutritionalValues nutritionalValuesFromPlanLogsSevenDayAvg() { - NutritionalValues sevenDaysAvg = NutritionalValues(); - int count = 0; - - final now = DateTime.now(); - final today = DateTime(now.year, now.month, now.day); - - _nutritionalPlan.logEntriesValues.forEach((key, value) { - if (key.difference(today).inDays >= -7) { - sevenDaysAvg += value; - count++; - } - }); - - if (count != 0) { - sevenDaysAvg.energy = sevenDaysAvg.energy / count; - sevenDaysAvg.protein = sevenDaysAvg.protein / count; - sevenDaysAvg.carbohydrates = sevenDaysAvg.carbohydrates / count; - sevenDaysAvg.carbohydratesSugar = sevenDaysAvg.carbohydratesSugar / count; - sevenDaysAvg.fat = sevenDaysAvg.fat / count; - sevenDaysAvg.fatSaturated = sevenDaysAvg.fatSaturated / count; - sevenDaysAvg.fibres = sevenDaysAvg.fibres / count; - sevenDaysAvg.sodium = sevenDaysAvg.sodium / count; +class NutritionalDiaryChartWidgetFlState extends State { + Widget bottomTitles(double value, TitleMeta meta) { + const style = TextStyle(fontSize: 10); + String text; + switch (value.toInt()) { + case 0: + text = AppLocalizations.of(context).protein; + break; + case 1: + text = AppLocalizations.of(context).carbohydrates; + break; + case 2: + text = AppLocalizations.of(context).sugars; + break; + case 3: + text = AppLocalizations.of(context).fat; + break; + case 4: + text = AppLocalizations.of(context).saturatedFat; + break; + + default: + text = ''; + break; } - - return sevenDaysAvg; + return SideTitleWidget( + axisSide: meta.axisSide, + child: Text(text, style: style), + ); } - NutritionalValues nutritionalValuesFromPlanLogsToday() { - final now = DateTime.now(); - final today = DateTime(now.year, now.month, now.day); - - return _nutritionalPlan.logEntriesValues[_nutritionalPlan.logEntriesValues.keys - .firstWhereOrNull((d) => d.difference(today).inDays == 0)] ?? - NutritionalValues(); + Widget leftTitles(double value, TitleMeta meta) { + if (value == meta.max) { + return Container(); + } + const style = TextStyle( + fontSize: 10, + ); + return SideTitleWidget( + axisSide: meta.axisSide, + child: Text( + meta.formattedValue, + style: style, + ), + ); } @override Widget build(BuildContext context) { - final NutritionalValues loggedNutritionalValues = nutritionalValuesFromPlanLogsToday(); - final NutritionalValues sevenDayAvg = nutritionalValuesFromPlanLogsSevenDayAvg(); - - if (_nutritionalPlan.nutritionalValues.energy == 0) { - return Container(); - } - - return Column( - children: [ - Container( - padding: const EdgeInsets.all(15), - height: 220, - child: charts.BarChart( - [ - charts.Series( - id: 'Planned', - domainFn: (nutritionEntry, index) => nutritionEntry.name, - measureFn: (nutritionEntry, index) => nutritionEntry.value, - data: [ - NutritionData(AppLocalizations.of(context).energy, - _nutritionalPlan.nutritionalValues.energy), - ], - ), - charts.Series( - id: 'Logged', - domainFn: (nutritionEntry, index) => nutritionEntry.name, - measureFn: (nutritionEntry, index) => nutritionEntry.value, - fillPatternFn: (nutritionEntry, index) => charts.FillPatternType.forwardHatch, - data: [ - NutritionData( - AppLocalizations.of(context).energy, loggedNutritionalValues.energy), - ], - ), - charts.Series( - id: 'Avg', - domainFn: (nutritionEntry, index) => nutritionEntry.name, - measureFn: (nutritionEntry, index) => nutritionEntry.value, - data: [ - NutritionData(AppLocalizations.of(context).energy, sevenDayAvg.energy), - ], - ), - ], - animate: true, - domainAxis: const charts.OrdinalAxisSpec( - ///labelRotation was added to rotate text of X Axis. Without that, - ///titles would overlap each other - renderSpec: charts.SmallTickRendererSpec(labelRotation: 60), - ), - barGroupingType: charts.BarGroupingType.grouped, - defaultRenderer: charts.BarRendererConfig( - groupingType: charts.BarGroupingType.grouped, strokeWidthPx: 0.0, maxBarWidthPx: 8), - primaryMeasureAxis: const charts.NumericAxisSpec( - tickProviderSpec: charts.BasicNumericTickProviderSpec(desiredTickCount: 5), - ), - ), - ), - Container( - padding: const EdgeInsets.all(15), - height: 300, - child: charts.BarChart( - [ - charts.Series( - id: 'Planned', - domainFn: (nutritionEntry, index) => nutritionEntry.name, - measureFn: (nutritionEntry, index) => nutritionEntry.value, - data: [ - // NutritionData( - // AppLocalizations.of(context).energy, - // _nutritionalPlan.nutritionalValues.energy, - // ), - NutritionData( - AppLocalizations.of(context).protein, - _nutritionalPlan.nutritionalValues.protein, + final planned = widget._nutritionalPlan.nutritionalValues; + final loggedToday = widget._nutritionalPlan.nutritionalValuesToday; + final logged7DayAvg = widget._nutritionalPlan.nutritionalValues7DayAvg; + + final colorPlanned = LIST_OF_COLORS3[0]; + final colorLoggedToday = LIST_OF_COLORS3[1]; + final colorLogged7Day = LIST_OF_COLORS3[2]; + + return AspectRatio( + aspectRatio: 1.66, + child: Padding( + padding: const EdgeInsets.only(top: 16), + child: LayoutBuilder( + builder: (context, constraints) { + final barsSpace = 4.0 * constraints.maxWidth / 400; + final barsWidth = 8.0 * constraints.maxWidth / 400; + return BarChart( + BarChartData( + alignment: BarChartAlignment.center, + barTouchData: BarTouchData( + enabled: false, + ), + titlesData: FlTitlesData( + show: true, + bottomTitles: AxisTitles( + sideTitles: SideTitles( + showTitles: true, + reservedSize: 48, + getTitlesWidget: bottomTitles, + ), ), - NutritionData( - AppLocalizations.of(context).carbohydrates, - _nutritionalPlan.nutritionalValues.carbohydrates, + leftTitles: AxisTitles( + sideTitles: SideTitles( + showTitles: true, + reservedSize: 40, + getTitlesWidget: leftTitles, + ), ), - NutritionData( - AppLocalizations.of(context).sugars, - _nutritionalPlan.nutritionalValues.carbohydratesSugar, + topTitles: AxisTitles( + sideTitles: SideTitles(showTitles: false), ), - NutritionData( - AppLocalizations.of(context).fat, - _nutritionalPlan.nutritionalValues.fat, + rightTitles: AxisTitles( + sideTitles: SideTitles(showTitles: false), ), - NutritionData( - AppLocalizations.of(context).saturatedFat, - _nutritionalPlan.nutritionalValues.fatSaturated, + ), + gridData: FlGridData( + show: true, + checkToShowHorizontalLine: (value) => value % 10 == 0, + getDrawingHorizontalLine: (value) => FlLine( + color: Colors.black, + strokeWidth: 1, ), - NutritionData( - AppLocalizations.of(context).fibres, - _nutritionalPlan.nutritionalValues.fibres, + drawVerticalLine: false, + ), + borderData: FlBorderData( + show: false, + ), + groupsSpace: 30, + // groupsSpace: barsSpace, + barGroups: [ + BarChartGroupData( + x: 0, + barsSpace: barsSpace, + barRods: [ + BarChartRodData( + toY: planned.protein, + color: colorPlanned, + width: barsWidth, + ), + BarChartRodData( + toY: loggedToday.protein, + color: colorLoggedToday, + width: barsWidth, + ), + BarChartRodData( + toY: logged7DayAvg.protein, + color: colorLogged7Day, + width: barsWidth, + ), + ], ), - NutritionData( - AppLocalizations.of(context).sodium, - _nutritionalPlan.nutritionalValues.sodium, + BarChartGroupData( + x: 1, + barsSpace: barsSpace, + barRods: [ + BarChartRodData( + toY: planned.carbohydrates, + color: colorPlanned, + width: barsWidth, + ), + BarChartRodData( + toY: loggedToday.carbohydrates, + color: colorLoggedToday, + width: barsWidth, + ), + BarChartRodData( + toY: logged7DayAvg.carbohydrates, + color: colorLogged7Day, + width: barsWidth, + ), + ], + ), + BarChartGroupData( + x: 2, + barsSpace: barsSpace, + barRods: [ + BarChartRodData( + toY: planned.carbohydratesSugar, + color: colorPlanned, + width: barsWidth, + ), + BarChartRodData( + toY: loggedToday.carbohydratesSugar, + color: colorLoggedToday, + width: barsWidth, + ), + BarChartRodData( + toY: logged7DayAvg.carbohydratesSugar, + color: colorLogged7Day, + width: barsWidth, + ), + ], + ), + BarChartGroupData( + x: 3, + barsSpace: barsSpace, + barRods: [ + BarChartRodData( + toY: planned.fat, + color: colorPlanned, + width: barsWidth, + ), + BarChartRodData( + toY: loggedToday.fat, + color: colorLoggedToday, + width: barsWidth, + ), + BarChartRodData( + toY: logged7DayAvg.fat, + color: colorLogged7Day, + width: barsWidth, + ), + ], + ), + BarChartGroupData( + x: 4, + barsSpace: barsSpace, + barRods: [ + BarChartRodData( + toY: planned.fatSaturated, + color: colorPlanned, + width: barsWidth, + ), + BarChartRodData( + toY: loggedToday.fatSaturated, + color: colorLoggedToday, + width: barsWidth, + ), + BarChartRodData( + toY: logged7DayAvg.fatSaturated, + color: colorLogged7Day, + width: barsWidth, + ), + ], ), ], + // barGroups: getData(barsWidth, barsSpace), ), - charts.Series( - id: 'Logged', - domainFn: (nutritionEntry, index) => nutritionEntry.name, - measureFn: (nutritionEntry, index) => nutritionEntry.value, - fillPatternFn: (nutritionEntry, index) => charts.FillPatternType.forwardHatch, - data: [ - // NutritionData( - // AppLocalizations.of(context).energy, - // loggedNutritionalValues.energy - // ), - - NutritionData( - AppLocalizations.of(context).protein, loggedNutritionalValues.protein), - NutritionData(AppLocalizations.of(context).carbohydrates, - loggedNutritionalValues.carbohydrates), - NutritionData(AppLocalizations.of(context).sugars, - loggedNutritionalValues.carbohydratesSugar), - NutritionData(AppLocalizations.of(context).fat, loggedNutritionalValues.fat), - NutritionData(AppLocalizations.of(context).saturatedFat, - loggedNutritionalValues.fatSaturated), - NutritionData( - AppLocalizations.of(context).fibres, loggedNutritionalValues.fibres), - NutritionData( - AppLocalizations.of(context).sodium, loggedNutritionalValues.sodium), - ], - ), - charts.Series( - id: 'Avg', - domainFn: (nutritionEntry, index) => nutritionEntry.name, - measureFn: (nutritionEntry, index) => nutritionEntry.value, - data: [ - // NutritionData(AppLocalizations.of(context).energy, sevenDayAvg.energy), - NutritionData(AppLocalizations.of(context).protein, sevenDayAvg.protein), - NutritionData( - AppLocalizations.of(context).carbohydrates, sevenDayAvg.carbohydrates), - NutritionData( - AppLocalizations.of(context).sugars, sevenDayAvg.carbohydratesSugar), - NutritionData(AppLocalizations.of(context).fat, sevenDayAvg.fat), - NutritionData( - AppLocalizations.of(context).saturatedFat, sevenDayAvg.fatSaturated), - NutritionData(AppLocalizations.of(context).fibres, sevenDayAvg.fibres), - NutritionData(AppLocalizations.of(context).sodium, sevenDayAvg.sodium), - ], - ), - ], - animate: true, - domainAxis: const charts.OrdinalAxisSpec( - ///labelRotation was added to rotate text of X Axis. Without that, - ///titles would overlap each other - renderSpec: charts.SmallTickRendererSpec(labelRotation: 60), - ), - barGroupingType: charts.BarGroupingType.grouped, - primaryMeasureAxis: const charts.NumericAxisSpec( - tickProviderSpec: charts.BasicNumericTickProviderSpec( - desiredTickCount: 5, - ), - ), - ), + ); + }, ), - ], + ), ); } } -//creating a seperate chart for energy as the energy value and other nutrient's value is not compatable to show in one graph -class EnergyChart extends StatelessWidget { - const EnergyChart({Key? key, required this.nutritionalPlan}) : super(key: key); - final NutritionalPlan nutritionalPlan; - NutritionalValues nutritionalValuesFromPlanLogsSevenDayAvg() { - NutritionalValues sevenDaysAvg = NutritionalValues(); - int count = 0; - - final now = DateTime.now(); - final today = DateTime(now.year, now.month, now.day); - - nutritionalPlan.logEntriesValues.forEach((key, value) { - if (key.difference(today).inDays >= -7) { - sevenDaysAvg += value; - count++; - } - }); +class FlNutritionalDiaryChartWidget extends StatefulWidget { + final NutritionalPlan _nutritionalPlan; - if (count != 0) { - sevenDaysAvg.energy = sevenDaysAvg.energy / count; - sevenDaysAvg.protein = sevenDaysAvg.protein / count; - sevenDaysAvg.carbohydrates = sevenDaysAvg.carbohydrates / count; - sevenDaysAvg.carbohydratesSugar = sevenDaysAvg.carbohydratesSugar / count; - sevenDaysAvg.fat = sevenDaysAvg.fat / count; - sevenDaysAvg.fatSaturated = sevenDaysAvg.fatSaturated / count; - sevenDaysAvg.fibres = sevenDaysAvg.fibres / count; - sevenDaysAvg.sodium = sevenDaysAvg.sodium / count; - } + const FlNutritionalDiaryChartWidget({ + Key? key, + required NutritionalPlan nutritionalPlan, + }) : _nutritionalPlan = nutritionalPlan, + super(key: key); - return sevenDaysAvg; - } + final Color barBackgroundColor = Colors.black12; + final Color barColor = Colors.red; + final Color touchedBarColor = Colors.deepOrange; - NutritionalValues nutritionalValuesFromPlanLogsToday() { - final now = DateTime.now(); - final today = DateTime(now.year, now.month, now.day); + @override + State createState() => FlNutritionalDiaryChartWidgetState(); +} - return nutritionalPlan.logEntriesValues[nutritionalPlan.logEntriesValues.keys - .firstWhereOrNull((d) => d.difference(today).inDays == 0)] ?? - NutritionalValues(); - } +class FlNutritionalDiaryChartWidgetState extends State { + final Duration animDuration = const Duration(milliseconds: 250); + + int touchedIndex = -1; @override Widget build(BuildContext context) { - final NutritionalValues loggedNutritionalValues = nutritionalValuesFromPlanLogsToday(); - final NutritionalValues sevenDayAvg = nutritionalValuesFromPlanLogsSevenDayAvg(); + return AspectRatio( + aspectRatio: 1, + child: BarChart( + mainBarData(), + swapAnimationDuration: animDuration, + ), + ); + } - if (nutritionalPlan.nutritionalValues.energy == 0) { + List getDatesBetween(DateTime startDate, DateTime endDate) { + final List dateList = []; + DateTime currentDate = startDate; + + while (currentDate.isBefore(endDate) || currentDate.isAtSameMomentAs(endDate)) { + dateList.add(currentDate); + currentDate = currentDate.add(const Duration(days: 1)); + } + + return dateList; + } + + BarChartGroupData makeGroupData( + int x, + double y, { + bool isTouched = false, + Color? barColor, + double width = 1.5, + List showTooltips = const [], + }) { + barColor ??= widget.barColor; + return BarChartGroupData( + x: x, + barRods: [ + BarChartRodData( + toY: isTouched ? y + 1 : y, + color: isTouched ? widget.touchedBarColor : barColor, + width: width, + borderSide: isTouched + ? const BorderSide(color: Colors.black54) + : const BorderSide(color: Colors.white, width: 0), + backDrawRodData: BackgroundBarChartRodData( + show: true, + toY: 20, + color: widget.barBackgroundColor, + ), + ), + ], + showingTooltipIndicators: showTooltips, + ); + } + + List showingGroups() { + final logEntries = widget._nutritionalPlan.logEntriesValues; + final List out = []; + final dateList = getDatesBetween(logEntries.keys.first, logEntries.keys.last); + + for (final date in dateList.reversed) { + out.add( + makeGroupData( + date.millisecondsSinceEpoch, + logEntries.containsKey(date) ? logEntries[date]!.energy : 0, + isTouched: date.millisecondsSinceEpoch == touchedIndex, + ), + ); + } + + return out; + } + + Widget leftTitles(double value, TitleMeta meta) { + if (value == meta.max) { return Container(); } + const style = TextStyle( + fontSize: 10, + ); + return SideTitleWidget( + axisSide: meta.axisSide, + child: Text( + '${meta.formattedValue} kcal', + style: style, + ), + ); + } - return charts.BarChart( - [ - charts.Series( - id: 'Planned', - domainFn: (nutritionEntry, index) => nutritionEntry.name, - measureFn: (nutritionEntry, index) => nutritionEntry.value, - data: [ - NutritionData( - AppLocalizations.of(context).energy, - nutritionalPlan.nutritionalValues.energy, - ), - ], + BarChartData mainBarData() { + return BarChartData( + barTouchData: BarTouchData( + touchTooltipData: BarTouchTooltipData( + tooltipBgColor: Colors.blueGrey, + tooltipHorizontalAlignment: FLHorizontalAlignment.right, + tooltipMargin: -10, + getTooltipItem: (group, groupIndex, rod, rodIndex) { + final date = DateTime.fromMillisecondsSinceEpoch(group.x); + + return BarTooltipItem( + '${DateFormat.yMMMd(Localizations.localeOf(context).languageCode).format(date)}\n', + const TextStyle( + color: Colors.white, + fontWeight: FontWeight.bold, + ), + children: [ + TextSpan( + text: '${(rod.toY - 1).toStringAsFixed(0)} kcal', + style: const TextStyle( + color: Colors.white, + fontWeight: FontWeight.w500, + ), + ), + ], + ); + }, ), - charts.Series( - id: 'Logged', - domainFn: (nutritionEntry, index) => nutritionEntry.name, - measureFn: (nutritionEntry, index) => nutritionEntry.value, - fillPatternFn: (nutritionEntry, index) => charts.FillPatternType.forwardHatch, - data: [ - NutritionData(AppLocalizations.of(context).energy, loggedNutritionalValues.energy), - ], + touchCallback: (FlTouchEvent event, barTouchResponse) { + setState(() { + if (!event.isInterestedForInteractions || + barTouchResponse == null || + barTouchResponse.spot == null) { + touchedIndex = -1; + return; + } + touchedIndex = barTouchResponse.spot!.touchedBarGroupIndex; + }); + }, + ), + titlesData: FlTitlesData( + show: true, + rightTitles: AxisTitles( + sideTitles: SideTitles(showTitles: false), ), - charts.Series( - id: 'Avg', - domainFn: (nutritionEntry, index) => nutritionEntry.name, - measureFn: (nutritionEntry, index) => nutritionEntry.value, - data: [ - NutritionData(AppLocalizations.of(context).energy, sevenDayAvg.energy), - ], + topTitles: AxisTitles( + sideTitles: SideTitles(showTitles: false), ), - ], - animate: true, - domainAxis: const charts.OrdinalAxisSpec( - ///labelRotation was added to rotate text of X Axis. Without that, - ///titles would overlap each other - renderSpec: charts.SmallTickRendererSpec(labelRotation: 60), + bottomTitles: AxisTitles( + sideTitles: SideTitles(showTitles: false), + ), + leftTitles: AxisTitles( + sideTitles: SideTitles( + showTitles: true, + reservedSize: 60, + getTitlesWidget: leftTitles, + ), + ), + ), + borderData: FlBorderData( + show: false, ), - barGroupingType: charts.BarGroupingType.grouped, - defaultRenderer: charts.BarRendererConfig( - groupingType: charts.BarGroupingType.grouped, strokeWidthPx: 0.0, maxBarWidthPx: 8), - primaryMeasureAxis: const charts.NumericAxisSpec( - tickProviderSpec: charts.BasicNumericTickProviderSpec(desiredTickCount: 5), + gridData: FlGridData( + show: true, + getDrawingHorizontalLine: (value) => FlLine( + color: Colors.grey, + strokeWidth: 1, + ), + drawVerticalLine: false, ), + barGroups: showingGroups(), + ); + } + + Future refreshState() async { + setState(() {}); + await Future.delayed( + animDuration + const Duration(milliseconds: 50), ); } } diff --git a/lib/widgets/nutrition/nutritional_diary_detail.dart b/lib/widgets/nutrition/nutritional_diary_detail.dart index fff02c400..6368fbe78 100644 --- a/lib/widgets/nutrition/nutritional_diary_detail.dart +++ b/lib/widgets/nutrition/nutritional_diary_detail.dart @@ -32,6 +32,7 @@ class NutritionalDiaryDetailWidget extends StatelessWidget { final NutritionalPlan _nutritionalPlan; final DateTime _date; static const double tablePadding = 7; + const NutritionalDiaryDetailWidget(this._nutritionalPlan, this._date); Widget getTable( @@ -223,7 +224,7 @@ class NutritionalDiaryDetailWidget extends StatelessWidget { Container( padding: const EdgeInsets.all(15), height: 220, - child: NutritionalPlanPieChartWidget(valuesDate), + child: FlNutritionalPlanPieChartWidget(valuesDate), ), Padding( padding: const EdgeInsets.all(8.0), diff --git a/lib/widgets/nutrition/nutritional_plan_detail.dart b/lib/widgets/nutrition/nutritional_plan_detail.dart index 671d0b4fe..993a28630 100644 --- a/lib/widgets/nutrition/nutritional_plan_detail.dart +++ b/lib/widgets/nutrition/nutritional_plan_detail.dart @@ -20,19 +20,23 @@ import 'package:flutter/material.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import 'package:intl/intl.dart'; import 'package:provider/provider.dart'; +import 'package:wger/helpers/colors.dart'; import 'package:wger/models/nutrition/nutritional_plan.dart'; import 'package:wger/models/nutrition/nutritional_values.dart'; import 'package:wger/providers/body_weight.dart'; import 'package:wger/screens/form_screen.dart'; import 'package:wger/screens/nutritional_diary_screen.dart'; import 'package:wger/theme/theme.dart'; +import 'package:wger/widgets/measurements/charts.dart'; import 'package:wger/widgets/nutrition/charts.dart'; import 'package:wger/widgets/nutrition/forms.dart'; import 'package:wger/widgets/nutrition/meal.dart'; class NutritionalPlanDetailWidget extends StatelessWidget { final NutritionalPlan _nutritionalPlan; + const NutritionalPlanDetailWidget(this._nutritionalPlan); + static const double tablePadding = 7; @override @@ -70,7 +74,7 @@ class NutritionalPlanDetailWidget extends StatelessWidget { Container( padding: const EdgeInsets.all(15), height: 220, - child: NutritionalPlanPieChartWidget(nutritionalValues), // chart + child: FlNutritionalPlanPieChartWidget(nutritionalValues), // chart ), Padding( padding: const EdgeInsets.symmetric(horizontal: 10), @@ -210,53 +214,82 @@ class NutritionalPlanDetailWidget extends StatelessWidget { textAlign: TextAlign.center, style: Theme.of(context).textTheme.headline6, ), - - NutritionalPlanHatchBarChartWidget(_nutritionalPlan), - // Container( - // padding: const EdgeInsets.all(15), - // height: 300, - // child: NutritionalPlanHatchBarChartWidget(_nutritionalPlan), // chart - // ), - const Padding(padding: EdgeInsets.all(8.0)), - Text( - AppLocalizations.of(context).nutritionalDiary, - textAlign: TextAlign.center, - style: Theme.of(context).textTheme.headline6, - ), Container( - padding: const EdgeInsets.all(15), - height: 220, - child: NutritionalDiaryChartWidget(nutritionalPlan: _nutritionalPlan), // chart + padding: const EdgeInsets.only(top: 15, left: 15, right: 15), + height: 300, + child: NutritionalDiaryChartWidgetFl(nutritionalPlan: _nutritionalPlan), // chart + ), + Padding( + padding: const EdgeInsets.only(bottom: 40, left: 25, right: 25), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Indicator( + color: LIST_OF_COLORS3[0], + text: AppLocalizations.of(context).planned, + isSquare: true, + marginRight: 0, + ), + Indicator( + color: LIST_OF_COLORS3[1], + text: AppLocalizations.of(context).logged, + isSquare: true, + marginRight: 0, + ), + Indicator( + color: LIST_OF_COLORS3[2], + text: AppLocalizations.of(context).weekAverage, + isSquare: true, + marginRight: 0, + ), + ], + ), ), - SizedBox( - height: 200, - child: ListView( - scrollDirection: Axis.horizontal, + if (_nutritionalPlan.logEntriesValues.isNotEmpty) + Column( children: [ - Padding( - padding: const EdgeInsets.all(8), - child: Column( - crossAxisAlignment: CrossAxisAlignment.end, + Text( + AppLocalizations.of(context).nutritionalDiary, + textAlign: TextAlign.center, + style: Theme.of(context).textTheme.headline6, + ), + Container( + padding: const EdgeInsets.all(15), + height: 220, + child: FlNutritionalDiaryChartWidget(nutritionalPlan: _nutritionalPlan), // chart + ), + SizedBox( + height: 200, + child: ListView( + scrollDirection: Axis.horizontal, children: [ - TextButton(onPressed: () {}, child: const Text('')), - Text( - '${AppLocalizations.of(context).energyShort} (${AppLocalizations.of(context).kcal})'), - Text( - '${AppLocalizations.of(context).proteinShort} (${AppLocalizations.of(context).g})'), - Text( - '${AppLocalizations.of(context).carbohydratesShort} (${AppLocalizations.of(context).g})'), - Text( - '${AppLocalizations.of(context).fatShort} (${AppLocalizations.of(context).g})'), + Padding( + padding: const EdgeInsets.all(8), + child: Column( + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + TextButton(onPressed: () {}, child: const Text('')), + Text( + '${AppLocalizations.of(context).energyShort} (${AppLocalizations.of(context).kcal})'), + Text( + '${AppLocalizations.of(context).proteinShort} (${AppLocalizations.of(context).g})'), + Text( + '${AppLocalizations.of(context).carbohydratesShort} (${AppLocalizations.of(context).g})'), + Text( + '${AppLocalizations.of(context).fatShort} (${AppLocalizations.of(context).g})'), + ], + ), + ), + ..._nutritionalPlan.logEntriesValues.entries + .map((entry) => + NutritionDiaryEntry(entry.key, entry.value, _nutritionalPlan)) + .toList() + .reversed, ], ), - ), - ..._nutritionalPlan.logEntriesValues.entries - .map((entry) => NutritionDiaryEntry(entry.key, entry.value, _nutritionalPlan)) - .toList() - .reversed, + ) ], ), - ) ], ), ); diff --git a/lib/widgets/weight/entries_list.dart b/lib/widgets/weight/entries_list.dart index 5d55b0317..10e51dcca 100644 --- a/lib/widgets/weight/entries_list.dart +++ b/lib/widgets/weight/entries_list.dart @@ -24,7 +24,7 @@ import 'package:wger/providers/body_weight.dart'; import 'package:wger/screens/form_screen.dart'; import 'package:wger/screens/measurement_categories_screen.dart'; import 'package:wger/theme/theme.dart'; -import 'package:wger/widgets/core/charts.dart'; +import 'package:wger/widgets/measurements/charts.dart'; import 'package:wger/widgets/weight/forms.dart'; class WeightEntriesList extends StatelessWidget { @@ -38,7 +38,7 @@ class WeightEntriesList extends StatelessWidget { color: Theme.of(context).cardColor, padding: const EdgeInsets.all(15), height: 220, - child: MeasurementChartWidget( + child: MeasurementChartWidgetFl( _weightProvider.items.map((e) => MeasurementChartEntry(e.weight, e.date)).toList()), ), TextButton( diff --git a/lib/widgets/workouts/charts.dart b/lib/widgets/workouts/charts.dart index c7e69aca6..cbf5bbd57 100644 --- a/lib/widgets/workouts/charts.dart +++ b/lib/widgets/workouts/charts.dart @@ -16,66 +16,148 @@ * along with this program. If not, see . */ -import 'package:community_charts_flutter/community_charts_flutter.dart' as charts; +import 'package:fl_chart/fl_chart.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/widgets.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; +import 'package:intl/intl.dart'; +import 'package:wger/helpers/charts.dart'; +import 'package:wger/helpers/colors.dart'; -/// Sample time series data type. -class TimeSeriesLog { - final DateTime time; - final double weight; - - TimeSeriesLog(this.time, this.weight); -} - -class LogChartWidget extends StatelessWidget { +class LogChartWidgetFl extends StatefulWidget { final Map _data; final DateTime _currentDate; - const LogChartWidget(this._data, this._currentDate); + + const LogChartWidgetFl(this._data, this._currentDate); + @override + State createState() => _LogChartWidgetFlState(); +} + +class _LogChartWidgetFlState extends State { @override Widget build(BuildContext context) { - return _data.containsKey('chart_data') && _data['chart_data'].length > 0 - ? charts.TimeSeriesChart( - [ - ..._data['chart_data'].map((e) { - return charts.Series( - id: '${e.first['reps']} ${AppLocalizations.of(context).reps}', - domainFn: (datum, index) => datum.time, - measureFn: (datum, index) => datum.weight, - data: [ - ...e.map( - (entry) => TimeSeriesLog( - DateTime.parse(entry['date']), - double.parse(entry['weight']), - ), - ), - ], - ); - }), - ], - primaryMeasureAxis: const charts.NumericAxisSpec( - tickProviderSpec: charts.BasicNumericTickProviderSpec(zeroBound: false), + return AspectRatio( + aspectRatio: 1.70, + child: Padding( + padding: const EdgeInsets.only( + top: 24, + bottom: 12, + ), + child: LineChart( + mainData(), + ), + ), + ); + } + + LineTouchData tooltipData() { + return LineTouchData( + touchTooltipData: LineTouchTooltipData( + getTooltipItems: (touchedSpots) { + return touchedSpots.map((touchedSpot) { + final reps = widget._data['chart_data'][touchedSpot.barIndex].first['reps']; + + return LineTooltipItem( + '$reps × ${touchedSpot.y} kg', + const TextStyle(color: Colors.white), + ); + }).toList(); + }, + ), + ); + } + + LineChartData mainData() { + final colors = generateChartColors(widget._data['chart_data'].length).iterator; + + return LineChartData( + lineTouchData: tooltipData(), + gridData: FlGridData( + show: true, + drawVerticalLine: true, + getDrawingHorizontalLine: (value) { + return FlLine( + color: Colors.grey, + strokeWidth: 1, + ); + }, + getDrawingVerticalLine: (value) { + return FlLine( + color: Colors.grey, + strokeWidth: 1, + ); + }, + ), + titlesData: FlTitlesData( + show: true, + rightTitles: AxisTitles( + sideTitles: SideTitles(showTitles: false), + ), + topTitles: AxisTitles( + sideTitles: SideTitles(showTitles: false), + ), + bottomTitles: AxisTitles( + sideTitles: SideTitles( + showTitles: true, + getTitlesWidget: (value, meta) { + // Don't show the first and last entries, otherwise they'll overlap with the + // calculated interval + if (value == meta.min || value == meta.max) { + return const Text(''); + } + + final DateTime date = DateTime.fromMillisecondsSinceEpoch(value.toInt()); + return Text( + DateFormat.yMd(Localizations.localeOf(context).languageCode).format(date), + ); + }, + interval: chartGetInterval( + DateTime.parse(widget._data['logs'].keys.first), + DateTime.parse(widget._data['logs'].keys.last), ), - behaviors: [ - charts.SeriesLegend( - position: charts.BehaviorPosition.bottom, - desiredMaxColumns: 4, - ), - charts.RangeAnnotation([ - charts.LineAnnotationSegment( - _currentDate, charts.RangeAnnotationAxisType.domain, - strokeWidthPx: 2, - labelPosition: charts.AnnotationLabelPosition.margin, - color: charts.Color.black, - dashPattern: [0, 1, 1, 1], - //startLabel: DateFormat.yMd(Localizations.localeOf(context).languageCode) - // .format(_currentDate), - ) - ]), + ), + ), + leftTitles: AxisTitles( + sideTitles: SideTitles( + showTitles: true, + reservedSize: 70, + getTitlesWidget: (value, meta) { + return Text('$value ${AppLocalizations.of(context).kg}'); + }, + ), + ), + ), + borderData: FlBorderData( + show: true, + border: Border.all(color: const Color(0xff37434d)), + ), + lineBarsData: [ + ...widget._data['chart_data'].map((e) { + colors.moveNext(); + return LineChartBarData( + spots: [ + ...e.map( + (entry) => FlSpot( + DateTime.parse(entry['date']).millisecondsSinceEpoch.toDouble(), + double.parse(entry['weight']), + ), + ) ], - ) - : Container(); + isCurved: true, + color: colors.current, + barWidth: 2, + isStrokeCapRound: true, + dotData: FlDotData( + show: true, + getDotPainter: (p0, p1, p2, p3) => FlDotCirclePainter( + radius: 2, + color: Colors.black, + strokeWidth: 0, + ), + ), + ); + }) + ], + ); } } diff --git a/lib/widgets/workouts/log.dart b/lib/widgets/workouts/log.dart index 54a09b954..c9feff23f 100644 --- a/lib/widgets/workouts/log.dart +++ b/lib/widgets/workouts/log.dart @@ -19,11 +19,13 @@ import 'package:flutter/material.dart'; import 'package:intl/intl.dart'; import 'package:provider/provider.dart'; +import 'package:wger/helpers/colors.dart'; import 'package:wger/helpers/ui.dart'; import 'package:wger/models/exercises/base.dart'; import 'package:wger/models/workouts/log.dart'; import 'package:wger/models/workouts/session.dart'; import 'package:wger/providers/workout_plans.dart'; +import 'package:wger/widgets/measurements/charts.dart'; import 'package:wger/widgets/workouts/charts.dart'; class ExerciseLogChart extends StatelessWidget { @@ -36,20 +38,51 @@ class ExerciseLogChart extends StatelessWidget { Widget build(BuildContext context) { final workoutPlansData = Provider.of(context, listen: false); final workout = workoutPlansData.currentPlan; + var colors = generateChartColors(1).iterator; Future> getChartEntries(BuildContext context) async { return workoutPlansData.fetchLogData(workout!, _base); } return FutureBuilder( - future: getChartEntries(context), - builder: (context, AsyncSnapshot> snapshot) => SizedBox( - height: 150, - child: snapshot.connectionState == ConnectionState.waiting - ? const Center(child: CircularProgressIndicator()) - : LogChartWidget(snapshot.data!, _currentDate), - ), - ); + future: getChartEntries(context), + builder: (context, AsyncSnapshot> snapshot) { + if (snapshot.connectionState == ConnectionState.done) { + colors = generateChartColors(snapshot.data!['chart_data'].length).iterator; + } + + return SizedBox( + height: 260, + child: snapshot.connectionState == ConnectionState.waiting + ? const Center(child: CircularProgressIndicator()) + : Column( + mainAxisSize: MainAxisSize.max, + children: [ + LogChartWidgetFl(snapshot.data!, _currentDate), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + ...snapshot.data!['chart_data'].map((e) { + // e is the list of logs with the same reps, so we can just take the + // first entry and read the reps from it. Yes, this is an amazingly ugly hack + final reps = e.first['reps']; + + colors.moveNext(); + return Indicator( + color: colors.current, + text: reps.toString(), + isSquare: false, + ); + }).toList(), + ], + ), + const SizedBox( + height: 15, + ) + ], + ), + ); + }); } } @@ -108,8 +141,10 @@ class _DayLogWidgetState extends State { ), ) .toList(), - ExerciseLogChart(base, widget._date), - const SizedBox(height: 30), + Padding( + padding: const EdgeInsets.symmetric(horizontal: 15), + child: ExerciseLogChart(base, widget._date), + ) ], ); }).toList() diff --git a/macos/Flutter/GeneratedPluginRegistrant.swift b/macos/Flutter/GeneratedPluginRegistrant.swift index 3de627737..0c54ca11e 100644 --- a/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/macos/Flutter/GeneratedPluginRegistrant.swift @@ -10,6 +10,7 @@ import package_info_plus import rive_common import shared_preferences_foundation import url_launcher_macos +import video_player_avfoundation func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { FileSelectorPlugin.register(with: registry.registrar(forPlugin: "FileSelectorPlugin")) @@ -17,4 +18,5 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { RivePlugin.register(with: registry.registrar(forPlugin: "RivePlugin")) SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin")) UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin")) + FVPVideoPlayerPlugin.register(with: registry.registrar(forPlugin: "FVPVideoPlayerPlugin")) } diff --git a/pubspec.lock b/pubspec.lock index 38b34bce4..9debeabbe 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -5,18 +5,18 @@ packages: dependency: transitive description: name: _fe_analyzer_shared - sha256: "8880b4cfe7b5b17d57c052a5a3a8cc1d4f546261c7cc8fbd717bd53f48db0568" + sha256: ae92f5d747aee634b87f89d9946000c2de774be1d6ac3e58268224348cd0101a url: "https://pub.dev" source: hosted - version: "59.0.0" + version: "61.0.0" analyzer: dependency: transitive description: name: analyzer - sha256: a89627f49b0e70e068130a36571409726b04dab12da7e5625941d2c8ec278b96 + sha256: ea3d8652bda62982addfd92fdc2d0214e5f82e43325104990d4f4c4a2a313562 url: "https://pub.dev" source: hosted - version: "5.11.1" + version: "5.13.0" android_metadata: dependency: "direct main" description: @@ -29,18 +29,18 @@ packages: dependency: transitive description: name: archive - sha256: "80e5141fafcb3361653ce308776cfd7d45e6e9fbb429e14eec571382c0c5fecb" + sha256: "7b875fd4a20b165a3084bd2d210439b22ebc653f21cea4842729c0c30c82596b" url: "https://pub.dev" source: hosted - version: "3.3.2" + version: "3.4.9" args: dependency: transitive description: name: args - sha256: c372bb384f273f0c2a8aaaa226dad84dc27c8519a691b888725dec59518ad53a + sha256: eef6c46b622e0494a36c5a12d10d77fb4e855501a91c1b9ef9339326e58f0596 url: "https://pub.dev" source: hosted - version: "2.4.1" + version: "2.4.2" async: dependency: transitive description: @@ -61,10 +61,10 @@ packages: dependency: transitive description: name: build - sha256: "3fbda25365741f8251b39f3917fb3c8e286a96fd068a5a242e11c2012d495777" + sha256: "80184af8b6cb3e5c1c4ec6d8544d27711700bc3e6d2efad04238c7b5290889f0" url: "https://pub.dev" source: hosted - version: "2.3.1" + version: "2.4.1" build_config: dependency: transitive description: @@ -77,34 +77,34 @@ packages: dependency: transitive description: name: build_daemon - sha256: "757153e5d9cd88253cb13f28c2fb55a537dc31fefd98137549895b5beb7c6169" + sha256: "0343061a33da9c5810b2d6cee51945127d8f4c060b7fbdd9d54917f0a3feaaa1" url: "https://pub.dev" source: hosted - version: "3.1.1" + version: "4.0.1" build_resolvers: dependency: transitive description: name: build_resolvers - sha256: db49b8609ef8c81cca2b310618c3017c00f03a92af44c04d310b907b2d692d95 + sha256: "64e12b0521812d1684b1917bc80945625391cb9bdd4312536b1d69dcb6133ed8" url: "https://pub.dev" source: hosted - version: "2.2.0" + version: "2.4.1" build_runner: dependency: "direct dev" description: name: build_runner - sha256: b0a8a7b8a76c493e85f1b84bffa0588859a06197863dba8c9036b15581fd9727 + sha256: "10c6bcdbf9d049a0b666702cf1cee4ddfdc38f02a19d35ae392863b47519848b" url: "https://pub.dev" source: hosted - version: "2.3.3" + version: "2.4.6" build_runner_core: dependency: transitive description: name: build_runner_core - sha256: "14febe0f5bac5ae474117a36099b4de6f1dbc52df6c5e55534b3da9591bf4292" + sha256: c9e32d21dd6626b5c163d48b037ce906bbe428bc23ab77bcd77bb21e593b6185 url: "https://pub.dev" source: hosted - version: "7.2.7" + version: "7.2.11" built_collection: dependency: transitive description: @@ -117,50 +117,50 @@ packages: dependency: transitive description: name: built_value - sha256: "2f17434bd5d52a26762043d6b43bb53b3acd029b4d9071a329f46d67ef297e6d" + sha256: "723b4021e903217dfc445ec4cf5b42e27975aece1fc4ebbc1ca6329c2d9fb54e" url: "https://pub.dev" source: hosted - version: "8.5.0" + version: "8.7.0" camera: dependency: transitive description: name: camera - sha256: ebebead3d5ec3d148249331d751d462d7e8c98102b8830a9b45ec96a2bd4333f + sha256: "1f9010f0689774380fbcd7d6b7820a5157e8e97685fa66d619e1d1f58b3fdf93" url: "https://pub.dev" source: hosted - version: "0.10.5+2" + version: "0.10.5+5" camera_android: dependency: transitive description: name: camera_android - sha256: f83e406d34f5faa80bf0f5c3beee4b4c11da94a94e9621c1bb8e312988621b4b + sha256: "58463140f1b39591b8e2155861b436abad4ceb48160058be8374164ff0309ef3" url: "https://pub.dev" source: hosted - version: "0.10.8+2" + version: "0.10.8+13" camera_avfoundation: dependency: transitive description: name: camera_avfoundation - sha256: "1a416e452b30955b392f4efbf23291d3f2ba3660a85e1628859eb62d2a2bab26" + sha256: "3b6d9f550cfd658c71f34a99509528501e5e5d4fa79f11e3a4d6ef380d8e0254" url: "https://pub.dev" source: hosted - version: "0.9.13+2" + version: "0.9.13+7" camera_platform_interface: dependency: transitive description: name: camera_platform_interface - sha256: "60fa0bb62a4f3bf3a7c413e31e4cd01b69c779ccc8e4668904a24581b86c316b" + sha256: "86fd4fc597c6e455265ddb5884feb352d0171ad14b9cdf3aba30da59b25738c4" url: "https://pub.dev" source: hosted - version: "2.5.1" + version: "2.6.0" camera_web: dependency: transitive description: name: camera_web - sha256: bcbd775fb3a9d51cc3ece899d54ad66f6306410556bac5759f78e13f9228841f + sha256: d4c2c571c7af04f8b10702ca16bb9ed2a26e64534171e8f75c9349b2c004d8f1 url: "https://pub.dev" source: hosted - version: "0.3.1+4" + version: "0.3.2+3" carousel_slider: dependency: "direct main" description: @@ -173,10 +173,10 @@ packages: dependency: transitive description: name: change - sha256: b4d4aceb94f5081d40a2c08211bd779e55373265ce2304b7b38b5c4c218a9263 + sha256: "75b6e28073433946a987e6082d00f08676a8260a6aa68cac8594c10611e7e9b9" url: "https://pub.dev" source: hosted - version: "0.6.0" + version: "0.7.2" characters: dependency: transitive description: @@ -197,10 +197,10 @@ packages: dependency: "direct dev" description: name: cider - sha256: "74d96930575f97d83e0a3a5cd26d27d10c38961b1b41346eebe5baabf0f56940" + sha256: "918ded9f4473d8042247b9e66a90101eb5ff72935c31df5d511a55f14e085ef0" url: "https://pub.dev" source: hosted - version: "0.1.6" + version: "0.2.4" cli_util: dependency: transitive description: @@ -221,10 +221,10 @@ packages: dependency: transitive description: name: code_builder - sha256: "0d43dd1288fd145de1ecc9a3948ad4a6d5a82f0a14c4fdd0892260787d975cbe" + sha256: "1be9be30396d7e4c0db42c35ea6ccd7cc6a1e19916b5dc64d6ac216b5544d677" url: "https://pub.dev" source: hosted - version: "4.4.0" + version: "4.7.0" collection: dependency: "direct main" description: @@ -233,22 +233,6 @@ packages: url: "https://pub.dev" source: hosted version: "1.17.2" - community_charts_common: - dependency: transitive - description: - name: community_charts_common - sha256: "20697244c826df0545237ebe01d61caa96a2a2e4d23c6f88890441636a4d5220" - url: "https://pub.dev" - source: hosted - version: "1.0.2" - community_charts_flutter: - dependency: "direct main" - description: - name: community_charts_flutter - sha256: ca5bd07337e162daee13c19679f602cd8b3f704520d242beeebbc2e312f84f89 - url: "https://pub.dev" - source: hosted - version: "1.0.2" convert: dependency: transitive description: @@ -261,42 +245,42 @@ packages: dependency: transitive description: name: cross_file - sha256: "0b0036e8cccbfbe0555fd83c1d31a6f30b77a96b598b35a5d36dd41f718695e9" + sha256: "445db18de832dba8d851e287aff8ccf169bed30d2e94243cb54c7d2f1ed2142c" url: "https://pub.dev" source: hosted - version: "0.3.3+4" + version: "0.3.3+6" crypto: dependency: transitive description: name: crypto - sha256: aa274aa7774f8964e4f4f38cc994db7b6158dd36e9187aaceaddc994b35c6c67 + sha256: ff625774173754681d66daaf4a448684fb04b78f902da9cb3d308c19cc5e8bab url: "https://pub.dev" source: hosted - version: "3.0.2" + version: "3.0.3" csslib: dependency: transitive description: name: csslib - sha256: b36c7f7e24c0bdf1bf9a3da461c837d1de64b9f8beb190c9011d8c72a3dfd745 + sha256: "831883fb353c8bdc1d71979e5b342c7d88acfbc643113c14ae51e2442ea0f20f" url: "https://pub.dev" source: hosted - version: "0.17.2" + version: "0.17.3" cupertino_icons: dependency: "direct main" description: name: cupertino_icons - sha256: e35129dc44c9118cee2a5603506d823bab99c68393879edb440e0090d07586be + sha256: d57953e10f9f8327ce64a508a355f0b1ec902193f66288e8cb5070e7c47eeb2d url: "https://pub.dev" source: hosted - version: "1.0.5" + version: "1.0.6" dart_style: dependency: transitive description: name: dart_style - sha256: f4f1f73ab3fd2afcbcca165ee601fe980d966af6a21b5970c6c9376955c528ad + sha256: "1efa911ca7086affd35f463ca2fc1799584fb6aa89883cf0af8e3664d6a02d55" url: "https://pub.dev" source: hosted - version: "2.3.1" + version: "2.3.2" equatable: dependency: "direct main" description: @@ -317,10 +301,10 @@ packages: dependency: transitive description: name: ffi - sha256: a38574032c5f1dd06c4aee541789906c12ccaab8ba01446e800d9c5b79c4a978 + sha256: "7bf0adc28a23d395f19f3f1eb21dd7cfd1dd9f8e1c50051c069122e6853bc878" url: "https://pub.dev" source: hosted - version: "2.0.1" + version: "2.1.0" file: dependency: transitive description: @@ -333,34 +317,34 @@ packages: dependency: transitive description: name: file_selector_linux - sha256: d17c5e450192cdc40b718804dfb4eaf79a71bed60ee9530703900879ba50baa3 + sha256: "045d372bf19b02aeb69cacf8b4009555fb5f6f0b7ad8016e5f46dd1387ddd492" url: "https://pub.dev" source: hosted - version: "0.9.1+3" + version: "0.9.2+1" file_selector_macos: dependency: transitive description: name: file_selector_macos - sha256: "6290eec24fc4cc62535fe609e0c6714d3c1306191dc8c3b0319eaecc09423a3a" + sha256: b15c3da8bd4908b9918111fa486903f5808e388b8d1c559949f584725a6594d6 url: "https://pub.dev" source: hosted - version: "0.9.2" + version: "0.9.3+3" file_selector_platform_interface: dependency: transitive description: name: file_selector_platform_interface - sha256: "2a7f4bbf7bd2f022ecea85bfb1754e87f7dd403a9abc17a84a4fa2ddfe2abc0a" + sha256: "0aa47a725c346825a2bd396343ce63ac00bda6eff2fbc43eabe99737dede8262" url: "https://pub.dev" source: hosted - version: "2.5.1" + version: "2.6.1" file_selector_windows: dependency: transitive description: name: file_selector_windows - sha256: ef246380b66d1fb9089fc65622c387bf3780bca79f533424c31d07f12c2c7fd8 + sha256: d3547240c20cabf205c7c7f01a50ecdbc413755814d6677f3cb366f04abcead0 url: "https://pub.dev" source: hosted - version: "0.9.2" + version: "0.9.3+1" fixnum: dependency: transitive description: @@ -369,6 +353,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.1.0" + fl_chart: + dependency: "direct main" + description: + name: fl_chart + sha256: "6b9eb2b3017241d05c482c01f668dd05cc909ec9a0114fdd49acd958ff2432fa" + url: "https://pub.dev" + source: hosted + version: "0.64.0" flutter: dependency: "direct main" description: flutter @@ -463,10 +455,10 @@ packages: dependency: "direct dev" description: name: flutter_lints - sha256: a25a15ebbdfc33ab1cd26c63a6ee519df92338a9c10f122adda92938253bef04 + sha256: e2a421b7e59244faef694ba7b30562e489c2b489866e505074eb005cd7060db7 url: "https://pub.dev" source: hosted - version: "2.0.3" + version: "3.0.1" flutter_localizations: dependency: "direct main" description: flutter @@ -476,10 +468,10 @@ packages: dependency: transitive description: name: flutter_plugin_android_lifecycle - sha256: "96af49aa6b57c10a312106ad6f71deed5a754029c24789bbf620ba784f0bd0b0" + sha256: b068ffc46f82a55844acfa4fdbb61fad72fa2aef0905548419d97f0f95c456da url: "https://pub.dev" source: hosted - version: "2.0.14" + version: "2.0.17" flutter_staggered_grid_view: dependency: "direct main" description: @@ -492,10 +484,10 @@ packages: dependency: "direct main" description: name: flutter_svg - sha256: f991fdb1533c3caeee0cdc14b04f50f0c3916f0dbcbc05237ccbe4e3c6b93f3f + sha256: d39e7f95621fc84376bc0f7d504f05c3a41488c562f4a8ad410569127507402c url: "https://pub.dev" source: hosted - version: "2.0.5" + version: "2.0.9" flutter_test: dependency: "direct dev" description: flutter @@ -526,10 +518,10 @@ packages: dependency: "direct main" description: name: font_awesome_flutter - sha256: "959ef4add147753f990b4a7c6cccb746d5792dbdc81b1cde99e62e7edb31b206" + sha256: "52671aea66da73b58d42ec6d0912b727a42248dd9a7c76d6c20f275783c48c08" url: "https://pub.dev" source: hosted - version: "10.4.0" + version: "10.6.0" frontend_server_client: dependency: transitive description: @@ -547,34 +539,34 @@ packages: dependency: transitive description: name: glob - sha256: "4515b5b6ddb505ebdd242a5f2cc5d22d3d6a80013789debfbda7777f47ea308c" + sha256: "0e7014b3b7d4dac1ca4d6114f82bf1782ee86745b9b42a92c9289c23d8a0ab63" url: "https://pub.dev" source: hosted - version: "2.1.1" + version: "2.1.2" graphs: dependency: transitive description: name: graphs - sha256: f9e130f3259f52d26f0cfc0e964513796dafed572fa52e45d2f8d6ca14db39b2 + sha256: aedc5a15e78fc65a6e23bcd927f24c64dd995062bcd1ca6eda65a3cff92a4d19 url: "https://pub.dev" source: hosted - version: "2.2.0" + version: "2.3.1" html: dependency: transitive description: name: html - sha256: "58e3491f7bf0b6a4ea5110c0c688877460d1a6366731155c4a4580e7ded773e8" + sha256: "3a7812d5bcd2894edf53dfaf8cd640876cf6cef50a8f238745c8b8120ea74d3a" url: "https://pub.dev" source: hosted - version: "0.15.3" + version: "0.15.4" http: dependency: "direct main" description: name: http - sha256: "5895291c13fa8a3bd82e76d5627f69e0d85ca6a30dcac95c4ea19a5d555879c2" + sha256: "759d1a329847dd0f39226c688d3e06a6b8679668e350e2891a6474f8b4bb8525" url: "https://pub.dev" source: hosted - version: "0.13.6" + version: "1.1.0" http_multi_server: dependency: transitive description: @@ -595,10 +587,10 @@ packages: dependency: transitive description: name: image - sha256: a72242c9a0ffb65d03de1b7113bc4e189686fc07c7147b8b41811d0dd0e0d9bf + sha256: "028f61960d56f26414eb616b48b04eb37d700cbe477b7fb09bf1d7ce57fd9271" url: "https://pub.dev" source: hosted - version: "4.0.17" + version: "4.1.3" image_picker: dependency: "direct main" description: @@ -619,10 +611,10 @@ packages: dependency: transitive description: name: image_picker_for_web - sha256: "869fe8a64771b7afbc99fc433a5f7be2fea4d1cb3d7c11a48b6b579eb9c797f0" + sha256: "50bc9ae6a77eea3a8b11af5eb6c661eeb858fdd2f734c2a4fd17086922347ef7" url: "https://pub.dev" source: hosted - version: "2.2.0" + version: "3.0.1" image_picker_ios: dependency: transitive description: @@ -651,10 +643,10 @@ packages: dependency: transitive description: name: image_picker_platform_interface - sha256: "7c7b96bb9413a9c28229e717e6fd1e3edd1cc5569c1778fcca060ecf729b65ee" + sha256: ed9b00e63977c93b0d2d2b343685bed9c324534ba5abafbb3dfbd6a780b1b514 url: "https://pub.dev" source: hosted - version: "2.8.0" + version: "2.9.1" image_picker_windows: dependency: transitive description: @@ -688,10 +680,10 @@ packages: dependency: transitive description: name: js - sha256: "5528c2f391ededb7775ec1daa69e65a2d61276f7552de2b5f7b8d34ee9fd4ab7" + sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3 url: "https://pub.dev" source: hosted - version: "0.6.5" + version: "0.6.7" json_annotation: dependency: "direct main" description: @@ -704,26 +696,18 @@ packages: dependency: "direct dev" description: name: json_serializable - sha256: "43793352f90efa5d8b251893a63d767b2f7c833120e3cc02adad55eefec04dc7" - url: "https://pub.dev" - source: hosted - version: "6.6.2" - klizma: - dependency: transitive - description: - name: klizma - sha256: "3bb0ed5cc183274e39d48fa42a61484e4dda3dc52970aa902379c7403cd7f0f2" + sha256: aa1f5a8912615733e0fdc7a02af03308933c93235bdc8d50d0b0c8a8ccb0b969 url: "https://pub.dev" source: hosted - version: "0.2.1" + version: "6.7.1" lints: dependency: transitive description: name: lints - sha256: "5e4a9cd06d447758280a8ac2405101e0e2094d2a1dbdd3756aec3fe7775ba593" + sha256: cbf8d4b858bb0134ef3ef87841abdf8d63bfc255c266b7bf6b39daa1085c4290 url: "https://pub.dev" source: hosted - version: "2.0.1" + version: "3.0.0" list_counter: dependency: transitive description: @@ -736,26 +720,26 @@ packages: dependency: transitive description: name: logging - sha256: "04094f2eb032cbb06c6f6e8d3607edcfcb0455e2bb6cbc010cb01171dcb64e6d" + sha256: "623a88c9594aa774443aa3eb2d41807a48486b5613e67599fb4c41c0ad47c340" url: "https://pub.dev" source: hosted - version: "1.1.1" + version: "1.2.0" markdown: dependency: transitive description: name: markdown - sha256: "8e332924094383133cee218b676871f42db2514f1f6ac617b6cf6152a7faab8e" + sha256: acf35edccc0463a9d7384e437c015a3535772e09714cf60e07eeef3a15870dcd url: "https://pub.dev" source: hosted - version: "7.1.0" + version: "7.1.1" marker: dependency: transitive description: name: marker - sha256: "970eb97ea43752bd443b91d992068575f37bcc7f952c01334779673b7db23114" + sha256: "3dadd01f3b0ffae148ffb3b1bc04290a98e54a465cddbab59727bd2a9fe57750" url: "https://pub.dev" source: hosted - version: "0.5.1" + version: "0.6.0" matcher: dependency: transitive description: @@ -792,10 +776,10 @@ packages: dependency: "direct dev" description: name: mockito - sha256: "8b46d7eb40abdda92d62edd01546051f0c27365e65608c284de336dccfef88cc" + sha256: "7d5b53bcd556c1bc7ffbe4e4d5a19c3e112b7e925e9e172dd7c6ad0630812616" url: "https://pub.dev" source: hosted - version: "5.4.1" + version: "5.4.2" multi_select_flutter: dependency: "direct main" description: @@ -864,34 +848,34 @@ packages: dependency: transitive description: name: path_provider_linux - sha256: "2ae08f2216225427e64ad224a24354221c2c7907e448e6e0e8b57b1eb9f10ad1" + sha256: f7a1fe3a634fe7734c8d3f2766ad746ae2a2884abe22e241a8b301bf5cac3279 url: "https://pub.dev" source: hosted - version: "2.1.10" + version: "2.2.1" path_provider_platform_interface: dependency: transitive description: name: path_provider_platform_interface - sha256: "57585299a729335f1298b43245842678cb9f43a6310351b18fb577d6e33165ec" + sha256: "94b1e0dd80970c1ce43d5d4e050a9918fce4f4a775e6142424c30a29a363265c" url: "https://pub.dev" source: hosted - version: "2.0.6" + version: "2.1.1" path_provider_windows: dependency: transitive description: name: path_provider_windows - sha256: d3f80b32e83ec208ac95253e0cd4d298e104fbc63cb29c5c69edaed43b0c69d6 + sha256: "8bc9f22eee8690981c22aa7fc602f5c85b497a6fb2ceb35ee5a5e5ed85ad8170" url: "https://pub.dev" source: hosted - version: "2.1.6" + version: "2.2.1" petitparser: dependency: transitive description: name: petitparser - sha256: "49392a45ced973e8d94a85fdb21293fbb40ba805fc49f2965101ae748a3683b4" + sha256: cb3798bef7fc021ac45b308f4b51208a152792445cce0448c9a4ba5879dd8750 url: "https://pub.dev" source: hosted - version: "5.1.0" + version: "5.4.0" platform: dependency: transitive description: @@ -904,18 +888,26 @@ packages: dependency: transitive description: name: plugin_platform_interface - sha256: "6a2128648c854906c53fa8e33986fc0247a1116122f9534dd20e3ab9e16a32bc" + sha256: da3fdfeccc4d4ff2da8f8c556704c08f912542c5fb3cf2233ed75372384a034d url: "https://pub.dev" source: hosted - version: "2.1.4" + version: "2.1.6" pointer_interceptor: dependency: transitive description: name: pointer_interceptor - sha256: "6aa680b30d96dccef496933d00208ad25f07e047f644dc98ce03ec6141633a9a" + sha256: adf7a637f97c077041d36801b43be08559fd4322d2127b3f20bb7be1b9eebc22 + url: "https://pub.dev" + source: hosted + version: "0.9.3+7" + pointycastle: + dependency: transitive + description: + name: pointycastle + sha256: "7c1e5f0d23c9016c5bbd8b1473d0d3fb3fc851b876046039509e18e0c7485f2c" url: "https://pub.dev" source: hosted - version: "0.9.3+4" + version: "3.7.3" pool: dependency: transitive description: @@ -936,10 +928,10 @@ packages: dependency: "direct main" description: name: provider - sha256: cdbe7530b12ecd9eb455bdaa2fcb8d4dad22e80b8afb4798b41479d5ce26847f + sha256: "659adaefa8196fa2799d7ac3dca3c2e831e549dc40b082d07a599fe9150d75fc" url: "https://pub.dev" source: hosted - version: "6.0.5" + version: "6.1.0" pub_semver: dependency: transitive description: @@ -968,26 +960,26 @@ packages: dependency: transitive description: name: rfc_6901 - sha256: "8d97680dada633146cf75ab9382f2ce2b7e4bd63ceecd867416cf43b5832b988" + sha256: df1bbfa3d023009598f19636d6114c6ac1e0b7bb7bf6a260f0e6e6ce91416820 url: "https://pub.dev" source: hosted - version: "0.1.1" + version: "0.2.0" rive: dependency: "direct main" description: name: rive - sha256: f3b8af0898c987d68019e91d92257edd902c28c816e49de033a7272e86bd5425 + sha256: fd15b219f5cc110285ebf52093b0b0f4038c3ca750f2fc5fc44d9c80a56c44f3 url: "https://pub.dev" source: hosted - version: "0.11.4" + version: "0.12.3" rive_common: dependency: transitive description: name: rive_common - sha256: f6687f9d70e6fd3888a9b0e9c0b307966d2ce74cf00cfb01dce906c3bbada52f + sha256: f4e20d0a99c5040c85624a3eb2b0b6b19e614d93a693c3bb25cf6e7bb2d3d6d3 url: "https://pub.dev" source: hosted - version: "0.1.0" + version: "0.2.8" shared_preferences: dependency: "direct main" description: @@ -1000,50 +992,50 @@ packages: dependency: transitive description: name: shared_preferences_android - sha256: "6478c6bbbecfe9aced34c483171e90d7c078f5883558b30ec3163cf18402c749" + sha256: "8568a389334b6e83415b6aae55378e158fbc2314e074983362d20c562780fb06" url: "https://pub.dev" source: hosted - version: "2.1.4" + version: "2.2.1" shared_preferences_foundation: dependency: transitive description: name: shared_preferences_foundation - sha256: "0c1c16c56c9708aa9c361541a6f0e5cc6fc12a3232d866a687a7b7db30032b07" + sha256: "7bf53a9f2d007329ee6f3df7268fd498f8373602f943c975598bbb34649b62a7" url: "https://pub.dev" source: hosted - version: "2.2.1" + version: "2.3.4" shared_preferences_linux: dependency: transitive description: name: shared_preferences_linux - sha256: "9d387433ca65717bbf1be88f4d5bb18f10508917a8fa2fb02e0fd0d7479a9afa" + sha256: "9f2cbcf46d4270ea8be39fa156d86379077c8a5228d9dfdb1164ae0bb93f1faa" url: "https://pub.dev" source: hosted - version: "2.2.0" + version: "2.3.2" shared_preferences_platform_interface: dependency: transitive description: name: shared_preferences_platform_interface - sha256: "23b052f17a25b90ff2b61aad4cc962154da76fb62848a9ce088efe30d7c50ab1" + sha256: d4ec5fc9ebb2f2e056c617112aa75dcf92fc2e4faaf2ae999caa297473f75d8a url: "https://pub.dev" source: hosted - version: "2.3.0" + version: "2.3.1" shared_preferences_web: dependency: transitive description: name: shared_preferences_web - sha256: "74083203a8eae241e0de4a0d597dbedab3b8fef5563f33cf3c12d7e93c655ca5" + sha256: d762709c2bbe80626ecc819143013cc820fa49ca5e363620ee20a8b15a3e3daf url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "2.2.1" shared_preferences_windows: dependency: transitive description: name: shared_preferences_windows - sha256: "5e588e2efef56916a3b229c3bfe81e6a525665a454519ca51dbcc4236a274173" + sha256: "841ad54f3c8381c480d0c9b508b89a34036f512482c407e6df7a9c4aa2ef8f59" url: "https://pub.dev" source: hosted - version: "2.2.0" + version: "2.3.2" shelf: dependency: transitive description: @@ -1077,18 +1069,18 @@ packages: dependency: transitive description: name: source_gen - sha256: b20e191de6964e98032573cecb1d2b169d96ba63fdb586d24dcd1003ba7e94f6 + sha256: fc0da689e5302edb6177fdd964efcb7f58912f43c28c2047a808f5bfff643d16 url: "https://pub.dev" source: hosted - version: "1.3.0" + version: "1.4.0" source_helper: dependency: transitive description: name: source_helper - sha256: "3b67aade1d52416149c633ba1bb36df44d97c6b51830c2198e934e3fca87ca1f" + sha256: "6adebc0006c37dd63fe05bca0a929b99f06402fc95aa35bf36d67f5c06de01fd" url: "https://pub.dev" source: hosted - version: "1.3.3" + version: "1.3.4" source_span: dependency: transitive description: @@ -1173,98 +1165,98 @@ packages: dependency: transitive description: name: typed_data - sha256: "26f87ade979c47a150c9eaab93ccd2bebe70a27dc0b4b29517f2904f04eb11a5" + sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c url: "https://pub.dev" source: hosted - version: "1.3.1" + version: "1.3.2" url_launcher: dependency: "direct main" description: name: url_launcher - sha256: eb1e00ab44303d50dd487aab67ebc575456c146c6af44422f9c13889984c00f3 + sha256: b1c9e98774adf8820c96fbc7ae3601231d324a7d5ebd8babe27b6dfac91357ba url: "https://pub.dev" source: hosted - version: "6.1.11" + version: "6.2.1" url_launcher_android: dependency: transitive description: name: url_launcher_android - sha256: "22f8db4a72be26e9e3a4aa3f194b1f7afbc76d20ec141f84be1d787db2155cbd" + sha256: "31222ffb0063171b526d3e569079cf1f8b294075ba323443fdc690842bfd4def" url: "https://pub.dev" source: hosted - version: "6.0.31" + version: "6.2.0" url_launcher_ios: dependency: transitive description: name: url_launcher_ios - sha256: "9af7ea73259886b92199f9e42c116072f05ff9bea2dcb339ab935dfc957392c2" + sha256: "4ac97281cf60e2e8c5cc703b2b28528f9b50c8f7cebc71df6bdf0845f647268a" url: "https://pub.dev" source: hosted - version: "6.1.4" + version: "6.2.0" url_launcher_linux: dependency: transitive description: name: url_launcher_linux - sha256: "207f4ddda99b95b4d4868320a352d374b0b7e05eefad95a4a26f57da413443f5" + sha256: "9f2d390e096fdbe1e6e6256f97851e51afc2d9c423d3432f1d6a02a8a9a8b9fd" url: "https://pub.dev" source: hosted - version: "3.0.5" + version: "3.1.0" url_launcher_macos: dependency: transitive description: name: url_launcher_macos - sha256: "91ee3e75ea9dadf38036200c5d3743518f4a5eb77a8d13fda1ee5764373f185e" + sha256: b7244901ea3cf489c5335bdacda07264a6e960b1c1b1a9f91e4bc371d9e68234 url: "https://pub.dev" source: hosted - version: "3.0.5" + version: "3.1.0" url_launcher_platform_interface: dependency: transitive description: name: url_launcher_platform_interface - sha256: "6c9ca697a5ae218ce56cece69d46128169a58aa8653c1b01d26fcd4aad8c4370" + sha256: "980e8d9af422f477be6948bdfb68df8433be71f5743a188968b0c1b887807e50" url: "https://pub.dev" source: hosted - version: "2.1.2" + version: "2.2.0" url_launcher_web: dependency: transitive description: name: url_launcher_web - sha256: "81fe91b6c4f84f222d186a9d23c73157dc4c8e1c71489c4d08be1ad3b228f1aa" + sha256: "7fd2f55fe86cea2897b963e864dc01a7eb0719ecc65fcef4c1cc3d686d718bb2" url: "https://pub.dev" source: hosted - version: "2.0.16" + version: "2.2.0" url_launcher_windows: dependency: transitive description: name: url_launcher_windows - sha256: "254708f17f7c20a9c8c471f67d86d76d4a3f9c1591aad1e15292008aceb82771" + sha256: "7754a1ad30ee896b265f8d14078b0513a4dba28d358eabb9d5f339886f4a1adc" url: "https://pub.dev" source: hosted - version: "3.0.6" + version: "3.1.0" vector_graphics: dependency: transitive description: name: vector_graphics - sha256: ea8d3fc7b2e0f35de38a7465063ecfcf03d8217f7962aa2a6717132cb5d43a79 + sha256: "0f0c746dd2d6254a0057218ff980fc7f5670fd0fcf5e4db38a490d31eed4ad43" url: "https://pub.dev" source: hosted - version: "1.1.5" + version: "1.1.9+1" vector_graphics_codec: dependency: transitive description: name: vector_graphics_codec - sha256: a5eaa5d19e123ad4f61c3718ca1ed921c4e6254238d9145f82aa214955d9aced + sha256: "0edf6d630d1bfd5589114138ed8fada3234deacc37966bec033d3047c29248b7" url: "https://pub.dev" source: hosted - version: "1.1.5" + version: "1.1.9+1" vector_graphics_compiler: dependency: transitive description: name: vector_graphics_compiler - sha256: "15edc42f7eaa478ce854eaf1fbb9062a899c0e4e56e775dd73b7f4709c97c4ca" + sha256: d24333727332d9bd20990f1483af4e09abdb9b1fc7c3db940b56ab5c42790c26 url: "https://pub.dev" source: hosted - version: "1.1.5" + version: "1.1.9+1" vector_math: dependency: transitive description: @@ -1285,50 +1277,50 @@ packages: dependency: transitive description: name: version_manipulation - sha256: "2fcb0597589e894082ebde9140b5c018c0858215eef39539d87c200e3da82ec0" + sha256: "9ef166939794d5bd80309cc6dbfe33c9f81674ba1c73ac117a866fd2dc746846" url: "https://pub.dev" source: hosted - version: "0.1.1" + version: "0.1.2" video_player: dependency: "direct main" description: name: video_player - sha256: "74b86e63529cf5885130c639d74cd2f9232e7c8a66cbecbddd1dcb9dbd060d1e" + sha256: e16f0a83601a78d165dabc17e4dac50997604eb9e4cc76e10fa219046b70cef3 url: "https://pub.dev" source: hosted - version: "2.7.2" + version: "2.8.1" video_player_android: dependency: transitive description: name: video_player_android - sha256: b608c320ab1a5fd373987c9c3c9ddbd6bda04d209f2a9f0bf197c5b02082201e + sha256: "3fe89ab07fdbce786e7eb25b58532d6eaf189ceddc091cb66cba712f8d9e8e55" url: "https://pub.dev" source: hosted - version: "2.4.7" + version: "2.4.10" video_player_avfoundation: dependency: transitive description: name: video_player_avfoundation - sha256: "824dad3e2986a13766fcccfd1c48c83eef9f896c220a53292e3019b9e98615bb" + sha256: fe73d636f82286a3739f5e644f95f09442cacdc436ebbe5436521dc915f3ecac url: "https://pub.dev" source: hosted - version: "2.4.5" + version: "2.5.1" video_player_platform_interface: dependency: transitive description: name: video_player_platform_interface - sha256: a8c4dcae2a7a6e7cc1d7f9808294d968eca1993af34a98e95b9bdfa959bec684 + sha256: be72301bf2c0150ab35a8c34d66e5a99de525f6de1e8d27c0672b836fe48f73a url: "https://pub.dev" source: hosted - version: "6.1.0" + version: "6.2.1" video_player_web: dependency: transitive description: name: video_player_web - sha256: "44ce41424d104dfb7cf6982cc6b84af2b007a24d126406025bf40de5d481c74c" + sha256: ab7a462b07d9ca80bed579e30fb3bce372468f1b78642e0911b10600f2c5cb5b url: "https://pub.dev" source: hosted - version: "2.0.16" + version: "2.1.2" vm_service: dependency: transitive description: @@ -1341,10 +1333,10 @@ packages: dependency: transitive description: name: watcher - sha256: "6a7f46926b01ce81bfc339da6a7f20afbe7733eff9846f6d6a5466aa4c6667c0" + sha256: "3d2ad6751b3c16cf07c7fca317a1413b3f26530319181b37e3b9039b84fc01d8" url: "https://pub.dev" source: hosted - version: "1.0.2" + version: "1.1.0" web: dependency: transitive description: @@ -1373,26 +1365,26 @@ packages: dependency: transitive description: name: win32 - sha256: "5a751eddf9db89b3e5f9d50c20ab8612296e4e8db69009788d6c8b060a84191c" + sha256: "350a11abd2d1d97e0cc7a28a81b781c08002aa2864d9e3f192ca0ffa18b06ed3" url: "https://pub.dev" source: hosted - version: "4.1.4" + version: "5.0.9" xdg_directories: dependency: transitive description: name: xdg_directories - sha256: ee1505df1426458f7f60aac270645098d318a8b4766d85fde75f76f2e21807d1 + sha256: "589ada45ba9e39405c198fe34eb0f607cddb2108527e658136120892beac46d2" url: "https://pub.dev" source: hosted - version: "1.0.0" + version: "1.0.3" xml: dependency: transitive description: name: xml - sha256: "979ee37d622dec6365e2efa4d906c37470995871fe9ae080d967e192d88286b5" + sha256: "5bc72e1e45e941d825fd7468b9b4cc3b9327942649aeb6fc5cdbf135f0a86e84" url: "https://pub.dev" source: hosted - version: "6.2.2" + version: "6.3.0" yaml: dependency: transitive description: @@ -1402,5 +1394,5 @@ packages: source: hosted version: "3.1.2" sdks: - dart: ">=3.1.0-185.0.dev <4.0.0" - flutter: ">=3.7.0" + dart: ">=3.1.0 <4.0.0" + flutter: ">=3.13.0" diff --git a/pubspec.yaml b/pubspec.yaml index 5413e843a..235e84917 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -24,7 +24,7 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev version: 1.5.6+34 environment: - sdk: '>=2.17.0 <3.0.0' + sdk: ">=2.17.0 <3.0.0" dependencies: flutter: @@ -33,7 +33,6 @@ dependencies: sdk: flutter android_metadata: ^0.2.1 - community_charts_flutter: ^1.0.2 collection: ^1.17.0 cupertino_icons: ^1.0.5 equatable: ^2.0.5 @@ -41,14 +40,14 @@ dependencies: flutter_html: ^3.0.0-beta.2 flutter_typeahead: ^4.8.0 font_awesome_flutter: ^10.4.0 - http: ^0.13.5 + http: ^1.1.0 image_picker: ^1.0.4 - intl: ^0.18.0 + intl: ^0.18.1 json_annotation: ^4.8.1 version: ^3.0.2 package_info_plus: ^4.2.0 provider: ^6.0.5 - rive: ^0.11.4 + rive: ^0.12.2 shared_preferences: ^2.2.2 table_calendar: ^3.0.8 url_launcher: ^6.1.11 @@ -58,7 +57,8 @@ dependencies: carousel_slider: ^4.2.1 multi_select_flutter: ^4.1.3 flutter_svg: ^2.0.5 - flutter_zxing: ^1.4.1 + fl_chart: ^0.64.0 + flutter_zxing: ^1.1.2 dev_dependencies: flutter_test: @@ -70,8 +70,8 @@ dev_dependencies: json_serializable: ^6.6.2 mockito: ^5.4.0 network_image_mock: ^2.1.1 - flutter_lints: ^2.0.3 - cider: ^0.1.6 + flutter_lints: ^3.0.1 + cider: ^0.2.4 # Better icons have been added manually, Android now uses vector icon # TODO Consider removing flutter_launcher_icons completely diff --git a/test/exercises/contribute_exercise_test.mocks.dart b/test/exercises/contribute_exercise_test.mocks.dart index ea2b2a429..d57a4f903 100644 --- a/test/exercises/contribute_exercise_test.mocks.dart +++ b/test/exercises/contribute_exercise_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.0 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in wger/test/exercises/contribute_exercise_test.dart. // Do not manually edit this file. @@ -32,7 +32,8 @@ import 'package:wger/providers/user.dart' as _i15; // ignore_for_file: camel_case_types // ignore_for_file: subtype_of_sealed_class -class _FakeWgerBaseProvider_0 extends _i1.SmartFake implements _i2.WgerBaseProvider { +class _FakeWgerBaseProvider_0 extends _i1.SmartFake + implements _i2.WgerBaseProvider { _FakeWgerBaseProvider_0( Object parent, Invocation parentInvocation, @@ -85,7 +86,8 @@ class _FakeAlias_4 extends _i1.SmartFake implements _i6.Alias { /// A class which mocks [AddExerciseProvider]. /// /// See the documentation for Mockito's code generation for more information. -class MockAddExerciseProvider extends _i1.Mock implements _i7.AddExerciseProvider { +class MockAddExerciseProvider extends _i1.Mock + implements _i7.AddExerciseProvider { MockAddExerciseProvider() { _i1.throwOnMissingStub(this); } @@ -98,6 +100,7 @@ class MockAddExerciseProvider extends _i1.Mock implements _i7.AddExerciseProvide Invocation.getter(#baseProvider), ), ) as _i2.WgerBaseProvider); + @override set language(_i8.Language? _language) => super.noSuchMethod( Invocation.setter( @@ -106,6 +109,7 @@ class MockAddExerciseProvider extends _i1.Mock implements _i7.AddExerciseProvide ), returnValueForMissingStub: null, ); + @override set category(_i9.ExerciseCategory? _category) => super.noSuchMethod( Invocation.setter( @@ -114,11 +118,13 @@ class MockAddExerciseProvider extends _i1.Mock implements _i7.AddExerciseProvide ), returnValueForMissingStub: null, ); + @override List<_i10.File> get exerciseImages => (super.noSuchMethod( Invocation.getter(#exerciseImages), returnValue: <_i10.File>[], ) as List<_i10.File>); + @override set exerciseNameEn(String? name) => super.noSuchMethod( Invocation.setter( @@ -127,6 +133,7 @@ class MockAddExerciseProvider extends _i1.Mock implements _i7.AddExerciseProvide ), returnValueForMissingStub: null, ); + @override set exerciseNameTrans(String? name) => super.noSuchMethod( Invocation.setter( @@ -135,6 +142,7 @@ class MockAddExerciseProvider extends _i1.Mock implements _i7.AddExerciseProvide ), returnValueForMissingStub: null, ); + @override set descriptionEn(String? description) => super.noSuchMethod( Invocation.setter( @@ -143,6 +151,7 @@ class MockAddExerciseProvider extends _i1.Mock implements _i7.AddExerciseProvide ), returnValueForMissingStub: null, ); + @override set descriptionTrans(String? description) => super.noSuchMethod( Invocation.setter( @@ -151,6 +160,7 @@ class MockAddExerciseProvider extends _i1.Mock implements _i7.AddExerciseProvide ), returnValueForMissingStub: null, ); + @override set alternateNamesEn(List? names) => super.noSuchMethod( Invocation.setter( @@ -159,6 +169,7 @@ class MockAddExerciseProvider extends _i1.Mock implements _i7.AddExerciseProvide ), returnValueForMissingStub: null, ); + @override set alternateNamesTrans(List? names) => super.noSuchMethod( Invocation.setter( @@ -167,6 +178,7 @@ class MockAddExerciseProvider extends _i1.Mock implements _i7.AddExerciseProvide ), returnValueForMissingStub: null, ); + @override set equipment(List<_i11.Equipment>? equipment) => super.noSuchMethod( Invocation.setter( @@ -175,16 +187,19 @@ class MockAddExerciseProvider extends _i1.Mock implements _i7.AddExerciseProvide ), returnValueForMissingStub: null, ); + @override List<_i11.Equipment> get equipment => (super.noSuchMethod( Invocation.getter(#equipment), returnValue: <_i11.Equipment>[], ) as List<_i11.Equipment>); + @override bool get newVariation => (super.noSuchMethod( Invocation.getter(#newVariation), returnValue: false, ) as bool); + @override set newVariationForExercise(int? value) => super.noSuchMethod( Invocation.setter( @@ -193,6 +208,7 @@ class MockAddExerciseProvider extends _i1.Mock implements _i7.AddExerciseProvide ), returnValueForMissingStub: null, ); + @override set variationId(int? variation) => super.noSuchMethod( Invocation.setter( @@ -201,6 +217,7 @@ class MockAddExerciseProvider extends _i1.Mock implements _i7.AddExerciseProvide ), returnValueForMissingStub: null, ); + @override _i3.ExerciseBase get base => (super.noSuchMethod( Invocation.getter(#base), @@ -209,6 +226,7 @@ class MockAddExerciseProvider extends _i1.Mock implements _i7.AddExerciseProvide Invocation.getter(#base), ), ) as _i3.ExerciseBase); + @override _i4.Translation get exerciseEn => (super.noSuchMethod( Invocation.getter(#exerciseEn), @@ -217,6 +235,7 @@ class MockAddExerciseProvider extends _i1.Mock implements _i7.AddExerciseProvide Invocation.getter(#exerciseEn), ), ) as _i4.Translation); + @override _i4.Translation get exerciseTranslation => (super.noSuchMethod( Invocation.getter(#exerciseTranslation), @@ -225,6 +244,7 @@ class MockAddExerciseProvider extends _i1.Mock implements _i7.AddExerciseProvide Invocation.getter(#exerciseTranslation), ), ) as _i4.Translation); + @override _i5.Variation get variation => (super.noSuchMethod( Invocation.getter(#variation), @@ -233,11 +253,13 @@ class MockAddExerciseProvider extends _i1.Mock implements _i7.AddExerciseProvide Invocation.getter(#variation), ), ) as _i5.Variation); + @override List<_i12.Muscle> get primaryMuscles => (super.noSuchMethod( Invocation.getter(#primaryMuscles), returnValue: <_i12.Muscle>[], ) as List<_i12.Muscle>); + @override set primaryMuscles(List<_i12.Muscle>? muscles) => super.noSuchMethod( Invocation.setter( @@ -246,11 +268,13 @@ class MockAddExerciseProvider extends _i1.Mock implements _i7.AddExerciseProvide ), returnValueForMissingStub: null, ); + @override List<_i12.Muscle> get secondaryMuscles => (super.noSuchMethod( Invocation.getter(#secondaryMuscles), returnValue: <_i12.Muscle>[], ) as List<_i12.Muscle>); + @override set secondaryMuscles(List<_i12.Muscle>? muscles) => super.noSuchMethod( Invocation.setter( @@ -259,11 +283,13 @@ class MockAddExerciseProvider extends _i1.Mock implements _i7.AddExerciseProvide ), returnValueForMissingStub: null, ); + @override bool get hasListeners => (super.noSuchMethod( Invocation.getter(#hasListeners), returnValue: false, ) as bool); + @override void clear() => super.noSuchMethod( Invocation.method( @@ -272,6 +298,7 @@ class MockAddExerciseProvider extends _i1.Mock implements _i7.AddExerciseProvide ), returnValueForMissingStub: null, ); + @override void addExerciseImages(List<_i10.File>? exercises) => super.noSuchMethod( Invocation.method( @@ -280,6 +307,7 @@ class MockAddExerciseProvider extends _i1.Mock implements _i7.AddExerciseProvide ), returnValueForMissingStub: null, ); + @override void removeExercise(String? path) => super.noSuchMethod( Invocation.method( @@ -288,6 +316,7 @@ class MockAddExerciseProvider extends _i1.Mock implements _i7.AddExerciseProvide ), returnValueForMissingStub: null, ); + @override void printValues() => super.noSuchMethod( Invocation.method( @@ -296,6 +325,7 @@ class MockAddExerciseProvider extends _i1.Mock implements _i7.AddExerciseProvide ), returnValueForMissingStub: null, ); + @override _i13.Future addExercise() => (super.noSuchMethod( Invocation.method( @@ -304,6 +334,7 @@ class MockAddExerciseProvider extends _i1.Mock implements _i7.AddExerciseProvide ), returnValue: _i13.Future.value(0), ) as _i13.Future); + @override _i13.Future<_i3.ExerciseBase> addExerciseBase() => (super.noSuchMethod( Invocation.method( @@ -318,6 +349,7 @@ class MockAddExerciseProvider extends _i1.Mock implements _i7.AddExerciseProvide ), )), ) as _i13.Future<_i3.ExerciseBase>); + @override _i13.Future<_i5.Variation> addVariation() => (super.noSuchMethod( Invocation.method( @@ -332,6 +364,7 @@ class MockAddExerciseProvider extends _i1.Mock implements _i7.AddExerciseProvide ), )), ) as _i13.Future<_i5.Variation>); + @override _i13.Future addImages(_i3.ExerciseBase? base) => (super.noSuchMethod( Invocation.method( @@ -341,8 +374,10 @@ class MockAddExerciseProvider extends _i1.Mock implements _i7.AddExerciseProvide returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); + @override - _i13.Future<_i4.Translation> addExerciseTranslation(_i4.Translation? exercise) => + _i13.Future<_i4.Translation> addExerciseTranslation( + _i4.Translation? exercise) => (super.noSuchMethod( Invocation.method( #addExerciseTranslation, @@ -356,6 +391,7 @@ class MockAddExerciseProvider extends _i1.Mock implements _i7.AddExerciseProvide ), )), ) as _i13.Future<_i4.Translation>); + @override _i13.Future<_i6.Alias> addExerciseAlias( String? name, @@ -380,6 +416,7 @@ class MockAddExerciseProvider extends _i1.Mock implements _i7.AddExerciseProvide ), )), ) as _i13.Future<_i6.Alias>); + @override void addListener(_i14.VoidCallback? listener) => super.noSuchMethod( Invocation.method( @@ -388,6 +425,7 @@ class MockAddExerciseProvider extends _i1.Mock implements _i7.AddExerciseProvide ), returnValueForMissingStub: null, ); + @override void removeListener(_i14.VoidCallback? listener) => super.noSuchMethod( Invocation.method( @@ -396,6 +434,7 @@ class MockAddExerciseProvider extends _i1.Mock implements _i7.AddExerciseProvide ), returnValueForMissingStub: null, ); + @override void dispose() => super.noSuchMethod( Invocation.method( @@ -404,6 +443,7 @@ class MockAddExerciseProvider extends _i1.Mock implements _i7.AddExerciseProvide ), returnValueForMissingStub: null, ); + @override void notifyListeners() => super.noSuchMethod( Invocation.method( @@ -430,6 +470,7 @@ class MockUserProvider extends _i1.Mock implements _i15.UserProvider { Invocation.getter(#baseProvider), ), ) as _i2.WgerBaseProvider); + @override set profile(_i16.Profile? _profile) => super.noSuchMethod( Invocation.setter( @@ -438,11 +479,13 @@ class MockUserProvider extends _i1.Mock implements _i15.UserProvider { ), returnValueForMissingStub: null, ); + @override bool get hasListeners => (super.noSuchMethod( Invocation.getter(#hasListeners), returnValue: false, ) as bool); + @override void clear() => super.noSuchMethod( Invocation.method( @@ -451,6 +494,7 @@ class MockUserProvider extends _i1.Mock implements _i15.UserProvider { ), returnValueForMissingStub: null, ); + @override _i13.Future fetchAndSetProfile() => (super.noSuchMethod( Invocation.method( @@ -460,6 +504,7 @@ class MockUserProvider extends _i1.Mock implements _i15.UserProvider { returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); + @override _i13.Future saveProfile() => (super.noSuchMethod( Invocation.method( @@ -469,6 +514,7 @@ class MockUserProvider extends _i1.Mock implements _i15.UserProvider { returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); + @override _i13.Future verifyEmail() => (super.noSuchMethod( Invocation.method( @@ -478,6 +524,7 @@ class MockUserProvider extends _i1.Mock implements _i15.UserProvider { returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); + @override void addListener(_i14.VoidCallback? listener) => super.noSuchMethod( Invocation.method( @@ -486,6 +533,7 @@ class MockUserProvider extends _i1.Mock implements _i15.UserProvider { ), returnValueForMissingStub: null, ); + @override void removeListener(_i14.VoidCallback? listener) => super.noSuchMethod( Invocation.method( @@ -494,6 +542,7 @@ class MockUserProvider extends _i1.Mock implements _i15.UserProvider { ), returnValueForMissingStub: null, ); + @override void dispose() => super.noSuchMethod( Invocation.method( @@ -502,6 +551,7 @@ class MockUserProvider extends _i1.Mock implements _i15.UserProvider { ), returnValueForMissingStub: null, ); + @override void notifyListeners() => super.noSuchMethod( Invocation.method( diff --git a/test/gallery/gallery_form_test.mocks.dart b/test/gallery/gallery_form_test.mocks.dart index fd2c12414..68ca4e783 100644 --- a/test/gallery/gallery_form_test.mocks.dart +++ b/test/gallery/gallery_form_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.0 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in wger/test/gallery/gallery_form_test.dart. // Do not manually edit this file. @@ -77,6 +77,7 @@ class MockGalleryProvider extends _i1.Mock implements _i4.GalleryProvider { Invocation.getter(#images), returnValue: <_i5.Image>[], ) as List<_i5.Image>); + @override set images(List<_i5.Image>? _images) => super.noSuchMethod( Invocation.setter( @@ -85,6 +86,7 @@ class MockGalleryProvider extends _i1.Mock implements _i4.GalleryProvider { ), returnValueForMissingStub: null, ); + @override _i2.AuthProvider get auth => (super.noSuchMethod( Invocation.getter(#auth), @@ -93,6 +95,7 @@ class MockGalleryProvider extends _i1.Mock implements _i4.GalleryProvider { Invocation.getter(#auth), ), ) as _i2.AuthProvider); + @override set auth(_i2.AuthProvider? _auth) => super.noSuchMethod( Invocation.setter( @@ -101,6 +104,7 @@ class MockGalleryProvider extends _i1.Mock implements _i4.GalleryProvider { ), returnValueForMissingStub: null, ); + @override _i3.Client get client => (super.noSuchMethod( Invocation.getter(#client), @@ -109,6 +113,7 @@ class MockGalleryProvider extends _i1.Mock implements _i4.GalleryProvider { Invocation.getter(#client), ), ) as _i3.Client); + @override set client(_i3.Client? _client) => super.noSuchMethod( Invocation.setter( @@ -117,11 +122,13 @@ class MockGalleryProvider extends _i1.Mock implements _i4.GalleryProvider { ), returnValueForMissingStub: null, ); + @override bool get hasListeners => (super.noSuchMethod( Invocation.getter(#hasListeners), returnValue: false, ) as bool); + @override void clear() => super.noSuchMethod( Invocation.method( @@ -130,6 +137,7 @@ class MockGalleryProvider extends _i1.Mock implements _i4.GalleryProvider { ), returnValueForMissingStub: null, ); + @override _i6.Future fetchAndSetGallery() => (super.noSuchMethod( Invocation.method( @@ -139,6 +147,7 @@ class MockGalleryProvider extends _i1.Mock implements _i4.GalleryProvider { returnValue: _i6.Future.value(), returnValueForMissingStub: _i6.Future.value(), ) as _i6.Future); + @override _i6.Future addImage( _i5.Image? image, @@ -155,6 +164,7 @@ class MockGalleryProvider extends _i1.Mock implements _i4.GalleryProvider { returnValue: _i6.Future.value(), returnValueForMissingStub: _i6.Future.value(), ) as _i6.Future); + @override _i6.Future editImage( _i5.Image? image, @@ -171,6 +181,7 @@ class MockGalleryProvider extends _i1.Mock implements _i4.GalleryProvider { returnValue: _i6.Future.value(), returnValueForMissingStub: _i6.Future.value(), ) as _i6.Future); + @override _i6.Future deleteImage(_i5.Image? image) => (super.noSuchMethod( Invocation.method( @@ -180,8 +191,10 @@ class MockGalleryProvider extends _i1.Mock implements _i4.GalleryProvider { returnValue: _i6.Future.value(), returnValueForMissingStub: _i6.Future.value(), ) as _i6.Future); + @override - Map getDefaultHeaders({dynamic includeAuth = false}) => (super.noSuchMethod( + Map getDefaultHeaders({dynamic includeAuth = false}) => + (super.noSuchMethod( Invocation.method( #getDefaultHeaders, [], @@ -189,6 +202,7 @@ class MockGalleryProvider extends _i1.Mock implements _i4.GalleryProvider { ), returnValue: {}, ) as Map); + @override Uri makeUrl( String? path, { @@ -219,14 +233,17 @@ class MockGalleryProvider extends _i1.Mock implements _i4.GalleryProvider { ), ), ) as Uri); + @override _i6.Future> fetch(Uri? uri) => (super.noSuchMethod( Invocation.method( #fetch, [uri], ), - returnValue: _i6.Future>.value({}), + returnValue: + _i6.Future>.value({}), ) as _i6.Future>); + @override _i6.Future> fetchPaginated(Uri? uri) => (super.noSuchMethod( Invocation.method( @@ -235,6 +252,7 @@ class MockGalleryProvider extends _i1.Mock implements _i4.GalleryProvider { ), returnValue: _i6.Future>.value([]), ) as _i6.Future>); + @override _i6.Future> post( Map? data, @@ -248,8 +266,10 @@ class MockGalleryProvider extends _i1.Mock implements _i4.GalleryProvider { uri, ], ), - returnValue: _i6.Future>.value({}), + returnValue: + _i6.Future>.value({}), ) as _i6.Future>); + @override _i6.Future> patch( Map? data, @@ -263,8 +283,10 @@ class MockGalleryProvider extends _i1.Mock implements _i4.GalleryProvider { uri, ], ), - returnValue: _i6.Future>.value({}), + returnValue: + _i6.Future>.value({}), ) as _i6.Future>); + @override _i6.Future<_i3.Response> deleteRequest( String? url, @@ -289,6 +311,7 @@ class MockGalleryProvider extends _i1.Mock implements _i4.GalleryProvider { ), )), ) as _i6.Future<_i3.Response>); + @override void addListener(_i8.VoidCallback? listener) => super.noSuchMethod( Invocation.method( @@ -297,6 +320,7 @@ class MockGalleryProvider extends _i1.Mock implements _i4.GalleryProvider { ), returnValueForMissingStub: null, ); + @override void removeListener(_i8.VoidCallback? listener) => super.noSuchMethod( Invocation.method( @@ -305,6 +329,7 @@ class MockGalleryProvider extends _i1.Mock implements _i4.GalleryProvider { ), returnValueForMissingStub: null, ); + @override void dispose() => super.noSuchMethod( Invocation.method( @@ -313,6 +338,7 @@ class MockGalleryProvider extends _i1.Mock implements _i4.GalleryProvider { ), returnValueForMissingStub: null, ); + @override void notifyListeners() => super.noSuchMethod( Invocation.method( diff --git a/test/gallery/gallery_screen_test.mocks.dart b/test/gallery/gallery_screen_test.mocks.dart index 628b8a407..5bf657f70 100644 --- a/test/gallery/gallery_screen_test.mocks.dart +++ b/test/gallery/gallery_screen_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.0 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in wger/test/gallery/gallery_screen_test.dart. // Do not manually edit this file. @@ -77,6 +77,7 @@ class MockGalleryProvider extends _i1.Mock implements _i4.GalleryProvider { Invocation.getter(#images), returnValue: <_i5.Image>[], ) as List<_i5.Image>); + @override set images(List<_i5.Image>? _images) => super.noSuchMethod( Invocation.setter( @@ -85,6 +86,7 @@ class MockGalleryProvider extends _i1.Mock implements _i4.GalleryProvider { ), returnValueForMissingStub: null, ); + @override _i2.AuthProvider get auth => (super.noSuchMethod( Invocation.getter(#auth), @@ -93,6 +95,7 @@ class MockGalleryProvider extends _i1.Mock implements _i4.GalleryProvider { Invocation.getter(#auth), ), ) as _i2.AuthProvider); + @override set auth(_i2.AuthProvider? _auth) => super.noSuchMethod( Invocation.setter( @@ -101,6 +104,7 @@ class MockGalleryProvider extends _i1.Mock implements _i4.GalleryProvider { ), returnValueForMissingStub: null, ); + @override _i3.Client get client => (super.noSuchMethod( Invocation.getter(#client), @@ -109,6 +113,7 @@ class MockGalleryProvider extends _i1.Mock implements _i4.GalleryProvider { Invocation.getter(#client), ), ) as _i3.Client); + @override set client(_i3.Client? _client) => super.noSuchMethod( Invocation.setter( @@ -117,11 +122,13 @@ class MockGalleryProvider extends _i1.Mock implements _i4.GalleryProvider { ), returnValueForMissingStub: null, ); + @override bool get hasListeners => (super.noSuchMethod( Invocation.getter(#hasListeners), returnValue: false, ) as bool); + @override void clear() => super.noSuchMethod( Invocation.method( @@ -130,6 +137,7 @@ class MockGalleryProvider extends _i1.Mock implements _i4.GalleryProvider { ), returnValueForMissingStub: null, ); + @override _i6.Future fetchAndSetGallery() => (super.noSuchMethod( Invocation.method( @@ -139,6 +147,7 @@ class MockGalleryProvider extends _i1.Mock implements _i4.GalleryProvider { returnValue: _i6.Future.value(), returnValueForMissingStub: _i6.Future.value(), ) as _i6.Future); + @override _i6.Future addImage( _i5.Image? image, @@ -155,6 +164,7 @@ class MockGalleryProvider extends _i1.Mock implements _i4.GalleryProvider { returnValue: _i6.Future.value(), returnValueForMissingStub: _i6.Future.value(), ) as _i6.Future); + @override _i6.Future editImage( _i5.Image? image, @@ -171,6 +181,7 @@ class MockGalleryProvider extends _i1.Mock implements _i4.GalleryProvider { returnValue: _i6.Future.value(), returnValueForMissingStub: _i6.Future.value(), ) as _i6.Future); + @override _i6.Future deleteImage(_i5.Image? image) => (super.noSuchMethod( Invocation.method( @@ -180,8 +191,10 @@ class MockGalleryProvider extends _i1.Mock implements _i4.GalleryProvider { returnValue: _i6.Future.value(), returnValueForMissingStub: _i6.Future.value(), ) as _i6.Future); + @override - Map getDefaultHeaders({dynamic includeAuth = false}) => (super.noSuchMethod( + Map getDefaultHeaders({dynamic includeAuth = false}) => + (super.noSuchMethod( Invocation.method( #getDefaultHeaders, [], @@ -189,6 +202,7 @@ class MockGalleryProvider extends _i1.Mock implements _i4.GalleryProvider { ), returnValue: {}, ) as Map); + @override Uri makeUrl( String? path, { @@ -219,14 +233,17 @@ class MockGalleryProvider extends _i1.Mock implements _i4.GalleryProvider { ), ), ) as Uri); + @override _i6.Future> fetch(Uri? uri) => (super.noSuchMethod( Invocation.method( #fetch, [uri], ), - returnValue: _i6.Future>.value({}), + returnValue: + _i6.Future>.value({}), ) as _i6.Future>); + @override _i6.Future> fetchPaginated(Uri? uri) => (super.noSuchMethod( Invocation.method( @@ -235,6 +252,7 @@ class MockGalleryProvider extends _i1.Mock implements _i4.GalleryProvider { ), returnValue: _i6.Future>.value([]), ) as _i6.Future>); + @override _i6.Future> post( Map? data, @@ -248,8 +266,10 @@ class MockGalleryProvider extends _i1.Mock implements _i4.GalleryProvider { uri, ], ), - returnValue: _i6.Future>.value({}), + returnValue: + _i6.Future>.value({}), ) as _i6.Future>); + @override _i6.Future> patch( Map? data, @@ -263,8 +283,10 @@ class MockGalleryProvider extends _i1.Mock implements _i4.GalleryProvider { uri, ], ), - returnValue: _i6.Future>.value({}), + returnValue: + _i6.Future>.value({}), ) as _i6.Future>); + @override _i6.Future<_i3.Response> deleteRequest( String? url, @@ -289,6 +311,7 @@ class MockGalleryProvider extends _i1.Mock implements _i4.GalleryProvider { ), )), ) as _i6.Future<_i3.Response>); + @override void addListener(_i8.VoidCallback? listener) => super.noSuchMethod( Invocation.method( @@ -297,6 +320,7 @@ class MockGalleryProvider extends _i1.Mock implements _i4.GalleryProvider { ), returnValueForMissingStub: null, ); + @override void removeListener(_i8.VoidCallback? listener) => super.noSuchMethod( Invocation.method( @@ -305,6 +329,7 @@ class MockGalleryProvider extends _i1.Mock implements _i4.GalleryProvider { ), returnValueForMissingStub: null, ); + @override void dispose() => super.noSuchMethod( Invocation.method( @@ -313,6 +338,7 @@ class MockGalleryProvider extends _i1.Mock implements _i4.GalleryProvider { ), returnValueForMissingStub: null, ); + @override void notifyListeners() => super.noSuchMethod( Invocation.method( diff --git a/test/measurements/measurement_categories_screen_test.dart b/test/measurements/measurement_categories_screen_test.dart index e1d59cd48..1fa899e4d 100644 --- a/test/measurements/measurement_categories_screen_test.dart +++ b/test/measurements/measurement_categories_screen_test.dart @@ -26,7 +26,7 @@ import 'package:wger/models/measurements/measurement_category.dart'; import 'package:wger/models/measurements/measurement_entry.dart'; import 'package:wger/providers/measurement.dart'; import 'package:wger/screens/measurement_categories_screen.dart'; -import 'package:wger/widgets/core/charts.dart'; +import 'package:wger/widgets/measurements/charts.dart'; import 'measurement_categories_screen_test.mocks.dart'; @@ -68,6 +68,6 @@ void main() { expect(find.text('body fat'), findsOneWidget); expect(find.text('biceps'), findsOneWidget); expect(find.byType(Card), findsNWidgets(2)); - expect(find.byType(MeasurementChartWidget), findsNWidgets(2)); + expect(find.byType(MeasurementChartWidgetFl), findsNWidgets(2)); }); } diff --git a/test/measurements/measurement_categories_screen_test.mocks.dart b/test/measurements/measurement_categories_screen_test.mocks.dart index 037234a47..4459e9d66 100644 --- a/test/measurements/measurement_categories_screen_test.mocks.dart +++ b/test/measurements/measurement_categories_screen_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.0 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in wger/test/measurements/measurement_categories_screen_test.dart. // Do not manually edit this file. @@ -23,7 +23,8 @@ import 'package:wger/providers/measurement.dart' as _i4; // ignore_for_file: camel_case_types // ignore_for_file: subtype_of_sealed_class -class _FakeWgerBaseProvider_0 extends _i1.SmartFake implements _i2.WgerBaseProvider { +class _FakeWgerBaseProvider_0 extends _i1.SmartFake + implements _i2.WgerBaseProvider { _FakeWgerBaseProvider_0( Object parent, Invocation parentInvocation, @@ -33,7 +34,8 @@ class _FakeWgerBaseProvider_0 extends _i1.SmartFake implements _i2.WgerBaseProvi ); } -class _FakeMeasurementCategory_1 extends _i1.SmartFake implements _i3.MeasurementCategory { +class _FakeMeasurementCategory_1 extends _i1.SmartFake + implements _i3.MeasurementCategory { _FakeMeasurementCategory_1( Object parent, Invocation parentInvocation, @@ -46,7 +48,8 @@ class _FakeMeasurementCategory_1 extends _i1.SmartFake implements _i3.Measuremen /// A class which mocks [MeasurementProvider]. /// /// See the documentation for Mockito's code generation for more information. -class MockMeasurementProvider extends _i1.Mock implements _i4.MeasurementProvider { +class MockMeasurementProvider extends _i1.Mock + implements _i4.MeasurementProvider { MockMeasurementProvider() { _i1.throwOnMissingStub(this); } @@ -59,16 +62,19 @@ class MockMeasurementProvider extends _i1.Mock implements _i4.MeasurementProvide Invocation.getter(#baseProvider), ), ) as _i2.WgerBaseProvider); + @override List<_i3.MeasurementCategory> get categories => (super.noSuchMethod( Invocation.getter(#categories), returnValue: <_i3.MeasurementCategory>[], ) as List<_i3.MeasurementCategory>); + @override bool get hasListeners => (super.noSuchMethod( Invocation.getter(#hasListeners), returnValue: false, ) as bool); + @override void clear() => super.noSuchMethod( Invocation.method( @@ -77,6 +83,7 @@ class MockMeasurementProvider extends _i1.Mock implements _i4.MeasurementProvide ), returnValueForMissingStub: null, ); + @override _i3.MeasurementCategory findCategoryById(int? id) => (super.noSuchMethod( Invocation.method( @@ -91,6 +98,7 @@ class MockMeasurementProvider extends _i1.Mock implements _i4.MeasurementProvide ), ), ) as _i3.MeasurementCategory); + @override _i5.Future fetchAndSetCategories() => (super.noSuchMethod( Invocation.method( @@ -100,6 +108,7 @@ class MockMeasurementProvider extends _i1.Mock implements _i4.MeasurementProvide returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future fetchAndSetCategoryEntries(int? id) => (super.noSuchMethod( Invocation.method( @@ -109,6 +118,7 @@ class MockMeasurementProvider extends _i1.Mock implements _i4.MeasurementProvide returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future fetchAndSetAllCategoriesAndEntries() => (super.noSuchMethod( Invocation.method( @@ -118,8 +128,10 @@ class MockMeasurementProvider extends _i1.Mock implements _i4.MeasurementProvide returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override - _i5.Future addCategory(_i3.MeasurementCategory? category) => (super.noSuchMethod( + _i5.Future addCategory(_i3.MeasurementCategory? category) => + (super.noSuchMethod( Invocation.method( #addCategory, [category], @@ -127,6 +139,7 @@ class MockMeasurementProvider extends _i1.Mock implements _i4.MeasurementProvide returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future deleteCategory(int? id) => (super.noSuchMethod( Invocation.method( @@ -136,6 +149,7 @@ class MockMeasurementProvider extends _i1.Mock implements _i4.MeasurementProvide returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future editCategory( int? id, @@ -154,6 +168,7 @@ class MockMeasurementProvider extends _i1.Mock implements _i4.MeasurementProvide returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future addEntry(_i6.MeasurementEntry? entry) => (super.noSuchMethod( Invocation.method( @@ -163,6 +178,7 @@ class MockMeasurementProvider extends _i1.Mock implements _i4.MeasurementProvide returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future deleteEntry( int? id, @@ -179,6 +195,7 @@ class MockMeasurementProvider extends _i1.Mock implements _i4.MeasurementProvide returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future editEntry( int? id, @@ -201,6 +218,7 @@ class MockMeasurementProvider extends _i1.Mock implements _i4.MeasurementProvide returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override void addListener(_i7.VoidCallback? listener) => super.noSuchMethod( Invocation.method( @@ -209,6 +227,7 @@ class MockMeasurementProvider extends _i1.Mock implements _i4.MeasurementProvide ), returnValueForMissingStub: null, ); + @override void removeListener(_i7.VoidCallback? listener) => super.noSuchMethod( Invocation.method( @@ -217,6 +236,7 @@ class MockMeasurementProvider extends _i1.Mock implements _i4.MeasurementProvide ), returnValueForMissingStub: null, ); + @override void dispose() => super.noSuchMethod( Invocation.method( @@ -225,6 +245,7 @@ class MockMeasurementProvider extends _i1.Mock implements _i4.MeasurementProvide ), returnValueForMissingStub: null, ); + @override void notifyListeners() => super.noSuchMethod( Invocation.method( diff --git a/test/measurements/measurement_entries_screen_test.dart b/test/measurements/measurement_entries_screen_test.dart index 58572d614..20b9b5dcd 100644 --- a/test/measurements/measurement_entries_screen_test.dart +++ b/test/measurements/measurement_entries_screen_test.dart @@ -73,8 +73,8 @@ void main() { expect(find.text('body fat'), findsOneWidget); // Entries - expect(find.text('10.2 %'), findsOneWidget); - expect(find.text('18.1 %'), findsOneWidget); + expect(find.text('10.2 %'), findsNWidgets(2)); + expect(find.text('18.1 %'), findsNWidgets(2)); }); testWidgets('Tests the localization of dates - EN', (WidgetTester tester) async { @@ -82,8 +82,9 @@ void main() { await tester.tap(find.byType(TextButton)); await tester.pumpAndSettle(); - expect(find.text('8/1/2021'), findsOneWidget); - expect(find.text('8/10/2021'), findsOneWidget); + // From the entries list and from the chart + expect(find.text('8/1/2021'), findsWidgets); + expect(find.text('8/10/2021'), findsWidgets); }); testWidgets('Tests the localization of dates - DE', (WidgetTester tester) async { @@ -91,7 +92,7 @@ void main() { await tester.tap(find.byType(TextButton)); await tester.pumpAndSettle(); - expect(find.text('1.8.2021'), findsOneWidget); - expect(find.text('10.8.2021'), findsOneWidget); + expect(find.text('1.8.2021'), findsWidgets); + expect(find.text('10.8.2021'), findsWidgets); }); } diff --git a/test/measurements/measurement_provider_test.mocks.dart b/test/measurements/measurement_provider_test.mocks.dart index f09d99228..b18f41ef6 100644 --- a/test/measurements/measurement_provider_test.mocks.dart +++ b/test/measurements/measurement_provider_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.0 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in wger/test/measurements/measurement_provider_test.dart. // Do not manually edit this file. @@ -77,6 +77,7 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider { Invocation.getter(#auth), ), ) as _i2.AuthProvider); + @override set auth(_i2.AuthProvider? _auth) => super.noSuchMethod( Invocation.setter( @@ -85,6 +86,7 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider { ), returnValueForMissingStub: null, ); + @override _i3.Client get client => (super.noSuchMethod( Invocation.getter(#client), @@ -93,6 +95,7 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider { Invocation.getter(#client), ), ) as _i3.Client); + @override set client(_i3.Client? _client) => super.noSuchMethod( Invocation.setter( @@ -101,8 +104,10 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider { ), returnValueForMissingStub: null, ); + @override - Map getDefaultHeaders({dynamic includeAuth = false}) => (super.noSuchMethod( + Map getDefaultHeaders({dynamic includeAuth = false}) => + (super.noSuchMethod( Invocation.method( #getDefaultHeaders, [], @@ -110,6 +115,7 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider { ), returnValue: {}, ) as Map); + @override Uri makeUrl( String? path, { @@ -140,14 +146,17 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider { ), ), ) as Uri); + @override _i5.Future> fetch(Uri? uri) => (super.noSuchMethod( Invocation.method( #fetch, [uri], ), - returnValue: _i5.Future>.value({}), + returnValue: + _i5.Future>.value({}), ) as _i5.Future>); + @override _i5.Future> fetchPaginated(Uri? uri) => (super.noSuchMethod( Invocation.method( @@ -156,6 +165,7 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider { ), returnValue: _i5.Future>.value([]), ) as _i5.Future>); + @override _i5.Future> post( Map? data, @@ -169,8 +179,10 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider { uri, ], ), - returnValue: _i5.Future>.value({}), + returnValue: + _i5.Future>.value({}), ) as _i5.Future>); + @override _i5.Future> patch( Map? data, @@ -184,8 +196,10 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider { uri, ], ), - returnValue: _i5.Future>.value({}), + returnValue: + _i5.Future>.value({}), ) as _i5.Future>); + @override _i5.Future<_i3.Response> deleteRequest( String? url, diff --git a/test/nutrition/nutritional_diary_test.dart b/test/nutrition/nutritional_diary_test.dart index d65029a76..a1372b7db 100644 --- a/test/nutrition/nutritional_diary_test.dart +++ b/test/nutrition/nutritional_diary_test.dart @@ -41,7 +41,7 @@ void main() { testWidgets('Test the detail view for the nutritional plan', (WidgetTester tester) async { await tester.pumpWidget(getWidget()); - expect(find.byType(NutritionalPlanPieChartWidget), findsOneWidget); + expect(find.byType(FlNutritionalPlanPieChartWidget), findsOneWidget); expect(find.byType(Table), findsOneWidget); expect(find.text('519kcal'), findsOneWidget, reason: 'find total energy'); diff --git a/test/nutrition/nutritional_meal_form_test.mocks.dart b/test/nutrition/nutritional_meal_form_test.mocks.dart index 6c194374e..8ed74c571 100644 --- a/test/nutrition/nutritional_meal_form_test.mocks.dart +++ b/test/nutrition/nutritional_meal_form_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.0 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in wger/test/nutrition/nutritional_meal_form_test.dart. // Do not manually edit this file. @@ -25,7 +25,8 @@ import 'package:wger/providers/nutrition.dart' as _i7; // ignore_for_file: camel_case_types // ignore_for_file: subtype_of_sealed_class -class _FakeWgerBaseProvider_0 extends _i1.SmartFake implements _i2.WgerBaseProvider { +class _FakeWgerBaseProvider_0 extends _i1.SmartFake + implements _i2.WgerBaseProvider { _FakeWgerBaseProvider_0( Object parent, Invocation parentInvocation, @@ -35,7 +36,8 @@ class _FakeWgerBaseProvider_0 extends _i1.SmartFake implements _i2.WgerBaseProvi ); } -class _FakeNutritionalPlan_1 extends _i1.SmartFake implements _i3.NutritionalPlan { +class _FakeNutritionalPlan_1 extends _i1.SmartFake + implements _i3.NutritionalPlan { _FakeNutritionalPlan_1( Object parent, Invocation parentInvocation, @@ -78,7 +80,8 @@ class _FakeIngredient_4 extends _i1.SmartFake implements _i6.Ingredient { /// A class which mocks [NutritionPlansProvider]. /// /// See the documentation for Mockito's code generation for more information. -class MockNutritionPlansProvider extends _i1.Mock implements _i7.NutritionPlansProvider { +class MockNutritionPlansProvider extends _i1.Mock + implements _i7.NutritionPlansProvider { MockNutritionPlansProvider() { _i1.throwOnMissingStub(this); } @@ -91,11 +94,13 @@ class MockNutritionPlansProvider extends _i1.Mock implements _i7.NutritionPlansP Invocation.getter(#baseProvider), ), ) as _i2.WgerBaseProvider); + @override List<_i3.NutritionalPlan> get items => (super.noSuchMethod( Invocation.getter(#items), returnValue: <_i3.NutritionalPlan>[], ) as List<_i3.NutritionalPlan>); + @override set ingredients(dynamic items) => super.noSuchMethod( Invocation.setter( @@ -104,11 +109,13 @@ class MockNutritionPlansProvider extends _i1.Mock implements _i7.NutritionPlansP ), returnValueForMissingStub: null, ); + @override bool get hasListeners => (super.noSuchMethod( Invocation.getter(#hasListeners), returnValue: false, ) as bool); + @override void clear() => super.noSuchMethod( Invocation.method( @@ -117,6 +124,7 @@ class MockNutritionPlansProvider extends _i1.Mock implements _i7.NutritionPlansP ), returnValueForMissingStub: null, ); + @override _i3.NutritionalPlan findById(int? id) => (super.noSuchMethod( Invocation.method( @@ -131,11 +139,13 @@ class MockNutritionPlansProvider extends _i1.Mock implements _i7.NutritionPlansP ), ), ) as _i3.NutritionalPlan); + @override _i4.Meal? findMealById(int? id) => (super.noSuchMethod(Invocation.method( #findMealById, [id], )) as _i4.Meal?); + @override _i8.Future fetchAndSetAllPlansSparse() => (super.noSuchMethod( Invocation.method( @@ -145,6 +155,7 @@ class MockNutritionPlansProvider extends _i1.Mock implements _i7.NutritionPlansP returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); + @override _i8.Future fetchAndSetAllPlansFull() => (super.noSuchMethod( Invocation.method( @@ -154,13 +165,16 @@ class MockNutritionPlansProvider extends _i1.Mock implements _i7.NutritionPlansP returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); + @override - _i8.Future<_i3.NutritionalPlan> fetchAndSetPlanSparse(int? planId) => (super.noSuchMethod( + _i8.Future<_i3.NutritionalPlan> fetchAndSetPlanSparse(int? planId) => + (super.noSuchMethod( Invocation.method( #fetchAndSetPlanSparse, [planId], ), - returnValue: _i8.Future<_i3.NutritionalPlan>.value(_FakeNutritionalPlan_1( + returnValue: + _i8.Future<_i3.NutritionalPlan>.value(_FakeNutritionalPlan_1( this, Invocation.method( #fetchAndSetPlanSparse, @@ -168,13 +182,16 @@ class MockNutritionPlansProvider extends _i1.Mock implements _i7.NutritionPlansP ), )), ) as _i8.Future<_i3.NutritionalPlan>); + @override - _i8.Future<_i3.NutritionalPlan> fetchAndSetPlanFull(int? planId) => (super.noSuchMethod( + _i8.Future<_i3.NutritionalPlan> fetchAndSetPlanFull(int? planId) => + (super.noSuchMethod( Invocation.method( #fetchAndSetPlanFull, [planId], ), - returnValue: _i8.Future<_i3.NutritionalPlan>.value(_FakeNutritionalPlan_1( + returnValue: + _i8.Future<_i3.NutritionalPlan>.value(_FakeNutritionalPlan_1( this, Invocation.method( #fetchAndSetPlanFull, @@ -182,13 +199,16 @@ class MockNutritionPlansProvider extends _i1.Mock implements _i7.NutritionPlansP ), )), ) as _i8.Future<_i3.NutritionalPlan>); + @override - _i8.Future<_i3.NutritionalPlan> addPlan(_i3.NutritionalPlan? planData) => (super.noSuchMethod( + _i8.Future<_i3.NutritionalPlan> addPlan(_i3.NutritionalPlan? planData) => + (super.noSuchMethod( Invocation.method( #addPlan, [planData], ), - returnValue: _i8.Future<_i3.NutritionalPlan>.value(_FakeNutritionalPlan_1( + returnValue: + _i8.Future<_i3.NutritionalPlan>.value(_FakeNutritionalPlan_1( this, Invocation.method( #addPlan, @@ -196,6 +216,7 @@ class MockNutritionPlansProvider extends _i1.Mock implements _i7.NutritionPlansP ), )), ) as _i8.Future<_i3.NutritionalPlan>); + @override _i8.Future editPlan(_i3.NutritionalPlan? plan) => (super.noSuchMethod( Invocation.method( @@ -205,6 +226,7 @@ class MockNutritionPlansProvider extends _i1.Mock implements _i7.NutritionPlansP returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); + @override _i8.Future deletePlan(int? id) => (super.noSuchMethod( Invocation.method( @@ -214,6 +236,7 @@ class MockNutritionPlansProvider extends _i1.Mock implements _i7.NutritionPlansP returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); + @override _i8.Future<_i4.Meal> addMeal( _i4.Meal? meal, @@ -238,6 +261,7 @@ class MockNutritionPlansProvider extends _i1.Mock implements _i7.NutritionPlansP ), )), ) as _i8.Future<_i4.Meal>); + @override _i8.Future<_i4.Meal> editMeal(_i4.Meal? meal) => (super.noSuchMethod( Invocation.method( @@ -252,6 +276,7 @@ class MockNutritionPlansProvider extends _i1.Mock implements _i7.NutritionPlansP ), )), ) as _i8.Future<_i4.Meal>); + @override _i8.Future deleteMeal(_i4.Meal? meal) => (super.noSuchMethod( Invocation.method( @@ -261,6 +286,7 @@ class MockNutritionPlansProvider extends _i1.Mock implements _i7.NutritionPlansP returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); + @override _i8.Future<_i5.MealItem> addMealItem( _i5.MealItem? mealItem, @@ -285,8 +311,10 @@ class MockNutritionPlansProvider extends _i1.Mock implements _i7.NutritionPlansP ), )), ) as _i8.Future<_i5.MealItem>); + @override - _i8.Future deleteMealItem(_i5.MealItem? mealItem) => (super.noSuchMethod( + _i8.Future deleteMealItem(_i5.MealItem? mealItem) => + (super.noSuchMethod( Invocation.method( #deleteMealItem, [mealItem], @@ -294,8 +322,10 @@ class MockNutritionPlansProvider extends _i1.Mock implements _i7.NutritionPlansP returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); + @override - _i8.Future<_i6.Ingredient> fetchIngredient(int? ingredientId) => (super.noSuchMethod( + _i8.Future<_i6.Ingredient> fetchIngredient(int? ingredientId) => + (super.noSuchMethod( Invocation.method( #fetchIngredient, [ingredientId], @@ -308,6 +338,7 @@ class MockNutritionPlansProvider extends _i1.Mock implements _i7.NutritionPlansP ), )), ) as _i8.Future<_i6.Ingredient>); + @override _i8.Future fetchIngredientsFromCache() => (super.noSuchMethod( Invocation.method( @@ -317,6 +348,7 @@ class MockNutritionPlansProvider extends _i1.Mock implements _i7.NutritionPlansP returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); + @override _i8.Future> searchIngredient( String? name, { @@ -334,14 +366,17 @@ class MockNutritionPlansProvider extends _i1.Mock implements _i7.NutritionPlansP ), returnValue: _i8.Future>.value([]), ) as _i8.Future>); + @override - _i8.Future<_i6.Ingredient?> searchIngredientWithCode(String? code) => (super.noSuchMethod( + _i8.Future<_i6.Ingredient?> searchIngredientWithCode(String? code) => + (super.noSuchMethod( Invocation.method( #searchIngredientWithCode, [code], ), returnValue: _i8.Future<_i6.Ingredient?>.value(), ) as _i8.Future<_i6.Ingredient?>); + @override _i8.Future logMealToDiary(_i4.Meal? meal) => (super.noSuchMethod( Invocation.method( @@ -351,6 +386,7 @@ class MockNutritionPlansProvider extends _i1.Mock implements _i7.NutritionPlansP returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); + @override _i8.Future logIngredientToDiary( _i5.MealItem? mealItem, @@ -369,6 +405,7 @@ class MockNutritionPlansProvider extends _i1.Mock implements _i7.NutritionPlansP returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); + @override _i8.Future deleteLog( int? logId, @@ -385,8 +422,10 @@ class MockNutritionPlansProvider extends _i1.Mock implements _i7.NutritionPlansP returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); + @override - _i8.Future fetchAndSetLogs(_i3.NutritionalPlan? plan) => (super.noSuchMethod( + _i8.Future fetchAndSetLogs(_i3.NutritionalPlan? plan) => + (super.noSuchMethod( Invocation.method( #fetchAndSetLogs, [plan], @@ -394,6 +433,7 @@ class MockNutritionPlansProvider extends _i1.Mock implements _i7.NutritionPlansP returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); + @override void addListener(_i9.VoidCallback? listener) => super.noSuchMethod( Invocation.method( @@ -402,6 +442,7 @@ class MockNutritionPlansProvider extends _i1.Mock implements _i7.NutritionPlansP ), returnValueForMissingStub: null, ); + @override void removeListener(_i9.VoidCallback? listener) => super.noSuchMethod( Invocation.method( @@ -410,6 +451,7 @@ class MockNutritionPlansProvider extends _i1.Mock implements _i7.NutritionPlansP ), returnValueForMissingStub: null, ); + @override void dispose() => super.noSuchMethod( Invocation.method( @@ -418,6 +460,7 @@ class MockNutritionPlansProvider extends _i1.Mock implements _i7.NutritionPlansP ), returnValueForMissingStub: null, ); + @override void notifyListeners() => super.noSuchMethod( Invocation.method( diff --git a/test/nutrition/nutritional_plan_form_test.mocks.dart b/test/nutrition/nutritional_plan_form_test.mocks.dart index a5f620ed4..a2b1b9702 100644 --- a/test/nutrition/nutritional_plan_form_test.mocks.dart +++ b/test/nutrition/nutritional_plan_form_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.0 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in wger/test/nutrition/nutritional_plan_form_test.dart. // Do not manually edit this file. @@ -25,7 +25,8 @@ import 'package:wger/providers/nutrition.dart' as _i7; // ignore_for_file: camel_case_types // ignore_for_file: subtype_of_sealed_class -class _FakeWgerBaseProvider_0 extends _i1.SmartFake implements _i2.WgerBaseProvider { +class _FakeWgerBaseProvider_0 extends _i1.SmartFake + implements _i2.WgerBaseProvider { _FakeWgerBaseProvider_0( Object parent, Invocation parentInvocation, @@ -35,7 +36,8 @@ class _FakeWgerBaseProvider_0 extends _i1.SmartFake implements _i2.WgerBaseProvi ); } -class _FakeNutritionalPlan_1 extends _i1.SmartFake implements _i3.NutritionalPlan { +class _FakeNutritionalPlan_1 extends _i1.SmartFake + implements _i3.NutritionalPlan { _FakeNutritionalPlan_1( Object parent, Invocation parentInvocation, @@ -78,7 +80,8 @@ class _FakeIngredient_4 extends _i1.SmartFake implements _i6.Ingredient { /// A class which mocks [NutritionPlansProvider]. /// /// See the documentation for Mockito's code generation for more information. -class MockNutritionPlansProvider extends _i1.Mock implements _i7.NutritionPlansProvider { +class MockNutritionPlansProvider extends _i1.Mock + implements _i7.NutritionPlansProvider { MockNutritionPlansProvider() { _i1.throwOnMissingStub(this); } @@ -91,11 +94,13 @@ class MockNutritionPlansProvider extends _i1.Mock implements _i7.NutritionPlansP Invocation.getter(#baseProvider), ), ) as _i2.WgerBaseProvider); + @override List<_i3.NutritionalPlan> get items => (super.noSuchMethod( Invocation.getter(#items), returnValue: <_i3.NutritionalPlan>[], ) as List<_i3.NutritionalPlan>); + @override set ingredients(dynamic items) => super.noSuchMethod( Invocation.setter( @@ -104,11 +109,13 @@ class MockNutritionPlansProvider extends _i1.Mock implements _i7.NutritionPlansP ), returnValueForMissingStub: null, ); + @override bool get hasListeners => (super.noSuchMethod( Invocation.getter(#hasListeners), returnValue: false, ) as bool); + @override void clear() => super.noSuchMethod( Invocation.method( @@ -117,6 +124,7 @@ class MockNutritionPlansProvider extends _i1.Mock implements _i7.NutritionPlansP ), returnValueForMissingStub: null, ); + @override _i3.NutritionalPlan findById(int? id) => (super.noSuchMethod( Invocation.method( @@ -131,11 +139,13 @@ class MockNutritionPlansProvider extends _i1.Mock implements _i7.NutritionPlansP ), ), ) as _i3.NutritionalPlan); + @override _i4.Meal? findMealById(int? id) => (super.noSuchMethod(Invocation.method( #findMealById, [id], )) as _i4.Meal?); + @override _i8.Future fetchAndSetAllPlansSparse() => (super.noSuchMethod( Invocation.method( @@ -145,6 +155,7 @@ class MockNutritionPlansProvider extends _i1.Mock implements _i7.NutritionPlansP returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); + @override _i8.Future fetchAndSetAllPlansFull() => (super.noSuchMethod( Invocation.method( @@ -154,13 +165,16 @@ class MockNutritionPlansProvider extends _i1.Mock implements _i7.NutritionPlansP returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); + @override - _i8.Future<_i3.NutritionalPlan> fetchAndSetPlanSparse(int? planId) => (super.noSuchMethod( + _i8.Future<_i3.NutritionalPlan> fetchAndSetPlanSparse(int? planId) => + (super.noSuchMethod( Invocation.method( #fetchAndSetPlanSparse, [planId], ), - returnValue: _i8.Future<_i3.NutritionalPlan>.value(_FakeNutritionalPlan_1( + returnValue: + _i8.Future<_i3.NutritionalPlan>.value(_FakeNutritionalPlan_1( this, Invocation.method( #fetchAndSetPlanSparse, @@ -168,13 +182,16 @@ class MockNutritionPlansProvider extends _i1.Mock implements _i7.NutritionPlansP ), )), ) as _i8.Future<_i3.NutritionalPlan>); + @override - _i8.Future<_i3.NutritionalPlan> fetchAndSetPlanFull(int? planId) => (super.noSuchMethod( + _i8.Future<_i3.NutritionalPlan> fetchAndSetPlanFull(int? planId) => + (super.noSuchMethod( Invocation.method( #fetchAndSetPlanFull, [planId], ), - returnValue: _i8.Future<_i3.NutritionalPlan>.value(_FakeNutritionalPlan_1( + returnValue: + _i8.Future<_i3.NutritionalPlan>.value(_FakeNutritionalPlan_1( this, Invocation.method( #fetchAndSetPlanFull, @@ -182,13 +199,16 @@ class MockNutritionPlansProvider extends _i1.Mock implements _i7.NutritionPlansP ), )), ) as _i8.Future<_i3.NutritionalPlan>); + @override - _i8.Future<_i3.NutritionalPlan> addPlan(_i3.NutritionalPlan? planData) => (super.noSuchMethod( + _i8.Future<_i3.NutritionalPlan> addPlan(_i3.NutritionalPlan? planData) => + (super.noSuchMethod( Invocation.method( #addPlan, [planData], ), - returnValue: _i8.Future<_i3.NutritionalPlan>.value(_FakeNutritionalPlan_1( + returnValue: + _i8.Future<_i3.NutritionalPlan>.value(_FakeNutritionalPlan_1( this, Invocation.method( #addPlan, @@ -196,6 +216,7 @@ class MockNutritionPlansProvider extends _i1.Mock implements _i7.NutritionPlansP ), )), ) as _i8.Future<_i3.NutritionalPlan>); + @override _i8.Future editPlan(_i3.NutritionalPlan? plan) => (super.noSuchMethod( Invocation.method( @@ -205,6 +226,7 @@ class MockNutritionPlansProvider extends _i1.Mock implements _i7.NutritionPlansP returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); + @override _i8.Future deletePlan(int? id) => (super.noSuchMethod( Invocation.method( @@ -214,6 +236,7 @@ class MockNutritionPlansProvider extends _i1.Mock implements _i7.NutritionPlansP returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); + @override _i8.Future<_i4.Meal> addMeal( _i4.Meal? meal, @@ -238,6 +261,7 @@ class MockNutritionPlansProvider extends _i1.Mock implements _i7.NutritionPlansP ), )), ) as _i8.Future<_i4.Meal>); + @override _i8.Future<_i4.Meal> editMeal(_i4.Meal? meal) => (super.noSuchMethod( Invocation.method( @@ -252,6 +276,7 @@ class MockNutritionPlansProvider extends _i1.Mock implements _i7.NutritionPlansP ), )), ) as _i8.Future<_i4.Meal>); + @override _i8.Future deleteMeal(_i4.Meal? meal) => (super.noSuchMethod( Invocation.method( @@ -261,6 +286,7 @@ class MockNutritionPlansProvider extends _i1.Mock implements _i7.NutritionPlansP returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); + @override _i8.Future<_i5.MealItem> addMealItem( _i5.MealItem? mealItem, @@ -285,8 +311,10 @@ class MockNutritionPlansProvider extends _i1.Mock implements _i7.NutritionPlansP ), )), ) as _i8.Future<_i5.MealItem>); + @override - _i8.Future deleteMealItem(_i5.MealItem? mealItem) => (super.noSuchMethod( + _i8.Future deleteMealItem(_i5.MealItem? mealItem) => + (super.noSuchMethod( Invocation.method( #deleteMealItem, [mealItem], @@ -294,8 +322,10 @@ class MockNutritionPlansProvider extends _i1.Mock implements _i7.NutritionPlansP returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); + @override - _i8.Future<_i6.Ingredient> fetchIngredient(int? ingredientId) => (super.noSuchMethod( + _i8.Future<_i6.Ingredient> fetchIngredient(int? ingredientId) => + (super.noSuchMethod( Invocation.method( #fetchIngredient, [ingredientId], @@ -308,6 +338,7 @@ class MockNutritionPlansProvider extends _i1.Mock implements _i7.NutritionPlansP ), )), ) as _i8.Future<_i6.Ingredient>); + @override _i8.Future fetchIngredientsFromCache() => (super.noSuchMethod( Invocation.method( @@ -317,6 +348,7 @@ class MockNutritionPlansProvider extends _i1.Mock implements _i7.NutritionPlansP returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); + @override _i8.Future> searchIngredient( String? name, { @@ -334,14 +366,17 @@ class MockNutritionPlansProvider extends _i1.Mock implements _i7.NutritionPlansP ), returnValue: _i8.Future>.value([]), ) as _i8.Future>); + @override - _i8.Future<_i6.Ingredient?> searchIngredientWithCode(String? code) => (super.noSuchMethod( + _i8.Future<_i6.Ingredient?> searchIngredientWithCode(String? code) => + (super.noSuchMethod( Invocation.method( #searchIngredientWithCode, [code], ), returnValue: _i8.Future<_i6.Ingredient?>.value(), ) as _i8.Future<_i6.Ingredient?>); + @override _i8.Future logMealToDiary(_i4.Meal? meal) => (super.noSuchMethod( Invocation.method( @@ -351,6 +386,7 @@ class MockNutritionPlansProvider extends _i1.Mock implements _i7.NutritionPlansP returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); + @override _i8.Future logIngredientToDiary( _i5.MealItem? mealItem, @@ -369,6 +405,7 @@ class MockNutritionPlansProvider extends _i1.Mock implements _i7.NutritionPlansP returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); + @override _i8.Future deleteLog( int? logId, @@ -385,8 +422,10 @@ class MockNutritionPlansProvider extends _i1.Mock implements _i7.NutritionPlansP returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); + @override - _i8.Future fetchAndSetLogs(_i3.NutritionalPlan? plan) => (super.noSuchMethod( + _i8.Future fetchAndSetLogs(_i3.NutritionalPlan? plan) => + (super.noSuchMethod( Invocation.method( #fetchAndSetLogs, [plan], @@ -394,6 +433,7 @@ class MockNutritionPlansProvider extends _i1.Mock implements _i7.NutritionPlansP returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); + @override void addListener(_i9.VoidCallback? listener) => super.noSuchMethod( Invocation.method( @@ -402,6 +442,7 @@ class MockNutritionPlansProvider extends _i1.Mock implements _i7.NutritionPlansP ), returnValueForMissingStub: null, ); + @override void removeListener(_i9.VoidCallback? listener) => super.noSuchMethod( Invocation.method( @@ -410,6 +451,7 @@ class MockNutritionPlansProvider extends _i1.Mock implements _i7.NutritionPlansP ), returnValueForMissingStub: null, ); + @override void dispose() => super.noSuchMethod( Invocation.method( @@ -418,6 +460,7 @@ class MockNutritionPlansProvider extends _i1.Mock implements _i7.NutritionPlansP ), returnValueForMissingStub: null, ); + @override void notifyListeners() => super.noSuchMethod( Invocation.method( diff --git a/test/nutrition/nutritional_plan_screen_test.dart b/test/nutrition/nutritional_plan_screen_test.dart index b2419ddad..af66d0056 100644 --- a/test/nutrition/nutritional_plan_screen_test.dart +++ b/test/nutrition/nutritional_plan_screen_test.dart @@ -81,7 +81,7 @@ void main() { expect(find.text('300g Broccoli cake'), findsOneWidget); expect(find.byType(Dismissible), findsNWidgets(2)); - expect(find.byType(NutritionalDiaryChartWidget), findsNothing); + expect(find.byType(FlNutritionalDiaryChartWidget), findsNothing); }); testWidgets('Tests the localization of times - EN', (WidgetTester tester) async { diff --git a/test/nutrition/nutritional_plan_screen_test.mocks.dart b/test/nutrition/nutritional_plan_screen_test.mocks.dart index ede5e1753..da991af90 100644 --- a/test/nutrition/nutritional_plan_screen_test.mocks.dart +++ b/test/nutrition/nutritional_plan_screen_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.0 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in wger/test/nutrition/nutritional_plan_screen_test.dart. // Do not manually edit this file. @@ -65,7 +65,8 @@ class _FakeResponse_3 extends _i1.SmartFake implements _i3.Response { ); } -class _FakeStreamedResponse_4 extends _i1.SmartFake implements _i3.StreamedResponse { +class _FakeStreamedResponse_4 extends _i1.SmartFake + implements _i3.StreamedResponse { _FakeStreamedResponse_4( Object parent, Invocation parentInvocation, @@ -91,6 +92,7 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider { Invocation.getter(#auth), ), ) as _i2.AuthProvider); + @override set auth(_i2.AuthProvider? _auth) => super.noSuchMethod( Invocation.setter( @@ -99,6 +101,7 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider { ), returnValueForMissingStub: null, ); + @override _i3.Client get client => (super.noSuchMethod( Invocation.getter(#client), @@ -107,6 +110,7 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider { Invocation.getter(#client), ), ) as _i3.Client); + @override set client(_i3.Client? _client) => super.noSuchMethod( Invocation.setter( @@ -115,8 +119,10 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider { ), returnValueForMissingStub: null, ); + @override - Map getDefaultHeaders({dynamic includeAuth = false}) => (super.noSuchMethod( + Map getDefaultHeaders({dynamic includeAuth = false}) => + (super.noSuchMethod( Invocation.method( #getDefaultHeaders, [], @@ -124,6 +130,7 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider { ), returnValue: {}, ) as Map); + @override Uri makeUrl( String? path, { @@ -154,14 +161,17 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider { ), ), ) as Uri); + @override _i5.Future> fetch(Uri? uri) => (super.noSuchMethod( Invocation.method( #fetch, [uri], ), - returnValue: _i5.Future>.value({}), + returnValue: + _i5.Future>.value({}), ) as _i5.Future>); + @override _i5.Future> fetchPaginated(Uri? uri) => (super.noSuchMethod( Invocation.method( @@ -170,6 +180,7 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider { ), returnValue: _i5.Future>.value([]), ) as _i5.Future>); + @override _i5.Future> post( Map? data, @@ -183,8 +194,10 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider { uri, ], ), - returnValue: _i5.Future>.value({}), + returnValue: + _i5.Future>.value({}), ) as _i5.Future>); + @override _i5.Future> patch( Map? data, @@ -198,8 +211,10 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider { uri, ], ), - returnValue: _i5.Future>.value({}), + returnValue: + _i5.Future>.value({}), ) as _i5.Future>); + @override _i5.Future<_i3.Response> deleteRequest( String? url, @@ -242,6 +257,7 @@ class MockAuthProvider extends _i1.Mock implements _i2.AuthProvider { ), returnValueForMissingStub: null, ); + @override set serverUrl(String? _serverUrl) => super.noSuchMethod( Invocation.setter( @@ -250,6 +266,7 @@ class MockAuthProvider extends _i1.Mock implements _i2.AuthProvider { ), returnValueForMissingStub: null, ); + @override set serverVersion(String? _serverVersion) => super.noSuchMethod( Invocation.setter( @@ -258,19 +275,23 @@ class MockAuthProvider extends _i1.Mock implements _i2.AuthProvider { ), returnValueForMissingStub: null, ); + @override - set applicationVersion(_i6.PackageInfo? _applicationVersion) => super.noSuchMethod( + set applicationVersion(_i6.PackageInfo? _applicationVersion) => + super.noSuchMethod( Invocation.setter( #applicationVersion, _applicationVersion, ), returnValueForMissingStub: null, ); + @override Map get metadata => (super.noSuchMethod( Invocation.getter(#metadata), returnValue: {}, ) as Map); + @override set metadata(Map? _metadata) => super.noSuchMethod( Invocation.setter( @@ -279,6 +300,7 @@ class MockAuthProvider extends _i1.Mock implements _i2.AuthProvider { ), returnValueForMissingStub: null, ); + @override _i3.Client get client => (super.noSuchMethod( Invocation.getter(#client), @@ -287,6 +309,7 @@ class MockAuthProvider extends _i1.Mock implements _i2.AuthProvider { Invocation.getter(#client), ), ) as _i3.Client); + @override set client(_i3.Client? _client) => super.noSuchMethod( Invocation.setter( @@ -295,11 +318,13 @@ class MockAuthProvider extends _i1.Mock implements _i2.AuthProvider { ), returnValueForMissingStub: null, ); + @override bool get dataInit => (super.noSuchMethod( Invocation.getter(#dataInit), returnValue: false, ) as bool); + @override set dataInit(bool? _dataInit) => super.noSuchMethod( Invocation.setter( @@ -308,16 +333,19 @@ class MockAuthProvider extends _i1.Mock implements _i2.AuthProvider { ), returnValueForMissingStub: null, ); + @override bool get isAuth => (super.noSuchMethod( Invocation.getter(#isAuth), returnValue: false, ) as bool); + @override bool get hasListeners => (super.noSuchMethod( Invocation.getter(#hasListeners), returnValue: false, ) as bool); + @override _i5.Future setServerVersion() => (super.noSuchMethod( Invocation.method( @@ -327,6 +355,7 @@ class MockAuthProvider extends _i1.Mock implements _i2.AuthProvider { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future initData(String? serverUrl) => (super.noSuchMethod( Invocation.method( @@ -336,6 +365,7 @@ class MockAuthProvider extends _i1.Mock implements _i2.AuthProvider { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future setApplicationVersion() => (super.noSuchMethod( Invocation.method( @@ -345,6 +375,7 @@ class MockAuthProvider extends _i1.Mock implements _i2.AuthProvider { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future applicationUpdateRequired([ String? version, @@ -360,6 +391,7 @@ class MockAuthProvider extends _i1.Mock implements _i2.AuthProvider { ), returnValue: _i5.Future.value(false), ) as _i5.Future); + @override _i5.Future> register({ required String? username, @@ -378,8 +410,10 @@ class MockAuthProvider extends _i1.Mock implements _i2.AuthProvider { #serverUrl: serverUrl, }, ), - returnValue: _i5.Future>.value({}), + returnValue: _i5.Future>.value( + {}), ) as _i5.Future>); + @override _i5.Future> login( String? username, @@ -395,8 +429,10 @@ class MockAuthProvider extends _i1.Mock implements _i2.AuthProvider { serverUrl, ], ), - returnValue: _i5.Future>.value({}), + returnValue: _i5.Future>.value( + {}), ) as _i5.Future>); + @override _i5.Future getServerUrlFromPrefs() => (super.noSuchMethod( Invocation.method( @@ -405,6 +441,7 @@ class MockAuthProvider extends _i1.Mock implements _i2.AuthProvider { ), returnValue: _i5.Future.value(''), ) as _i5.Future); + @override _i5.Future tryAutoLogin() => (super.noSuchMethod( Invocation.method( @@ -413,6 +450,7 @@ class MockAuthProvider extends _i1.Mock implements _i2.AuthProvider { ), returnValue: _i5.Future.value(false), ) as _i5.Future); + @override _i5.Future logout({bool? shouldNotify = true}) => (super.noSuchMethod( Invocation.method( @@ -423,6 +461,7 @@ class MockAuthProvider extends _i1.Mock implements _i2.AuthProvider { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override String getAppNameHeader() => (super.noSuchMethod( Invocation.method( @@ -431,6 +470,7 @@ class MockAuthProvider extends _i1.Mock implements _i2.AuthProvider { ), returnValue: '', ) as String); + @override void addListener(_i7.VoidCallback? listener) => super.noSuchMethod( Invocation.method( @@ -439,6 +479,7 @@ class MockAuthProvider extends _i1.Mock implements _i2.AuthProvider { ), returnValueForMissingStub: null, ); + @override void removeListener(_i7.VoidCallback? listener) => super.noSuchMethod( Invocation.method( @@ -447,6 +488,7 @@ class MockAuthProvider extends _i1.Mock implements _i2.AuthProvider { ), returnValueForMissingStub: null, ); + @override void dispose() => super.noSuchMethod( Invocation.method( @@ -455,6 +497,7 @@ class MockAuthProvider extends _i1.Mock implements _i2.AuthProvider { ), returnValueForMissingStub: null, ); + @override void notifyListeners() => super.noSuchMethod( Invocation.method( @@ -493,6 +536,7 @@ class MockClient extends _i1.Mock implements _i3.Client { ), )), ) as _i5.Future<_i3.Response>); + @override _i5.Future<_i3.Response> get( Uri? url, { @@ -513,6 +557,7 @@ class MockClient extends _i1.Mock implements _i3.Client { ), )), ) as _i5.Future<_i3.Response>); + @override _i5.Future<_i3.Response> post( Uri? url, { @@ -543,6 +588,7 @@ class MockClient extends _i1.Mock implements _i3.Client { ), )), ) as _i5.Future<_i3.Response>); + @override _i5.Future<_i3.Response> put( Uri? url, { @@ -573,6 +619,7 @@ class MockClient extends _i1.Mock implements _i3.Client { ), )), ) as _i5.Future<_i3.Response>); + @override _i5.Future<_i3.Response> patch( Uri? url, { @@ -603,6 +650,7 @@ class MockClient extends _i1.Mock implements _i3.Client { ), )), ) as _i5.Future<_i3.Response>); + @override _i5.Future<_i3.Response> delete( Uri? url, { @@ -633,6 +681,7 @@ class MockClient extends _i1.Mock implements _i3.Client { ), )), ) as _i5.Future<_i3.Response>); + @override _i5.Future read( Uri? url, { @@ -646,6 +695,7 @@ class MockClient extends _i1.Mock implements _i3.Client { ), returnValue: _i5.Future.value(''), ) as _i5.Future); + @override _i5.Future<_i9.Uint8List> readBytes( Uri? url, { @@ -659,13 +709,16 @@ class MockClient extends _i1.Mock implements _i3.Client { ), returnValue: _i5.Future<_i9.Uint8List>.value(_i9.Uint8List(0)), ) as _i5.Future<_i9.Uint8List>); + @override - _i5.Future<_i3.StreamedResponse> send(_i3.BaseRequest? request) => (super.noSuchMethod( + _i5.Future<_i3.StreamedResponse> send(_i3.BaseRequest? request) => + (super.noSuchMethod( Invocation.method( #send, [request], ), - returnValue: _i5.Future<_i3.StreamedResponse>.value(_FakeStreamedResponse_4( + returnValue: + _i5.Future<_i3.StreamedResponse>.value(_FakeStreamedResponse_4( this, Invocation.method( #send, @@ -673,6 +726,7 @@ class MockClient extends _i1.Mock implements _i3.Client { ), )), ) as _i5.Future<_i3.StreamedResponse>); + @override void close() => super.noSuchMethod( Invocation.method( diff --git a/test/nutrition/nutritional_plans_screen_test.mocks.dart b/test/nutrition/nutritional_plans_screen_test.mocks.dart index d0c8b92d5..2cee1227f 100644 --- a/test/nutrition/nutritional_plans_screen_test.mocks.dart +++ b/test/nutrition/nutritional_plans_screen_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.0 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in wger/test/nutrition/nutritional_plans_screen_test.dart. // Do not manually edit this file. @@ -65,7 +65,8 @@ class _FakeResponse_3 extends _i1.SmartFake implements _i2.Response { ); } -class _FakeStreamedResponse_4 extends _i1.SmartFake implements _i2.StreamedResponse { +class _FakeStreamedResponse_4 extends _i1.SmartFake + implements _i2.StreamedResponse { _FakeStreamedResponse_4( Object parent, Invocation parentInvocation, @@ -91,6 +92,7 @@ class MockAuthProvider extends _i1.Mock implements _i3.AuthProvider { ), returnValueForMissingStub: null, ); + @override set serverUrl(String? _serverUrl) => super.noSuchMethod( Invocation.setter( @@ -99,6 +101,7 @@ class MockAuthProvider extends _i1.Mock implements _i3.AuthProvider { ), returnValueForMissingStub: null, ); + @override set serverVersion(String? _serverVersion) => super.noSuchMethod( Invocation.setter( @@ -107,19 +110,23 @@ class MockAuthProvider extends _i1.Mock implements _i3.AuthProvider { ), returnValueForMissingStub: null, ); + @override - set applicationVersion(_i4.PackageInfo? _applicationVersion) => super.noSuchMethod( + set applicationVersion(_i4.PackageInfo? _applicationVersion) => + super.noSuchMethod( Invocation.setter( #applicationVersion, _applicationVersion, ), returnValueForMissingStub: null, ); + @override Map get metadata => (super.noSuchMethod( Invocation.getter(#metadata), returnValue: {}, ) as Map); + @override set metadata(Map? _metadata) => super.noSuchMethod( Invocation.setter( @@ -128,6 +135,7 @@ class MockAuthProvider extends _i1.Mock implements _i3.AuthProvider { ), returnValueForMissingStub: null, ); + @override _i2.Client get client => (super.noSuchMethod( Invocation.getter(#client), @@ -136,6 +144,7 @@ class MockAuthProvider extends _i1.Mock implements _i3.AuthProvider { Invocation.getter(#client), ), ) as _i2.Client); + @override set client(_i2.Client? _client) => super.noSuchMethod( Invocation.setter( @@ -144,11 +153,13 @@ class MockAuthProvider extends _i1.Mock implements _i3.AuthProvider { ), returnValueForMissingStub: null, ); + @override bool get dataInit => (super.noSuchMethod( Invocation.getter(#dataInit), returnValue: false, ) as bool); + @override set dataInit(bool? _dataInit) => super.noSuchMethod( Invocation.setter( @@ -157,16 +168,19 @@ class MockAuthProvider extends _i1.Mock implements _i3.AuthProvider { ), returnValueForMissingStub: null, ); + @override bool get isAuth => (super.noSuchMethod( Invocation.getter(#isAuth), returnValue: false, ) as bool); + @override bool get hasListeners => (super.noSuchMethod( Invocation.getter(#hasListeners), returnValue: false, ) as bool); + @override _i5.Future setServerVersion() => (super.noSuchMethod( Invocation.method( @@ -176,6 +190,7 @@ class MockAuthProvider extends _i1.Mock implements _i3.AuthProvider { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future initData(String? serverUrl) => (super.noSuchMethod( Invocation.method( @@ -185,6 +200,7 @@ class MockAuthProvider extends _i1.Mock implements _i3.AuthProvider { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future setApplicationVersion() => (super.noSuchMethod( Invocation.method( @@ -194,6 +210,7 @@ class MockAuthProvider extends _i1.Mock implements _i3.AuthProvider { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future applicationUpdateRequired([ String? version, @@ -209,6 +226,7 @@ class MockAuthProvider extends _i1.Mock implements _i3.AuthProvider { ), returnValue: _i5.Future.value(false), ) as _i5.Future); + @override _i5.Future> register({ required String? username, @@ -227,8 +245,10 @@ class MockAuthProvider extends _i1.Mock implements _i3.AuthProvider { #serverUrl: serverUrl, }, ), - returnValue: _i5.Future>.value({}), + returnValue: _i5.Future>.value( + {}), ) as _i5.Future>); + @override _i5.Future> login( String? username, @@ -244,8 +264,10 @@ class MockAuthProvider extends _i1.Mock implements _i3.AuthProvider { serverUrl, ], ), - returnValue: _i5.Future>.value({}), + returnValue: _i5.Future>.value( + {}), ) as _i5.Future>); + @override _i5.Future getServerUrlFromPrefs() => (super.noSuchMethod( Invocation.method( @@ -254,6 +276,7 @@ class MockAuthProvider extends _i1.Mock implements _i3.AuthProvider { ), returnValue: _i5.Future.value(''), ) as _i5.Future); + @override _i5.Future tryAutoLogin() => (super.noSuchMethod( Invocation.method( @@ -262,6 +285,7 @@ class MockAuthProvider extends _i1.Mock implements _i3.AuthProvider { ), returnValue: _i5.Future.value(false), ) as _i5.Future); + @override _i5.Future logout({bool? shouldNotify = true}) => (super.noSuchMethod( Invocation.method( @@ -272,6 +296,7 @@ class MockAuthProvider extends _i1.Mock implements _i3.AuthProvider { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override String getAppNameHeader() => (super.noSuchMethod( Invocation.method( @@ -280,6 +305,7 @@ class MockAuthProvider extends _i1.Mock implements _i3.AuthProvider { ), returnValue: '', ) as String); + @override void addListener(_i6.VoidCallback? listener) => super.noSuchMethod( Invocation.method( @@ -288,6 +314,7 @@ class MockAuthProvider extends _i1.Mock implements _i3.AuthProvider { ), returnValueForMissingStub: null, ); + @override void removeListener(_i6.VoidCallback? listener) => super.noSuchMethod( Invocation.method( @@ -296,6 +323,7 @@ class MockAuthProvider extends _i1.Mock implements _i3.AuthProvider { ), returnValueForMissingStub: null, ); + @override void dispose() => super.noSuchMethod( Invocation.method( @@ -304,6 +332,7 @@ class MockAuthProvider extends _i1.Mock implements _i3.AuthProvider { ), returnValueForMissingStub: null, ); + @override void notifyListeners() => super.noSuchMethod( Invocation.method( @@ -330,6 +359,7 @@ class MockWgerBaseProvider extends _i1.Mock implements _i7.WgerBaseProvider { Invocation.getter(#auth), ), ) as _i3.AuthProvider); + @override set auth(_i3.AuthProvider? _auth) => super.noSuchMethod( Invocation.setter( @@ -338,6 +368,7 @@ class MockWgerBaseProvider extends _i1.Mock implements _i7.WgerBaseProvider { ), returnValueForMissingStub: null, ); + @override _i2.Client get client => (super.noSuchMethod( Invocation.getter(#client), @@ -346,6 +377,7 @@ class MockWgerBaseProvider extends _i1.Mock implements _i7.WgerBaseProvider { Invocation.getter(#client), ), ) as _i2.Client); + @override set client(_i2.Client? _client) => super.noSuchMethod( Invocation.setter( @@ -354,8 +386,10 @@ class MockWgerBaseProvider extends _i1.Mock implements _i7.WgerBaseProvider { ), returnValueForMissingStub: null, ); + @override - Map getDefaultHeaders({dynamic includeAuth = false}) => (super.noSuchMethod( + Map getDefaultHeaders({dynamic includeAuth = false}) => + (super.noSuchMethod( Invocation.method( #getDefaultHeaders, [], @@ -363,6 +397,7 @@ class MockWgerBaseProvider extends _i1.Mock implements _i7.WgerBaseProvider { ), returnValue: {}, ) as Map); + @override Uri makeUrl( String? path, { @@ -393,14 +428,17 @@ class MockWgerBaseProvider extends _i1.Mock implements _i7.WgerBaseProvider { ), ), ) as Uri); + @override _i5.Future> fetch(Uri? uri) => (super.noSuchMethod( Invocation.method( #fetch, [uri], ), - returnValue: _i5.Future>.value({}), + returnValue: + _i5.Future>.value({}), ) as _i5.Future>); + @override _i5.Future> fetchPaginated(Uri? uri) => (super.noSuchMethod( Invocation.method( @@ -409,6 +447,7 @@ class MockWgerBaseProvider extends _i1.Mock implements _i7.WgerBaseProvider { ), returnValue: _i5.Future>.value([]), ) as _i5.Future>); + @override _i5.Future> post( Map? data, @@ -422,8 +461,10 @@ class MockWgerBaseProvider extends _i1.Mock implements _i7.WgerBaseProvider { uri, ], ), - returnValue: _i5.Future>.value({}), + returnValue: + _i5.Future>.value({}), ) as _i5.Future>); + @override _i5.Future> patch( Map? data, @@ -437,8 +478,10 @@ class MockWgerBaseProvider extends _i1.Mock implements _i7.WgerBaseProvider { uri, ], ), - returnValue: _i5.Future>.value({}), + returnValue: + _i5.Future>.value({}), ) as _i5.Future>); + @override _i5.Future<_i2.Response> deleteRequest( String? url, @@ -493,6 +536,7 @@ class MockClient extends _i1.Mock implements _i2.Client { ), )), ) as _i5.Future<_i2.Response>); + @override _i5.Future<_i2.Response> get( Uri? url, { @@ -513,6 +557,7 @@ class MockClient extends _i1.Mock implements _i2.Client { ), )), ) as _i5.Future<_i2.Response>); + @override _i5.Future<_i2.Response> post( Uri? url, { @@ -543,6 +588,7 @@ class MockClient extends _i1.Mock implements _i2.Client { ), )), ) as _i5.Future<_i2.Response>); + @override _i5.Future<_i2.Response> put( Uri? url, { @@ -573,6 +619,7 @@ class MockClient extends _i1.Mock implements _i2.Client { ), )), ) as _i5.Future<_i2.Response>); + @override _i5.Future<_i2.Response> patch( Uri? url, { @@ -603,6 +650,7 @@ class MockClient extends _i1.Mock implements _i2.Client { ), )), ) as _i5.Future<_i2.Response>); + @override _i5.Future<_i2.Response> delete( Uri? url, { @@ -633,6 +681,7 @@ class MockClient extends _i1.Mock implements _i2.Client { ), )), ) as _i5.Future<_i2.Response>); + @override _i5.Future read( Uri? url, { @@ -646,6 +695,7 @@ class MockClient extends _i1.Mock implements _i2.Client { ), returnValue: _i5.Future.value(''), ) as _i5.Future); + @override _i5.Future<_i9.Uint8List> readBytes( Uri? url, { @@ -659,13 +709,16 @@ class MockClient extends _i1.Mock implements _i2.Client { ), returnValue: _i5.Future<_i9.Uint8List>.value(_i9.Uint8List(0)), ) as _i5.Future<_i9.Uint8List>); + @override - _i5.Future<_i2.StreamedResponse> send(_i2.BaseRequest? request) => (super.noSuchMethod( + _i5.Future<_i2.StreamedResponse> send(_i2.BaseRequest? request) => + (super.noSuchMethod( Invocation.method( #send, [request], ), - returnValue: _i5.Future<_i2.StreamedResponse>.value(_FakeStreamedResponse_4( + returnValue: + _i5.Future<_i2.StreamedResponse>.value(_FakeStreamedResponse_4( this, Invocation.method( #send, @@ -673,6 +726,7 @@ class MockClient extends _i1.Mock implements _i2.Client { ), )), ) as _i5.Future<_i2.StreamedResponse>); + @override void close() => super.noSuchMethod( Invocation.method( diff --git a/test/other/base_provider_test.mocks.dart b/test/other/base_provider_test.mocks.dart index b4bacacdb..aeb648c76 100644 --- a/test/other/base_provider_test.mocks.dart +++ b/test/other/base_provider_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.0 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in wger/test/other/base_provider_test.dart. // Do not manually edit this file. @@ -31,7 +31,8 @@ class _FakeResponse_0 extends _i1.SmartFake implements _i2.Response { ); } -class _FakeStreamedResponse_1 extends _i1.SmartFake implements _i2.StreamedResponse { +class _FakeStreamedResponse_1 extends _i1.SmartFake + implements _i2.StreamedResponse { _FakeStreamedResponse_1( Object parent, Invocation parentInvocation, @@ -69,6 +70,7 @@ class MockClient extends _i1.Mock implements _i2.Client { ), )), ) as _i3.Future<_i2.Response>); + @override _i3.Future<_i2.Response> get( Uri? url, { @@ -89,6 +91,7 @@ class MockClient extends _i1.Mock implements _i2.Client { ), )), ) as _i3.Future<_i2.Response>); + @override _i3.Future<_i2.Response> post( Uri? url, { @@ -119,6 +122,7 @@ class MockClient extends _i1.Mock implements _i2.Client { ), )), ) as _i3.Future<_i2.Response>); + @override _i3.Future<_i2.Response> put( Uri? url, { @@ -149,6 +153,7 @@ class MockClient extends _i1.Mock implements _i2.Client { ), )), ) as _i3.Future<_i2.Response>); + @override _i3.Future<_i2.Response> patch( Uri? url, { @@ -179,6 +184,7 @@ class MockClient extends _i1.Mock implements _i2.Client { ), )), ) as _i3.Future<_i2.Response>); + @override _i3.Future<_i2.Response> delete( Uri? url, { @@ -209,6 +215,7 @@ class MockClient extends _i1.Mock implements _i2.Client { ), )), ) as _i3.Future<_i2.Response>); + @override _i3.Future read( Uri? url, { @@ -222,6 +229,7 @@ class MockClient extends _i1.Mock implements _i2.Client { ), returnValue: _i3.Future.value(''), ) as _i3.Future); + @override _i3.Future<_i5.Uint8List> readBytes( Uri? url, { @@ -235,13 +243,16 @@ class MockClient extends _i1.Mock implements _i2.Client { ), returnValue: _i3.Future<_i5.Uint8List>.value(_i5.Uint8List(0)), ) as _i3.Future<_i5.Uint8List>); + @override - _i3.Future<_i2.StreamedResponse> send(_i2.BaseRequest? request) => (super.noSuchMethod( + _i3.Future<_i2.StreamedResponse> send(_i2.BaseRequest? request) => + (super.noSuchMethod( Invocation.method( #send, [request], ), - returnValue: _i3.Future<_i2.StreamedResponse>.value(_FakeStreamedResponse_1( + returnValue: + _i3.Future<_i2.StreamedResponse>.value(_FakeStreamedResponse_1( this, Invocation.method( #send, @@ -249,6 +260,7 @@ class MockClient extends _i1.Mock implements _i2.Client { ), )), ) as _i3.Future<_i2.StreamedResponse>); + @override void close() => super.noSuchMethod( Invocation.method( diff --git a/test/user/provider_test.mocks.dart b/test/user/provider_test.mocks.dart index 11199fbc4..d6dc8d6eb 100644 --- a/test/user/provider_test.mocks.dart +++ b/test/user/provider_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.0 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in wger/test/user/provider_test.dart. // Do not manually edit this file. @@ -77,6 +77,7 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider { Invocation.getter(#auth), ), ) as _i2.AuthProvider); + @override set auth(_i2.AuthProvider? _auth) => super.noSuchMethod( Invocation.setter( @@ -85,6 +86,7 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider { ), returnValueForMissingStub: null, ); + @override _i3.Client get client => (super.noSuchMethod( Invocation.getter(#client), @@ -93,6 +95,7 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider { Invocation.getter(#client), ), ) as _i3.Client); + @override set client(_i3.Client? _client) => super.noSuchMethod( Invocation.setter( @@ -101,8 +104,10 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider { ), returnValueForMissingStub: null, ); + @override - Map getDefaultHeaders({dynamic includeAuth = false}) => (super.noSuchMethod( + Map getDefaultHeaders({dynamic includeAuth = false}) => + (super.noSuchMethod( Invocation.method( #getDefaultHeaders, [], @@ -110,6 +115,7 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider { ), returnValue: {}, ) as Map); + @override Uri makeUrl( String? path, { @@ -140,14 +146,17 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider { ), ), ) as Uri); + @override _i5.Future> fetch(Uri? uri) => (super.noSuchMethod( Invocation.method( #fetch, [uri], ), - returnValue: _i5.Future>.value({}), + returnValue: + _i5.Future>.value({}), ) as _i5.Future>); + @override _i5.Future> fetchPaginated(Uri? uri) => (super.noSuchMethod( Invocation.method( @@ -156,6 +165,7 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider { ), returnValue: _i5.Future>.value([]), ) as _i5.Future>); + @override _i5.Future> post( Map? data, @@ -169,8 +179,10 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider { uri, ], ), - returnValue: _i5.Future>.value({}), + returnValue: + _i5.Future>.value({}), ) as _i5.Future>); + @override _i5.Future> patch( Map? data, @@ -184,8 +196,10 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider { uri, ], ), - returnValue: _i5.Future>.value({}), + returnValue: + _i5.Future>.value({}), ) as _i5.Future>); + @override _i5.Future<_i3.Response> deleteRequest( String? url, diff --git a/test/utils/colors.dart b/test/utils/colors.dart new file mode 100644 index 000000000..d3e48d7d8 --- /dev/null +++ b/test/utils/colors.dart @@ -0,0 +1,49 @@ +import 'dart:ui'; + +import 'package:flutter_test/flutter_test.dart'; +import 'package:wger/helpers/colors.dart'; + +void main() { + group('test the color utility', () { + test('3 items or less', () { + final result = generateChartColors(2).iterator; + expect(result.current, equals(const Color(0xFF2A4C7D))); + result.moveNext(); + expect(result.current, equals(const Color(0xFFD45089))); + }); + + test('5 items or less', () { + final result = generateChartColors(5).iterator; + expect(result.current, equals(const Color(0xFF2A4C7D))); + result.moveNext(); + expect(result.current, equals(const Color(0xFF825298))); + result.moveNext(); + expect(result.current, equals(const Color(0xFFD45089))); + result.moveNext(); + expect(result.current, equals(const Color(0xFFFF6A59))); + result.moveNext(); + expect(result.current, equals(const Color(0xFFFFA600))); + }); + + test('8 items or more - last ones undefined', () { + final result = generateChartColors(8).iterator; + expect(result.current, equals(const Color(0xFF2A4C7D))); + result.moveNext(); + expect(result.current, equals(const Color(0xFF5B5291))); + result.moveNext(); + expect(result.current, equals(const Color(0xFF8E5298))); + result.moveNext(); + expect(result.current, equals(const Color(0xFFBF5092))); + result.moveNext(); + expect(result.current, equals(const Color(0xFFE7537E))); + result.moveNext(); + expect(result.current, equals(const Color(0xFFFF6461))); + result.moveNext(); + expect(result.current, equals(const Color(0xFFFF813D))); + result.moveNext(); + expect(result.current, equals(const Color(0xFFFFA600))); + result.moveNext(); + expect(result.current, isNull); + }); + }); +} diff --git a/test/weight/weight_provider_test.mocks.dart b/test/weight/weight_provider_test.mocks.dart index e60495f5f..352c53ad1 100644 --- a/test/weight/weight_provider_test.mocks.dart +++ b/test/weight/weight_provider_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.0 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in wger/test/weight/weight_provider_test.dart. // Do not manually edit this file. @@ -77,6 +77,7 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider { Invocation.getter(#auth), ), ) as _i2.AuthProvider); + @override set auth(_i2.AuthProvider? _auth) => super.noSuchMethod( Invocation.setter( @@ -85,6 +86,7 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider { ), returnValueForMissingStub: null, ); + @override _i3.Client get client => (super.noSuchMethod( Invocation.getter(#client), @@ -93,6 +95,7 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider { Invocation.getter(#client), ), ) as _i3.Client); + @override set client(_i3.Client? _client) => super.noSuchMethod( Invocation.setter( @@ -101,8 +104,10 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider { ), returnValueForMissingStub: null, ); + @override - Map getDefaultHeaders({dynamic includeAuth = false}) => (super.noSuchMethod( + Map getDefaultHeaders({dynamic includeAuth = false}) => + (super.noSuchMethod( Invocation.method( #getDefaultHeaders, [], @@ -110,6 +115,7 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider { ), returnValue: {}, ) as Map); + @override Uri makeUrl( String? path, { @@ -140,14 +146,17 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider { ), ), ) as Uri); + @override _i5.Future> fetch(Uri? uri) => (super.noSuchMethod( Invocation.method( #fetch, [uri], ), - returnValue: _i5.Future>.value({}), + returnValue: + _i5.Future>.value({}), ) as _i5.Future>); + @override _i5.Future> fetchPaginated(Uri? uri) => (super.noSuchMethod( Invocation.method( @@ -156,6 +165,7 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider { ), returnValue: _i5.Future>.value([]), ) as _i5.Future>); + @override _i5.Future> post( Map? data, @@ -169,8 +179,10 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider { uri, ], ), - returnValue: _i5.Future>.value({}), + returnValue: + _i5.Future>.value({}), ) as _i5.Future>); + @override _i5.Future> patch( Map? data, @@ -184,8 +196,10 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider { uri, ], ), - returnValue: _i5.Future>.value({}), + returnValue: + _i5.Future>.value({}), ) as _i5.Future>); + @override _i5.Future<_i3.Response> deleteRequest( String? url, diff --git a/test/weight/weight_screen_test.dart b/test/weight/weight_screen_test.dart index 3ebceef53..10bd75bd0 100644 --- a/test/weight/weight_screen_test.dart +++ b/test/weight/weight_screen_test.dart @@ -25,7 +25,7 @@ import 'package:provider/provider.dart'; import 'package:wger/providers/body_weight.dart'; import 'package:wger/screens/form_screen.dart'; import 'package:wger/screens/weight_screen.dart'; -import 'package:wger/widgets/core/charts.dart'; +import 'package:wger/widgets/measurements/charts.dart'; import 'package:wger/widgets/weight/forms.dart'; import '../../test_data/body_weight.dart'; @@ -57,7 +57,7 @@ void main() { await tester.pumpWidget(createWeightScreen()); expect(find.text('Weight'), findsOneWidget); - expect(find.byType(MeasurementChartWidget), findsOneWidget); + expect(find.byType(MeasurementChartWidgetFl), findsOneWidget); expect(find.byType(Dismissible), findsNWidgets(2)); expect(find.byType(ListTile), findsNWidgets(2)); }); @@ -83,6 +83,7 @@ void main() { testWidgets('Tests the localization of dates - EN', (WidgetTester tester) async { await tester.pumpWidget(createWeightScreen()); + // One in the entries list, one in the chart expect(find.text('1/1/2021'), findsOneWidget); expect(find.text('1/10/2021'), findsOneWidget); }); diff --git a/test/weight/weight_screen_test.mocks.dart b/test/weight/weight_screen_test.mocks.dart index 7de6b61d8..a63186b3d 100644 --- a/test/weight/weight_screen_test.mocks.dart +++ b/test/weight/weight_screen_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.0 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in wger/test/weight/weight_screen_test.dart. // Do not manually edit this file. @@ -22,7 +22,8 @@ import 'package:wger/providers/body_weight.dart' as _i4; // ignore_for_file: camel_case_types // ignore_for_file: subtype_of_sealed_class -class _FakeWgerBaseProvider_0 extends _i1.SmartFake implements _i2.WgerBaseProvider { +class _FakeWgerBaseProvider_0 extends _i1.SmartFake + implements _i2.WgerBaseProvider { _FakeWgerBaseProvider_0( Object parent, Invocation parentInvocation, @@ -45,7 +46,8 @@ class _FakeWeightEntry_1 extends _i1.SmartFake implements _i3.WeightEntry { /// A class which mocks [BodyWeightProvider]. /// /// See the documentation for Mockito's code generation for more information. -class MockBodyWeightProvider extends _i1.Mock implements _i4.BodyWeightProvider { +class MockBodyWeightProvider extends _i1.Mock + implements _i4.BodyWeightProvider { MockBodyWeightProvider() { _i1.throwOnMissingStub(this); } @@ -58,11 +60,13 @@ class MockBodyWeightProvider extends _i1.Mock implements _i4.BodyWeightProvider Invocation.getter(#baseProvider), ), ) as _i2.WgerBaseProvider); + @override List<_i3.WeightEntry> get items => (super.noSuchMethod( Invocation.getter(#items), returnValue: <_i3.WeightEntry>[], ) as List<_i3.WeightEntry>); + @override set items(List<_i3.WeightEntry>? entries) => super.noSuchMethod( Invocation.setter( @@ -71,11 +75,13 @@ class MockBodyWeightProvider extends _i1.Mock implements _i4.BodyWeightProvider ), returnValueForMissingStub: null, ); + @override bool get hasListeners => (super.noSuchMethod( Invocation.getter(#hasListeners), returnValue: false, ) as bool); + @override void clear() => super.noSuchMethod( Invocation.method( @@ -84,6 +90,7 @@ class MockBodyWeightProvider extends _i1.Mock implements _i4.BodyWeightProvider ), returnValueForMissingStub: null, ); + @override _i3.WeightEntry findById(int? id) => (super.noSuchMethod( Invocation.method( @@ -98,21 +105,27 @@ class MockBodyWeightProvider extends _i1.Mock implements _i4.BodyWeightProvider ), ), ) as _i3.WeightEntry); + @override - _i3.WeightEntry? findByDate(DateTime? date) => (super.noSuchMethod(Invocation.method( + _i3.WeightEntry? findByDate(DateTime? date) => + (super.noSuchMethod(Invocation.method( #findByDate, [date], )) as _i3.WeightEntry?); + @override _i5.Future> fetchAndSetEntries() => (super.noSuchMethod( Invocation.method( #fetchAndSetEntries, [], ), - returnValue: _i5.Future>.value(<_i3.WeightEntry>[]), + returnValue: + _i5.Future>.value(<_i3.WeightEntry>[]), ) as _i5.Future>); + @override - _i5.Future<_i3.WeightEntry> addEntry(_i3.WeightEntry? entry) => (super.noSuchMethod( + _i5.Future<_i3.WeightEntry> addEntry(_i3.WeightEntry? entry) => + (super.noSuchMethod( Invocation.method( #addEntry, [entry], @@ -125,6 +138,7 @@ class MockBodyWeightProvider extends _i1.Mock implements _i4.BodyWeightProvider ), )), ) as _i5.Future<_i3.WeightEntry>); + @override _i5.Future editEntry(_i3.WeightEntry? entry) => (super.noSuchMethod( Invocation.method( @@ -134,6 +148,7 @@ class MockBodyWeightProvider extends _i1.Mock implements _i4.BodyWeightProvider returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future deleteEntry(int? id) => (super.noSuchMethod( Invocation.method( @@ -143,6 +158,7 @@ class MockBodyWeightProvider extends _i1.Mock implements _i4.BodyWeightProvider returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override void addListener(_i6.VoidCallback? listener) => super.noSuchMethod( Invocation.method( @@ -151,6 +167,7 @@ class MockBodyWeightProvider extends _i1.Mock implements _i4.BodyWeightProvider ), returnValueForMissingStub: null, ); + @override void removeListener(_i6.VoidCallback? listener) => super.noSuchMethod( Invocation.method( @@ -159,6 +176,7 @@ class MockBodyWeightProvider extends _i1.Mock implements _i4.BodyWeightProvider ), returnValueForMissingStub: null, ); + @override void dispose() => super.noSuchMethod( Invocation.method( @@ -167,6 +185,7 @@ class MockBodyWeightProvider extends _i1.Mock implements _i4.BodyWeightProvider ), returnValueForMissingStub: null, ); + @override void notifyListeners() => super.noSuchMethod( Invocation.method( diff --git a/test/workout/gym_mode_screen_test.mocks.dart b/test/workout/gym_mode_screen_test.mocks.dart index 81f8f7fe6..b32f85875 100644 --- a/test/workout/gym_mode_screen_test.mocks.dart +++ b/test/workout/gym_mode_screen_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.0 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in wger/test/workout/gym_mode_screen_test.dart. // Do not manually edit this file. @@ -68,7 +68,8 @@ class _FakeResponse_3 extends _i1.SmartFake implements _i3.Response { ); } -class _FakeWgerBaseProvider_4 extends _i1.SmartFake implements _i4.WgerBaseProvider { +class _FakeWgerBaseProvider_4 extends _i1.SmartFake + implements _i4.WgerBaseProvider { _FakeWgerBaseProvider_4( Object parent, Invocation parentInvocation, @@ -88,7 +89,8 @@ class _FakeExerciseBase_5 extends _i1.SmartFake implements _i5.ExerciseBase { ); } -class _FakeExerciseCategory_6 extends _i1.SmartFake implements _i6.ExerciseCategory { +class _FakeExerciseCategory_6 extends _i1.SmartFake + implements _i6.ExerciseCategory { _FakeExerciseCategory_6( Object parent, Invocation parentInvocation, @@ -144,6 +146,7 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider { Invocation.getter(#auth), ), ) as _i2.AuthProvider); + @override set auth(_i2.AuthProvider? _auth) => super.noSuchMethod( Invocation.setter( @@ -152,6 +155,7 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider { ), returnValueForMissingStub: null, ); + @override _i3.Client get client => (super.noSuchMethod( Invocation.getter(#client), @@ -160,6 +164,7 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider { Invocation.getter(#client), ), ) as _i3.Client); + @override set client(_i3.Client? _client) => super.noSuchMethod( Invocation.setter( @@ -168,8 +173,10 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider { ), returnValueForMissingStub: null, ); + @override - Map getDefaultHeaders({dynamic includeAuth = false}) => (super.noSuchMethod( + Map getDefaultHeaders({dynamic includeAuth = false}) => + (super.noSuchMethod( Invocation.method( #getDefaultHeaders, [], @@ -177,6 +184,7 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider { ), returnValue: {}, ) as Map); + @override Uri makeUrl( String? path, { @@ -207,14 +215,17 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider { ), ), ) as Uri); + @override _i10.Future> fetch(Uri? uri) => (super.noSuchMethod( Invocation.method( #fetch, [uri], ), - returnValue: _i10.Future>.value({}), + returnValue: + _i10.Future>.value({}), ) as _i10.Future>); + @override _i10.Future> fetchPaginated(Uri? uri) => (super.noSuchMethod( Invocation.method( @@ -223,6 +234,7 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider { ), returnValue: _i10.Future>.value([]), ) as _i10.Future>); + @override _i10.Future> post( Map? data, @@ -236,8 +248,10 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider { uri, ], ), - returnValue: _i10.Future>.value({}), + returnValue: + _i10.Future>.value({}), ) as _i10.Future>); + @override _i10.Future> patch( Map? data, @@ -251,8 +265,10 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider { uri, ], ), - returnValue: _i10.Future>.value({}), + returnValue: + _i10.Future>.value({}), ) as _i10.Future>); + @override _i10.Future<_i3.Response> deleteRequest( String? url, @@ -295,57 +311,70 @@ class MockExercisesProvider extends _i1.Mock implements _i11.ExercisesProvider { Invocation.getter(#baseProvider), ), ) as _i4.WgerBaseProvider); + @override - set exerciseBases(List<_i5.ExerciseBase>? exercisesBases) => super.noSuchMethod( + set exerciseBases(List<_i5.ExerciseBase>? exercisesBases) => + super.noSuchMethod( Invocation.setter( #exerciseBases, exercisesBases, ), returnValueForMissingStub: null, ); + @override List<_i5.ExerciseBase> get filteredExerciseBases => (super.noSuchMethod( Invocation.getter(#filteredExerciseBases), returnValue: <_i5.ExerciseBase>[], ) as List<_i5.ExerciseBase>); + @override - set filteredExerciseBases(List<_i5.ExerciseBase>? newFilteredExercises) => super.noSuchMethod( + set filteredExerciseBases(List<_i5.ExerciseBase>? newFilteredExercises) => + super.noSuchMethod( Invocation.setter( #filteredExerciseBases, newFilteredExercises, ), returnValueForMissingStub: null, ); + @override - Map> get exerciseBasesByVariation => (super.noSuchMethod( + Map> get exerciseBasesByVariation => + (super.noSuchMethod( Invocation.getter(#exerciseBasesByVariation), returnValue: >{}, ) as Map>); + @override List<_i5.ExerciseBase> get bases => (super.noSuchMethod( Invocation.getter(#bases), returnValue: <_i5.ExerciseBase>[], ) as List<_i5.ExerciseBase>); + @override List<_i6.ExerciseCategory> get categories => (super.noSuchMethod( Invocation.getter(#categories), returnValue: <_i6.ExerciseCategory>[], ) as List<_i6.ExerciseCategory>); + @override List<_i8.Muscle> get muscles => (super.noSuchMethod( Invocation.getter(#muscles), returnValue: <_i8.Muscle>[], ) as List<_i8.Muscle>); + @override List<_i7.Equipment> get equipment => (super.noSuchMethod( Invocation.getter(#equipment), returnValue: <_i7.Equipment>[], ) as List<_i7.Equipment>); + @override List<_i9.Language> get languages => (super.noSuchMethod( Invocation.getter(#languages), returnValue: <_i9.Language>[], ) as List<_i9.Language>); + @override set languages(List<_i9.Language>? languages) => super.noSuchMethod( Invocation.setter( @@ -354,11 +383,13 @@ class MockExercisesProvider extends _i1.Mock implements _i11.ExercisesProvider { ), returnValueForMissingStub: null, ); + @override bool get hasListeners => (super.noSuchMethod( Invocation.getter(#hasListeners), returnValue: false, ) as bool); + @override _i10.Future setFilters(_i11.Filters? newFilters) => (super.noSuchMethod( Invocation.method( @@ -368,6 +399,7 @@ class MockExercisesProvider extends _i1.Mock implements _i11.ExercisesProvider { returnValue: _i10.Future.value(), returnValueForMissingStub: _i10.Future.value(), ) as _i10.Future); + @override _i10.Future findByFilters() => (super.noSuchMethod( Invocation.method( @@ -377,6 +409,7 @@ class MockExercisesProvider extends _i1.Mock implements _i11.ExercisesProvider { returnValue: _i10.Future.value(), returnValueForMissingStub: _i10.Future.value(), ) as _i10.Future); + @override void clear() => super.noSuchMethod( Invocation.method( @@ -385,6 +418,7 @@ class MockExercisesProvider extends _i1.Mock implements _i11.ExercisesProvider { ), returnValueForMissingStub: null, ); + @override _i5.ExerciseBase findExerciseBaseById(int? id) => (super.noSuchMethod( Invocation.method( @@ -399,6 +433,7 @@ class MockExercisesProvider extends _i1.Mock implements _i11.ExercisesProvider { ), ), ) as _i5.ExerciseBase); + @override List<_i5.ExerciseBase> findExerciseBasesByVariationId( int? id, { @@ -412,6 +447,7 @@ class MockExercisesProvider extends _i1.Mock implements _i11.ExercisesProvider { ), returnValue: <_i5.ExerciseBase>[], ) as List<_i5.ExerciseBase>); + @override _i6.ExerciseCategory findCategoryById(int? id) => (super.noSuchMethod( Invocation.method( @@ -426,6 +462,7 @@ class MockExercisesProvider extends _i1.Mock implements _i11.ExercisesProvider { ), ), ) as _i6.ExerciseCategory); + @override _i7.Equipment findEquipmentById(int? id) => (super.noSuchMethod( Invocation.method( @@ -440,6 +477,7 @@ class MockExercisesProvider extends _i1.Mock implements _i11.ExercisesProvider { ), ), ) as _i7.Equipment); + @override _i8.Muscle findMuscleById(int? id) => (super.noSuchMethod( Invocation.method( @@ -454,6 +492,7 @@ class MockExercisesProvider extends _i1.Mock implements _i11.ExercisesProvider { ), ), ) as _i8.Muscle); + @override _i9.Language findLanguageById(int? id) => (super.noSuchMethod( Invocation.method( @@ -468,6 +507,7 @@ class MockExercisesProvider extends _i1.Mock implements _i11.ExercisesProvider { ), ), ) as _i9.Language); + @override _i10.Future fetchAndSetCategories() => (super.noSuchMethod( Invocation.method( @@ -477,6 +517,7 @@ class MockExercisesProvider extends _i1.Mock implements _i11.ExercisesProvider { returnValue: _i10.Future.value(), returnValueForMissingStub: _i10.Future.value(), ) as _i10.Future); + @override _i10.Future fetchAndSetVariations() => (super.noSuchMethod( Invocation.method( @@ -486,6 +527,7 @@ class MockExercisesProvider extends _i1.Mock implements _i11.ExercisesProvider { returnValue: _i10.Future.value(), returnValueForMissingStub: _i10.Future.value(), ) as _i10.Future); + @override _i10.Future fetchAndSetMuscles() => (super.noSuchMethod( Invocation.method( @@ -495,6 +537,7 @@ class MockExercisesProvider extends _i1.Mock implements _i11.ExercisesProvider { returnValue: _i10.Future.value(), returnValueForMissingStub: _i10.Future.value(), ) as _i10.Future); + @override _i10.Future fetchAndSetEquipment() => (super.noSuchMethod( Invocation.method( @@ -504,6 +547,7 @@ class MockExercisesProvider extends _i1.Mock implements _i11.ExercisesProvider { returnValue: _i10.Future.value(), returnValueForMissingStub: _i10.Future.value(), ) as _i10.Future); + @override _i10.Future fetchAndSetLanguages() => (super.noSuchMethod( Invocation.method( @@ -513,8 +557,10 @@ class MockExercisesProvider extends _i1.Mock implements _i11.ExercisesProvider { returnValue: _i10.Future.value(), returnValueForMissingStub: _i10.Future.value(), ) as _i10.Future); + @override - _i10.Future<_i5.ExerciseBase> fetchAndSetExerciseBase(int? exerciseBaseId) => (super.noSuchMethod( + _i10.Future<_i5.ExerciseBase> fetchAndSetExerciseBase(int? exerciseBaseId) => + (super.noSuchMethod( Invocation.method( #fetchAndSetExerciseBase, [exerciseBaseId], @@ -527,8 +573,10 @@ class MockExercisesProvider extends _i1.Mock implements _i11.ExercisesProvider { ), )), ) as _i10.Future<_i5.ExerciseBase>); + @override - _i5.ExerciseBase readExerciseBaseFromBaseInfo(dynamic baseData) => (super.noSuchMethod( + _i5.ExerciseBase readExerciseBaseFromBaseInfo(dynamic baseData) => + (super.noSuchMethod( Invocation.method( #readExerciseBaseFromBaseInfo, [baseData], @@ -541,6 +589,7 @@ class MockExercisesProvider extends _i1.Mock implements _i11.ExercisesProvider { ), ), ) as _i5.ExerciseBase); + @override _i10.Future checkExerciseCacheVersion() => (super.noSuchMethod( Invocation.method( @@ -550,6 +599,7 @@ class MockExercisesProvider extends _i1.Mock implements _i11.ExercisesProvider { returnValue: _i10.Future.value(), returnValueForMissingStub: _i10.Future.value(), ) as _i10.Future); + @override _i10.Future fetchAndSetExercises() => (super.noSuchMethod( Invocation.method( @@ -559,6 +609,7 @@ class MockExercisesProvider extends _i1.Mock implements _i11.ExercisesProvider { returnValue: _i10.Future.value(), returnValueForMissingStub: _i10.Future.value(), ) as _i10.Future); + @override _i10.Future> searchExercise( String? name, { @@ -574,8 +625,10 @@ class MockExercisesProvider extends _i1.Mock implements _i11.ExercisesProvider { #searchEnglish: searchEnglish, }, ), - returnValue: _i10.Future>.value(<_i5.ExerciseBase>[]), + returnValue: + _i10.Future>.value(<_i5.ExerciseBase>[]), ) as _i10.Future>); + @override void addListener(_i12.VoidCallback? listener) => super.noSuchMethod( Invocation.method( @@ -584,6 +637,7 @@ class MockExercisesProvider extends _i1.Mock implements _i11.ExercisesProvider { ), returnValueForMissingStub: null, ); + @override void removeListener(_i12.VoidCallback? listener) => super.noSuchMethod( Invocation.method( @@ -592,6 +646,7 @@ class MockExercisesProvider extends _i1.Mock implements _i11.ExercisesProvider { ), returnValueForMissingStub: null, ); + @override void dispose() => super.noSuchMethod( Invocation.method( @@ -600,6 +655,7 @@ class MockExercisesProvider extends _i1.Mock implements _i11.ExercisesProvider { ), returnValueForMissingStub: null, ); + @override void notifyListeners() => super.noSuchMethod( Invocation.method( diff --git a/test/workout/repetition_unit_form_widget_test.dart b/test/workout/repetition_unit_form_widget_test.dart index d237bd49b..61664d3ae 100644 --- a/test/workout/repetition_unit_form_widget_test.dart +++ b/test/workout/repetition_unit_form_widget_test.dart @@ -76,29 +76,14 @@ void main() { testWidgets('Test that the entries are shown', (WidgetTester tester) async { // arrange - final key1 = find.byKey(const Key('1')); - final key2 = find.byKey(const Key('2')); - final key3 = find.byKey(const Key('3')); await tester.pumpWidget(createHomeScreen()); + await tester.tap(find.byKey(const Key('1'))); await tester.pump(); // assert - expect(key1, findsOneWidget); - expect( - (tester.widget(key1) as DropdownMenuItem).value!.name, - equals('some rep unit'), - ); - - expect(key2, findsOneWidget); - expect( - (tester.widget(key2) as DropdownMenuItem).value!.name, - equals('another name'), - ); - expect(key3, findsOneWidget); - expect( - (tester.widget(key3) as DropdownMenuItem).value!.name, - equals('this is repetition number 3'), - ); + expect(find.text('some rep unit'), findsWidgets); + expect(find.text('another name'), findsWidgets); + expect(find.text('this is repetition number 3'), findsWidgets); }); testWidgets('Test that the correct units are set after selection', (WidgetTester tester) async { diff --git a/test/workout/repetition_unit_form_widget_test.mocks.dart b/test/workout/repetition_unit_form_widget_test.mocks.dart index af33fd82c..07ecf14bc 100644 --- a/test/workout/repetition_unit_form_widget_test.mocks.dart +++ b/test/workout/repetition_unit_form_widget_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.0 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in wger/test/workout/repetition_unit_form_widget_test.dart. // Do not manually edit this file. @@ -31,7 +31,8 @@ import 'package:wger/providers/workout_plans.dart' as _i11; // ignore_for_file: camel_case_types // ignore_for_file: subtype_of_sealed_class -class _FakeWgerBaseProvider_0 extends _i1.SmartFake implements _i2.WgerBaseProvider { +class _FakeWgerBaseProvider_0 extends _i1.SmartFake + implements _i2.WgerBaseProvider { _FakeWgerBaseProvider_0( Object parent, Invocation parentInvocation, @@ -51,7 +52,8 @@ class _FakeWeightUnit_1 extends _i1.SmartFake implements _i3.WeightUnit { ); } -class _FakeRepetitionUnit_2 extends _i1.SmartFake implements _i4.RepetitionUnit { +class _FakeRepetitionUnit_2 extends _i1.SmartFake + implements _i4.RepetitionUnit { _FakeRepetitionUnit_2( Object parent, Invocation parentInvocation, @@ -101,7 +103,8 @@ class _FakeSetting_6 extends _i1.SmartFake implements _i8.Setting { ); } -class _FakeWorkoutSession_7 extends _i1.SmartFake implements _i9.WorkoutSession { +class _FakeWorkoutSession_7 extends _i1.SmartFake + implements _i9.WorkoutSession { _FakeWorkoutSession_7( Object parent, Invocation parentInvocation, @@ -124,7 +127,8 @@ class _FakeLog_8 extends _i1.SmartFake implements _i10.Log { /// A class which mocks [WorkoutPlansProvider]. /// /// See the documentation for Mockito's code generation for more information. -class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProvider { +class MockWorkoutPlansProvider extends _i1.Mock + implements _i11.WorkoutPlansProvider { MockWorkoutPlansProvider() { _i1.throwOnMissingStub(this); } @@ -137,16 +141,19 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProv Invocation.getter(#baseProvider), ), ) as _i2.WgerBaseProvider); + @override List<_i5.WorkoutPlan> get items => (super.noSuchMethod( Invocation.getter(#items), returnValue: <_i5.WorkoutPlan>[], ) as List<_i5.WorkoutPlan>); + @override List<_i3.WeightUnit> get weightUnits => (super.noSuchMethod( Invocation.getter(#weightUnits), returnValue: <_i3.WeightUnit>[], ) as List<_i3.WeightUnit>); + @override _i3.WeightUnit get defaultWeightUnit => (super.noSuchMethod( Invocation.getter(#defaultWeightUnit), @@ -155,11 +162,13 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProv Invocation.getter(#defaultWeightUnit), ), ) as _i3.WeightUnit); + @override List<_i4.RepetitionUnit> get repetitionUnits => (super.noSuchMethod( Invocation.getter(#repetitionUnits), returnValue: <_i4.RepetitionUnit>[], ) as List<_i4.RepetitionUnit>); + @override _i4.RepetitionUnit get defaultRepetitionUnit => (super.noSuchMethod( Invocation.getter(#defaultRepetitionUnit), @@ -168,11 +177,13 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProv Invocation.getter(#defaultRepetitionUnit), ), ) as _i4.RepetitionUnit); + @override bool get hasListeners => (super.noSuchMethod( Invocation.getter(#hasListeners), returnValue: false, ) as bool); + @override void clear() => super.noSuchMethod( Invocation.method( @@ -181,6 +192,7 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProv ), returnValueForMissingStub: null, ); + @override List<_i5.WorkoutPlan> getPlans() => (super.noSuchMethod( Invocation.method( @@ -189,6 +201,7 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProv ), returnValue: <_i5.WorkoutPlan>[], ) as List<_i5.WorkoutPlan>); + @override _i5.WorkoutPlan findById(int? id) => (super.noSuchMethod( Invocation.method( @@ -203,6 +216,7 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProv ), ), ) as _i5.WorkoutPlan); + @override int findIndexById(int? id) => (super.noSuchMethod( Invocation.method( @@ -211,6 +225,7 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProv ), returnValue: 0, ) as int); + @override void setCurrentPlan(int? id) => super.noSuchMethod( Invocation.method( @@ -219,6 +234,7 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProv ), returnValueForMissingStub: null, ); + @override void resetCurrentPlan() => super.noSuchMethod( Invocation.method( @@ -227,6 +243,7 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProv ), returnValueForMissingStub: null, ); + @override _i12.Future fetchAndSetAllPlansFull() => (super.noSuchMethod( Invocation.method( @@ -236,6 +253,7 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProv returnValue: _i12.Future.value(), returnValueForMissingStub: _i12.Future.value(), ) as _i12.Future); + @override _i12.Future fetchAndSetAllPlansSparse() => (super.noSuchMethod( Invocation.method( @@ -245,8 +263,10 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProv returnValue: _i12.Future.value(), returnValueForMissingStub: _i12.Future.value(), ) as _i12.Future); + @override - _i12.Future<_i5.WorkoutPlan> fetchAndSetPlanSparse(int? planId) => (super.noSuchMethod( + _i12.Future<_i5.WorkoutPlan> fetchAndSetPlanSparse(int? planId) => + (super.noSuchMethod( Invocation.method( #fetchAndSetPlanSparse, [planId], @@ -259,8 +279,10 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProv ), )), ) as _i12.Future<_i5.WorkoutPlan>); + @override - _i12.Future<_i5.WorkoutPlan> fetchAndSetWorkoutPlanFull(int? workoutId) => (super.noSuchMethod( + _i12.Future<_i5.WorkoutPlan> fetchAndSetWorkoutPlanFull(int? workoutId) => + (super.noSuchMethod( Invocation.method( #fetchAndSetWorkoutPlanFull, [workoutId], @@ -273,8 +295,10 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProv ), )), ) as _i12.Future<_i5.WorkoutPlan>); + @override - _i12.Future<_i5.WorkoutPlan> addWorkout(_i5.WorkoutPlan? workout) => (super.noSuchMethod( + _i12.Future<_i5.WorkoutPlan> addWorkout(_i5.WorkoutPlan? workout) => + (super.noSuchMethod( Invocation.method( #addWorkout, [workout], @@ -287,8 +311,10 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProv ), )), ) as _i12.Future<_i5.WorkoutPlan>); + @override - _i12.Future editWorkout(_i5.WorkoutPlan? workout) => (super.noSuchMethod( + _i12.Future editWorkout(_i5.WorkoutPlan? workout) => + (super.noSuchMethod( Invocation.method( #editWorkout, [workout], @@ -296,6 +322,7 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProv returnValue: _i12.Future.value(), returnValueForMissingStub: _i12.Future.value(), ) as _i12.Future); + @override _i12.Future deleteWorkout(int? id) => (super.noSuchMethod( Invocation.method( @@ -305,6 +332,7 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProv returnValue: _i12.Future.value(), returnValueForMissingStub: _i12.Future.value(), ) as _i12.Future); + @override _i12.Future> fetchLogData( _i5.WorkoutPlan? workout, @@ -318,8 +346,10 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProv base, ], ), - returnValue: _i12.Future>.value({}), + returnValue: + _i12.Future>.value({}), ) as _i12.Future>); + @override _i12.Future fetchAndSetRepetitionUnits() => (super.noSuchMethod( Invocation.method( @@ -329,6 +359,7 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProv returnValue: _i12.Future.value(), returnValueForMissingStub: _i12.Future.value(), ) as _i12.Future); + @override _i12.Future fetchAndSetWeightUnits() => (super.noSuchMethod( Invocation.method( @@ -338,6 +369,7 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProv returnValue: _i12.Future.value(), returnValueForMissingStub: _i12.Future.value(), ) as _i12.Future); + @override _i12.Future fetchAndSetUnits() => (super.noSuchMethod( Invocation.method( @@ -347,6 +379,7 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProv returnValue: _i12.Future.value(), returnValueForMissingStub: _i12.Future.value(), ) as _i12.Future); + @override _i12.Future<_i6.Day> addDay( _i6.Day? day, @@ -371,6 +404,7 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProv ), )), ) as _i12.Future<_i6.Day>); + @override _i12.Future editDay(_i6.Day? day) => (super.noSuchMethod( Invocation.method( @@ -380,6 +414,7 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProv returnValue: _i12.Future.value(), returnValueForMissingStub: _i12.Future.value(), ) as _i12.Future); + @override _i12.Future deleteDay(_i6.Day? day) => (super.noSuchMethod( Invocation.method( @@ -389,6 +424,7 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProv returnValue: _i12.Future.value(), returnValueForMissingStub: _i12.Future.value(), ) as _i12.Future); + @override _i12.Future<_i7.Set> addSet(_i7.Set? workoutSet) => (super.noSuchMethod( Invocation.method( @@ -403,6 +439,7 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProv ), )), ) as _i12.Future<_i7.Set>); + @override _i12.Future editSet(_i7.Set? workoutSet) => (super.noSuchMethod( Invocation.method( @@ -412,6 +449,7 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProv returnValue: _i12.Future.value(), returnValueForMissingStub: _i12.Future.value(), ) as _i12.Future); + @override _i12.Future> reorderSets( List<_i7.Set>? sets, @@ -427,8 +465,10 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProv ), returnValue: _i12.Future>.value(<_i7.Set>[]), ) as _i12.Future>); + @override - _i12.Future fetchComputedSettings(_i7.Set? workoutSet) => (super.noSuchMethod( + _i12.Future fetchComputedSettings(_i7.Set? workoutSet) => + (super.noSuchMethod( Invocation.method( #fetchComputedSettings, [workoutSet], @@ -436,6 +476,7 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProv returnValue: _i12.Future.value(), returnValueForMissingStub: _i12.Future.value(), ) as _i12.Future); + @override _i12.Future fetchSmartText( _i7.Set? workoutSet, @@ -451,6 +492,7 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProv ), returnValue: _i12.Future.value(''), ) as _i12.Future); + @override _i12.Future deleteSet(_i7.Set? workoutSet) => (super.noSuchMethod( Invocation.method( @@ -460,8 +502,10 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProv returnValue: _i12.Future.value(), returnValueForMissingStub: _i12.Future.value(), ) as _i12.Future); + @override - _i12.Future<_i8.Setting> addSetting(_i8.Setting? workoutSetting) => (super.noSuchMethod( + _i12.Future<_i8.Setting> addSetting(_i8.Setting? workoutSetting) => + (super.noSuchMethod( Invocation.method( #addSetting, [workoutSetting], @@ -474,6 +518,7 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProv ), )), ) as _i12.Future<_i8.Setting>); + @override _i12.Future fetchSessionData() => (super.noSuchMethod( Invocation.method( @@ -482,13 +527,16 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProv ), returnValue: _i12.Future.value(), ) as _i12.Future); + @override - _i12.Future<_i9.WorkoutSession> addSession(_i9.WorkoutSession? session) => (super.noSuchMethod( + _i12.Future<_i9.WorkoutSession> addSession(_i9.WorkoutSession? session) => + (super.noSuchMethod( Invocation.method( #addSession, [session], ), - returnValue: _i12.Future<_i9.WorkoutSession>.value(_FakeWorkoutSession_7( + returnValue: + _i12.Future<_i9.WorkoutSession>.value(_FakeWorkoutSession_7( this, Invocation.method( #addSession, @@ -496,6 +544,7 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProv ), )), ) as _i12.Future<_i9.WorkoutSession>); + @override _i12.Future<_i10.Log> addLog(_i10.Log? log) => (super.noSuchMethod( Invocation.method( @@ -510,6 +559,7 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProv ), )), ) as _i12.Future<_i10.Log>); + @override _i12.Future deleteLog(_i10.Log? log) => (super.noSuchMethod( Invocation.method( @@ -519,6 +569,7 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProv returnValue: _i12.Future.value(), returnValueForMissingStub: _i12.Future.value(), ) as _i12.Future); + @override void addListener(_i15.VoidCallback? listener) => super.noSuchMethod( Invocation.method( @@ -527,6 +578,7 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProv ), returnValueForMissingStub: null, ); + @override void removeListener(_i15.VoidCallback? listener) => super.noSuchMethod( Invocation.method( @@ -535,6 +587,7 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProv ), returnValueForMissingStub: null, ); + @override void dispose() => super.noSuchMethod( Invocation.method( @@ -543,6 +596,7 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProv ), returnValueForMissingStub: null, ); + @override void notifyListeners() => super.noSuchMethod( Invocation.method( diff --git a/test/workout/weight_unit_form_widget_test.dart b/test/workout/weight_unit_form_widget_test.dart index 8fbe987a4..eb051354f 100644 --- a/test/workout/weight_unit_form_widget_test.dart +++ b/test/workout/weight_unit_form_widget_test.dart @@ -77,29 +77,14 @@ void main() { testWidgets('Test that the entries are shown', (WidgetTester tester) async { // arrange - final key1 = find.byKey(const Key('1')); - final key2 = find.byKey(const Key('2')); - final key3 = find.byKey(const Key('3')); await tester.pumpWidget(createHomeScreen()); + await tester.tap(find.byKey(const Key('1'))); await tester.pump(); // assert - expect(key1, findsOneWidget); - expect( - (tester.widget(key1) as DropdownMenuItem).value!.name, - equals('kg'), - ); - - expect(key2, findsOneWidget); - expect( - (tester.widget(key2) as DropdownMenuItem).value!.name, - equals('donkeys'), - ); - expect(key3, findsOneWidget); - expect( - (tester.widget(key3) as DropdownMenuItem).value!.name, - equals('plates'), - ); + expect(find.text('kg'), findsWidgets); + expect(find.text('donkeys'), findsWidgets); + expect(find.text('plates'), findsWidgets); }); testWidgets('Test that the correct units are set after selection', (WidgetTester tester) async { diff --git a/test/workout/weight_unit_form_widget_test.mocks.dart b/test/workout/weight_unit_form_widget_test.mocks.dart index f3f638a2b..7dacae9e1 100644 --- a/test/workout/weight_unit_form_widget_test.mocks.dart +++ b/test/workout/weight_unit_form_widget_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.0 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in wger/test/workout/weight_unit_form_widget_test.dart. // Do not manually edit this file. @@ -22,7 +22,8 @@ import 'package:wger/providers/body_weight.dart' as _i4; // ignore_for_file: camel_case_types // ignore_for_file: subtype_of_sealed_class -class _FakeWgerBaseProvider_0 extends _i1.SmartFake implements _i2.WgerBaseProvider { +class _FakeWgerBaseProvider_0 extends _i1.SmartFake + implements _i2.WgerBaseProvider { _FakeWgerBaseProvider_0( Object parent, Invocation parentInvocation, @@ -45,7 +46,8 @@ class _FakeWeightEntry_1 extends _i1.SmartFake implements _i3.WeightEntry { /// A class which mocks [BodyWeightProvider]. /// /// See the documentation for Mockito's code generation for more information. -class MockBodyWeightProvider extends _i1.Mock implements _i4.BodyWeightProvider { +class MockBodyWeightProvider extends _i1.Mock + implements _i4.BodyWeightProvider { MockBodyWeightProvider() { _i1.throwOnMissingStub(this); } @@ -58,11 +60,13 @@ class MockBodyWeightProvider extends _i1.Mock implements _i4.BodyWeightProvider Invocation.getter(#baseProvider), ), ) as _i2.WgerBaseProvider); + @override List<_i3.WeightEntry> get items => (super.noSuchMethod( Invocation.getter(#items), returnValue: <_i3.WeightEntry>[], ) as List<_i3.WeightEntry>); + @override set items(List<_i3.WeightEntry>? entries) => super.noSuchMethod( Invocation.setter( @@ -71,11 +75,13 @@ class MockBodyWeightProvider extends _i1.Mock implements _i4.BodyWeightProvider ), returnValueForMissingStub: null, ); + @override bool get hasListeners => (super.noSuchMethod( Invocation.getter(#hasListeners), returnValue: false, ) as bool); + @override void clear() => super.noSuchMethod( Invocation.method( @@ -84,6 +90,7 @@ class MockBodyWeightProvider extends _i1.Mock implements _i4.BodyWeightProvider ), returnValueForMissingStub: null, ); + @override _i3.WeightEntry findById(int? id) => (super.noSuchMethod( Invocation.method( @@ -98,21 +105,27 @@ class MockBodyWeightProvider extends _i1.Mock implements _i4.BodyWeightProvider ), ), ) as _i3.WeightEntry); + @override - _i3.WeightEntry? findByDate(DateTime? date) => (super.noSuchMethod(Invocation.method( + _i3.WeightEntry? findByDate(DateTime? date) => + (super.noSuchMethod(Invocation.method( #findByDate, [date], )) as _i3.WeightEntry?); + @override _i5.Future> fetchAndSetEntries() => (super.noSuchMethod( Invocation.method( #fetchAndSetEntries, [], ), - returnValue: _i5.Future>.value(<_i3.WeightEntry>[]), + returnValue: + _i5.Future>.value(<_i3.WeightEntry>[]), ) as _i5.Future>); + @override - _i5.Future<_i3.WeightEntry> addEntry(_i3.WeightEntry? entry) => (super.noSuchMethod( + _i5.Future<_i3.WeightEntry> addEntry(_i3.WeightEntry? entry) => + (super.noSuchMethod( Invocation.method( #addEntry, [entry], @@ -125,6 +138,7 @@ class MockBodyWeightProvider extends _i1.Mock implements _i4.BodyWeightProvider ), )), ) as _i5.Future<_i3.WeightEntry>); + @override _i5.Future editEntry(_i3.WeightEntry? entry) => (super.noSuchMethod( Invocation.method( @@ -134,6 +148,7 @@ class MockBodyWeightProvider extends _i1.Mock implements _i4.BodyWeightProvider returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future deleteEntry(int? id) => (super.noSuchMethod( Invocation.method( @@ -143,6 +158,7 @@ class MockBodyWeightProvider extends _i1.Mock implements _i4.BodyWeightProvider returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override void addListener(_i6.VoidCallback? listener) => super.noSuchMethod( Invocation.method( @@ -151,6 +167,7 @@ class MockBodyWeightProvider extends _i1.Mock implements _i4.BodyWeightProvider ), returnValueForMissingStub: null, ); + @override void removeListener(_i6.VoidCallback? listener) => super.noSuchMethod( Invocation.method( @@ -159,6 +176,7 @@ class MockBodyWeightProvider extends _i1.Mock implements _i4.BodyWeightProvider ), returnValueForMissingStub: null, ); + @override void dispose() => super.noSuchMethod( Invocation.method( @@ -167,6 +185,7 @@ class MockBodyWeightProvider extends _i1.Mock implements _i4.BodyWeightProvider ), returnValueForMissingStub: null, ); + @override void notifyListeners() => super.noSuchMethod( Invocation.method( diff --git a/test/workout/workout_day_form_test.mocks.dart b/test/workout/workout_day_form_test.mocks.dart index 9a50fe297..c147b84f0 100644 --- a/test/workout/workout_day_form_test.mocks.dart +++ b/test/workout/workout_day_form_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.0 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in wger/test/workout/workout_day_form_test.dart. // Do not manually edit this file. @@ -31,7 +31,8 @@ import 'package:wger/providers/workout_plans.dart' as _i11; // ignore_for_file: camel_case_types // ignore_for_file: subtype_of_sealed_class -class _FakeWgerBaseProvider_0 extends _i1.SmartFake implements _i2.WgerBaseProvider { +class _FakeWgerBaseProvider_0 extends _i1.SmartFake + implements _i2.WgerBaseProvider { _FakeWgerBaseProvider_0( Object parent, Invocation parentInvocation, @@ -51,7 +52,8 @@ class _FakeWeightUnit_1 extends _i1.SmartFake implements _i3.WeightUnit { ); } -class _FakeRepetitionUnit_2 extends _i1.SmartFake implements _i4.RepetitionUnit { +class _FakeRepetitionUnit_2 extends _i1.SmartFake + implements _i4.RepetitionUnit { _FakeRepetitionUnit_2( Object parent, Invocation parentInvocation, @@ -101,7 +103,8 @@ class _FakeSetting_6 extends _i1.SmartFake implements _i8.Setting { ); } -class _FakeWorkoutSession_7 extends _i1.SmartFake implements _i9.WorkoutSession { +class _FakeWorkoutSession_7 extends _i1.SmartFake + implements _i9.WorkoutSession { _FakeWorkoutSession_7( Object parent, Invocation parentInvocation, @@ -124,7 +127,8 @@ class _FakeLog_8 extends _i1.SmartFake implements _i10.Log { /// A class which mocks [WorkoutPlansProvider]. /// /// See the documentation for Mockito's code generation for more information. -class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProvider { +class MockWorkoutPlansProvider extends _i1.Mock + implements _i11.WorkoutPlansProvider { MockWorkoutPlansProvider() { _i1.throwOnMissingStub(this); } @@ -137,16 +141,19 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProv Invocation.getter(#baseProvider), ), ) as _i2.WgerBaseProvider); + @override List<_i5.WorkoutPlan> get items => (super.noSuchMethod( Invocation.getter(#items), returnValue: <_i5.WorkoutPlan>[], ) as List<_i5.WorkoutPlan>); + @override List<_i3.WeightUnit> get weightUnits => (super.noSuchMethod( Invocation.getter(#weightUnits), returnValue: <_i3.WeightUnit>[], ) as List<_i3.WeightUnit>); + @override _i3.WeightUnit get defaultWeightUnit => (super.noSuchMethod( Invocation.getter(#defaultWeightUnit), @@ -155,11 +162,13 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProv Invocation.getter(#defaultWeightUnit), ), ) as _i3.WeightUnit); + @override List<_i4.RepetitionUnit> get repetitionUnits => (super.noSuchMethod( Invocation.getter(#repetitionUnits), returnValue: <_i4.RepetitionUnit>[], ) as List<_i4.RepetitionUnit>); + @override _i4.RepetitionUnit get defaultRepetitionUnit => (super.noSuchMethod( Invocation.getter(#defaultRepetitionUnit), @@ -168,11 +177,13 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProv Invocation.getter(#defaultRepetitionUnit), ), ) as _i4.RepetitionUnit); + @override bool get hasListeners => (super.noSuchMethod( Invocation.getter(#hasListeners), returnValue: false, ) as bool); + @override void clear() => super.noSuchMethod( Invocation.method( @@ -181,6 +192,7 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProv ), returnValueForMissingStub: null, ); + @override List<_i5.WorkoutPlan> getPlans() => (super.noSuchMethod( Invocation.method( @@ -189,6 +201,7 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProv ), returnValue: <_i5.WorkoutPlan>[], ) as List<_i5.WorkoutPlan>); + @override _i5.WorkoutPlan findById(int? id) => (super.noSuchMethod( Invocation.method( @@ -203,6 +216,7 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProv ), ), ) as _i5.WorkoutPlan); + @override int findIndexById(int? id) => (super.noSuchMethod( Invocation.method( @@ -211,6 +225,7 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProv ), returnValue: 0, ) as int); + @override void setCurrentPlan(int? id) => super.noSuchMethod( Invocation.method( @@ -219,6 +234,7 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProv ), returnValueForMissingStub: null, ); + @override void resetCurrentPlan() => super.noSuchMethod( Invocation.method( @@ -227,6 +243,7 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProv ), returnValueForMissingStub: null, ); + @override _i12.Future fetchAndSetAllPlansFull() => (super.noSuchMethod( Invocation.method( @@ -236,6 +253,7 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProv returnValue: _i12.Future.value(), returnValueForMissingStub: _i12.Future.value(), ) as _i12.Future); + @override _i12.Future fetchAndSetAllPlansSparse() => (super.noSuchMethod( Invocation.method( @@ -245,8 +263,10 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProv returnValue: _i12.Future.value(), returnValueForMissingStub: _i12.Future.value(), ) as _i12.Future); + @override - _i12.Future<_i5.WorkoutPlan> fetchAndSetPlanSparse(int? planId) => (super.noSuchMethod( + _i12.Future<_i5.WorkoutPlan> fetchAndSetPlanSparse(int? planId) => + (super.noSuchMethod( Invocation.method( #fetchAndSetPlanSparse, [planId], @@ -259,8 +279,10 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProv ), )), ) as _i12.Future<_i5.WorkoutPlan>); + @override - _i12.Future<_i5.WorkoutPlan> fetchAndSetWorkoutPlanFull(int? workoutId) => (super.noSuchMethod( + _i12.Future<_i5.WorkoutPlan> fetchAndSetWorkoutPlanFull(int? workoutId) => + (super.noSuchMethod( Invocation.method( #fetchAndSetWorkoutPlanFull, [workoutId], @@ -273,8 +295,10 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProv ), )), ) as _i12.Future<_i5.WorkoutPlan>); + @override - _i12.Future<_i5.WorkoutPlan> addWorkout(_i5.WorkoutPlan? workout) => (super.noSuchMethod( + _i12.Future<_i5.WorkoutPlan> addWorkout(_i5.WorkoutPlan? workout) => + (super.noSuchMethod( Invocation.method( #addWorkout, [workout], @@ -287,8 +311,10 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProv ), )), ) as _i12.Future<_i5.WorkoutPlan>); + @override - _i12.Future editWorkout(_i5.WorkoutPlan? workout) => (super.noSuchMethod( + _i12.Future editWorkout(_i5.WorkoutPlan? workout) => + (super.noSuchMethod( Invocation.method( #editWorkout, [workout], @@ -296,6 +322,7 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProv returnValue: _i12.Future.value(), returnValueForMissingStub: _i12.Future.value(), ) as _i12.Future); + @override _i12.Future deleteWorkout(int? id) => (super.noSuchMethod( Invocation.method( @@ -305,6 +332,7 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProv returnValue: _i12.Future.value(), returnValueForMissingStub: _i12.Future.value(), ) as _i12.Future); + @override _i12.Future> fetchLogData( _i5.WorkoutPlan? workout, @@ -318,8 +346,10 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProv base, ], ), - returnValue: _i12.Future>.value({}), + returnValue: + _i12.Future>.value({}), ) as _i12.Future>); + @override _i12.Future fetchAndSetRepetitionUnits() => (super.noSuchMethod( Invocation.method( @@ -329,6 +359,7 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProv returnValue: _i12.Future.value(), returnValueForMissingStub: _i12.Future.value(), ) as _i12.Future); + @override _i12.Future fetchAndSetWeightUnits() => (super.noSuchMethod( Invocation.method( @@ -338,6 +369,7 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProv returnValue: _i12.Future.value(), returnValueForMissingStub: _i12.Future.value(), ) as _i12.Future); + @override _i12.Future fetchAndSetUnits() => (super.noSuchMethod( Invocation.method( @@ -347,6 +379,7 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProv returnValue: _i12.Future.value(), returnValueForMissingStub: _i12.Future.value(), ) as _i12.Future); + @override _i12.Future<_i6.Day> addDay( _i6.Day? day, @@ -371,6 +404,7 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProv ), )), ) as _i12.Future<_i6.Day>); + @override _i12.Future editDay(_i6.Day? day) => (super.noSuchMethod( Invocation.method( @@ -380,6 +414,7 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProv returnValue: _i12.Future.value(), returnValueForMissingStub: _i12.Future.value(), ) as _i12.Future); + @override _i12.Future deleteDay(_i6.Day? day) => (super.noSuchMethod( Invocation.method( @@ -389,6 +424,7 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProv returnValue: _i12.Future.value(), returnValueForMissingStub: _i12.Future.value(), ) as _i12.Future); + @override _i12.Future<_i7.Set> addSet(_i7.Set? workoutSet) => (super.noSuchMethod( Invocation.method( @@ -403,6 +439,7 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProv ), )), ) as _i12.Future<_i7.Set>); + @override _i12.Future editSet(_i7.Set? workoutSet) => (super.noSuchMethod( Invocation.method( @@ -412,6 +449,7 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProv returnValue: _i12.Future.value(), returnValueForMissingStub: _i12.Future.value(), ) as _i12.Future); + @override _i12.Future> reorderSets( List<_i7.Set>? sets, @@ -427,8 +465,10 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProv ), returnValue: _i12.Future>.value(<_i7.Set>[]), ) as _i12.Future>); + @override - _i12.Future fetchComputedSettings(_i7.Set? workoutSet) => (super.noSuchMethod( + _i12.Future fetchComputedSettings(_i7.Set? workoutSet) => + (super.noSuchMethod( Invocation.method( #fetchComputedSettings, [workoutSet], @@ -436,6 +476,7 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProv returnValue: _i12.Future.value(), returnValueForMissingStub: _i12.Future.value(), ) as _i12.Future); + @override _i12.Future fetchSmartText( _i7.Set? workoutSet, @@ -451,6 +492,7 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProv ), returnValue: _i12.Future.value(''), ) as _i12.Future); + @override _i12.Future deleteSet(_i7.Set? workoutSet) => (super.noSuchMethod( Invocation.method( @@ -460,8 +502,10 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProv returnValue: _i12.Future.value(), returnValueForMissingStub: _i12.Future.value(), ) as _i12.Future); + @override - _i12.Future<_i8.Setting> addSetting(_i8.Setting? workoutSetting) => (super.noSuchMethod( + _i12.Future<_i8.Setting> addSetting(_i8.Setting? workoutSetting) => + (super.noSuchMethod( Invocation.method( #addSetting, [workoutSetting], @@ -474,6 +518,7 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProv ), )), ) as _i12.Future<_i8.Setting>); + @override _i12.Future fetchSessionData() => (super.noSuchMethod( Invocation.method( @@ -482,13 +527,16 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProv ), returnValue: _i12.Future.value(), ) as _i12.Future); + @override - _i12.Future<_i9.WorkoutSession> addSession(_i9.WorkoutSession? session) => (super.noSuchMethod( + _i12.Future<_i9.WorkoutSession> addSession(_i9.WorkoutSession? session) => + (super.noSuchMethod( Invocation.method( #addSession, [session], ), - returnValue: _i12.Future<_i9.WorkoutSession>.value(_FakeWorkoutSession_7( + returnValue: + _i12.Future<_i9.WorkoutSession>.value(_FakeWorkoutSession_7( this, Invocation.method( #addSession, @@ -496,6 +544,7 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProv ), )), ) as _i12.Future<_i9.WorkoutSession>); + @override _i12.Future<_i10.Log> addLog(_i10.Log? log) => (super.noSuchMethod( Invocation.method( @@ -510,6 +559,7 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProv ), )), ) as _i12.Future<_i10.Log>); + @override _i12.Future deleteLog(_i10.Log? log) => (super.noSuchMethod( Invocation.method( @@ -519,6 +569,7 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProv returnValue: _i12.Future.value(), returnValueForMissingStub: _i12.Future.value(), ) as _i12.Future); + @override void addListener(_i15.VoidCallback? listener) => super.noSuchMethod( Invocation.method( @@ -527,6 +578,7 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProv ), returnValueForMissingStub: null, ); + @override void removeListener(_i15.VoidCallback? listener) => super.noSuchMethod( Invocation.method( @@ -535,6 +587,7 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProv ), returnValueForMissingStub: null, ); + @override void dispose() => super.noSuchMethod( Invocation.method( @@ -543,6 +596,7 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProv ), returnValueForMissingStub: null, ); + @override void notifyListeners() => super.noSuchMethod( Invocation.method( diff --git a/test/workout/workout_form_test.mocks.dart b/test/workout/workout_form_test.mocks.dart index 6eda30254..a61e2a921 100644 --- a/test/workout/workout_form_test.mocks.dart +++ b/test/workout/workout_form_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.0 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in wger/test/workout/workout_form_test.dart. // Do not manually edit this file. @@ -31,7 +31,8 @@ import 'package:wger/providers/workout_plans.dart' as _i11; // ignore_for_file: camel_case_types // ignore_for_file: subtype_of_sealed_class -class _FakeWgerBaseProvider_0 extends _i1.SmartFake implements _i2.WgerBaseProvider { +class _FakeWgerBaseProvider_0 extends _i1.SmartFake + implements _i2.WgerBaseProvider { _FakeWgerBaseProvider_0( Object parent, Invocation parentInvocation, @@ -51,7 +52,8 @@ class _FakeWeightUnit_1 extends _i1.SmartFake implements _i3.WeightUnit { ); } -class _FakeRepetitionUnit_2 extends _i1.SmartFake implements _i4.RepetitionUnit { +class _FakeRepetitionUnit_2 extends _i1.SmartFake + implements _i4.RepetitionUnit { _FakeRepetitionUnit_2( Object parent, Invocation parentInvocation, @@ -101,7 +103,8 @@ class _FakeSetting_6 extends _i1.SmartFake implements _i8.Setting { ); } -class _FakeWorkoutSession_7 extends _i1.SmartFake implements _i9.WorkoutSession { +class _FakeWorkoutSession_7 extends _i1.SmartFake + implements _i9.WorkoutSession { _FakeWorkoutSession_7( Object parent, Invocation parentInvocation, @@ -124,7 +127,8 @@ class _FakeLog_8 extends _i1.SmartFake implements _i10.Log { /// A class which mocks [WorkoutPlansProvider]. /// /// See the documentation for Mockito's code generation for more information. -class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProvider { +class MockWorkoutPlansProvider extends _i1.Mock + implements _i11.WorkoutPlansProvider { MockWorkoutPlansProvider() { _i1.throwOnMissingStub(this); } @@ -137,16 +141,19 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProv Invocation.getter(#baseProvider), ), ) as _i2.WgerBaseProvider); + @override List<_i5.WorkoutPlan> get items => (super.noSuchMethod( Invocation.getter(#items), returnValue: <_i5.WorkoutPlan>[], ) as List<_i5.WorkoutPlan>); + @override List<_i3.WeightUnit> get weightUnits => (super.noSuchMethod( Invocation.getter(#weightUnits), returnValue: <_i3.WeightUnit>[], ) as List<_i3.WeightUnit>); + @override _i3.WeightUnit get defaultWeightUnit => (super.noSuchMethod( Invocation.getter(#defaultWeightUnit), @@ -155,11 +162,13 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProv Invocation.getter(#defaultWeightUnit), ), ) as _i3.WeightUnit); + @override List<_i4.RepetitionUnit> get repetitionUnits => (super.noSuchMethod( Invocation.getter(#repetitionUnits), returnValue: <_i4.RepetitionUnit>[], ) as List<_i4.RepetitionUnit>); + @override _i4.RepetitionUnit get defaultRepetitionUnit => (super.noSuchMethod( Invocation.getter(#defaultRepetitionUnit), @@ -168,11 +177,13 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProv Invocation.getter(#defaultRepetitionUnit), ), ) as _i4.RepetitionUnit); + @override bool get hasListeners => (super.noSuchMethod( Invocation.getter(#hasListeners), returnValue: false, ) as bool); + @override void clear() => super.noSuchMethod( Invocation.method( @@ -181,6 +192,7 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProv ), returnValueForMissingStub: null, ); + @override List<_i5.WorkoutPlan> getPlans() => (super.noSuchMethod( Invocation.method( @@ -189,6 +201,7 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProv ), returnValue: <_i5.WorkoutPlan>[], ) as List<_i5.WorkoutPlan>); + @override _i5.WorkoutPlan findById(int? id) => (super.noSuchMethod( Invocation.method( @@ -203,6 +216,7 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProv ), ), ) as _i5.WorkoutPlan); + @override int findIndexById(int? id) => (super.noSuchMethod( Invocation.method( @@ -211,6 +225,7 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProv ), returnValue: 0, ) as int); + @override void setCurrentPlan(int? id) => super.noSuchMethod( Invocation.method( @@ -219,6 +234,7 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProv ), returnValueForMissingStub: null, ); + @override void resetCurrentPlan() => super.noSuchMethod( Invocation.method( @@ -227,6 +243,7 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProv ), returnValueForMissingStub: null, ); + @override _i12.Future fetchAndSetAllPlansFull() => (super.noSuchMethod( Invocation.method( @@ -236,6 +253,7 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProv returnValue: _i12.Future.value(), returnValueForMissingStub: _i12.Future.value(), ) as _i12.Future); + @override _i12.Future fetchAndSetAllPlansSparse() => (super.noSuchMethod( Invocation.method( @@ -245,8 +263,10 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProv returnValue: _i12.Future.value(), returnValueForMissingStub: _i12.Future.value(), ) as _i12.Future); + @override - _i12.Future<_i5.WorkoutPlan> fetchAndSetPlanSparse(int? planId) => (super.noSuchMethod( + _i12.Future<_i5.WorkoutPlan> fetchAndSetPlanSparse(int? planId) => + (super.noSuchMethod( Invocation.method( #fetchAndSetPlanSparse, [planId], @@ -259,8 +279,10 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProv ), )), ) as _i12.Future<_i5.WorkoutPlan>); + @override - _i12.Future<_i5.WorkoutPlan> fetchAndSetWorkoutPlanFull(int? workoutId) => (super.noSuchMethod( + _i12.Future<_i5.WorkoutPlan> fetchAndSetWorkoutPlanFull(int? workoutId) => + (super.noSuchMethod( Invocation.method( #fetchAndSetWorkoutPlanFull, [workoutId], @@ -273,8 +295,10 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProv ), )), ) as _i12.Future<_i5.WorkoutPlan>); + @override - _i12.Future<_i5.WorkoutPlan> addWorkout(_i5.WorkoutPlan? workout) => (super.noSuchMethod( + _i12.Future<_i5.WorkoutPlan> addWorkout(_i5.WorkoutPlan? workout) => + (super.noSuchMethod( Invocation.method( #addWorkout, [workout], @@ -287,8 +311,10 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProv ), )), ) as _i12.Future<_i5.WorkoutPlan>); + @override - _i12.Future editWorkout(_i5.WorkoutPlan? workout) => (super.noSuchMethod( + _i12.Future editWorkout(_i5.WorkoutPlan? workout) => + (super.noSuchMethod( Invocation.method( #editWorkout, [workout], @@ -296,6 +322,7 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProv returnValue: _i12.Future.value(), returnValueForMissingStub: _i12.Future.value(), ) as _i12.Future); + @override _i12.Future deleteWorkout(int? id) => (super.noSuchMethod( Invocation.method( @@ -305,6 +332,7 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProv returnValue: _i12.Future.value(), returnValueForMissingStub: _i12.Future.value(), ) as _i12.Future); + @override _i12.Future> fetchLogData( _i5.WorkoutPlan? workout, @@ -318,8 +346,10 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProv base, ], ), - returnValue: _i12.Future>.value({}), + returnValue: + _i12.Future>.value({}), ) as _i12.Future>); + @override _i12.Future fetchAndSetRepetitionUnits() => (super.noSuchMethod( Invocation.method( @@ -329,6 +359,7 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProv returnValue: _i12.Future.value(), returnValueForMissingStub: _i12.Future.value(), ) as _i12.Future); + @override _i12.Future fetchAndSetWeightUnits() => (super.noSuchMethod( Invocation.method( @@ -338,6 +369,7 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProv returnValue: _i12.Future.value(), returnValueForMissingStub: _i12.Future.value(), ) as _i12.Future); + @override _i12.Future fetchAndSetUnits() => (super.noSuchMethod( Invocation.method( @@ -347,6 +379,7 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProv returnValue: _i12.Future.value(), returnValueForMissingStub: _i12.Future.value(), ) as _i12.Future); + @override _i12.Future<_i6.Day> addDay( _i6.Day? day, @@ -371,6 +404,7 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProv ), )), ) as _i12.Future<_i6.Day>); + @override _i12.Future editDay(_i6.Day? day) => (super.noSuchMethod( Invocation.method( @@ -380,6 +414,7 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProv returnValue: _i12.Future.value(), returnValueForMissingStub: _i12.Future.value(), ) as _i12.Future); + @override _i12.Future deleteDay(_i6.Day? day) => (super.noSuchMethod( Invocation.method( @@ -389,6 +424,7 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProv returnValue: _i12.Future.value(), returnValueForMissingStub: _i12.Future.value(), ) as _i12.Future); + @override _i12.Future<_i7.Set> addSet(_i7.Set? workoutSet) => (super.noSuchMethod( Invocation.method( @@ -403,6 +439,7 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProv ), )), ) as _i12.Future<_i7.Set>); + @override _i12.Future editSet(_i7.Set? workoutSet) => (super.noSuchMethod( Invocation.method( @@ -412,6 +449,7 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProv returnValue: _i12.Future.value(), returnValueForMissingStub: _i12.Future.value(), ) as _i12.Future); + @override _i12.Future> reorderSets( List<_i7.Set>? sets, @@ -427,8 +465,10 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProv ), returnValue: _i12.Future>.value(<_i7.Set>[]), ) as _i12.Future>); + @override - _i12.Future fetchComputedSettings(_i7.Set? workoutSet) => (super.noSuchMethod( + _i12.Future fetchComputedSettings(_i7.Set? workoutSet) => + (super.noSuchMethod( Invocation.method( #fetchComputedSettings, [workoutSet], @@ -436,6 +476,7 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProv returnValue: _i12.Future.value(), returnValueForMissingStub: _i12.Future.value(), ) as _i12.Future); + @override _i12.Future fetchSmartText( _i7.Set? workoutSet, @@ -451,6 +492,7 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProv ), returnValue: _i12.Future.value(''), ) as _i12.Future); + @override _i12.Future deleteSet(_i7.Set? workoutSet) => (super.noSuchMethod( Invocation.method( @@ -460,8 +502,10 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProv returnValue: _i12.Future.value(), returnValueForMissingStub: _i12.Future.value(), ) as _i12.Future); + @override - _i12.Future<_i8.Setting> addSetting(_i8.Setting? workoutSetting) => (super.noSuchMethod( + _i12.Future<_i8.Setting> addSetting(_i8.Setting? workoutSetting) => + (super.noSuchMethod( Invocation.method( #addSetting, [workoutSetting], @@ -474,6 +518,7 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProv ), )), ) as _i12.Future<_i8.Setting>); + @override _i12.Future fetchSessionData() => (super.noSuchMethod( Invocation.method( @@ -482,13 +527,16 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProv ), returnValue: _i12.Future.value(), ) as _i12.Future); + @override - _i12.Future<_i9.WorkoutSession> addSession(_i9.WorkoutSession? session) => (super.noSuchMethod( + _i12.Future<_i9.WorkoutSession> addSession(_i9.WorkoutSession? session) => + (super.noSuchMethod( Invocation.method( #addSession, [session], ), - returnValue: _i12.Future<_i9.WorkoutSession>.value(_FakeWorkoutSession_7( + returnValue: + _i12.Future<_i9.WorkoutSession>.value(_FakeWorkoutSession_7( this, Invocation.method( #addSession, @@ -496,6 +544,7 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProv ), )), ) as _i12.Future<_i9.WorkoutSession>); + @override _i12.Future<_i10.Log> addLog(_i10.Log? log) => (super.noSuchMethod( Invocation.method( @@ -510,6 +559,7 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProv ), )), ) as _i12.Future<_i10.Log>); + @override _i12.Future deleteLog(_i10.Log? log) => (super.noSuchMethod( Invocation.method( @@ -519,6 +569,7 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProv returnValue: _i12.Future.value(), returnValueForMissingStub: _i12.Future.value(), ) as _i12.Future); + @override void addListener(_i15.VoidCallback? listener) => super.noSuchMethod( Invocation.method( @@ -527,6 +578,7 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProv ), returnValueForMissingStub: null, ); + @override void removeListener(_i15.VoidCallback? listener) => super.noSuchMethod( Invocation.method( @@ -535,6 +587,7 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProv ), returnValueForMissingStub: null, ); + @override void dispose() => super.noSuchMethod( Invocation.method( @@ -543,6 +596,7 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProv ), returnValueForMissingStub: null, ); + @override void notifyListeners() => super.noSuchMethod( Invocation.method( diff --git a/test/workout/workout_plan_screen_test.mocks.dart b/test/workout/workout_plan_screen_test.mocks.dart index 3ddba8094..03f2be6fa 100644 --- a/test/workout/workout_plan_screen_test.mocks.dart +++ b/test/workout/workout_plan_screen_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.0 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in wger/test/workout/workout_plan_screen_test.dart. // Do not manually edit this file. @@ -77,6 +77,7 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider { Invocation.getter(#auth), ), ) as _i2.AuthProvider); + @override set auth(_i2.AuthProvider? _auth) => super.noSuchMethod( Invocation.setter( @@ -85,6 +86,7 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider { ), returnValueForMissingStub: null, ); + @override _i3.Client get client => (super.noSuchMethod( Invocation.getter(#client), @@ -93,6 +95,7 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider { Invocation.getter(#client), ), ) as _i3.Client); + @override set client(_i3.Client? _client) => super.noSuchMethod( Invocation.setter( @@ -101,8 +104,10 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider { ), returnValueForMissingStub: null, ); + @override - Map getDefaultHeaders({dynamic includeAuth = false}) => (super.noSuchMethod( + Map getDefaultHeaders({dynamic includeAuth = false}) => + (super.noSuchMethod( Invocation.method( #getDefaultHeaders, [], @@ -110,6 +115,7 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider { ), returnValue: {}, ) as Map); + @override Uri makeUrl( String? path, { @@ -140,14 +146,17 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider { ), ), ) as Uri); + @override _i5.Future> fetch(Uri? uri) => (super.noSuchMethod( Invocation.method( #fetch, [uri], ), - returnValue: _i5.Future>.value({}), + returnValue: + _i5.Future>.value({}), ) as _i5.Future>); + @override _i5.Future> fetchPaginated(Uri? uri) => (super.noSuchMethod( Invocation.method( @@ -156,6 +165,7 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider { ), returnValue: _i5.Future>.value([]), ) as _i5.Future>); + @override _i5.Future> post( Map? data, @@ -169,8 +179,10 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider { uri, ], ), - returnValue: _i5.Future>.value({}), + returnValue: + _i5.Future>.value({}), ) as _i5.Future>); + @override _i5.Future> patch( Map? data, @@ -184,8 +196,10 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider { uri, ], ), - returnValue: _i5.Future>.value({}), + returnValue: + _i5.Future>.value({}), ) as _i5.Future>); + @override _i5.Future<_i3.Response> deleteRequest( String? url, diff --git a/test/workout/workout_plans_screen_test.mocks.dart b/test/workout/workout_plans_screen_test.mocks.dart index ef4354646..cdf74da5f 100644 --- a/test/workout/workout_plans_screen_test.mocks.dart +++ b/test/workout/workout_plans_screen_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.0 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in wger/test/workout/workout_plans_screen_test.dart. // Do not manually edit this file. @@ -77,6 +77,7 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider { Invocation.getter(#auth), ), ) as _i2.AuthProvider); + @override set auth(_i2.AuthProvider? _auth) => super.noSuchMethod( Invocation.setter( @@ -85,6 +86,7 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider { ), returnValueForMissingStub: null, ); + @override _i3.Client get client => (super.noSuchMethod( Invocation.getter(#client), @@ -93,6 +95,7 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider { Invocation.getter(#client), ), ) as _i3.Client); + @override set client(_i3.Client? _client) => super.noSuchMethod( Invocation.setter( @@ -101,8 +104,10 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider { ), returnValueForMissingStub: null, ); + @override - Map getDefaultHeaders({dynamic includeAuth = false}) => (super.noSuchMethod( + Map getDefaultHeaders({dynamic includeAuth = false}) => + (super.noSuchMethod( Invocation.method( #getDefaultHeaders, [], @@ -110,6 +115,7 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider { ), returnValue: {}, ) as Map); + @override Uri makeUrl( String? path, { @@ -140,14 +146,17 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider { ), ), ) as Uri); + @override _i5.Future> fetch(Uri? uri) => (super.noSuchMethod( Invocation.method( #fetch, [uri], ), - returnValue: _i5.Future>.value({}), + returnValue: + _i5.Future>.value({}), ) as _i5.Future>); + @override _i5.Future> fetchPaginated(Uri? uri) => (super.noSuchMethod( Invocation.method( @@ -156,6 +165,7 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider { ), returnValue: _i5.Future>.value([]), ) as _i5.Future>); + @override _i5.Future> post( Map? data, @@ -169,8 +179,10 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider { uri, ], ), - returnValue: _i5.Future>.value({}), + returnValue: + _i5.Future>.value({}), ) as _i5.Future>); + @override _i5.Future> patch( Map? data, @@ -184,8 +196,10 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider { uri, ], ), - returnValue: _i5.Future>.value({}), + returnValue: + _i5.Future>.value({}), ) as _i5.Future>); + @override _i5.Future<_i3.Response> deleteRequest( String? url, diff --git a/test/workout/workout_provider_test.mocks.dart b/test/workout/workout_provider_test.mocks.dart index a42145cb9..a89a913f4 100644 --- a/test/workout/workout_provider_test.mocks.dart +++ b/test/workout/workout_provider_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.0 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in wger/test/workout/workout_provider_test.dart. // Do not manually edit this file. @@ -77,6 +77,7 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider { Invocation.getter(#auth), ), ) as _i2.AuthProvider); + @override set auth(_i2.AuthProvider? _auth) => super.noSuchMethod( Invocation.setter( @@ -85,6 +86,7 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider { ), returnValueForMissingStub: null, ); + @override _i3.Client get client => (super.noSuchMethod( Invocation.getter(#client), @@ -93,6 +95,7 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider { Invocation.getter(#client), ), ) as _i3.Client); + @override set client(_i3.Client? _client) => super.noSuchMethod( Invocation.setter( @@ -101,8 +104,10 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider { ), returnValueForMissingStub: null, ); + @override - Map getDefaultHeaders({dynamic includeAuth = false}) => (super.noSuchMethod( + Map getDefaultHeaders({dynamic includeAuth = false}) => + (super.noSuchMethod( Invocation.method( #getDefaultHeaders, [], @@ -110,6 +115,7 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider { ), returnValue: {}, ) as Map); + @override Uri makeUrl( String? path, { @@ -140,14 +146,17 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider { ), ), ) as Uri); + @override _i5.Future> fetch(Uri? uri) => (super.noSuchMethod( Invocation.method( #fetch, [uri], ), - returnValue: _i5.Future>.value({}), + returnValue: + _i5.Future>.value({}), ) as _i5.Future>); + @override _i5.Future> fetchPaginated(Uri? uri) => (super.noSuchMethod( Invocation.method( @@ -156,6 +165,7 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider { ), returnValue: _i5.Future>.value([]), ) as _i5.Future>); + @override _i5.Future> post( Map? data, @@ -169,8 +179,10 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider { uri, ], ), - returnValue: _i5.Future>.value({}), + returnValue: + _i5.Future>.value({}), ) as _i5.Future>); + @override _i5.Future> patch( Map? data, @@ -184,8 +196,10 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider { uri, ], ), - returnValue: _i5.Future>.value({}), + returnValue: + _i5.Future>.value({}), ) as _i5.Future>); + @override _i5.Future<_i3.Response> deleteRequest( String? url, diff --git a/test/workout/workout_set_form_test.mocks.dart b/test/workout/workout_set_form_test.mocks.dart index 3eb80a05e..c319ed775 100644 --- a/test/workout/workout_set_form_test.mocks.dart +++ b/test/workout/workout_set_form_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.0 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in wger/test/workout/workout_set_form_test.dart. // Do not manually edit this file. @@ -38,7 +38,8 @@ import 'package:wger/providers/workout_plans.dart' as _i21; // ignore_for_file: camel_case_types // ignore_for_file: subtype_of_sealed_class -class _FakeWgerBaseProvider_0 extends _i1.SmartFake implements _i2.WgerBaseProvider { +class _FakeWgerBaseProvider_0 extends _i1.SmartFake + implements _i2.WgerBaseProvider { _FakeWgerBaseProvider_0( Object parent, Invocation parentInvocation, @@ -58,7 +59,8 @@ class _FakeExerciseBase_1 extends _i1.SmartFake implements _i3.ExerciseBase { ); } -class _FakeExerciseCategory_2 extends _i1.SmartFake implements _i4.ExerciseCategory { +class _FakeExerciseCategory_2 extends _i1.SmartFake + implements _i4.ExerciseCategory { _FakeExerciseCategory_2( Object parent, Invocation parentInvocation, @@ -148,7 +150,8 @@ class _FakeWeightUnit_10 extends _i1.SmartFake implements _i10.WeightUnit { ); } -class _FakeRepetitionUnit_11 extends _i1.SmartFake implements _i11.RepetitionUnit { +class _FakeRepetitionUnit_11 extends _i1.SmartFake + implements _i11.RepetitionUnit { _FakeRepetitionUnit_11( Object parent, Invocation parentInvocation, @@ -198,7 +201,8 @@ class _FakeSetting_15 extends _i1.SmartFake implements _i15.Setting { ); } -class _FakeWorkoutSession_16 extends _i1.SmartFake implements _i16.WorkoutSession { +class _FakeWorkoutSession_16 extends _i1.SmartFake + implements _i16.WorkoutSession { _FakeWorkoutSession_16( Object parent, Invocation parentInvocation, @@ -234,57 +238,70 @@ class MockExercisesProvider extends _i1.Mock implements _i18.ExercisesProvider { Invocation.getter(#baseProvider), ), ) as _i2.WgerBaseProvider); + @override - set exerciseBases(List<_i3.ExerciseBase>? exercisesBases) => super.noSuchMethod( + set exerciseBases(List<_i3.ExerciseBase>? exercisesBases) => + super.noSuchMethod( Invocation.setter( #exerciseBases, exercisesBases, ), returnValueForMissingStub: null, ); + @override List<_i3.ExerciseBase> get filteredExerciseBases => (super.noSuchMethod( Invocation.getter(#filteredExerciseBases), returnValue: <_i3.ExerciseBase>[], ) as List<_i3.ExerciseBase>); + @override - set filteredExerciseBases(List<_i3.ExerciseBase>? newFilteredExercises) => super.noSuchMethod( + set filteredExerciseBases(List<_i3.ExerciseBase>? newFilteredExercises) => + super.noSuchMethod( Invocation.setter( #filteredExerciseBases, newFilteredExercises, ), returnValueForMissingStub: null, ); + @override - Map> get exerciseBasesByVariation => (super.noSuchMethod( + Map> get exerciseBasesByVariation => + (super.noSuchMethod( Invocation.getter(#exerciseBasesByVariation), returnValue: >{}, ) as Map>); + @override List<_i3.ExerciseBase> get bases => (super.noSuchMethod( Invocation.getter(#bases), returnValue: <_i3.ExerciseBase>[], ) as List<_i3.ExerciseBase>); + @override List<_i4.ExerciseCategory> get categories => (super.noSuchMethod( Invocation.getter(#categories), returnValue: <_i4.ExerciseCategory>[], ) as List<_i4.ExerciseCategory>); + @override List<_i6.Muscle> get muscles => (super.noSuchMethod( Invocation.getter(#muscles), returnValue: <_i6.Muscle>[], ) as List<_i6.Muscle>); + @override List<_i5.Equipment> get equipment => (super.noSuchMethod( Invocation.getter(#equipment), returnValue: <_i5.Equipment>[], ) as List<_i5.Equipment>); + @override List<_i7.Language> get languages => (super.noSuchMethod( Invocation.getter(#languages), returnValue: <_i7.Language>[], ) as List<_i7.Language>); + @override set languages(List<_i7.Language>? languages) => super.noSuchMethod( Invocation.setter( @@ -293,11 +310,13 @@ class MockExercisesProvider extends _i1.Mock implements _i18.ExercisesProvider { ), returnValueForMissingStub: null, ); + @override bool get hasListeners => (super.noSuchMethod( Invocation.getter(#hasListeners), returnValue: false, ) as bool); + @override _i19.Future setFilters(_i18.Filters? newFilters) => (super.noSuchMethod( Invocation.method( @@ -307,6 +326,7 @@ class MockExercisesProvider extends _i1.Mock implements _i18.ExercisesProvider { returnValue: _i19.Future.value(), returnValueForMissingStub: _i19.Future.value(), ) as _i19.Future); + @override _i19.Future findByFilters() => (super.noSuchMethod( Invocation.method( @@ -316,6 +336,7 @@ class MockExercisesProvider extends _i1.Mock implements _i18.ExercisesProvider { returnValue: _i19.Future.value(), returnValueForMissingStub: _i19.Future.value(), ) as _i19.Future); + @override void clear() => super.noSuchMethod( Invocation.method( @@ -324,6 +345,7 @@ class MockExercisesProvider extends _i1.Mock implements _i18.ExercisesProvider { ), returnValueForMissingStub: null, ); + @override _i3.ExerciseBase findExerciseBaseById(int? id) => (super.noSuchMethod( Invocation.method( @@ -338,6 +360,7 @@ class MockExercisesProvider extends _i1.Mock implements _i18.ExercisesProvider { ), ), ) as _i3.ExerciseBase); + @override List<_i3.ExerciseBase> findExerciseBasesByVariationId( int? id, { @@ -351,6 +374,7 @@ class MockExercisesProvider extends _i1.Mock implements _i18.ExercisesProvider { ), returnValue: <_i3.ExerciseBase>[], ) as List<_i3.ExerciseBase>); + @override _i4.ExerciseCategory findCategoryById(int? id) => (super.noSuchMethod( Invocation.method( @@ -365,6 +389,7 @@ class MockExercisesProvider extends _i1.Mock implements _i18.ExercisesProvider { ), ), ) as _i4.ExerciseCategory); + @override _i5.Equipment findEquipmentById(int? id) => (super.noSuchMethod( Invocation.method( @@ -379,6 +404,7 @@ class MockExercisesProvider extends _i1.Mock implements _i18.ExercisesProvider { ), ), ) as _i5.Equipment); + @override _i6.Muscle findMuscleById(int? id) => (super.noSuchMethod( Invocation.method( @@ -393,6 +419,7 @@ class MockExercisesProvider extends _i1.Mock implements _i18.ExercisesProvider { ), ), ) as _i6.Muscle); + @override _i7.Language findLanguageById(int? id) => (super.noSuchMethod( Invocation.method( @@ -407,6 +434,7 @@ class MockExercisesProvider extends _i1.Mock implements _i18.ExercisesProvider { ), ), ) as _i7.Language); + @override _i19.Future fetchAndSetCategories() => (super.noSuchMethod( Invocation.method( @@ -416,6 +444,7 @@ class MockExercisesProvider extends _i1.Mock implements _i18.ExercisesProvider { returnValue: _i19.Future.value(), returnValueForMissingStub: _i19.Future.value(), ) as _i19.Future); + @override _i19.Future fetchAndSetVariations() => (super.noSuchMethod( Invocation.method( @@ -425,6 +454,7 @@ class MockExercisesProvider extends _i1.Mock implements _i18.ExercisesProvider { returnValue: _i19.Future.value(), returnValueForMissingStub: _i19.Future.value(), ) as _i19.Future); + @override _i19.Future fetchAndSetMuscles() => (super.noSuchMethod( Invocation.method( @@ -434,6 +464,7 @@ class MockExercisesProvider extends _i1.Mock implements _i18.ExercisesProvider { returnValue: _i19.Future.value(), returnValueForMissingStub: _i19.Future.value(), ) as _i19.Future); + @override _i19.Future fetchAndSetEquipment() => (super.noSuchMethod( Invocation.method( @@ -443,6 +474,7 @@ class MockExercisesProvider extends _i1.Mock implements _i18.ExercisesProvider { returnValue: _i19.Future.value(), returnValueForMissingStub: _i19.Future.value(), ) as _i19.Future); + @override _i19.Future fetchAndSetLanguages() => (super.noSuchMethod( Invocation.method( @@ -452,8 +484,10 @@ class MockExercisesProvider extends _i1.Mock implements _i18.ExercisesProvider { returnValue: _i19.Future.value(), returnValueForMissingStub: _i19.Future.value(), ) as _i19.Future); + @override - _i19.Future<_i3.ExerciseBase> fetchAndSetExerciseBase(int? exerciseBaseId) => (super.noSuchMethod( + _i19.Future<_i3.ExerciseBase> fetchAndSetExerciseBase(int? exerciseBaseId) => + (super.noSuchMethod( Invocation.method( #fetchAndSetExerciseBase, [exerciseBaseId], @@ -466,8 +500,10 @@ class MockExercisesProvider extends _i1.Mock implements _i18.ExercisesProvider { ), )), ) as _i19.Future<_i3.ExerciseBase>); + @override - _i3.ExerciseBase readExerciseBaseFromBaseInfo(dynamic baseData) => (super.noSuchMethod( + _i3.ExerciseBase readExerciseBaseFromBaseInfo(dynamic baseData) => + (super.noSuchMethod( Invocation.method( #readExerciseBaseFromBaseInfo, [baseData], @@ -480,6 +516,7 @@ class MockExercisesProvider extends _i1.Mock implements _i18.ExercisesProvider { ), ), ) as _i3.ExerciseBase); + @override _i19.Future checkExerciseCacheVersion() => (super.noSuchMethod( Invocation.method( @@ -489,6 +526,7 @@ class MockExercisesProvider extends _i1.Mock implements _i18.ExercisesProvider { returnValue: _i19.Future.value(), returnValueForMissingStub: _i19.Future.value(), ) as _i19.Future); + @override _i19.Future fetchAndSetExercises() => (super.noSuchMethod( Invocation.method( @@ -498,6 +536,7 @@ class MockExercisesProvider extends _i1.Mock implements _i18.ExercisesProvider { returnValue: _i19.Future.value(), returnValueForMissingStub: _i19.Future.value(), ) as _i19.Future); + @override _i19.Future> searchExercise( String? name, { @@ -513,8 +552,10 @@ class MockExercisesProvider extends _i1.Mock implements _i18.ExercisesProvider { #searchEnglish: searchEnglish, }, ), - returnValue: _i19.Future>.value(<_i3.ExerciseBase>[]), + returnValue: + _i19.Future>.value(<_i3.ExerciseBase>[]), ) as _i19.Future>); + @override void addListener(_i20.VoidCallback? listener) => super.noSuchMethod( Invocation.method( @@ -523,6 +564,7 @@ class MockExercisesProvider extends _i1.Mock implements _i18.ExercisesProvider { ), returnValueForMissingStub: null, ); + @override void removeListener(_i20.VoidCallback? listener) => super.noSuchMethod( Invocation.method( @@ -531,6 +573,7 @@ class MockExercisesProvider extends _i1.Mock implements _i18.ExercisesProvider { ), returnValueForMissingStub: null, ); + @override void dispose() => super.noSuchMethod( Invocation.method( @@ -539,6 +582,7 @@ class MockExercisesProvider extends _i1.Mock implements _i18.ExercisesProvider { ), returnValueForMissingStub: null, ); + @override void notifyListeners() => super.noSuchMethod( Invocation.method( @@ -565,6 +609,7 @@ class MockWgerBaseProvider extends _i1.Mock implements _i2.WgerBaseProvider { Invocation.getter(#auth), ), ) as _i8.AuthProvider); + @override set auth(_i8.AuthProvider? _auth) => super.noSuchMethod( Invocation.setter( @@ -573,6 +618,7 @@ class MockWgerBaseProvider extends _i1.Mock implements _i2.WgerBaseProvider { ), returnValueForMissingStub: null, ); + @override _i9.Client get client => (super.noSuchMethod( Invocation.getter(#client), @@ -581,6 +627,7 @@ class MockWgerBaseProvider extends _i1.Mock implements _i2.WgerBaseProvider { Invocation.getter(#client), ), ) as _i9.Client); + @override set client(_i9.Client? _client) => super.noSuchMethod( Invocation.setter( @@ -589,8 +636,10 @@ class MockWgerBaseProvider extends _i1.Mock implements _i2.WgerBaseProvider { ), returnValueForMissingStub: null, ); + @override - Map getDefaultHeaders({dynamic includeAuth = false}) => (super.noSuchMethod( + Map getDefaultHeaders({dynamic includeAuth = false}) => + (super.noSuchMethod( Invocation.method( #getDefaultHeaders, [], @@ -598,6 +647,7 @@ class MockWgerBaseProvider extends _i1.Mock implements _i2.WgerBaseProvider { ), returnValue: {}, ) as Map); + @override Uri makeUrl( String? path, { @@ -628,14 +678,17 @@ class MockWgerBaseProvider extends _i1.Mock implements _i2.WgerBaseProvider { ), ), ) as Uri); + @override _i19.Future> fetch(Uri? uri) => (super.noSuchMethod( Invocation.method( #fetch, [uri], ), - returnValue: _i19.Future>.value({}), + returnValue: + _i19.Future>.value({}), ) as _i19.Future>); + @override _i19.Future> fetchPaginated(Uri? uri) => (super.noSuchMethod( Invocation.method( @@ -644,6 +697,7 @@ class MockWgerBaseProvider extends _i1.Mock implements _i2.WgerBaseProvider { ), returnValue: _i19.Future>.value([]), ) as _i19.Future>); + @override _i19.Future> post( Map? data, @@ -657,8 +711,10 @@ class MockWgerBaseProvider extends _i1.Mock implements _i2.WgerBaseProvider { uri, ], ), - returnValue: _i19.Future>.value({}), + returnValue: + _i19.Future>.value({}), ) as _i19.Future>); + @override _i19.Future> patch( Map? data, @@ -672,8 +728,10 @@ class MockWgerBaseProvider extends _i1.Mock implements _i2.WgerBaseProvider { uri, ], ), - returnValue: _i19.Future>.value({}), + returnValue: + _i19.Future>.value({}), ) as _i19.Future>); + @override _i19.Future<_i9.Response> deleteRequest( String? url, @@ -703,7 +761,8 @@ class MockWgerBaseProvider extends _i1.Mock implements _i2.WgerBaseProvider { /// A class which mocks [WorkoutPlansProvider]. /// /// See the documentation for Mockito's code generation for more information. -class MockWorkoutPlansProvider extends _i1.Mock implements _i21.WorkoutPlansProvider { +class MockWorkoutPlansProvider extends _i1.Mock + implements _i21.WorkoutPlansProvider { MockWorkoutPlansProvider() { _i1.throwOnMissingStub(this); } @@ -716,16 +775,19 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i21.WorkoutPlansProv Invocation.getter(#baseProvider), ), ) as _i2.WgerBaseProvider); + @override List<_i12.WorkoutPlan> get items => (super.noSuchMethod( Invocation.getter(#items), returnValue: <_i12.WorkoutPlan>[], ) as List<_i12.WorkoutPlan>); + @override List<_i10.WeightUnit> get weightUnits => (super.noSuchMethod( Invocation.getter(#weightUnits), returnValue: <_i10.WeightUnit>[], ) as List<_i10.WeightUnit>); + @override _i10.WeightUnit get defaultWeightUnit => (super.noSuchMethod( Invocation.getter(#defaultWeightUnit), @@ -734,11 +796,13 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i21.WorkoutPlansProv Invocation.getter(#defaultWeightUnit), ), ) as _i10.WeightUnit); + @override List<_i11.RepetitionUnit> get repetitionUnits => (super.noSuchMethod( Invocation.getter(#repetitionUnits), returnValue: <_i11.RepetitionUnit>[], ) as List<_i11.RepetitionUnit>); + @override _i11.RepetitionUnit get defaultRepetitionUnit => (super.noSuchMethod( Invocation.getter(#defaultRepetitionUnit), @@ -747,11 +811,13 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i21.WorkoutPlansProv Invocation.getter(#defaultRepetitionUnit), ), ) as _i11.RepetitionUnit); + @override bool get hasListeners => (super.noSuchMethod( Invocation.getter(#hasListeners), returnValue: false, ) as bool); + @override void clear() => super.noSuchMethod( Invocation.method( @@ -760,6 +826,7 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i21.WorkoutPlansProv ), returnValueForMissingStub: null, ); + @override List<_i12.WorkoutPlan> getPlans() => (super.noSuchMethod( Invocation.method( @@ -768,6 +835,7 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i21.WorkoutPlansProv ), returnValue: <_i12.WorkoutPlan>[], ) as List<_i12.WorkoutPlan>); + @override _i12.WorkoutPlan findById(int? id) => (super.noSuchMethod( Invocation.method( @@ -782,6 +850,7 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i21.WorkoutPlansProv ), ), ) as _i12.WorkoutPlan); + @override int findIndexById(int? id) => (super.noSuchMethod( Invocation.method( @@ -790,6 +859,7 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i21.WorkoutPlansProv ), returnValue: 0, ) as int); + @override void setCurrentPlan(int? id) => super.noSuchMethod( Invocation.method( @@ -798,6 +868,7 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i21.WorkoutPlansProv ), returnValueForMissingStub: null, ); + @override void resetCurrentPlan() => super.noSuchMethod( Invocation.method( @@ -806,6 +877,7 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i21.WorkoutPlansProv ), returnValueForMissingStub: null, ); + @override _i19.Future fetchAndSetAllPlansFull() => (super.noSuchMethod( Invocation.method( @@ -815,6 +887,7 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i21.WorkoutPlansProv returnValue: _i19.Future.value(), returnValueForMissingStub: _i19.Future.value(), ) as _i19.Future); + @override _i19.Future fetchAndSetAllPlansSparse() => (super.noSuchMethod( Invocation.method( @@ -824,8 +897,10 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i21.WorkoutPlansProv returnValue: _i19.Future.value(), returnValueForMissingStub: _i19.Future.value(), ) as _i19.Future); + @override - _i19.Future<_i12.WorkoutPlan> fetchAndSetPlanSparse(int? planId) => (super.noSuchMethod( + _i19.Future<_i12.WorkoutPlan> fetchAndSetPlanSparse(int? planId) => + (super.noSuchMethod( Invocation.method( #fetchAndSetPlanSparse, [planId], @@ -838,8 +913,10 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i21.WorkoutPlansProv ), )), ) as _i19.Future<_i12.WorkoutPlan>); + @override - _i19.Future<_i12.WorkoutPlan> fetchAndSetWorkoutPlanFull(int? workoutId) => (super.noSuchMethod( + _i19.Future<_i12.WorkoutPlan> fetchAndSetWorkoutPlanFull(int? workoutId) => + (super.noSuchMethod( Invocation.method( #fetchAndSetWorkoutPlanFull, [workoutId], @@ -852,8 +929,10 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i21.WorkoutPlansProv ), )), ) as _i19.Future<_i12.WorkoutPlan>); + @override - _i19.Future<_i12.WorkoutPlan> addWorkout(_i12.WorkoutPlan? workout) => (super.noSuchMethod( + _i19.Future<_i12.WorkoutPlan> addWorkout(_i12.WorkoutPlan? workout) => + (super.noSuchMethod( Invocation.method( #addWorkout, [workout], @@ -866,8 +945,10 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i21.WorkoutPlansProv ), )), ) as _i19.Future<_i12.WorkoutPlan>); + @override - _i19.Future editWorkout(_i12.WorkoutPlan? workout) => (super.noSuchMethod( + _i19.Future editWorkout(_i12.WorkoutPlan? workout) => + (super.noSuchMethod( Invocation.method( #editWorkout, [workout], @@ -875,6 +956,7 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i21.WorkoutPlansProv returnValue: _i19.Future.value(), returnValueForMissingStub: _i19.Future.value(), ) as _i19.Future); + @override _i19.Future deleteWorkout(int? id) => (super.noSuchMethod( Invocation.method( @@ -884,6 +966,7 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i21.WorkoutPlansProv returnValue: _i19.Future.value(), returnValueForMissingStub: _i19.Future.value(), ) as _i19.Future); + @override _i19.Future> fetchLogData( _i12.WorkoutPlan? workout, @@ -897,8 +980,10 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i21.WorkoutPlansProv base, ], ), - returnValue: _i19.Future>.value({}), + returnValue: + _i19.Future>.value({}), ) as _i19.Future>); + @override _i19.Future fetchAndSetRepetitionUnits() => (super.noSuchMethod( Invocation.method( @@ -908,6 +993,7 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i21.WorkoutPlansProv returnValue: _i19.Future.value(), returnValueForMissingStub: _i19.Future.value(), ) as _i19.Future); + @override _i19.Future fetchAndSetWeightUnits() => (super.noSuchMethod( Invocation.method( @@ -917,6 +1003,7 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i21.WorkoutPlansProv returnValue: _i19.Future.value(), returnValueForMissingStub: _i19.Future.value(), ) as _i19.Future); + @override _i19.Future fetchAndSetUnits() => (super.noSuchMethod( Invocation.method( @@ -926,6 +1013,7 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i21.WorkoutPlansProv returnValue: _i19.Future.value(), returnValueForMissingStub: _i19.Future.value(), ) as _i19.Future); + @override _i19.Future<_i13.Day> addDay( _i13.Day? day, @@ -950,6 +1038,7 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i21.WorkoutPlansProv ), )), ) as _i19.Future<_i13.Day>); + @override _i19.Future editDay(_i13.Day? day) => (super.noSuchMethod( Invocation.method( @@ -959,6 +1048,7 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i21.WorkoutPlansProv returnValue: _i19.Future.value(), returnValueForMissingStub: _i19.Future.value(), ) as _i19.Future); + @override _i19.Future deleteDay(_i13.Day? day) => (super.noSuchMethod( Invocation.method( @@ -968,6 +1058,7 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i21.WorkoutPlansProv returnValue: _i19.Future.value(), returnValueForMissingStub: _i19.Future.value(), ) as _i19.Future); + @override _i19.Future<_i14.Set> addSet(_i14.Set? workoutSet) => (super.noSuchMethod( Invocation.method( @@ -982,6 +1073,7 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i21.WorkoutPlansProv ), )), ) as _i19.Future<_i14.Set>); + @override _i19.Future editSet(_i14.Set? workoutSet) => (super.noSuchMethod( Invocation.method( @@ -991,6 +1083,7 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i21.WorkoutPlansProv returnValue: _i19.Future.value(), returnValueForMissingStub: _i19.Future.value(), ) as _i19.Future); + @override _i19.Future> reorderSets( List<_i14.Set>? sets, @@ -1006,8 +1099,10 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i21.WorkoutPlansProv ), returnValue: _i19.Future>.value(<_i14.Set>[]), ) as _i19.Future>); + @override - _i19.Future fetchComputedSettings(_i14.Set? workoutSet) => (super.noSuchMethod( + _i19.Future fetchComputedSettings(_i14.Set? workoutSet) => + (super.noSuchMethod( Invocation.method( #fetchComputedSettings, [workoutSet], @@ -1015,6 +1110,7 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i21.WorkoutPlansProv returnValue: _i19.Future.value(), returnValueForMissingStub: _i19.Future.value(), ) as _i19.Future); + @override _i19.Future fetchSmartText( _i14.Set? workoutSet, @@ -1030,6 +1126,7 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i21.WorkoutPlansProv ), returnValue: _i19.Future.value(''), ) as _i19.Future); + @override _i19.Future deleteSet(_i14.Set? workoutSet) => (super.noSuchMethod( Invocation.method( @@ -1039,8 +1136,10 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i21.WorkoutPlansProv returnValue: _i19.Future.value(), returnValueForMissingStub: _i19.Future.value(), ) as _i19.Future); + @override - _i19.Future<_i15.Setting> addSetting(_i15.Setting? workoutSetting) => (super.noSuchMethod( + _i19.Future<_i15.Setting> addSetting(_i15.Setting? workoutSetting) => + (super.noSuchMethod( Invocation.method( #addSetting, [workoutSetting], @@ -1053,6 +1152,7 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i21.WorkoutPlansProv ), )), ) as _i19.Future<_i15.Setting>); + @override _i19.Future fetchSessionData() => (super.noSuchMethod( Invocation.method( @@ -1061,13 +1161,16 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i21.WorkoutPlansProv ), returnValue: _i19.Future.value(), ) as _i19.Future); + @override - _i19.Future<_i16.WorkoutSession> addSession(_i16.WorkoutSession? session) => (super.noSuchMethod( + _i19.Future<_i16.WorkoutSession> addSession(_i16.WorkoutSession? session) => + (super.noSuchMethod( Invocation.method( #addSession, [session], ), - returnValue: _i19.Future<_i16.WorkoutSession>.value(_FakeWorkoutSession_16( + returnValue: + _i19.Future<_i16.WorkoutSession>.value(_FakeWorkoutSession_16( this, Invocation.method( #addSession, @@ -1075,6 +1178,7 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i21.WorkoutPlansProv ), )), ) as _i19.Future<_i16.WorkoutSession>); + @override _i19.Future<_i17.Log> addLog(_i17.Log? log) => (super.noSuchMethod( Invocation.method( @@ -1089,6 +1193,7 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i21.WorkoutPlansProv ), )), ) as _i19.Future<_i17.Log>); + @override _i19.Future deleteLog(_i17.Log? log) => (super.noSuchMethod( Invocation.method( @@ -1098,6 +1203,7 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i21.WorkoutPlansProv returnValue: _i19.Future.value(), returnValueForMissingStub: _i19.Future.value(), ) as _i19.Future); + @override void addListener(_i20.VoidCallback? listener) => super.noSuchMethod( Invocation.method( @@ -1106,6 +1212,7 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i21.WorkoutPlansProv ), returnValueForMissingStub: null, ); + @override void removeListener(_i20.VoidCallback? listener) => super.noSuchMethod( Invocation.method( @@ -1114,6 +1221,7 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i21.WorkoutPlansProv ), returnValueForMissingStub: null, ); + @override void dispose() => super.noSuchMethod( Invocation.method( @@ -1122,6 +1230,7 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i21.WorkoutPlansProv ), returnValueForMissingStub: null, ); + @override void notifyListeners() => super.noSuchMethod( Invocation.method( diff --git a/test_driver/screenshot_driver.dart b/test_driver/screenshot_driver.dart index 285d715ac..f98d10c7f 100644 --- a/test_driver/screenshot_driver.dart +++ b/test_driver/screenshot_driver.dart @@ -6,8 +6,7 @@ import 'package:integration_test/integration_test_driver_extended.dart'; Future main() async { try { await integrationDriver( - onScreenshot: (String screenshotName, List screenshotBytes, - [Map? _]) async { + onScreenshot: (String screenshotName, List screenshotBytes, [_]) async { final File image = await File(screenshotName).create(recursive: true); image.writeAsBytesSync(screenshotBytes); return true;