Skip to content

Commit

Permalink
Consts and finals where possible
Browse files Browse the repository at this point in the history
  • Loading branch information
Miroslav Mazel committed Nov 5, 2023
1 parent d86ee69 commit f31bcc7
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion integration_test/5_nutritional_plan.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import 'package:wger/theme/theme.dart';
import '../test/user/provider_test.mocks.dart';

Widget createNutritionalPlanScreen({locale = 'en'}) {
var mockBaseProvider = MockWgerBaseProvider();
final mockBaseProvider = MockWgerBaseProvider();

final key = GlobalKey<NavigatorState>();

Expand Down
2 changes: 1 addition & 1 deletion lib/providers/gallery.dart
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ class GalleryProvider extends WgerBaseProvider with ChangeNotifier {
}

Future<void> deleteImage(gallery.Image image) async {
var response = await deleteRequest(_galleryUrlPath, image.id!);
final response = await deleteRequest(_galleryUrlPath, image.id!);
images.removeWhere((element) => element.id == image.id);

notifyListeners();
Expand Down
4 changes: 2 additions & 2 deletions lib/widgets/core/app_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import 'package:wger/widgets/user/forms.dart';
class MainAppBar extends StatelessWidget implements PreferredSizeWidget {
final String _title;

MainAppBar(this._title);
const MainAppBar(this._title);

@override
Widget build(BuildContext context) {
Expand Down Expand Up @@ -116,7 +116,7 @@ class MainAppBar extends StatelessWidget implements PreferredSizeWidget {
class EmptyAppBar extends StatelessWidget implements PreferredSizeWidget {
final String _title;

EmptyAppBar(this._title);
const EmptyAppBar(this._title);

@override
Widget build(BuildContext context) {
Expand Down
2 changes: 1 addition & 1 deletion lib/widgets/core/text_prompt.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class TextPrompt extends StatelessWidget {
style: Theme.of(context).textTheme.headlineMedium,
),
Padding(
padding: EdgeInsets.only(top: 12),
padding: const EdgeInsets.only(top: 12),
child: Text(AppLocalizations.of(context).textPromptSubheading),
),
],
Expand Down
2 changes: 1 addition & 1 deletion lib/widgets/dashboard/widgets.dart
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ class _DashboardMeasurementWidgetState extends State<DashboardMeasurementWidget>
child: Container(
width: 12.0,
height: 12.0,
margin: EdgeInsets.symmetric(vertical: 8.0, horizontal: 4.0),
margin: const EdgeInsets.symmetric(vertical: 8.0, horizontal: 4.0),
decoration: BoxDecoration(
shape: BoxShape.circle,
color: (Theme.of(context).brightness == Brightness.dark
Expand Down
4 changes: 2 additions & 2 deletions lib/widgets/exercises/filter_row.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import 'package:wger/screens/add_exercise_screen.dart';
import 'filter_modal.dart';

class FilterRow extends StatefulWidget {
FilterRow({Key? key}) : super(key: key);
const FilterRow({Key? key}) : super(key: key);

@override
_FilterRowState createState() => _FilterRowState();
Expand Down Expand Up @@ -89,8 +89,8 @@ class _FilterRowState extends State<FilterRow> {
itemBuilder: (context) {
return [
PopupMenuItem<ExerciseMoreOption>(
child: Text(AppLocalizations.of(context).contributeExercise),
value: ExerciseMoreOption.ADD_EXERCISE,
child: Text(AppLocalizations.of(context).contributeExercise),
)
];
},
Expand Down
8 changes: 4 additions & 4 deletions lib/widgets/measurements/categories_card.dart
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
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 '../core/charts.dart';
import 'forms.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';

class CategoriesCard extends StatelessWidget {
MeasurementCategory currentCategory;
double? elevation;
final MeasurementCategory currentCategory;
final double? elevation;

CategoriesCard(this.currentCategory, {this.elevation});
const CategoriesCard(this.currentCategory, {this.elevation});

@override
Widget build(BuildContext context) {
Expand Down

0 comments on commit f31bcc7

Please sign in to comment.