You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

109 lines
3.0 KiB

import 'dart:io' show Platform;
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
// import 'package:flutter_redux/flutter_redux.dart';
import 'package:info_tren/models/ui_design.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';
void main() {
// final store = createStore();
// runApp(
// StoreProvider(
// store: store,
// child: StartPoint(),
// )
// );
runApp(
StartPoint(),
);
}
Map<String, WidgetBuilder> routesByUiDesign(UiDesign uiDesign) => {
Navigator.defaultRouteName: (context) {
return MainPage(
uiDesign: uiDesign,
);
},
AboutPage.routeName: (context) {
return AboutPage(
uiDesign: uiDesign,
);
},
SelectTrainPage.routeName: (context) {
return SelectTrainPage(
uiDesign: uiDesign,
);
},
TrainInfo.routeName: (context) {
final args = ModalRoute.of(context)!.settings.arguments as TrainInfoArguments;
return TrainInfo(
trainNumber: args.trainNumber,
date: args.date,
uiDesign: uiDesign,
);
},
SelectStationPage.routeName: (context) {
return SelectStationPage(
uiDesign: uiDesign,
);
},
ViewStationPage.routeName: (context) {
return ViewStationPage(
stationName: ModalRoute.of(context)!.settings.arguments as String,
uiDesign: uiDesign,
);
},
};
class StartPoint extends StatelessWidget {
final String appTitle = 'Info Tren';
@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: routesByUiDesign(UiDesign.MATERIAL),
);
// }
}
}