selfprivacy.org.app/lib/main.dart

48 lines
1.5 KiB
Dart
Raw Normal View History

2020-11-29 20:07:46 +00:00
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
2021-01-06 17:35:57 +00:00
import 'package:selfprivacy/config/hive_config.dart';
import 'package:selfprivacy/ui/pages/initializing/initializing.dart';
2020-11-29 20:07:46 +00:00
import 'package:selfprivacy/ui/pages/onboarding/onboarding.dart';
2020-12-01 12:26:29 +00:00
import 'package:easy_localization/easy_localization.dart';
2020-12-03 16:52:53 +00:00
import 'package:selfprivacy/ui/pages/rootRoute.dart';
2020-12-01 19:08:19 +00:00
import 'config/bloc_config.dart';
2020-11-29 20:07:46 +00:00
import 'config/brand_theme.dart';
2020-12-01 12:26:29 +00:00
import 'config/localization.dart';
2020-12-08 19:26:51 +00:00
import 'logic/cubit/app_settings/app_settings_cubit.dart';
2020-11-29 20:07:46 +00:00
2021-01-06 17:35:57 +00:00
void main() async {
await HiveConfig.init();
2020-12-01 12:26:29 +00:00
WidgetsFlutterBinding.ensureInitialized();
runApp(
Localization(
2020-12-01 19:08:19 +00:00
child: BlocAndProviderConfig(
child: MyApp(),
),
2020-12-01 12:26:29 +00:00
),
);
2020-11-29 20:07:46 +00:00
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
2021-01-06 17:35:57 +00:00
var appSettings = context.watch<AppSettingsCubit>().state;
2020-11-29 20:07:46 +00:00
return AnnotatedRegion<SystemUiOverlayStyle>(
value: SystemUiOverlayStyle.light, // Manually changnig appbar color
child: MaterialApp(
2020-12-01 12:26:29 +00:00
localizationsDelegates: context.localizationDelegates,
supportedLocales: context.supportedLocales,
locale: context.locale,
2020-11-29 20:07:46 +00:00
debugShowCheckedModeBanner: false,
title: 'SelfPrivacy',
2021-01-06 17:35:57 +00:00
theme: appSettings.isDarkModeOn ? darkTheme : ligtTheme,
home: appSettings.isOnbordingShowing
? OnboardingPage(nextPage: InitializingPage())
: RootPage(),
2020-11-29 20:07:46 +00:00
),
);
}
}