forked from fluttercandies/wechat_flutter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.dart
executable file
·43 lines (41 loc) · 1.45 KB
/
app.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import 'package:flutter/material.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:get/get.dart';
import 'package:oktoast/oktoast.dart';
import 'package:provider/provider.dart';
import 'package:wechat_flutter/pages/login/login_begin_page.dart';
import 'package:wechat_flutter/pages/root/root_page.dart';
import 'package:wechat_flutter/provider/global_model.dart';
import 'package:wechat_flutter/tools/wechat_flutter.dart';
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
final model = Provider.of<GlobalModel>(context)..setContext(context);
return GetMaterialApp(
title: model.appName,
theme: ThemeData(
scaffoldBackgroundColor: bgColor,
hintColor: Colors.grey.withOpacity(0.3),
splashColor: Colors.transparent,
canvasColor: Colors.transparent,
),
debugShowCheckedModeBanner: false,
localizationsDelegates: [
S.delegate,
GlobalCupertinoLocalizations.delegate,
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate
],
supportedLocales: S.delegate.supportedLocales,
locale: model.currentLocale,
routes: {
'/': (context) {
return model.goToLogin ? new LoginBeginPage() : new RootPage();
}
},
builder: (BuildContext context, Widget? widget) {
return OKToast(child: widget ?? Container());
},
);
}
}