@@ -11,7 +11,6 @@ import 'package:gsy_github_app_flutter/common/local/LocalStorage.dart';
1111import 'package:gsy_github_app_flutter/common/localization/DefaultLocalizations.dart' ;
1212import 'package:gsy_github_app_flutter/common/model/User.dart' ;
1313import 'package:gsy_github_app_flutter/common/redux/GSYState.dart' ;
14- import 'package:gsy_github_app_flutter/common/redux/LocaleRedux.dart' ;
1514import 'package:gsy_github_app_flutter/common/style/GSYStyle.dart' ;
1615import 'package:gsy_github_app_flutter/common/utils/CommonUtils.dart' ;
1716import 'package:gsy_github_app_flutter/common/utils/NavigatorUtils.dart' ;
@@ -52,6 +51,19 @@ class HomeDrawer extends StatelessWidget {
5251 }, colorList: CommonUtils .getThemeListColor ());
5352 }
5453
54+ showLanguageDialog (BuildContext context, Store store) {
55+ List <String > list = [
56+ CommonUtils .getLocale (context).home_language_default,
57+ CommonUtils .getLocale (context).home_language_zh,
58+ CommonUtils .getLocale (context).home_language_en,
59+ ];
60+ CommonUtils .showCommitOptionDialog (context, list, (index) {
61+ CommonUtils .changeLocale (store, index);
62+ LocalStorage .save (Config .LOCALE , index.toString ());
63+ }, colorList: CommonUtils .getThemeListColor (), height: 150.0 );
64+ }
65+
66+
5567 @override
5668 Widget build (BuildContext context) {
5769 return new StoreBuilder <GSYState >(
@@ -138,6 +150,14 @@ class HomeDrawer extends StatelessWidget {
138150 onTap: () {
139151 showThemeDialog (context, store);
140152 }),
153+ new ListTile (
154+ title: new Text (
155+ CommonUtils .getLocale (context).home_change_language,
156+ style: GSYConstant .normalText,
157+ ),
158+ onTap: () {
159+ showLanguageDialog (context, store);
160+ }),
141161 new ListTile (
142162 title: new Text (
143163 CommonUtils .getLocale (context).home_check_update,
@@ -154,7 +174,6 @@ class HomeDrawer extends StatelessWidget {
154174 onTap: () {
155175 GetVersion .projectVersion.then ((value) {
156176 showAboutDialog (context, value);
157- store.dispatch (RefreshLocaleAction (Locale ('en' , 'US' )));
158177 });
159178 }),
160179 new ListTile (
0 commit comments