@@ -145,132 +145,132 @@ class _IndexState extends State<Index> {
145145
146146 @override
147147 Widget build (BuildContext ctx) {
148- return WillPopScope (
149- child: Scaffold (
150- appBar: AppBar (
151- centerTitle: true ,
152- title: Text (
153- AppLocalizations .$t ('common.login' ),
154- textAlign: TextAlign .center,
155- ),
156- automaticallyImplyLeading: false ,
148+ // return WillPopScope(
149+ // child: ,
150+ // onWillPop: () {
151+ // beforeDispose();
152+ // },
153+ // );
154+ return Scaffold (
155+ appBar: AppBar (
156+ centerTitle: true ,
157+ title: Text (
158+ AppLocalizations .$t ('common.login' ),
159+ textAlign: TextAlign .center,
157160 ),
158- body: Builder (builder: (BuildContext context) {
159- return SingleChildScrollView (
160- child: Padding (
161- padding: EdgeInsets .symmetric (vertical: 50 , horizontal: 24 ),
162- child: Form (
163- key: _formKey,
164- autovalidate: true ,
165- child: Column (
166- children: < Widget > [
167- renderGithubImage (),
168- TextFormField (
169- controller: nameCtl,
170- autofocus: true ,
171- decoration: InputDecoration (
172- labelText: AppLocalizations .$t ('login.account' ),
173- hintText: AppLocalizations .$t ('login.account_tips' ),
174- icon: Icon (Icons .person),
175- ),
176- validator: (v) {
177- return v.trim ().length > 0
178- ? null
179- : AppLocalizations .$t ('login.account_error_tips' );
180- },
181- ),
182- TextFormField (
183- controller: pwdCtl,
184- decoration: InputDecoration (
185- labelText: AppLocalizations .$t ('login.password' ),
186- hintText: AppLocalizations .$t ('login.password_tips' ),
187- icon: Icon (Icons .lock),
188- ),
189- obscureText: true ,
190- validator: (v) {
191- return v.trim ().length > 0
192- ? null
193- : AppLocalizations .$t ('login.password_error_tips' );
194- },
195- ),
196- Padding (
197- padding: EdgeInsets .only (top: 50 ),
198- child: Row (
199- children: < Widget > [
200- Expanded (
201- child: RaisedButton (
202- padding: EdgeInsets .all (15 ),
203- color: Theme .of (context).primaryColor,
204- textColor: Theme .of (context)
205- .primaryTextTheme
206- .title
207- .color,
208- child: Text (
209- AppLocalizations .$t ('common.login' ),
210- ),
211- onPressed: () async {
212- if ((_formKey.currentState as FormState )
213- .validate ()) {
214- await Store .value <UserModel >(context)
215- .loginController (context, {
216- 'name' : nameCtl.text.trim (),
217- 'pwd' : pwdCtl.text.trim ()
218- });
219- await Store .value <UserModel >(context).getUserStar ();
220- }
221- },
222- ),
223- )
224- ],
225- ),
161+ // automaticallyImplyLeading: false,
162+ ),
163+ body: Builder (builder: (BuildContext context) {
164+ return SingleChildScrollView (
165+ child: Padding (
166+ padding: EdgeInsets .symmetric (vertical: 50 , horizontal: 24 ),
167+ child: Form (
168+ key: _formKey,
169+ autovalidate: true ,
170+ child: Column (
171+ children: < Widget > [
172+ renderGithubImage (),
173+ TextFormField (
174+ controller: nameCtl,
175+ autofocus: false ,
176+ decoration: InputDecoration (
177+ labelText: AppLocalizations .$t ('login.account' ),
178+ hintText: AppLocalizations .$t ('login.account_tips' ),
179+ icon: Icon (Icons .person),
226180 ),
227- SizedBox (
228- height: 10 ,
181+ validator: (v) {
182+ return v.trim ().length > 0
183+ ? null
184+ : AppLocalizations .$t ('login.account_error_tips' );
185+ },
186+ ),
187+ TextFormField (
188+ controller: pwdCtl,
189+ decoration: InputDecoration (
190+ labelText: AppLocalizations .$t ('login.password' ),
191+ hintText: AppLocalizations .$t ('login.password_tips' ),
192+ icon: Icon (Icons .lock),
229193 ),
230- Row (
231- mainAxisAlignment: MainAxisAlignment .center,
194+ obscureText: true ,
195+ validator: (v) {
196+ return v.trim ().length > 0
197+ ? null
198+ : AppLocalizations .$t ('login.password_error_tips' );
199+ },
200+ ),
201+ Padding (
202+ padding: EdgeInsets .only (top: 50 ),
203+ child: Row (
232204 children: < Widget > [
233- GestureDetector (
234- child: Text (
235- 'Github账户登录说明' ,
236- style: TextStyle (
237- decoration: TextDecoration .underline,
238- textBaseline: TextBaseline .ideographic,
239- decorationColor: Color (0xff000000 ),
205+ Expanded (
206+ child: RaisedButton (
207+ padding: EdgeInsets .all (15 ),
208+ color: Theme .of (context).primaryColor,
209+ textColor:
210+ Theme .of (context).primaryTextTheme.title.color,
211+ child: Text (
212+ AppLocalizations .$t ('common.login' ),
240213 ),
214+ onPressed: () async {
215+ if ((_formKey.currentState as FormState )
216+ .validate ()) {
217+ await Store .value <UserModel >(context)
218+ .loginController (context, {
219+ 'name' : nameCtl.text.trim (),
220+ 'pwd' : pwdCtl.text.trim ()
221+ });
222+ await Store .value <UserModel >(context)
223+ .getUserStar ();
224+ }
225+ },
226+ ),
227+ )
228+ ],
229+ ),
230+ ),
231+ SizedBox (
232+ height: 10 ,
233+ ),
234+ Row (
235+ mainAxisAlignment: MainAxisAlignment .center,
236+ children: < Widget > [
237+ GestureDetector (
238+ child: Text (
239+ 'Github账户登录说明' ,
240+ style: TextStyle (
241+ decoration: TextDecoration .underline,
242+ textBaseline: TextBaseline .ideographic,
243+ decorationColor: Color (0xff000000 ),
241244 ),
242- onTap: () {
243- renderOverlay (Content .loginText);
244- },
245- ),
246- SizedBox (
247- width: 10 ,
248245 ),
249- GestureDetector (
250- child: Text (
251- '软件许可及服务协议' ,
252- style: TextStyle (
253- decoration: TextDecoration .underline,
254- textBaseline: TextBaseline .ideographic,
255- decorationColor: const Color (0xff000000 ),
256- ),
246+ onTap: () {
247+ renderOverlay (Content .loginText);
248+ },
249+ ),
250+ SizedBox (
251+ width: 10 ,
252+ ),
253+ GestureDetector (
254+ child: Text (
255+ '软件许可及服务协议' ,
256+ style: TextStyle (
257+ decoration: TextDecoration .underline,
258+ textBaseline: TextBaseline .ideographic,
259+ decorationColor: const Color (0xff000000 ),
257260 ),
258- onTap: () {
259- renderOverlay (" Text 2" );
260- },
261261 ),
262- ],
263- )
264- ],
265- ),
262+ onTap: () {
263+ renderOverlay (" Text 2" );
264+ },
265+ ),
266+ ],
267+ )
268+ ],
266269 ),
267270 ),
268- );
269- }),
270- ),
271- onWillPop: () {
272- beforeDispose ();
273- },
271+ ),
272+ );
273+ }),
274274 );
275275 }
276276
0 commit comments