git-touch-android-ios-app/lib/main.dart

79 lines
2.9 KiB
Dart
Raw Normal View History

2018-04-18 14:38:28 +02:00
import 'package:flutter/material.dart';
2020-01-14 11:13:07 +01:00
import 'package:git_touch/app.dart';
2019-09-15 11:36:09 +02:00
import 'package:git_touch/models/code.dart';
2019-09-27 14:52:38 +02:00
import 'package:git_touch/models/auth.dart';
import 'package:git_touch/models/theme.dart';
2020-02-01 06:26:14 +01:00
import 'package:git_touch/router.dart';
2021-07-20 08:33:34 +02:00
import 'package:google_fonts/google_fonts.dart';
2019-09-02 14:40:20 +02:00
import 'package:provider/provider.dart';
import 'package:git_touch/models/notification.dart';
2019-12-12 13:29:56 +01:00
import 'package:fluro/fluro.dart';
import 'package:flutter/services.dart';
2021-06-14 08:35:10 +02:00
import 'package:sentry_flutter/sentry_flutter.dart';
2018-04-18 14:38:28 +02:00
void main() async {
2021-06-14 08:35:10 +02:00
await SentryFlutter.init(
(options) {
options.dsn =
'https://006354525fa244289c48169790fa3757@o71119.ingest.sentry.io/5814819';
},
// Init your App.
appRunner: () async {
2021-07-20 08:33:34 +02:00
GoogleFonts.config.allowRuntimeFetching = false;
2021-06-14 08:35:10 +02:00
final notificationModel = NotificationModel();
final themeModel = ThemeModel();
final authModel = AuthModel();
final codeModel = CodeModel();
await Future.wait([
themeModel.init(),
authModel.init(),
codeModel.init(),
]);
2019-02-07 07:35:19 +01:00
2022-09-06 18:28:12 +02:00
for (var screen in CommonRouter.routes) {
2021-06-14 08:35:10 +02:00
themeModel.router.define(CommonRouter.prefix + screen.path,
handler: Handler(handlerFunc: screen.handler));
2022-09-06 18:28:12 +02:00
}
for (var screen in GitlabRouter.routes) {
2021-06-14 08:35:10 +02:00
themeModel.router.define(GitlabRouter.prefix + screen.path,
handler: Handler(handlerFunc: screen.handler));
2022-09-06 18:28:12 +02:00
}
for (var screen in GiteaRouter.routes) {
2021-06-14 08:35:10 +02:00
themeModel.router.define(GiteaRouter.prefix + screen.path,
handler: Handler(handlerFunc: screen.handler));
2022-09-06 18:28:12 +02:00
}
for (var screen in BitbucketRouter.routes) {
2021-06-14 08:35:10 +02:00
themeModel.router.define(BitbucketRouter.prefix + screen.path,
handler: Handler(handlerFunc: screen.handler));
2022-09-06 18:28:12 +02:00
}
for (var screen in GithubRouter.routes) {
2021-06-14 08:35:10 +02:00
themeModel.router.define(GithubRouter.prefix + screen.path,
handler: Handler(handlerFunc: screen.handler));
2022-09-06 18:28:12 +02:00
}
for (var screen in GiteeRouter.routes) {
2021-06-14 08:35:10 +02:00
themeModel.router.define(GiteeRouter.prefix + screen.path,
handler: Handler(handlerFunc: screen.handler));
2022-09-06 18:28:12 +02:00
}
for (var screen in GogsRouter.routes) {
2021-06-14 08:35:10 +02:00
themeModel.router.define(GogsRouter.prefix + screen.path,
handler: Handler(handlerFunc: screen.handler));
2022-09-06 18:28:12 +02:00
}
2021-06-14 08:35:10 +02:00
// To match status bar color to app bar color
2022-09-06 18:28:12 +02:00
SystemChrome.setSystemUIOverlayStyle(const SystemUiOverlayStyle(
2021-06-14 08:35:10 +02:00
statusBarColor: Colors.transparent,
));
2021-06-14 08:35:10 +02:00
runApp(MultiProvider(
providers: [
ChangeNotifierProvider(create: (context) => notificationModel),
ChangeNotifierProvider(create: (context) => themeModel),
ChangeNotifierProvider(create: (context) => authModel),
ChangeNotifierProvider(create: (context) => codeModel),
],
child: MyApp(),
));
},
);
}