Skip to content

Commit

Permalink
Run dart fix on the code base
Browse files Browse the repository at this point in the history
  • Loading branch information
rolandgeider committed Nov 19, 2023
1 parent afba3a8 commit 29a6839
Show file tree
Hide file tree
Showing 44 changed files with 108 additions and 113 deletions.
2 changes: 1 addition & 1 deletion flatpak/scripts/flatpak_shared.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
1 change: 0 additions & 1 deletion lib/helpers/colors.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import 'dart:math';
import 'dart:ui';

const LIST_OF_COLORS8 = [
Expand Down
1 change: 1 addition & 0 deletions lib/helpers/i18n.dart
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/helpers/ui.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
8 changes: 4 additions & 4 deletions lib/models/nutrition/nutritional_plan.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/providers/body_weight.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class BodyWeightProvider with ChangeNotifier {
return [..._entries];
}

void set items(List<WeightEntry> entries) {
set items(List<WeightEntry> entries) {
_entries = entries;
}

Expand Down
4 changes: 2 additions & 2 deletions lib/providers/exercises.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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,
);
}
}
6 changes: 2 additions & 4 deletions lib/providers/gallery.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,15 @@ 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 {
static const _galleryUrlPath = 'gallery';

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() {
Expand Down
1 change: 1 addition & 0 deletions lib/providers/workout_plans.dart
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ class WorkoutPlansProvider with ChangeNotifier {
if (_workoutPlans.isNotEmpty) {
return _workoutPlans.first;
}
return null;
}

/*
Expand Down
8 changes: 4 additions & 4 deletions lib/screens/add_exercise_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand All @@ -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;

Expand Down Expand Up @@ -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) {
Expand Down
9 changes: 4 additions & 5 deletions lib/screens/exercises_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
Expand All @@ -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;

Expand Down
4 changes: 2 additions & 2 deletions lib/widgets/add_exercise/add_exercise_dropdown_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 2 additions & 3 deletions lib/widgets/add_exercise/add_exercise_multiselect_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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>();
Expand Down
4 changes: 2 additions & 2 deletions lib/widgets/add_exercise/add_exercise_text_area.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ import 'package:flutter/material.dart';

class AddExerciseTextArea extends StatelessWidget {
const AddExerciseTextArea({
Key? key,
super.key,
required this.onChange,
required this.title,
this.helperText = '',
this.isRequired = true,
this.isMultiline = false,
this.validator,
this.onSaved,
}) : super(key: key);
});

final ValueChanged<String> onChange;
final bool isRequired;
Expand Down
8 changes: 4 additions & 4 deletions lib/widgets/add_exercise/preview_images.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -52,7 +52,7 @@ class PreviewExerciseImages extends StatelessWidget with ExerciseImagePickerMixi
),
),
)
.toList(),
,
const SizedBox(
width: 10,
),
Expand Down
8 changes: 4 additions & 4 deletions lib/widgets/add_exercise/steps/step2variations.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -48,7 +48,7 @@ class Step2Variations extends StatelessWidget {
overflow: TextOverflow.ellipsis,
),
)
.toList(),
,
const SizedBox(height: 20),
],
),
Expand All @@ -61,7 +61,7 @@ class Step2Variations extends StatelessWidget {
],
),
)
.toList(),
,
// Exercise bases without variations
...exerciseProvider.bases
.where((b) => b.variationId == null)
Expand Down Expand Up @@ -93,7 +93,7 @@ class Step2Variations extends StatelessWidget {
],
),
)
.toList(),
,
],
),
),
Expand Down
4 changes: 2 additions & 2 deletions lib/widgets/add_exercise/steps/step5images.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
)
],
),
Expand Down
3 changes: 1 addition & 2 deletions lib/widgets/core/about.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion lib/widgets/core/core.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion lib/widgets/dashboard/calendar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ class _DashboardCalendarWidgetState extends State<DashboardCalendarWidget>
subtitle: Text(event.description),
//onTap: () => print('$event tapped!'),
))
.toList()

],
),
),
Expand Down
4 changes: 2 additions & 2 deletions lib/widgets/dashboard/widgets.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -509,7 +509,7 @@ class _DashboardWorkoutWidgetState extends State<DashboardWorkoutWidget> {
],
)
: Container();
}).toList(),
}),
],
),
));
Expand Down
12 changes: 6 additions & 6 deletions lib/widgets/exercises/exercises.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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))),
],
),
);
Expand All @@ -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)),
],
),
);
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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(),
,
],
);
}
Expand Down
4 changes: 2 additions & 2 deletions lib/widgets/exercises/filter_modal.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Loading

0 comments on commit 29a6839

Please sign in to comment.