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.

76 lines
2.0 KiB

import 'dart:io' show Platform;
import 'package:flutter/cupertino.dart';
5 years ago
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';
5 years ago
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,
);
},
};
5 years ago
class StartPoint extends StatelessWidget {
final String appTitle = 'Info Tren';
5 years ago
@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),
);
}
5 years ago
}
}