import 'package:flutter/material.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart'; import 'package:info_tren/pages/about/about_page.dart'; import 'package:info_tren/pages/main/main_page.dart'; import 'package:info_tren/pages/station_arrdep_page/select_station/select_station.dart'; import 'package:info_tren/pages/station_arrdep_page/view_station/view_station.dart'; import 'package:info_tren/pages/train_info_page/view_train/train_info.dart'; import 'package:info_tren/pages/train_info_page/select_train/select_train.dart'; import 'package:info_tren/providers.dart'; import 'package:shared_preferences/shared_preferences.dart'; void main() async { final sharedPreferences = await SharedPreferences.getInstance(); runApp( ProviderScope( overrides: [ sharedPreferencesProvider.overrideWithValue(sharedPreferences), ], child: const StartPoint(), ), ); } Map get routes => { Navigator.defaultRouteName: (context) { return const MainPage(); }, AboutPage.routeName: (context) { return const AboutPage(); }, SelectTrainPage.routeName: (context) { return const SelectTrainPage(); }, TrainInfo.routeName: (context) { final args = ModalRoute.of(context)!.settings.arguments as TrainInfoArguments; return ProviderScope( overrides: [ trainInfoArgumentsProvider.overrideWithValue(args), ], child: const TrainInfo(), ); }, SelectStationPage.routeName: (context) { return const SelectStationPage(); }, ViewStationPage.routeName: (context) { final args = ModalRoute.of(context)!.settings.arguments as ViewStationArguments; return ProviderScope( overrides: [ viewStationArgumentsProvider.overrideWithValue(args), ], child: const ViewStationPage(), ); }, }; class StartPoint extends StatelessWidget { final String appTitle = 'Info Tren'; const StartPoint({super.key}); @override Widget build(BuildContext context) { // if (Platform.isIOS || Platform.isMacOS) { // return AnnotatedRegion( // value: const SystemUiOverlayStyle( // statusBarBrightness: Brightness.dark, // ), // child: CupertinoApp( // title: appTitle, // theme: CupertinoThemeData( // primaryColor: Colors.blue.shade600, // brightness: Brightness.dark, // // textTheme: CupertinoTextThemeData( // // textStyle: TextStyle( // // fontFamily: 'Atkinson Hyperlegible', // // ), // // ), // ), // routes: routesByUiDesign(UiDesign.CUPERTINO), // ), // ); // } // else { return MaterialApp( title: appTitle, theme: ThemeData( primarySwatch: Colors.blue, colorScheme: ColorScheme.fromSwatch( brightness: Brightness.dark, primarySwatch: Colors.blue, accentColor: Colors.blue.shade700, ), useMaterial3: true, // fontFamily: 'Atkinson Hyperlegible', ), routes: routes, ); // } } }