mirror of
https://github.com/wger-project/flutter.git
synced 2026-02-18 00:17:48 +01:00
Run dart fix on the code base
This commit is contained in:
@@ -77,7 +77,7 @@ class GithubReleases {
|
||||
.body;
|
||||
final decodedJson = jsonDecode(releaseJsonContent) as List;
|
||||
|
||||
DateTime? latestReleaseAssetDate = null;
|
||||
DateTime? latestReleaseAssetDate;
|
||||
|
||||
final releases = List<Release>.empty(growable: true);
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import 'dart:math';
|
||||
import 'dart:ui';
|
||||
|
||||
const LIST_OF_COLORS8 = [
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ class BodyWeightProvider with ChangeNotifier {
|
||||
return [..._entries];
|
||||
}
|
||||
|
||||
void set items(List<WeightEntry> entries) {
|
||||
set items(List<WeightEntry> entries) {
|
||||
_entries = entries;
|
||||
}
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ class ExercisesProvider with ChangeNotifier {
|
||||
List<Muscle> _muscles = [];
|
||||
List<Equipment> _equipment = [];
|
||||
List<Language> _languages = [];
|
||||
List<Variation> _variations = [];
|
||||
final List<Variation> _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,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<gallery.Image> images = [];
|
||||
|
||||
GalleryProvider(AuthProvider auth, List<gallery.Image> entries, [http.Client? client])
|
||||
: images = entries,
|
||||
super(auth, client);
|
||||
GalleryProvider(super.auth, List<gallery.Image> entries, [super.client])
|
||||
: images = entries;
|
||||
|
||||
/// Clears all lists
|
||||
void clear() {
|
||||
|
||||
@@ -120,6 +120,7 @@ class WorkoutPlansProvider with ChangeNotifier {
|
||||
if (_workoutPlans.isNotEmpty) {
|
||||
return _workoutPlans.first;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -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<AddExerciseStepper> {
|
||||
|
||||
class EmailNotVerified extends StatelessWidget {
|
||||
const EmailNotVerified({
|
||||
Key? key,
|
||||
}) : super(key: key);
|
||||
super.key,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
@@ -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<ExercisesScreen> {
|
||||
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<ExercisesScreen> {
|
||||
|
||||
class _ExercisesList extends StatelessWidget {
|
||||
const _ExercisesList({
|
||||
Key? key,
|
||||
required this.exerciseBaseList,
|
||||
}) : super(key: key);
|
||||
});
|
||||
|
||||
final List<ExerciseBase> exerciseBaseList;
|
||||
|
||||
|
||||
@@ -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<String> items;
|
||||
final String title;
|
||||
|
||||
@@ -10,14 +10,13 @@ class AddExerciseMultiselectButton<T> 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<T>();
|
||||
|
||||
@@ -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<String> onChange;
|
||||
final bool isRequired;
|
||||
|
||||
@@ -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<File> selectedImages;
|
||||
@override
|
||||
@@ -52,7 +52,7 @@ class PreviewExerciseImages extends StatelessWidget with ExerciseImagePickerMixi
|
||||
),
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
,
|
||||
const SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
|
||||
@@ -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(),
|
||||
,
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@@ -22,7 +22,7 @@ class _Step5ImagesState extends State<Step5Images> with ExerciseImagePickerMixin
|
||||
children: [
|
||||
Text(
|
||||
AppLocalizations.of(context).add_exercise_image_license,
|
||||
style: Theme.of(context).textTheme.caption,
|
||||
style: Theme.of(context).textTheme.bodySmall,
|
||||
),
|
||||
Consumer<AddExerciseProvider>(
|
||||
builder: (ctx, provider, __) => provider.exerciseImages.isNotEmpty
|
||||
@@ -45,7 +45,7 @@ class _Step5ImagesState extends State<Step5Images> 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,
|
||||
)
|
||||
],
|
||||
),
|
||||
|
||||
@@ -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<AboutPage> createState() => _AboutPageState();
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -270,7 +270,7 @@ class _DashboardCalendarWidgetState extends State<DashboardCalendarWidget>
|
||||
subtitle: Text(event.description),
|
||||
//onTap: () => print('$event tapped!'),
|
||||
))
|
||||
.toList()
|
||||
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@@ -263,7 +263,7 @@ class _DashboardWeightWidgetState extends State<DashboardWeightWidget> {
|
||||
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<DashboardWorkoutWidget> {
|
||||
],
|
||||
)
|
||||
: Container();
|
||||
}).toList(),
|
||||
}),
|
||||
],
|
||||
),
|
||||
));
|
||||
|
||||
@@ -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(),
|
||||
,
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -68,7 +68,7 @@ class _ExerciseCategoryInputWidgetState<T> extends State<ExerciseCategoryInputWi
|
||||
),
|
||||
onChanged: (T? newValue) {
|
||||
setState(() {
|
||||
selectedEntry = newValue!;
|
||||
selectedEntry = newValue as T;
|
||||
widget._callback(newValue);
|
||||
});
|
||||
},
|
||||
|
||||
@@ -23,7 +23,7 @@ import 'package:wger/screens/exercise_screen.dart';
|
||||
import 'package:wger/widgets/exercises/images.dart';
|
||||
|
||||
class ExerciseListTile extends StatelessWidget {
|
||||
const ExerciseListTile({Key? key, required this.exerciseBase}) : super(key: key);
|
||||
const ExerciseListTile({super.key, required this.exerciseBase});
|
||||
|
||||
final ExerciseBase exerciseBase;
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ class _ExerciseVideoWidgetState extends State<ExerciseVideoWidget> {
|
||||
///
|
||||
/// 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,
|
||||
|
||||
@@ -25,14 +25,14 @@ import 'categories_card.dart';
|
||||
class CategoriesList extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final _provider = Provider.of<MeasurementProvider>(context, listen: false);
|
||||
final provider = Provider.of<MeasurementProvider>(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]),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -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';
|
||||
|
||||
|
||||
@@ -70,13 +70,13 @@ class _MeasurementChartWidgetFlState extends State<MeasurementChartWidgetFl> {
|
||||
//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<MeasurementChartWidgetFl> {
|
||||
),
|
||||
titlesData: FlTitlesData(
|
||||
show: true,
|
||||
rightTitles: AxisTitles(
|
||||
rightTitles: const AxisTitles(
|
||||
sideTitles: SideTitles(showTitles: false),
|
||||
),
|
||||
topTitles: AxisTitles(
|
||||
topTitles: const AxisTitles(
|
||||
sideTitles: SideTitles(showTitles: false),
|
||||
),
|
||||
bottomTitles: AxisTitles(
|
||||
|
||||
@@ -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),
|
||||
|
||||
@@ -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<FlNutritionalDiaryChartWi
|
||||
),
|
||||
titlesData: FlTitlesData(
|
||||
show: true,
|
||||
rightTitles: AxisTitles(
|
||||
rightTitles: const AxisTitles(
|
||||
sideTitles: SideTitles(showTitles: false),
|
||||
),
|
||||
topTitles: AxisTitles(
|
||||
topTitles: const AxisTitles(
|
||||
sideTitles: SideTitles(showTitles: false),
|
||||
),
|
||||
bottomTitles: AxisTitles(
|
||||
bottomTitles: const AxisTitles(
|
||||
sideTitles: SideTitles(showTitles: false),
|
||||
),
|
||||
leftTitles: AxisTitles(
|
||||
@@ -563,7 +562,7 @@ class FlNutritionalDiaryChartWidgetState extends State<FlNutritionalDiaryChartWi
|
||||
),
|
||||
gridData: FlGridData(
|
||||
show: true,
|
||||
getDrawingHorizontalLine: (value) => FlLine(
|
||||
getDrawingHorizontalLine: (value) => const FlLine(
|
||||
color: Colors.grey,
|
||||
strokeWidth: 1,
|
||||
),
|
||||
|
||||
@@ -86,7 +86,7 @@ class _MealWidgetState extends State<MealWidget> {
|
||||
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<MealWidget> {
|
||||
],
|
||||
),
|
||||
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: () {
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -29,7 +29,7 @@ import 'package:wger/widgets/weight/forms.dart';
|
||||
class WeightEntriesList extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final _weightProvider = Provider.of<BodyWeightProvider>(context, listen: false);
|
||||
final weightProvider = Provider.of<BodyWeightProvider>(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(
|
||||
|
||||
@@ -76,13 +76,13 @@ class _LogChartWidgetFlState extends State<LogChartWidgetFl> {
|
||||
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<LogChartWidgetFl> {
|
||||
),
|
||||
titlesData: FlTitlesData(
|
||||
show: true,
|
||||
rightTitles: AxisTitles(
|
||||
rightTitles: const AxisTitles(
|
||||
sideTitles: SideTitles(showTitles: false),
|
||||
),
|
||||
topTitles: AxisTitles(
|
||||
topTitles: const AxisTitles(
|
||||
sideTitles: SideTitles(showTitles: false),
|
||||
),
|
||||
bottomTitles: AxisTitles(
|
||||
|
||||
@@ -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<WorkoutDayWidget> {
|
||||
toggle: _toggleExpanded,
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
,
|
||||
const Divider(),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -209,7 +209,7 @@ class _DayFormWidgetState extends State<DayFormWidget> {
|
||||
},
|
||||
),
|
||||
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<SetFormWidget> {
|
||||
},
|
||||
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<SetFormWidget> {
|
||||
),
|
||||
],
|
||||
);
|
||||
}).toList(),
|
||||
}),
|
||||
ElevatedButton(
|
||||
key: const Key(SUBMIT_BUTTON_KEY_NAME),
|
||||
child: Text(AppLocalizations.of(context).save),
|
||||
@@ -800,7 +800,7 @@ class _RiRInputWidgetState extends State<RiRInputWidget> {
|
||||
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<RiRInputWidget> {
|
||||
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();
|
||||
|
||||
@@ -140,14 +140,14 @@ class _DayLogWidgetState extends State<DayLogWidget> {
|
||||
],
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
,
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 15),
|
||||
child: ExerciseLogChart(base, widget._date),
|
||||
)
|
||||
],
|
||||
);
|
||||
}).toList()
|
||||
})
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user