|
|
|
import 'dart:io' show Platform;
|
|
|
|
|
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
// import 'package:flutter_redux/flutter_redux.dart';
|
|
|
|
import 'package:info_tren/models/ui_design.dart';
|
|
|
|
import 'package:info_tren/pages/main/main_page.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,);
|
|
|
|
},
|
|
|
|
SelectTrainPage.routeName: (context) {
|
|
|
|
return SelectTrainPage(uiDesign: uiDesign);
|
|
|
|
},
|
|
|
|
TrainInfo.routeName: (context) {
|
|
|
|
return TrainInfo(
|
|
|
|
trainNumber: 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 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,
|
|
|
|
brightness: Brightness.dark,
|
|
|
|
primaryColor: Colors.blue.shade600,
|
|
|
|
accentColor: Colors.blue.shade700,
|
|
|
|
// fontFamily: 'Atkinson Hyperlegible',
|
|
|
|
),
|
|
|
|
routes: routesByUiDesign(UiDesign.MATERIAL),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|