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