@@ -57,65 +57,68 @@ class _LoginPageState extends State<LoginPage> {
5757 onTap: () {
5858 FocusScope .of (context).requestFocus (new FocusNode ());
5959 },
60- child: new Container (
61- color: Theme .of (context).primaryColor,
62- child: new Center (
63- child: new Card (
64- elevation: 5.0 ,
65- shape: new RoundedRectangleBorder (borderRadius: BorderRadius .all (Radius .circular (10.0 ))),
66- color: Color (GSYColors .cardWhite),
67- margin: const EdgeInsets .all (30.0 ),
68- child: new Padding (
69- padding: new EdgeInsets .only (left: 30.0 , top: 40.0 , right: 30.0 , bottom: 80.0 ),
70- child: new Column (
71- mainAxisAlignment: MainAxisAlignment .center,
72- mainAxisSize: MainAxisSize .min,
73- children: < Widget > [
74- new Image (image: new AssetImage (GSYICons .DEFAULT_USER_ICON ), width: 90.0 , height: 90.0 ),
75- new Padding (padding: new EdgeInsets .all (10.0 )),
76- new GSYInputWidget (
77- hintText: CommonUtils .getLocale (context).login_username_hint_text,
78- iconData: GSYICons .LOGIN_USER ,
79- onChanged: (String value) {
80- _userName = value;
81- },
82- controller: userController,
83- ),
84- new Padding (padding: new EdgeInsets .all (10.0 )),
85- new GSYInputWidget (
86- hintText: CommonUtils .getLocale (context).login_password_hint_text,
87- iconData: GSYICons .LOGIN_PW ,
88- obscureText: true ,
89- onChanged: (String value) {
90- _password = value;
91- },
92- controller: pwController,
93- ),
94- new Padding (padding: new EdgeInsets .all (30.0 )),
95- new GSYFlexButton (
96- text: CommonUtils .getLocale (context).login_text,
97- color: Theme .of (context).primaryColor,
98- textColor: Color (GSYColors .textWhite),
99- onPress: () {
100- if (_userName == null || _userName.length == 0 ) {
101- return ;
102- }
103- if (_password == null || _password.length == 0 ) {
104- return ;
105- }
106- CommonUtils .showLoadingDialog (context);
107- UserDao .login (_userName.trim (), _password.trim (), store).then ((res) {
108- Navigator .pop (context);
109- if (res != null && res.result) {
110- new Future .delayed (const Duration (seconds: 1 ), () {
111- NavigatorUtils .goHome (context);
112- return true ;
113- });
60+ child: Scaffold (
61+ body: new Container (
62+ color: Theme .of (context).primaryColor,
63+ child: new Center (
64+ child: new Card (
65+ elevation: 5.0 ,
66+ shape: new RoundedRectangleBorder (borderRadius: BorderRadius .all (Radius .circular (10.0 ))),
67+ color: Color (GSYColors .cardWhite),
68+ margin: const EdgeInsets .only (left: 30.0 , right: 30.0 ),
69+ child: new Padding (
70+ padding: new EdgeInsets .only (left: 30.0 , top: 40.0 , right: 30.0 , bottom: 0.0 ),
71+ child: new Column (
72+ mainAxisAlignment: MainAxisAlignment .center,
73+ mainAxisSize: MainAxisSize .min,
74+ children: < Widget > [
75+ new Image (image: new AssetImage (GSYICons .DEFAULT_USER_ICON ), width: 90.0 , height: 90.0 ),
76+ new Padding (padding: new EdgeInsets .all (10.0 )),
77+ new GSYInputWidget (
78+ hintText: CommonUtils .getLocale (context).login_username_hint_text,
79+ iconData: GSYICons .LOGIN_USER ,
80+ onChanged: (String value) {
81+ _userName = value;
82+ },
83+ controller: userController,
84+ ),
85+ new Padding (padding: new EdgeInsets .all (10.0 )),
86+ new GSYInputWidget (
87+ hintText: CommonUtils .getLocale (context).login_password_hint_text,
88+ iconData: GSYICons .LOGIN_PW ,
89+ obscureText: true ,
90+ onChanged: (String value) {
91+ _password = value;
92+ },
93+ controller: pwController,
94+ ),
95+ new Padding (padding: new EdgeInsets .all (30.0 )),
96+ new GSYFlexButton (
97+ text: CommonUtils .getLocale (context).login_text,
98+ color: Theme .of (context).primaryColor,
99+ textColor: Color (GSYColors .textWhite),
100+ onPress: () {
101+ if (_userName == null || _userName.length == 0 ) {
102+ return ;
114103 }
115- });
116- },
117- )
118- ],
104+ if (_password == null || _password.length == 0 ) {
105+ return ;
106+ }
107+ CommonUtils .showLoadingDialog (context);
108+ UserDao .login (_userName.trim (), _password.trim (), store).then ((res) {
109+ Navigator .pop (context);
110+ if (res != null && res.result) {
111+ new Future .delayed (const Duration (seconds: 1 ), () {
112+ NavigatorUtils .goHome (context);
113+ return true ;
114+ });
115+ }
116+ });
117+ },
118+ ),
119+ new Padding (padding: new EdgeInsets .all (30.0 )),
120+ ],
121+ ),
119122 ),
120123 ),
121124 ),
0 commit comments