80 lines
2.4 KiB
Dart
80 lines
2.4 KiB
Dart
import 'dart:io';
|
|
|
|
import 'package:flutter/foundation.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter/services.dart';
|
|
import 'package:flutter_redux/flutter_redux.dart';
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
import 'package:satu/routes/router.dart';
|
|
import 'package:satu/shared/app_colors.dart';
|
|
import 'package:satu/views/start_up/start_up_view.dart';
|
|
import 'package:satu/widgets/dialog/dialog_manager.dart';
|
|
|
|
import 'core/redux/store.dart';
|
|
import 'core/services/dialog_service.dart';
|
|
import 'core/services/navigator_service.dart';
|
|
import 'core/utils/locator.dart';
|
|
|
|
void main() async {
|
|
WidgetsFlutterBinding.ensureInitialized();
|
|
//initialize locator
|
|
await LocatorInjector.setupLocator();
|
|
|
|
HttpOverrides.global = MyHttpOverrides();
|
|
|
|
LicenseRegistry.addLicense(() async* {
|
|
final license = await rootBundle.loadString('assets/google_fonts/OFL.txt');
|
|
yield LicenseEntryWithLineBreaks(['google_fonts'], license);
|
|
});
|
|
|
|
await Redux.init();
|
|
runApp(MainApplication());
|
|
}
|
|
|
|
class MainApplication extends StatelessWidget {
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return StoreProvider<AppState>(
|
|
store: Redux.store!,
|
|
child: ScreenUtilInit(
|
|
designSize: const Size(
|
|
375,
|
|
812,
|
|
),
|
|
builder: () => MaterialApp(
|
|
theme: ThemeData(
|
|
backgroundColor: backgroundColor,
|
|
primaryColor: whiteColor,
|
|
scaffoldBackgroundColor: backgroundColor,
|
|
colorScheme:
|
|
ColorScheme.fromSwatch().copyWith(secondary: primaryColor),
|
|
// textTheme: GoogleFonts.robotoTextTheme(
|
|
// Theme.of(context).textTheme,
|
|
// )
|
|
),
|
|
debugShowCheckedModeBanner: false,
|
|
builder: (context, child) => Navigator(
|
|
key: locator<DialogService>().dialogNavigationKey,
|
|
onGenerateRoute: (settings) => MaterialPageRoute(
|
|
builder: (context) => DialogManager(child: child!),
|
|
),
|
|
),
|
|
navigatorKey: locator<NavigatorService>().navigatorKey,
|
|
home: StartUpView(),
|
|
// first page
|
|
onGenerateRoute: generateRoute,
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
class MyHttpOverrides extends HttpOverrides {
|
|
@override
|
|
HttpClient createHttpClient(SecurityContext? context) {
|
|
return super.createHttpClient(context)
|
|
..badCertificateCallback =
|
|
(X509Certificate cert, String host, int port) => true;
|
|
}
|
|
}
|