diff --git a/flatpak/scripts/flatpak_shared.dart b/flatpak/scripts/flatpak_shared.dart index 4e16b65ff..f411aabef 100644 --- a/flatpak/scripts/flatpak_shared.dart +++ b/flatpak/scripts/flatpak_shared.dart @@ -77,7 +77,7 @@ class GithubReleases { .body; final decodedJson = jsonDecode(releaseJsonContent) as List; - DateTime? latestReleaseAssetDate = null; + DateTime? latestReleaseAssetDate; final releases = List.empty(growable: true); diff --git a/lib/helpers/colors.dart b/lib/helpers/colors.dart index 8e362db04..b7fd22885 100644 --- a/lib/helpers/colors.dart +++ b/lib/helpers/colors.dart @@ -1,4 +1,3 @@ -import 'dart:math'; import 'dart:ui'; const LIST_OF_COLORS8 = [ diff --git a/lib/helpers/i18n.dart b/lib/helpers/i18n.dart index 21fc03f2e..ebf02de8b 100644 --- a/lib/helpers/i18n.dart +++ b/lib/helpers/i18n.dart @@ -1,4 +1,5 @@ /// This code is autogenerated in the backend repo in extract-i18n.py do not edit! +library; /// Translate dynamic strings that are returned from the server /// These strings such as categories or equipment are returned by the server diff --git a/lib/helpers/ui.dart b/lib/helpers/ui.dart index 626e42e63..83a3d84f6 100644 --- a/lib/helpers/ui.dart +++ b/lib/helpers/ui.dart @@ -125,7 +125,7 @@ dynamic showDeleteDialog( TextButton( child: Text( AppLocalizations.of(context).delete, - style: TextStyle(color: Theme.of(context).errorColor), + style: TextStyle(color: Theme.of(context).colorScheme.error), ), onPressed: () { exerciseData[exercise]!.removeWhere((el) => el.id == log.id); diff --git a/lib/models/nutrition/nutritional_plan.dart b/lib/models/nutrition/nutritional_plan.dart index 978304c23..10a568284 100644 --- a/lib/models/nutrition/nutritional_plan.dart +++ b/lib/models/nutrition/nutritional_plan.dart @@ -91,17 +91,17 @@ class NutritionalPlan { NutritionalValues get nutritionalValues7DayAvg { final currentDate = DateTime.now(); - final sevenDaysAgo = currentDate.subtract(Duration(days: 7)); + final sevenDaysAgo = currentDate.subtract(const Duration(days: 7)); final entries = logs.where((obj) { - DateTime objDate = obj.datetime; + final DateTime objDate = obj.datetime; return objDate.isAfter(sevenDaysAgo) && objDate.isBefore(currentDate); }).toList(); var out = NutritionalValues(); - entries.forEach((log) { + for (final log in entries) { out = out + log.nutritionalValues; - }); + } return out; } diff --git a/lib/providers/body_weight.dart b/lib/providers/body_weight.dart index 82b0ad4d4..35b10ff23 100644 --- a/lib/providers/body_weight.dart +++ b/lib/providers/body_weight.dart @@ -34,7 +34,7 @@ class BodyWeightProvider with ChangeNotifier { return [..._entries]; } - void set items(List entries) { + set items(List entries) { _entries = entries; } diff --git a/lib/providers/exercises.dart b/lib/providers/exercises.dart index 65615fca6..2c9e70907 100644 --- a/lib/providers/exercises.dart +++ b/lib/providers/exercises.dart @@ -65,7 +65,7 @@ class ExercisesProvider with ChangeNotifier { List _muscles = []; List _equipment = []; List _languages = []; - List _variations = []; + final List _variations = []; Filters? _filters; @@ -522,7 +522,7 @@ class Filters { exerciseCategories: exerciseCategories ?? this.exerciseCategories, equipment: equipment ?? this.equipment, searchTerm: searchTerm ?? this.searchTerm, - doesNeedUpdate: doesNeedUpdate ?? this._doesNeedUpdate, + doesNeedUpdate: doesNeedUpdate ?? _doesNeedUpdate, ); } } diff --git a/lib/providers/gallery.dart b/lib/providers/gallery.dart index ce1980b4e..f843e0443 100644 --- a/lib/providers/gallery.dart +++ b/lib/providers/gallery.dart @@ -24,7 +24,6 @@ import 'package:http/http.dart' as http; import 'package:image_picker/image_picker.dart'; import 'package:wger/helpers/json.dart'; import 'package:wger/models/gallery/image.dart' as gallery; -import 'package:wger/providers/auth.dart'; import 'package:wger/providers/base_provider.dart'; class GalleryProvider extends WgerBaseProvider with ChangeNotifier { @@ -32,9 +31,8 @@ class GalleryProvider extends WgerBaseProvider with ChangeNotifier { List images = []; - GalleryProvider(AuthProvider auth, List entries, [http.Client? client]) - : images = entries, - super(auth, client); + GalleryProvider(super.auth, List entries, [super.client]) + : images = entries; /// Clears all lists void clear() { diff --git a/lib/providers/workout_plans.dart b/lib/providers/workout_plans.dart index c5d2406aa..f753eb6e7 100644 --- a/lib/providers/workout_plans.dart +++ b/lib/providers/workout_plans.dart @@ -120,6 +120,7 @@ class WorkoutPlansProvider with ChangeNotifier { if (_workoutPlans.isNotEmpty) { return _workoutPlans.first; } + return null; } /* diff --git a/lib/screens/add_exercise_screen.dart b/lib/screens/add_exercise_screen.dart index 4d65f0b64..92a0a2121 100644 --- a/lib/screens/add_exercise_screen.dart +++ b/lib/screens/add_exercise_screen.dart @@ -17,7 +17,7 @@ import 'package:wger/widgets/user/forms.dart'; import 'form_screen.dart'; class AddExerciseScreen extends StatelessWidget { - const AddExerciseScreen({Key? key}) : super(key: key); + const AddExerciseScreen({super.key}); static const routeName = '/exercises/add'; @@ -30,7 +30,7 @@ class AddExerciseScreen extends StatelessWidget { } class AddExerciseStepper extends StatefulWidget { - const AddExerciseStepper({Key? key}) : super(key: key); + const AddExerciseStepper({super.key}); static const STEPS_IN_FORM = 5; @@ -182,8 +182,8 @@ class _AddExerciseStepperState extends State { class EmailNotVerified extends StatelessWidget { const EmailNotVerified({ - Key? key, - }) : super(key: key); + super.key, + }); @override Widget build(BuildContext context) { diff --git a/lib/screens/exercises_screen.dart b/lib/screens/exercises_screen.dart index 5601c5550..5c26404ba 100644 --- a/lib/screens/exercises_screen.dart +++ b/lib/screens/exercises_screen.dart @@ -8,7 +8,7 @@ import 'package:wger/widgets/exercises/filter_row.dart'; import 'package:wger/widgets/exercises/list_tile.dart'; class ExercisesScreen extends StatefulWidget { - const ExercisesScreen({Key? key}) : super(key: key); + const ExercisesScreen({super.key}); static const routeName = '/exercises'; @override @@ -27,9 +27,9 @@ class _ExercisesScreenState extends State { appBar: EmptyAppBar(AppLocalizations.of(context).exercises), body: Column( children: [ - FilterRow(), + const FilterRow(), Expanded( - child: exercisesList == null + child: exercisesList.isEmpty ? const Center( child: SizedBox( height: 100, @@ -53,9 +53,8 @@ class _ExercisesScreenState extends State { class _ExercisesList extends StatelessWidget { const _ExercisesList({ - Key? key, required this.exerciseBaseList, - }) : super(key: key); + }); final List exerciseBaseList; diff --git a/lib/widgets/add_exercise/add_exercise_dropdown_button.dart b/lib/widgets/add_exercise/add_exercise_dropdown_button.dart index 0f2894da4..7b8d71dd7 100644 --- a/lib/widgets/add_exercise/add_exercise_dropdown_button.dart +++ b/lib/widgets/add_exercise/add_exercise_dropdown_button.dart @@ -2,13 +2,13 @@ import 'package:flutter/material.dart'; class AddExerciseDropdownButton extends StatefulWidget { const AddExerciseDropdownButton({ - Key? key, + super.key, required this.items, required this.title, required this.onChange, this.validator, this.onSaved, - }) : super(key: key); + }); final List items; final String title; diff --git a/lib/widgets/add_exercise/add_exercise_multiselect_button.dart b/lib/widgets/add_exercise/add_exercise_multiselect_button.dart index d190ef381..97cbbceaa 100644 --- a/lib/widgets/add_exercise/add_exercise_multiselect_button.dart +++ b/lib/widgets/add_exercise/add_exercise_multiselect_button.dart @@ -10,14 +10,13 @@ class AddExerciseMultiselectButton extends StatefulWidget { final Function displayName; const AddExerciseMultiselectButton( - {Key? key, + {super.key, required this.items, required this.title, required this.onChange, this.initialItems = const [], this.onSaved, - required this.displayName}) - : super(key: key); + required this.displayName}); @override _AddExerciseMultiselectButtonState createState() => _AddExerciseMultiselectButtonState(); diff --git a/lib/widgets/add_exercise/add_exercise_text_area.dart b/lib/widgets/add_exercise/add_exercise_text_area.dart index cec1d50c5..7bad7be62 100644 --- a/lib/widgets/add_exercise/add_exercise_text_area.dart +++ b/lib/widgets/add_exercise/add_exercise_text_area.dart @@ -2,7 +2,7 @@ import 'package:flutter/material.dart'; class AddExerciseTextArea extends StatelessWidget { const AddExerciseTextArea({ - Key? key, + super.key, required this.onChange, required this.title, this.helperText = '', @@ -10,7 +10,7 @@ class AddExerciseTextArea extends StatelessWidget { this.isMultiline = false, this.validator, this.onSaved, - }) : super(key: key); + }); final ValueChanged onChange; final bool isRequired; diff --git a/lib/widgets/add_exercise/preview_images.dart b/lib/widgets/add_exercise/preview_images.dart index e9f291af3..65a465670 100644 --- a/lib/widgets/add_exercise/preview_images.dart +++ b/lib/widgets/add_exercise/preview_images.dart @@ -3,14 +3,14 @@ import 'dart:io'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; -import '../../providers/add_exercise.dart'; +import 'package:wger/providers/add_exercise.dart'; import 'mixins/image_picker_mixin.dart'; class PreviewExerciseImages extends StatelessWidget with ExerciseImagePickerMixin { PreviewExerciseImages({ - Key? key, + super.key, required this.selectedImages, - }) : super(key: key); + }); final List selectedImages; @override @@ -52,7 +52,7 @@ class PreviewExerciseImages extends StatelessWidget with ExerciseImagePickerMixi ), ), ) - .toList(), + , const SizedBox( width: 10, ), diff --git a/lib/widgets/add_exercise/steps/step2variations.dart b/lib/widgets/add_exercise/steps/step2variations.dart index ebe9254ef..ce25185ea 100644 --- a/lib/widgets/add_exercise/steps/step2variations.dart +++ b/lib/widgets/add_exercise/steps/step2variations.dart @@ -19,7 +19,7 @@ class Step2Variations extends StatelessWidget { children: [ Text( AppLocalizations.of(context).whatVariationsExist, - style: Theme.of(context).textTheme.caption, + style: Theme.of(context).textTheme.bodySmall, ), const SizedBox(height: 10), SizedBox( @@ -48,7 +48,7 @@ class Step2Variations extends StatelessWidget { overflow: TextOverflow.ellipsis, ), ) - .toList(), + , const SizedBox(height: 20), ], ), @@ -61,7 +61,7 @@ class Step2Variations extends StatelessWidget { ], ), ) - .toList(), + , // Exercise bases without variations ...exerciseProvider.bases .where((b) => b.variationId == null) @@ -93,7 +93,7 @@ class Step2Variations extends StatelessWidget { ], ), ) - .toList(), + , ], ), ), diff --git a/lib/widgets/add_exercise/steps/step5images.dart b/lib/widgets/add_exercise/steps/step5images.dart index 34eb16022..a0c7d043b 100644 --- a/lib/widgets/add_exercise/steps/step5images.dart +++ b/lib/widgets/add_exercise/steps/step5images.dart @@ -22,7 +22,7 @@ class _Step5ImagesState extends State with ExerciseImagePickerMixin children: [ Text( AppLocalizations.of(context).add_exercise_image_license, - style: Theme.of(context).textTheme.caption, + style: Theme.of(context).textTheme.bodySmall, ), Consumer( builder: (ctx, provider, __) => provider.exerciseImages.isNotEmpty @@ -45,7 +45,7 @@ class _Step5ImagesState extends State with ExerciseImagePickerMixin ), Text( 'Only JPEG, PNG and WEBP files below 20 MB are supported', - style: Theme.of(context).textTheme.caption, + style: Theme.of(context).textTheme.bodySmall, ) ], ), diff --git a/lib/widgets/core/about.dart b/lib/widgets/core/about.dart index a614bd568..338e27f22 100644 --- a/lib/widgets/core/about.dart +++ b/lib/widgets/core/about.dart @@ -25,8 +25,7 @@ import 'package:wger/providers/auth.dart'; class AboutPage extends StatefulWidget { static String routeName = '/AboutPage'; - - const AboutPage({Key? key}) : super(key: key); + const AboutPage({super.key}); @override State createState() => _AboutPageState(); diff --git a/lib/widgets/core/core.dart b/lib/widgets/core/core.dart index c65ea59b7..6430f5b66 100644 --- a/lib/widgets/core/core.dart +++ b/lib/widgets/core/core.dart @@ -38,7 +38,7 @@ class MutedText extends StatelessWidget { } class Pill extends StatelessWidget { - const Pill({Key? key, required this.title}) : super(key: key); + const Pill({super.key, required this.title}); final String title; diff --git a/lib/widgets/dashboard/calendar.dart b/lib/widgets/dashboard/calendar.dart index 979477048..f7ba8ba60 100644 --- a/lib/widgets/dashboard/calendar.dart +++ b/lib/widgets/dashboard/calendar.dart @@ -270,7 +270,7 @@ class _DashboardCalendarWidgetState extends State subtitle: Text(event.description), //onTap: () => print('$event tapped!'), )) - .toList() + ], ), ), diff --git a/lib/widgets/dashboard/widgets.dart b/lib/widgets/dashboard/widgets.dart index 9310cd5a4..b5565c840 100644 --- a/lib/widgets/dashboard/widgets.dart +++ b/lib/widgets/dashboard/widgets.dart @@ -263,7 +263,7 @@ class _DashboardWeightWidgetState extends State { if (weightEntriesData.items.isNotEmpty) Column( children: [ - Container( + SizedBox( height: 200, child: MeasurementChartWidgetFl(weightEntriesData.items .map((e) => MeasurementChartEntry(e.weight, e.date)) @@ -509,7 +509,7 @@ class _DashboardWorkoutWidgetState extends State { ], ) : Container(); - }).toList(), + }), ], ), )); diff --git a/lib/widgets/exercises/exercises.dart b/lib/widgets/exercises/exercises.dart index 6c0a931b7..a60e10bef 100644 --- a/lib/widgets/exercises/exercises.dart +++ b/lib/widgets/exercises/exercises.dart @@ -156,7 +156,7 @@ class ExerciseDetail extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ const MuscleColorHelper(main: true), - ..._exerciseBase.muscles.map((e) => Text(e.nameTranslated(context))).toList(), + ..._exerciseBase.muscles.map((e) => Text(e.nameTranslated(context))), ], ), ); @@ -166,7 +166,7 @@ class ExerciseDetail extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ const MuscleColorHelper(main: false), - ..._exerciseBase.musclesSecondary.map((e) => Text(e.name)).toList(), + ..._exerciseBase.musclesSecondary.map((e) => Text(e.name)), ], ), ); @@ -259,8 +259,8 @@ class MuscleColorHelper extends StatelessWidget { const MuscleColorHelper({ this.main = true, - Key? key, - }) : super(key: key); + super.key, + }); @override Widget build(BuildContext context) { @@ -343,10 +343,10 @@ class MuscleWidget extends StatelessWidget { SvgPicture.asset('assets/images/muscles/$background.svg'), ...muscles .map((m) => SvgPicture.asset('assets/images/muscles/main/muscle-${m.id}.svg')) - .toList(), + , ...musclesSecondary .map((m) => SvgPicture.asset('assets/images/muscles/secondary/muscle-${m.id}.svg')) - .toList(), + , ], ); } diff --git a/lib/widgets/exercises/filter_modal.dart b/lib/widgets/exercises/filter_modal.dart index 0b1c00024..d90b290cb 100644 --- a/lib/widgets/exercises/filter_modal.dart +++ b/lib/widgets/exercises/filter_modal.dart @@ -23,8 +23,8 @@ import 'package:wger/providers/exercises.dart'; class ExerciseFilterModalBody extends StatefulWidget { const ExerciseFilterModalBody({ - Key? key, - }) : super(key: key); + super.key, + }); @override _ExerciseFilterModalBodyState createState() => _ExerciseFilterModalBodyState(); diff --git a/lib/widgets/exercises/filter_row.dart b/lib/widgets/exercises/filter_row.dart index d7510dd1b..bb0924895 100644 --- a/lib/widgets/exercises/filter_row.dart +++ b/lib/widgets/exercises/filter_row.dart @@ -25,7 +25,7 @@ import 'package:wger/screens/add_exercise_screen.dart'; import 'filter_modal.dart'; class FilterRow extends StatefulWidget { - const FilterRow({Key? key}) : super(key: key); + const FilterRow({super.key}); @override _FilterRowState createState() => _FilterRowState(); diff --git a/lib/widgets/exercises/forms.dart b/lib/widgets/exercises/forms.dart index 4983d88f0..d07577280 100644 --- a/lib/widgets/exercises/forms.dart +++ b/lib/widgets/exercises/forms.dart @@ -68,7 +68,7 @@ class _ExerciseCategoryInputWidgetState extends State { /// /// Taken from this example: https://pub.dev/packages/video_player/example class _ControlsOverlay extends StatelessWidget { - const _ControlsOverlay({Key? key, required this.controller}) : super(key: key); + const _ControlsOverlay({required this.controller}); static const _playbackRates = [ 0.25, diff --git a/lib/widgets/measurements/categories.dart b/lib/widgets/measurements/categories.dart index 9dbd4fc43..45a9b3640 100644 --- a/lib/widgets/measurements/categories.dart +++ b/lib/widgets/measurements/categories.dart @@ -25,14 +25,14 @@ import 'categories_card.dart'; class CategoriesList extends StatelessWidget { @override Widget build(BuildContext context) { - final _provider = Provider.of(context, listen: false); + final provider = Provider.of(context, listen: false); return RefreshIndicator( - onRefresh: () => _provider.fetchAndSetAllCategoriesAndEntries(), + onRefresh: () => provider.fetchAndSetAllCategoriesAndEntries(), child: ListView.builder( padding: const EdgeInsets.all(10.0), - itemCount: _provider.categories.length, - itemBuilder: (context, index) => CategoriesCard(_provider.categories[index]), + itemCount: provider.categories.length, + itemBuilder: (context, index) => CategoriesCard(provider.categories[index]), ), ); } diff --git a/lib/widgets/measurements/categories_card.dart b/lib/widgets/measurements/categories_card.dart index b660f7dc6..a855af176 100644 --- a/lib/widgets/measurements/categories_card.dart +++ b/lib/widgets/measurements/categories_card.dart @@ -1,9 +1,9 @@ import 'package:flutter/material.dart'; 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 'package:wger/models/measurements/measurement_category.dart'; +import 'package:wger/screens/form_screen.dart'; +import 'package:wger/screens/measurement_entries_screen.dart'; import 'charts.dart'; import 'forms.dart'; diff --git a/lib/widgets/measurements/charts.dart b/lib/widgets/measurements/charts.dart index 66f08c5a8..8aaca9aba 100644 --- a/lib/widgets/measurements/charts.dart +++ b/lib/widgets/measurements/charts.dart @@ -70,13 +70,13 @@ class _MeasurementChartWidgetFlState extends State { //horizontalInterval: 1, //verticalInterval: interval, getDrawingHorizontalLine: (value) { - return FlLine( + return const FlLine( color: Colors.grey, strokeWidth: 1, ); }, getDrawingVerticalLine: (value) { - return FlLine( + return const FlLine( color: Colors.grey, strokeWidth: 1, ); @@ -84,10 +84,10 @@ class _MeasurementChartWidgetFlState extends State { ), titlesData: FlTitlesData( show: true, - rightTitles: AxisTitles( + rightTitles: const AxisTitles( sideTitles: SideTitles(showTitles: false), ), - topTitles: AxisTitles( + topTitles: const AxisTitles( sideTitles: SideTitles(showTitles: false), ), bottomTitles: AxisTitles( diff --git a/lib/widgets/measurements/entries.dart b/lib/widgets/measurements/entries.dart index 869832826..c3cf83379 100644 --- a/lib/widgets/measurements/entries.dart +++ b/lib/widgets/measurements/entries.dart @@ -86,7 +86,7 @@ class EntriesList extends StatelessWidget { return true; }, secondaryBackground: Container( - color: Theme.of(context).errorColor, + color: Theme.of(context).colorScheme.error, alignment: Alignment.centerRight, padding: const EdgeInsets.only(right: 20), margin: const EdgeInsets.symmetric( @@ -113,7 +113,7 @@ class EntriesList extends StatelessWidget { ), child: Card( child: ListTile( - title: Text('${currentEntry.value.toString()} ${_category.unit}'), + title: Text('${currentEntry.value} ${_category.unit}'), subtitle: Text( DateFormat.yMd(Localizations.localeOf(context).languageCode) .format(currentEntry.date), diff --git a/lib/widgets/nutrition/charts.dart b/lib/widgets/nutrition/charts.dart index cefc84346..e4ec2dd28 100644 --- a/lib/widgets/nutrition/charts.dart +++ b/lib/widgets/nutrition/charts.dart @@ -158,7 +158,7 @@ class NutritionalDiaryChartWidgetFl extends StatefulWidget { const NutritionalDiaryChartWidgetFl({ super.key, required NutritionalPlan nutritionalPlan, - }) : _nutritionalPlan = nutritionalPlan; + }) : _nutritionalPlan = nutritionalPlan; final NutritionalPlan _nutritionalPlan; @@ -395,10 +395,9 @@ class FlNutritionalDiaryChartWidget extends StatefulWidget { final NutritionalPlan _nutritionalPlan; const FlNutritionalDiaryChartWidget({ - Key? key, + super.key, required NutritionalPlan nutritionalPlan, - }) : _nutritionalPlan = nutritionalPlan, - super(key: key); + }) : _nutritionalPlan = nutritionalPlan; final Color barColor = Colors.red; final Color touchedBarColor = Colors.deepOrange; @@ -541,13 +540,13 @@ class FlNutritionalDiaryChartWidgetState extends State FlLine( + getDrawingHorizontalLine: (value) => const FlLine( color: Colors.grey, strokeWidth: 1, ), diff --git a/lib/widgets/nutrition/meal.dart b/lib/widgets/nutrition/meal.dart index bca757163..381ef006c 100644 --- a/lib/widgets/nutrition/meal.dart +++ b/lib/widgets/nutrition/meal.dart @@ -86,7 +86,7 @@ class _MealWidgetState extends State { Ink( decoration: ShapeDecoration( color: Theme.of(context).primaryColor, //wgerPrimaryButtonColor, - shape: CircleBorder(), + shape: const CircleBorder(), ), child: IconButton( icon: const Icon(Icons.history_edu), @@ -121,7 +121,7 @@ class _MealWidgetState extends State { ], ), if (_expanded) const Divider(), - ...widget._meal.mealItems.map((item) => MealItemWidget(item, _expanded)).toList(), + ...widget._meal.mealItems.map((item) => MealItemWidget(item, _expanded)), OutlinedButton( child: Text(AppLocalizations.of(context).addIngredient), onPressed: () { diff --git a/lib/widgets/nutrition/nutritional_plans_list.dart b/lib/widgets/nutrition/nutritional_plans_list.dart index 6d1eae27d..58b112108 100644 --- a/lib/widgets/nutrition/nutritional_plans_list.dart +++ b/lib/widgets/nutrition/nutritional_plans_list.dart @@ -58,7 +58,7 @@ class NutritionalPlansList extends StatelessWidget { TextButton( child: Text( AppLocalizations.of(context).delete, - style: TextStyle(color: Theme.of(context).errorColor), + style: TextStyle(color: Theme.of(context).colorScheme.error), ), onPressed: () { // Confirmed, delete the workout @@ -84,7 +84,7 @@ class NutritionalPlansList extends StatelessWidget { return res; }, background: Container( - color: Theme.of(context).errorColor, + color: Theme.of(context).colorScheme.error, alignment: Alignment.centerRight, padding: const EdgeInsets.only(right: 20), margin: const EdgeInsets.symmetric( diff --git a/lib/widgets/weight/entries_list.dart b/lib/widgets/weight/entries_list.dart index 9937e0f22..8377ec5b6 100644 --- a/lib/widgets/weight/entries_list.dart +++ b/lib/widgets/weight/entries_list.dart @@ -29,7 +29,7 @@ import 'package:wger/widgets/weight/forms.dart'; class WeightEntriesList extends StatelessWidget { @override Widget build(BuildContext context) { - final _weightProvider = Provider.of(context, listen: false); + final weightProvider = Provider.of(context, listen: false); return Column( children: [ @@ -37,7 +37,7 @@ class WeightEntriesList extends StatelessWidget { padding: const EdgeInsets.all(15), height: 220, child: MeasurementChartWidgetFl( - _weightProvider.items.map((e) => MeasurementChartEntry(e.weight, e.date)).toList()), + weightProvider.items.map((e) => MeasurementChartEntry(e.weight, e.date)).toList()), ), TextButton( onPressed: () => Navigator.pushNamed( @@ -54,18 +54,18 @@ class WeightEntriesList extends StatelessWidget { ), Expanded( child: RefreshIndicator( - onRefresh: () => _weightProvider.fetchAndSetEntries(), + onRefresh: () => weightProvider.fetchAndSetEntries(), child: ListView.builder( padding: const EdgeInsets.all(10.0), - itemCount: _weightProvider.items.length, + itemCount: weightProvider.items.length, itemBuilder: (context, index) { - final currentEntry = _weightProvider.items[index]; + final currentEntry = weightProvider.items[index]; return Dismissible( key: Key(currentEntry.id.toString()), onDismissed: (direction) { if (direction == DismissDirection.endToStart) { // Delete entry from DB - _weightProvider.deleteEntry(currentEntry.id!); + weightProvider.deleteEntry(currentEntry.id!); // and inform the user ScaffoldMessenger.of(context).showSnackBar( @@ -94,7 +94,7 @@ class WeightEntriesList extends StatelessWidget { return true; }, secondaryBackground: Container( - color: Theme.of(context).errorColor, + color: Theme.of(context).colorScheme.error, alignment: Alignment.centerRight, padding: const EdgeInsets.only(right: 20), margin: const EdgeInsets.symmetric( diff --git a/lib/widgets/workouts/charts.dart b/lib/widgets/workouts/charts.dart index cbf5bbd57..fd632128e 100644 --- a/lib/widgets/workouts/charts.dart +++ b/lib/widgets/workouts/charts.dart @@ -76,13 +76,13 @@ class _LogChartWidgetFlState extends State { show: true, drawVerticalLine: true, getDrawingHorizontalLine: (value) { - return FlLine( + return const FlLine( color: Colors.grey, strokeWidth: 1, ); }, getDrawingVerticalLine: (value) { - return FlLine( + return const FlLine( color: Colors.grey, strokeWidth: 1, ); @@ -90,10 +90,10 @@ class _LogChartWidgetFlState extends State { ), titlesData: FlTitlesData( show: true, - rightTitles: AxisTitles( + rightTitles: const AxisTitles( sideTitles: SideTitles(showTitles: false), ), - topTitles: AxisTitles( + topTitles: const AxisTitles( sideTitles: SideTitles(showTitles: false), ), bottomTitles: AxisTitles( diff --git a/lib/widgets/workouts/day.dart b/lib/widgets/workouts/day.dart index f195a78a2..dbd923dcc 100644 --- a/lib/widgets/workouts/day.dart +++ b/lib/widgets/workouts/day.dart @@ -80,7 +80,7 @@ class SettingWidget extends StatelessWidget { subtitle: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - ...set.getSmartRepr(setting.exerciseBaseObj).map((e) => Text(e)).toList(), + ...set.getSmartRepr(setting.exerciseBaseObj).map((e) => Text(e)), ], ), ); @@ -140,7 +140,7 @@ class _WorkoutDayWidgetState extends State { toggle: _toggleExpanded, ), ) - .toList(), + , const Divider(), ], ), diff --git a/lib/widgets/workouts/forms.dart b/lib/widgets/workouts/forms.dart index 6a56decfb..111936d56 100644 --- a/lib/widgets/workouts/forms.dart +++ b/lib/widgets/workouts/forms.dart @@ -209,7 +209,7 @@ class _DayFormWidgetState extends State { }, ), const SizedBox(height: 10), - ...Day.weekdays.keys.map((dayNr) => DayCheckbox(dayNr, widget._day)).toList(), + ...Day.weekdays.keys.map((dayNr) => DayCheckbox(dayNr, widget._day)), ElevatedButton( key: const Key(SUBMIT_BUTTON_KEY_NAME), child: Text(AppLocalizations.of(context).save), @@ -428,7 +428,7 @@ class _SetFormWidgetState extends State { }, onSuggestionSelected: (ExerciseBase exerciseSuggestion) { addExercise(exerciseSuggestion); - this._exercisesController.text = ''; + _exercisesController.text = ''; }, validator: (value) { // At least one exercise must be selected @@ -510,7 +510,7 @@ class _SetFormWidgetState extends State { ), ], ); - }).toList(), + }), ElevatedButton( key: const Key(SUBMIT_BUTTON_KEY_NAME), child: Text(AppLocalizations.of(context).save), @@ -800,7 +800,7 @@ class _RiRInputWidgetState extends State { if (value < 0) { return AppLocalizations.of(context).rirNotUsed; } - return '${value.toString()} ${AppLocalizations.of(context).rir}'; + return '$value ${AppLocalizations.of(context).rir}'; } String mapDoubleToAllowedRir(double value) { @@ -848,7 +848,7 @@ class _RiRInputWidgetState extends State { class WeightUnitInputWidget extends StatefulWidget { final dynamic _setting; - const WeightUnitInputWidget(this._setting, {Key? key}) : super(key: key); + const WeightUnitInputWidget(this._setting, {super.key}); @override _WeightUnitInputWidgetState createState() => _WeightUnitInputWidgetState(); diff --git a/lib/widgets/workouts/log.dart b/lib/widgets/workouts/log.dart index 0dc168b71..1909b2565 100644 --- a/lib/widgets/workouts/log.dart +++ b/lib/widgets/workouts/log.dart @@ -140,14 +140,14 @@ class _DayLogWidgetState extends State { ], ), ) - .toList(), + , Padding( padding: const EdgeInsets.symmetric(horizontal: 15), child: ExerciseLogChart(base, widget._date), ) ], ); - }).toList() + }) ], ), ); diff --git a/lib/widgets/workouts/workout_plans_list.dart b/lib/widgets/workouts/workout_plans_list.dart index 92723dd40..d2bc3d7ec 100644 --- a/lib/widgets/workouts/workout_plans_list.dart +++ b/lib/widgets/workouts/workout_plans_list.dart @@ -59,7 +59,7 @@ class WorkoutPlansList extends StatelessWidget { TextButton( child: Text( AppLocalizations.of(context).delete, - style: TextStyle(color: Theme.of(context).errorColor), + style: TextStyle(color: Theme.of(context).colorScheme.error), ), onPressed: () { // Confirmed, delete the workout @@ -86,7 +86,7 @@ class WorkoutPlansList extends StatelessWidget { return res; }, background: Container( - color: Theme.of(context).errorColor, + color: Theme.of(context).colorScheme.error, alignment: Alignment.centerRight, padding: const EdgeInsets.only(right: 20), margin: const EdgeInsets.symmetric( diff --git a/test/gallery/gallery_provider_test.dart b/test/gallery/gallery_provider_test.dart index 1c6021a8a..a7b20a808 100644 --- a/test/gallery/gallery_provider_test.dart +++ b/test/gallery/gallery_provider_test.dart @@ -70,7 +70,7 @@ void main() { id: 58, date: DateTime(2022, 01, 09), url: 'https://wger.de/media/gallery/170335/d2b9c9e0-d541-41ae-8786-a2ab459e3538.jpg', - description: "eggsaddjujuit\'ddayhadIforcanview"); + description: "eggsaddjujuit'ddayhadIforcanview"); galleryProvider.images.add(image); diff --git a/test/gallery/gallery_screen_test.dart b/test/gallery/gallery_screen_test.dart index dfb08a16d..43e90b3f4 100644 --- a/test/gallery/gallery_screen_test.dart +++ b/test/gallery/gallery_screen_test.dart @@ -28,8 +28,8 @@ import 'package:wger/providers/gallery.dart'; import 'package:wger/screens/form_screen.dart'; import 'package:wger/widgets/gallery/overview.dart'; -import './gallery_screen_test.mocks.dart'; import '../../test_data/gallery.dart'; +import './gallery_screen_test.mocks.dart'; @GenerateMocks([GalleryProvider]) void main() { diff --git a/test/nutrition/nutritional_meal_item_form_test.dart b/test/nutrition/nutritional_meal_item_form_test.dart index f593619ca..aa1eb9c3e 100644 --- a/test/nutrition/nutritional_meal_item_form_test.dart +++ b/test/nutrition/nutritional_meal_item_form_test.dart @@ -52,7 +52,7 @@ void main() { var meal1 = Meal(); final Uri tUriRightCode = Uri.parse('https://localhost/api/v2/ingredient/?code=123'); - final Uri tUriEmptyCode = Uri.parse('https://localhost/api/v2/ingredient/?code=\"%20\"'); + final Uri tUriEmptyCode = Uri.parse('https://localhost/api/v2/ingredient/?code="%20"'); final Uri tUriBadCode = Uri.parse('https://localhost/api/v2/ingredient/?code=222'); when(client.get(tUriRightCode, headers: anyNamed('headers'))).thenAnswer( diff --git a/test/weight/weight_model_test.dart b/test/weight/weight_model_test.dart index 1a3698f86..f903f3707 100644 --- a/test/weight/weight_model_test.dart +++ b/test/weight/weight_model_test.dart @@ -45,13 +45,13 @@ void main() { group('model', () { test('Test the individual values from the model', () { - WeightEntry _weightModel; + WeightEntry weightModel; //_weightModel = WeightEntry(); - _weightModel = WeightEntry(id: 1, weight: 80, date: DateTime(2020, 10, 01)); + weightModel = WeightEntry(id: 1, weight: 80, date: DateTime(2020, 10, 01)); - expect(_weightModel.id, 1); - expect(_weightModel.weight, 80); - expect(_weightModel.date, DateTime(2020, 10, 01)); + expect(weightModel.id, 1); + expect(weightModel.weight, 80); + expect(weightModel.date, DateTime(2020, 10, 01)); }); }); }