@@ -19,6 +19,7 @@ import 'package:redux/redux.dart';
1919import 'package:gsy_github_app_flutter/common/net/code.dart' ;
2020
2121import 'common/event/index.dart' ;
22+ import 'common/utils/navigator_utils.dart' ;
2223
2324void main () {
2425 runZoned (() {
@@ -38,7 +39,10 @@ class FlutterReduxApp extends StatelessWidget {
3839 middleware: middleware,
3940
4041 ///初始化数据
41- initialState: new GSYState (userInfo: User .empty (), themeData: CommonUtils .getThemeData (GSYColors .primarySwatch), locale: Locale ('zh' , 'CH' )),
42+ initialState: new GSYState (
43+ userInfo: User .empty (),
44+ themeData: CommonUtils .getThemeData (GSYColors .primarySwatch),
45+ locale: Locale ('zh' , 'CH' )),
4246 );
4347
4448 FlutterReduxApp ({Key key}) : super (key: key);
@@ -68,13 +72,11 @@ class FlutterReduxApp extends StatelessWidget {
6872 HomePage .sName: (context) {
6973 ///通过 Localizations.override 包裹一层,
7074 return new GSYLocalizations (
71- child: new HomePage (),
72- );
75+ child: NavigatorUtils .pageContainer (new HomePage ()));
7376 },
7477 LoginPage .sName: (context) {
7578 return new GSYLocalizations (
76- child: new LoginPage (),
77- );
79+ child: NavigatorUtils .pageContainer (new LoginPage ()));
7880 },
7981 });
8082 }),
@@ -128,23 +130,31 @@ class _GSYLocalizations extends State<GSYLocalizations> {
128130 errorHandleFunction (int code, message) {
129131 switch (code) {
130132 case Code .NETWORK_ERROR :
131- Fluttertoast .showToast (msg: CommonUtils .getLocale (context).network_error);
133+ Fluttertoast .showToast (
134+ msg: CommonUtils .getLocale (context).network_error);
132135 break ;
133136 case 401 :
134- Fluttertoast .showToast (msg: CommonUtils .getLocale (context).network_error_401);
137+ Fluttertoast .showToast (
138+ msg: CommonUtils .getLocale (context).network_error_401);
135139 break ;
136140 case 403 :
137- Fluttertoast .showToast (msg: CommonUtils .getLocale (context).network_error_403);
141+ Fluttertoast .showToast (
142+ msg: CommonUtils .getLocale (context).network_error_403);
138143 break ;
139144 case 404 :
140- Fluttertoast .showToast (msg: CommonUtils .getLocale (context).network_error_404);
145+ Fluttertoast .showToast (
146+ msg: CommonUtils .getLocale (context).network_error_404);
141147 break ;
142148 case Code .NETWORK_TIMEOUT :
143149 //超时
144- Fluttertoast .showToast (msg: CommonUtils .getLocale (context).network_error_timeout);
150+ Fluttertoast .showToast (
151+ msg: CommonUtils .getLocale (context).network_error_timeout);
145152 break ;
146153 default :
147- Fluttertoast .showToast (msg: CommonUtils .getLocale (context).network_error_unknown + " " + message);
154+ Fluttertoast .showToast (
155+ msg: CommonUtils .getLocale (context).network_error_unknown +
156+ " " +
157+ message);
148158 break ;
149159 }
150160 }
0 commit comments