1
0
mirror of https://github.com/git-touch/git-touch synced 2024-12-19 11:43:30 +01:00
git-touch-android-ios-app/lib/main.dart

111 lines
3.6 KiB
Dart
Raw Normal View History

2018-04-18 14:38:28 +02:00
import 'package:flutter/material.dart';
2019-01-22 16:39:44 +01:00
import 'package:flutter/cupertino.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-01-04 06:28:29 +01:00
import 'package:git_touch/screens/about.dart';
2020-01-12 10:13:48 +01:00
import 'package:git_touch/screens/code_theme.dart';
2019-12-12 13:29:56 +01:00
import 'package:git_touch/screens/commits.dart';
2020-01-29 11:50:17 +01:00
import 'package:git_touch/screens/gitea_repo.dart';
import 'package:git_touch/screens/gitea_user.dart';
2019-12-14 17:08:12 +01:00
import 'package:git_touch/screens/gitlab_blob.dart';
2020-01-28 15:10:44 +01:00
import 'package:git_touch/screens/gitlab_commits.dart';
import 'package:git_touch/screens/gitlab_issue.dart';
2020-01-28 16:39:26 +01:00
import 'package:git_touch/screens/gitlab_issues.dart';
2020-01-28 16:43:47 +01:00
import 'package:git_touch/screens/gitlab_merge_requests.dart';
2019-12-14 17:08:12 +01:00
import 'package:git_touch/screens/gitlab_project.dart';
import 'package:git_touch/screens/gitlab_tree.dart';
2019-12-11 15:26:04 +01:00
import 'package:git_touch/screens/gitlab_user.dart';
2019-12-12 13:29:56 +01:00
import 'package:git_touch/screens/issue_form.dart';
2019-09-13 11:45:09 +02:00
import 'package:git_touch/screens/issues.dart';
2019-12-12 13:29:56 +01:00
import 'package:git_touch/screens/object.dart';
2020-01-28 16:19:05 +01:00
import 'package:git_touch/screens/pulls.dart';
2019-09-23 12:28:33 +02:00
import 'package:git_touch/screens/repository.dart';
2019-12-12 15:02:58 +01:00
import 'package:git_touch/screens/settings.dart';
2019-12-13 06:40:05 +01:00
import 'package:git_touch/screens/stargazers.dart';
2019-09-13 11:00:45 +02:00
import 'package:git_touch/screens/user.dart';
2019-12-13 06:40:05 +01:00
import 'package:git_touch/screens/watchers.dart';
2019-12-25 03:41:51 +01:00
import 'package:git_touch/utils/utils.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';
2019-12-30 13:55:37 +01:00
import 'package:git_touch/screens/login.dart';
import 'package:git_touch/screens/issue.dart';
import 'package:fimber/fimber.dart';
2018-04-18 14:38:28 +02:00
void main() async {
2019-11-05 08:09:54 +01:00
WidgetsFlutterBinding.ensureInitialized();
2019-02-07 07:35:19 +01:00
// Platform messages may fail, so we use a try/catch PlatformException.
// try {
// String initialLink = await getInitialLink();
// Fimber.d(initialLink);
2019-02-07 07:35:19 +01:00
// } on PlatformException {
// Fimber.d('test');
2019-02-07 07:35:19 +01:00
// }
// DeviceInfoPlugin deviceInfo = DeviceInfoPlugin();
// AndroidDeviceInfo androidInfo = await deviceInfo.androidInfo;
// Fimber.d('Running on ${androidInfo.model}'); // e.g. "Moto G (4)"
// IosDeviceInfo iosInfo = await deviceInfo.iosInfo;
// Fimber.d('Running on ${iosInfo.utsname.machine}'); // e.g. "iPod7,1"
// TODO: Later, should check to enable debug log in debug build only
Fimber.plantTree(DebugTree());
2019-11-05 08:09:54 +01:00
final notificationModel = NotificationModel();
final themeModel = ThemeModel();
final authModel = AuthModel();
final codeModel = CodeModel();
await Future.wait([
themeModel.init(),
authModel.init(),
codeModel.init(),
]);
2019-12-25 03:41:51 +01:00
final List<RouterScreen> routers = [
2020-01-12 10:13:48 +01:00
codeThemeRouter,
2020-01-04 06:28:29 +01:00
aboutRouter,
2019-12-30 13:55:37 +01:00
gitlabUserRouter,
2019-12-14 17:08:12 +01:00
gitlabBlobRouter,
gitlabTreeRouter,
gitlabProjectRouter,
gitlabIssueRouter,
2020-01-28 16:39:26 +01:00
gitlabIssuesRouter,
2020-01-28 16:43:47 +01:00
gitlabMergeRequestsRouter,
2020-01-28 15:10:44 +01:00
gitlabCommitsRouter,
2020-01-29 11:50:17 +01:00
giteaUserRouter,
giteaRepoRouter,
2019-12-13 06:13:45 +01:00
loginRouter,
settingsRouter,
userRouter,
repositoryRouter,
2020-01-07 08:55:39 +01:00
issueAddRouter,
2019-12-13 06:13:45 +01:00
issuesRouter,
pullsRouter,
issueRouter,
pullRouter,
commitsRouter,
objectRouter,
2019-12-13 06:40:05 +01:00
stargazersRouter,
watchersRouter,
2019-12-13 06:13:45 +01:00
];
2019-12-12 13:29:56 +01:00
2019-12-13 06:13:45 +01:00
routers.forEach((screen) {
themeModel.router
.define(screen.path, handler: Handler(handlerFunc: screen.handler));
});
2019-11-05 08:09:54 +01:00
runApp(MultiProvider(
providers: [
2019-12-07 16:12:31 +01:00
ChangeNotifierProvider(create: (context) => notificationModel),
ChangeNotifierProvider(create: (context) => themeModel),
ChangeNotifierProvider(create: (context) => authModel),
ChangeNotifierProvider(create: (context) => codeModel),
2019-11-05 08:09:54 +01:00
],
2020-01-14 11:13:07 +01:00
child: MyApp(),
2019-11-05 08:09:54 +01:00
));
}