mirror of
https://github.com/wger-project/flutter.git
synced 2026-02-18 00:17:48 +01:00
dart fix --apply
This commit is contained in:
@@ -79,7 +79,7 @@ Widget createDashboardScreen({locale = 'en'}) {
|
||||
localizationsDelegates: AppLocalizations.localizationsDelegates,
|
||||
supportedLocales: AppLocalizations.supportedLocales,
|
||||
theme: wgerLightTheme,
|
||||
home: DashboardScreen(),
|
||||
home: const DashboardScreen(),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ Widget createWorkoutDetailScreen({locale = 'en'}) {
|
||||
onPressed: () => key.currentState!.push(
|
||||
MaterialPageRoute<void>(
|
||||
settings: RouteSettings(arguments: workout),
|
||||
builder: (_) => WorkoutPlanScreen(),
|
||||
builder: (_) => const WorkoutPlanScreen(),
|
||||
),
|
||||
),
|
||||
child: const SizedBox(),
|
||||
|
||||
@@ -44,13 +44,13 @@ Widget createGymModeScreen({locale = 'en'}) {
|
||||
onPressed: () => key.currentState!.push(
|
||||
MaterialPageRoute<void>(
|
||||
settings: RouteSettings(arguments: workout.days.first),
|
||||
builder: (_) => GymModeScreen(),
|
||||
builder: (_) => const GymModeScreen(),
|
||||
),
|
||||
),
|
||||
child: const SizedBox(),
|
||||
),
|
||||
routes: {
|
||||
WorkoutPlanScreen.routeName: (ctx) => WorkoutPlanScreen(),
|
||||
WorkoutPlanScreen.routeName: (ctx) => const WorkoutPlanScreen(),
|
||||
},
|
||||
),
|
||||
),
|
||||
|
||||
@@ -25,7 +25,7 @@ Widget createMeasurementScreen({locale = 'en'}) {
|
||||
localizationsDelegates: AppLocalizations.localizationsDelegates,
|
||||
supportedLocales: AppLocalizations.supportedLocales,
|
||||
theme: wgerLightTheme,
|
||||
home: MeasurementCategoriesScreen(),
|
||||
home: const MeasurementCategoriesScreen(),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ Widget createNutritionalPlanScreen({locale = 'en'}) {
|
||||
onPressed: () => key.currentState!.push(
|
||||
MaterialPageRoute<void>(
|
||||
settings: RouteSettings(arguments: getNutritionalPlanScreenshot()),
|
||||
builder: (_) => NutritionalPlanScreen(),
|
||||
builder: (_) => const NutritionalPlanScreen(),
|
||||
),
|
||||
),
|
||||
child: const SizedBox(),
|
||||
|
||||
@@ -35,9 +35,9 @@ Widget createWeightScreen({locale = 'en'}) {
|
||||
localizationsDelegates: AppLocalizations.localizationsDelegates,
|
||||
supportedLocales: AppLocalizations.supportedLocales,
|
||||
theme: wgerLightTheme,
|
||||
home: WeightScreen(),
|
||||
home: const WeightScreen(),
|
||||
routes: {
|
||||
FormScreen.routeName: (ctx) => FormScreen(),
|
||||
FormScreen.routeName: (ctx) => const FormScreen(),
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
@@ -13,7 +13,7 @@ class ServiceLocator {
|
||||
|
||||
const ServiceLocator._internal();
|
||||
|
||||
static final ServiceLocator _singleton = ServiceLocator._internal();
|
||||
static const ServiceLocator _singleton = ServiceLocator._internal();
|
||||
|
||||
Future<void> _initDB() async {
|
||||
ExerciseDatabase exerciseDB;
|
||||
|
||||
@@ -64,7 +64,7 @@ void main() async {
|
||||
// Locator to initialize exerciseDB
|
||||
await ServiceLocator().configure();
|
||||
// Application
|
||||
runApp(MyApp());
|
||||
runApp(const MyApp());
|
||||
}
|
||||
|
||||
class MyApp extends StatelessWidget {
|
||||
@@ -142,30 +142,30 @@ class MyApp extends StatelessWidget {
|
||||
highContrastDarkTheme: wgerDarkThemeHc,
|
||||
themeMode: ThemeMode.system,
|
||||
home: auth.isAuth
|
||||
? HomeTabsScreen()
|
||||
? const HomeTabsScreen()
|
||||
: FutureBuilder(
|
||||
future: auth.tryAutoLogin(),
|
||||
builder: (ctx, authResultSnapshot) =>
|
||||
authResultSnapshot.connectionState == ConnectionState.waiting
|
||||
? SplashScreen()
|
||||
: AuthScreen(),
|
||||
? const SplashScreen()
|
||||
: const AuthScreen(),
|
||||
),
|
||||
routes: {
|
||||
DashboardScreen.routeName: (ctx) => DashboardScreen(),
|
||||
FormScreen.routeName: (ctx) => FormScreen(),
|
||||
DashboardScreen.routeName: (ctx) => const DashboardScreen(),
|
||||
FormScreen.routeName: (ctx) => const FormScreen(),
|
||||
GalleryScreen.routeName: (ctx) => const GalleryScreen(),
|
||||
GymModeScreen.routeName: (ctx) => GymModeScreen(),
|
||||
HomeTabsScreen.routeName: (ctx) => HomeTabsScreen(),
|
||||
MeasurementCategoriesScreen.routeName: (ctx) => MeasurementCategoriesScreen(),
|
||||
MeasurementEntriesScreen.routeName: (ctx) => MeasurementEntriesScreen(),
|
||||
NutritionalPlansScreen.routeName: (ctx) => NutritionalPlansScreen(),
|
||||
NutritionalDiaryScreen.routeName: (ctx) => NutritionalDiaryScreen(),
|
||||
NutritionalPlanScreen.routeName: (ctx) => NutritionalPlanScreen(),
|
||||
LogMealsScreen.routeName: (ctx) => LogMealsScreen(),
|
||||
LogMealScreen.routeName: (ctx) => LogMealScreen(),
|
||||
WeightScreen.routeName: (ctx) => WeightScreen(),
|
||||
WorkoutPlanScreen.routeName: (ctx) => WorkoutPlanScreen(),
|
||||
WorkoutPlansScreen.routeName: (ctx) => WorkoutPlansScreen(),
|
||||
GymModeScreen.routeName: (ctx) => const GymModeScreen(),
|
||||
HomeTabsScreen.routeName: (ctx) => const HomeTabsScreen(),
|
||||
MeasurementCategoriesScreen.routeName: (ctx) => const MeasurementCategoriesScreen(),
|
||||
MeasurementEntriesScreen.routeName: (ctx) => const MeasurementEntriesScreen(),
|
||||
NutritionalPlansScreen.routeName: (ctx) => const NutritionalPlansScreen(),
|
||||
NutritionalDiaryScreen.routeName: (ctx) => const NutritionalDiaryScreen(),
|
||||
NutritionalPlanScreen.routeName: (ctx) => const NutritionalPlanScreen(),
|
||||
LogMealsScreen.routeName: (ctx) => const LogMealsScreen(),
|
||||
LogMealScreen.routeName: (ctx) => const LogMealScreen(),
|
||||
WeightScreen.routeName: (ctx) => const WeightScreen(),
|
||||
WorkoutPlanScreen.routeName: (ctx) => const WorkoutPlanScreen(),
|
||||
WorkoutPlansScreen.routeName: (ctx) => const WorkoutPlansScreen(),
|
||||
ExercisesScreen.routeName: (ctx) => const ExercisesScreen(),
|
||||
ExerciseDetailScreen.routeName: (ctx) => const ExerciseDetailScreen(),
|
||||
AddExerciseScreen.routeName: (ctx) => const AddExerciseScreen(),
|
||||
|
||||
@@ -43,7 +43,7 @@ class MeasurementCategory extends Equatable {
|
||||
MeasurementEntry findEntryById(entryId) {
|
||||
return entries.firstWhere(
|
||||
(entry) => entry.id == entryId,
|
||||
orElse: () => throw NoSuchEntryException(),
|
||||
orElse: () => throw const NoSuchEntryException(),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -182,7 +182,7 @@ class ExercisesProvider with ChangeNotifier {
|
||||
Exercise findExerciseById(int id) {
|
||||
return exercises.firstWhere(
|
||||
(base) => base.id == id,
|
||||
orElse: () => throw NoSuchEntryException(),
|
||||
orElse: () => throw const NoSuchEntryException(),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -208,7 +208,7 @@ class ExercisesProvider with ChangeNotifier {
|
||||
ExerciseCategory findCategoryById(int id) {
|
||||
return _categories.firstWhere(
|
||||
(cat) => cat.id == id,
|
||||
orElse: () => throw NoSuchEntryException(),
|
||||
orElse: () => throw const NoSuchEntryException(),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -216,7 +216,7 @@ class ExercisesProvider with ChangeNotifier {
|
||||
Equipment findEquipmentById(int id) {
|
||||
return _equipment.firstWhere(
|
||||
(equipment) => equipment.id == id,
|
||||
orElse: () => throw NoSuchEntryException(),
|
||||
orElse: () => throw const NoSuchEntryException(),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -224,7 +224,7 @@ class ExercisesProvider with ChangeNotifier {
|
||||
Muscle findMuscleById(int id) {
|
||||
return _muscles.firstWhere(
|
||||
(muscle) => muscle.id == id,
|
||||
orElse: () => throw NoSuchEntryException(),
|
||||
orElse: () => throw const NoSuchEntryException(),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -232,7 +232,7 @@ class ExercisesProvider with ChangeNotifier {
|
||||
Language findLanguageById(int id) {
|
||||
return _languages.firstWhere(
|
||||
(language) => language.id == id,
|
||||
orElse: () => throw NoSuchEntryException(),
|
||||
orElse: () => throw const NoSuchEntryException(),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ class MeasurementProvider with ChangeNotifier {
|
||||
MeasurementCategory findCategoryById(int id) {
|
||||
return _categories.firstWhere(
|
||||
(category) => category.id == id,
|
||||
orElse: () => throw NoSuchEntryException(),
|
||||
orElse: () => throw const NoSuchEntryException(),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ class NutritionPlansProvider with ChangeNotifier {
|
||||
NutritionalPlan findById(int id) {
|
||||
return _plans.firstWhere(
|
||||
(plan) => plan.id == id,
|
||||
orElse: () => throw NoSuchEntryException(),
|
||||
orElse: () => throw const NoSuchEntryException(),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -211,7 +211,7 @@ class _AuthCardState extends State<AuthCard> {
|
||||
if (res.containsKey('action')) {
|
||||
if (res['action'] == LoginActions.update && mounted) {
|
||||
Navigator.of(context).push(
|
||||
MaterialPageRoute(builder: (context) => UpdateAppScreen()),
|
||||
MaterialPageRoute(builder: (context) => const UpdateAppScreen()),
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -35,15 +35,15 @@ class _DashboardScreenState extends State<DashboardScreen> {
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: MainAppBar(AppLocalizations.of(context).labelDashboard),
|
||||
body: SingleChildScrollView(
|
||||
padding: const EdgeInsets.all(10),
|
||||
body: const SingleChildScrollView(
|
||||
padding: EdgeInsets.all(10),
|
||||
child: Column(
|
||||
children: [
|
||||
DashboardWorkoutWidget(),
|
||||
DashboardNutritionWidget(),
|
||||
DashboardWeightWidget(),
|
||||
DashboardMeasurementWidget(),
|
||||
const DashboardCalendarWidget(),
|
||||
DashboardCalendarWidget(),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@@ -63,10 +63,10 @@ class _HomeTabsScreenState extends State<HomeTabsScreen> with SingleTickerProvid
|
||||
}
|
||||
|
||||
final _screenList = [
|
||||
DashboardScreen(),
|
||||
WorkoutPlansScreen(),
|
||||
NutritionalPlansScreen(),
|
||||
WeightScreen(),
|
||||
const DashboardScreen(),
|
||||
const WorkoutPlansScreen(),
|
||||
const NutritionalPlansScreen(),
|
||||
const WeightScreen(),
|
||||
const GalleryScreen(),
|
||||
];
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ class MeasurementCategoriesScreen extends StatelessWidget {
|
||||
},
|
||||
),
|
||||
body: Consumer<MeasurementProvider>(
|
||||
builder: (context, provider, child) => CategoriesList(),
|
||||
builder: (context, provider, child) => const CategoriesList(),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ class WeightScreen extends StatelessWidget {
|
||||
},
|
||||
),
|
||||
body: Consumer<BodyWeightProvider>(
|
||||
builder: (context, workoutProvider, child) => WeightEntriesList(),
|
||||
builder: (context, workoutProvider, child) => const WeightEntriesList(),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ class WorkoutPlansScreen extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: WorkoutOverviewAppBar(),
|
||||
appBar: const WorkoutOverviewAppBar(),
|
||||
floatingActionButton: FloatingActionButton(
|
||||
onPressed: () {
|
||||
Navigator.pushNamed(
|
||||
|
||||
@@ -40,7 +40,7 @@ class Gallery extends StatelessWidget {
|
||||
child: RefreshIndicator(
|
||||
onRefresh: () => provider.fetchAndSetGallery(),
|
||||
child: provider.images.isEmpty
|
||||
? TextPrompt()
|
||||
? const TextPrompt()
|
||||
: MasonryGridView.count(
|
||||
crossAxisCount: 2,
|
||||
mainAxisSpacing: 5,
|
||||
|
||||
@@ -33,7 +33,7 @@ class NutritionalPlansList extends StatelessWidget {
|
||||
return RefreshIndicator(
|
||||
onRefresh: () => _nutritionProvider.fetchAndSetAllPlansSparse(),
|
||||
child: _nutritionProvider.items.isEmpty
|
||||
? TextPrompt()
|
||||
? const TextPrompt()
|
||||
: ListView.builder(
|
||||
padding: const EdgeInsets.all(10.0),
|
||||
itemCount: _nutritionProvider.items.length,
|
||||
|
||||
@@ -92,7 +92,7 @@ class _IngredientTypeaheadState extends State<IngredientTypeahead> {
|
||||
Future<String> readerscan(BuildContext context) async {
|
||||
try {
|
||||
final code = await Navigator.of(context)
|
||||
.push<String?>(MaterialPageRoute(builder: (context) => ScanReader()));
|
||||
.push<String?>(MaterialPageRoute(builder: (context) => const ScanReader()));
|
||||
if (code == null) {
|
||||
return '';
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ class WorkoutPlansList extends StatelessWidget {
|
||||
return RefreshIndicator(
|
||||
onRefresh: () => _workoutProvider.fetchAndSetAllPlansSparse(),
|
||||
child: _workoutProvider.items.isEmpty
|
||||
? TextPrompt()
|
||||
? const TextPrompt()
|
||||
: ListView.builder(
|
||||
padding: const EdgeInsets.all(10.0),
|
||||
itemCount: _workoutProvider.items.length,
|
||||
|
||||
@@ -63,10 +63,10 @@ void main() {
|
||||
ChangeNotifierProvider(create: (ctx) => authProvider),
|
||||
],
|
||||
child: Consumer<AuthProvider>(
|
||||
builder: (ctx, auth, _) => MaterialApp(
|
||||
builder: (ctx, auth, _) => const MaterialApp(
|
||||
localizationsDelegates: AppLocalizations.localizationsDelegates,
|
||||
supportedLocales: AppLocalizations.supportedLocales,
|
||||
locale: const Locale('en'),
|
||||
locale: Locale('en'),
|
||||
home: AuthScreen(),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -49,7 +49,7 @@ void main() {
|
||||
supportedLocales: AppLocalizations.supportedLocales,
|
||||
home: const Gallery(),
|
||||
routes: {
|
||||
FormScreen.routeName: (ctx) => FormScreen(),
|
||||
FormScreen.routeName: (ctx) => const FormScreen(),
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
@@ -55,7 +55,7 @@ void main() {
|
||||
locale: Locale(locale),
|
||||
localizationsDelegates: AppLocalizations.localizationsDelegates,
|
||||
supportedLocales: AppLocalizations.supportedLocales,
|
||||
home: MeasurementCategoriesScreen(),
|
||||
home: const MeasurementCategoriesScreen(),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ void main() {
|
||||
onPressed: () => key.currentState!.push(
|
||||
MaterialPageRoute<void>(
|
||||
settings: const RouteSettings(arguments: 1),
|
||||
builder: (_) => MeasurementEntriesScreen(),
|
||||
builder: (_) => const MeasurementEntriesScreen(),
|
||||
),
|
||||
),
|
||||
child: Container(),
|
||||
|
||||
@@ -64,7 +64,7 @@ void main() {
|
||||
body: MealForm(1, meal),
|
||||
),
|
||||
routes: {
|
||||
NutritionalPlanScreen.routeName: (ctx) => NutritionalPlanScreen(),
|
||||
NutritionalPlanScreen.routeName: (ctx) => const NutritionalPlanScreen(),
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
@@ -105,7 +105,7 @@ void main() {
|
||||
),
|
||||
),
|
||||
routes: {
|
||||
NutritionalPlanScreen.routeName: (ctx) => NutritionalPlanScreen(),
|
||||
NutritionalPlanScreen.routeName: (ctx) => const NutritionalPlanScreen(),
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
@@ -62,7 +62,7 @@ void main() {
|
||||
body: PlanForm(plan),
|
||||
),
|
||||
routes: {
|
||||
NutritionalPlanScreen.routeName: (ctx) => NutritionalPlanScreen(),
|
||||
NutritionalPlanScreen.routeName: (ctx) => const NutritionalPlanScreen(),
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
@@ -57,7 +57,7 @@ void main() {
|
||||
onPressed: () => key.currentState!.push(
|
||||
MaterialPageRoute<void>(
|
||||
settings: RouteSettings(arguments: plan),
|
||||
builder: (_) => NutritionalPlanScreen(),
|
||||
builder: (_) => const NutritionalPlanScreen(),
|
||||
),
|
||||
),
|
||||
child: const SizedBox(),
|
||||
|
||||
@@ -73,9 +73,9 @@ void main() {
|
||||
locale: Locale(locale),
|
||||
localizationsDelegates: AppLocalizations.localizationsDelegates,
|
||||
supportedLocales: AppLocalizations.supportedLocales,
|
||||
home: NutritionalPlansScreen(),
|
||||
home: const NutritionalPlansScreen(),
|
||||
routes: {
|
||||
FormScreen.routeName: (ctx) => FormScreen(),
|
||||
FormScreen.routeName: (ctx) => const FormScreen(),
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
@@ -56,9 +56,9 @@ void main() {
|
||||
locale: Locale(locale),
|
||||
localizationsDelegates: AppLocalizations.localizationsDelegates,
|
||||
supportedLocales: AppLocalizations.supportedLocales,
|
||||
home: WeightScreen(),
|
||||
home: const WeightScreen(),
|
||||
routes: {
|
||||
FormScreen.routeName: (_) => FormScreen(),
|
||||
FormScreen.routeName: (_) => const FormScreen(),
|
||||
},
|
||||
),
|
||||
),
|
||||
|
||||
@@ -61,13 +61,13 @@ void main() {
|
||||
onPressed: () => key.currentState!.push(
|
||||
MaterialPageRoute<void>(
|
||||
settings: RouteSettings(arguments: workoutPlan.days.first),
|
||||
builder: (_) => GymModeScreen(),
|
||||
builder: (_) => const GymModeScreen(),
|
||||
),
|
||||
),
|
||||
child: const SizedBox(),
|
||||
),
|
||||
routes: {
|
||||
WorkoutPlanScreen.routeName: (ctx) => WorkoutPlanScreen(),
|
||||
WorkoutPlanScreen.routeName: (ctx) => const WorkoutPlanScreen(),
|
||||
},
|
||||
),
|
||||
),
|
||||
|
||||
@@ -68,7 +68,7 @@ void main() {
|
||||
body: RepetitionUnitInputWidget(setting1),
|
||||
),
|
||||
routes: {
|
||||
WorkoutPlanScreen.routeName: (ctx) => WorkoutPlanScreen(),
|
||||
WorkoutPlanScreen.routeName: (ctx) => const WorkoutPlanScreen(),
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
@@ -69,7 +69,7 @@ void main() {
|
||||
body: WeightUnitInputWidget(setting1),
|
||||
),
|
||||
routes: {
|
||||
WorkoutPlanScreen.routeName: (ctx) => WorkoutPlanScreen(),
|
||||
WorkoutPlanScreen.routeName: (ctx) => const WorkoutPlanScreen(),
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
@@ -63,7 +63,7 @@ void main() {
|
||||
body: WorkoutForm(workoutPlan),
|
||||
),
|
||||
routes: {
|
||||
WorkoutPlanScreen.routeName: (ctx) => WorkoutPlanScreen(),
|
||||
WorkoutPlanScreen.routeName: (ctx) => const WorkoutPlanScreen(),
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
@@ -52,13 +52,13 @@ void main() {
|
||||
onPressed: () => key.currentState!.push(
|
||||
MaterialPageRoute<void>(
|
||||
settings: RouteSettings(arguments: getWorkout()),
|
||||
builder: (_) => WorkoutPlanScreen(),
|
||||
builder: (_) => const WorkoutPlanScreen(),
|
||||
),
|
||||
),
|
||||
child: const SizedBox(),
|
||||
),
|
||||
routes: {
|
||||
WorkoutPlanScreen.routeName: (ctx) => WorkoutPlanScreen(),
|
||||
WorkoutPlanScreen.routeName: (ctx) => const WorkoutPlanScreen(),
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
@@ -70,9 +70,9 @@ void main() {
|
||||
locale: Locale(locale),
|
||||
localizationsDelegates: AppLocalizations.localizationsDelegates,
|
||||
supportedLocales: AppLocalizations.supportedLocales,
|
||||
home: WorkoutPlansScreen(),
|
||||
home: const WorkoutPlansScreen(),
|
||||
routes: {
|
||||
FormScreen.routeName: (ctx) => FormScreen(),
|
||||
FormScreen.routeName: (ctx) => const FormScreen(),
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user