1+ import 'dart:async' ;
2+
3+ import 'package:flutter/foundation.dart' ;
14import 'package:flutter/material.dart' ;
25import 'package:gsy_github_app_flutter/common/redux/GSYState.dart' ;
36import 'package:gsy_github_app_flutter/common/model/User.dart' ;
47import 'package:gsy_github_app_flutter/common/style/GSYStyle.dart' ;
58import 'package:gsy_github_app_flutter/page/HomePage.dart' ;
69import 'package:gsy_github_app_flutter/page/LoginPage.dart' ;
7- import 'package:gsy_github_app_flutter/page/PersonPage.dart' ;
810import 'package:gsy_github_app_flutter/page/WelcomePage.dart' ;
911import 'package:flutter_redux/flutter_redux.dart' ;
1012import 'package:redux/redux.dart' ;
@@ -14,8 +16,7 @@ void main() {
1416}
1517
1618class FlutterReduxApp extends StatelessWidget {
17- final store = new Store <GSYState >(appReducer,
18- initialState: new GSYState (userInfo: User .empty (), eventList: new List ()));
19+ final store = new Store <GSYState >(appReducer, initialState: new GSYState (userInfo: User .empty (), eventList: new List ()));
1920
2021 FlutterReduxApp ({Key key}) : super (key: key);
2122
@@ -24,6 +25,13 @@ class FlutterReduxApp extends StatelessWidget {
2425 return new StoreProvider (
2526 store: store,
2627 child: new MaterialApp (
28+ localizationsDelegates: [
29+ _MaterialLocalizationsDelegate (),
30+ ],
31+ supportedLocales: [
32+ const Locale ('zh' , 'US' ), // English
33+ // ... other locales the app supports
34+ ],
2735 theme: new ThemeData (
2836 primarySwatch: GSYColors .primarySwatch,
2937 ),
@@ -41,3 +49,27 @@ class FlutterReduxApp extends StatelessWidget {
4149 );
4250 }
4351}
52+
53+ class GSYMaterialLocalizations extends DefaultMaterialLocalizations {
54+ const GSYMaterialLocalizations ();
55+
56+ @override
57+ String get viewLicensesButtonLabel => GSYStrings .app_licenses;
58+
59+ String get closeButtonLabel => GSYStrings .app_close;
60+ }
61+
62+ class _MaterialLocalizationsDelegate extends LocalizationsDelegate <MaterialLocalizations > {
63+ const _MaterialLocalizationsDelegate ();
64+
65+ @override
66+ bool isSupported (Locale locale) => locale.languageCode == 'zh' ;
67+
68+ @override
69+ Future <MaterialLocalizations > load (Locale locale) {
70+ return new SynchronousFuture <MaterialLocalizations >(const GSYMaterialLocalizations ());
71+ }
72+
73+ @override
74+ bool shouldReload (_MaterialLocalizationsDelegate old) => false ;
75+ }
0 commit comments