fmassive/lib/main.dart

50 lines
1.4 KiB
Dart
Raw Normal View History

2023-03-30 15:19:24 +13:00
import 'package:flutter/material.dart';
2023-04-07 11:50:02 +12:00
import 'package:fmassive/best_page.dart';
import 'package:fmassive/database.dart';
2023-04-07 11:50:02 +12:00
import 'package:fmassive/edit_set.dart';
2023-04-07 15:56:17 +12:00
import 'package:fmassive/gym_set.dart';
2023-04-07 11:50:02 +12:00
import 'package:fmassive/home_page.dart';
import 'package:fmassive/plans_page.dart';
import 'package:fmassive/settings_page.dart';
import 'package:fmassive/timer_page.dart';
import 'package:fmassive/workouts_page.dart';
2023-03-30 15:19:24 +13:00
MyDatabase db = MyDatabase();
2023-03-30 15:19:24 +13:00
void main() {
2023-04-05 12:24:48 +12:00
runApp(MyApp());
2023-03-30 15:19:24 +13:00
}
class MyApp extends StatelessWidget {
2023-04-07 11:50:02 +12:00
MyApp({Key? key}) : super(key: key);
final navigatorKey = GlobalKey<NavigatorState>();
2023-03-30 15:19:24 +13:00
@override
Widget build(BuildContext context) {
2023-04-07 11:50:02 +12:00
final edit = EditGymSetPage(
gymSet: GymSet(name: '', reps: 0, weight: 0, created: DateTime.now()));
final Map<String, WidgetBuilder> routes = {
'/home': (context) => HomePage(),
'/plans': (context) => const PlansPage(),
'/best': (context) => const BestPage(),
'/workouts': (context) => const WorkoutsPage(),
'/timer': (context) => const TimerPage(),
'/settings': (context) => SettingsPage(),
2023-04-07 11:50:02 +12:00
'/edit-set': (context) => edit,
};
2023-03-30 15:19:24 +13:00
return MaterialApp(
2023-04-05 12:24:48 +12:00
title: 'Gym App',
2023-03-30 15:19:24 +13:00
theme: ThemeData(
primarySwatch: Colors.blue,
2023-04-05 12:24:48 +12:00
visualDensity: VisualDensity.adaptivePlatformDensity,
2023-03-30 15:19:24 +13:00
),
2023-04-07 11:50:02 +12:00
initialRoute: '/home',
routes: routes,
navigatorKey: navigatorKey,
2023-03-30 15:19:24 +13:00
);
}
}