@@ -66,134 +66,135 @@ class _IndexState extends State<Index> {
6666
6767 @override
6868 Widget build (BuildContext ctx) {
69- return WillPopScope (
70- child: Scaffold (
71- appBar: AppBar (
72- centerTitle: true ,
73- title: Text (
74- AppLocalizations .$t ('common.login' ),
75- textAlign: TextAlign .center,
76- ),
77- automaticallyImplyLeading: false ,
69+ // return WillPopScope(
70+ // child: ,
71+ // onWillPop: () {
72+ // beforeDispose();
73+ // },
74+ // );
75+ return Scaffold (
76+ appBar: AppBar (
77+ centerTitle: true ,
78+ title: Text (
79+ AppLocalizations .$t ('common.login' ),
80+ textAlign: TextAlign .center,
7881 ),
79- body: Builder (builder: (BuildContext context) {
80- return SingleChildScrollView (
81- child: Padding (
82- padding: EdgeInsets .symmetric (vertical: 50 , horizontal: 24 ),
83- child: Form (
84- key: _formKey,
85- autovalidate: true ,
86- child: Column (
87- children: < Widget > [
88- renderGithubImage (),
89- TextFormField (
90- controller: nameCtl,
91- autofocus: true ,
92- decoration: InputDecoration (
93- labelText: AppLocalizations .$t ('login.account' ),
94- hintText: AppLocalizations .$t ('login.account_tips' ),
95- icon: Icon (Icons .person),
96- ),
97- validator: (v) {
98- return v.trim ().length > 0
99- ? null
100- : AppLocalizations .$t ('login.account_error_tips' );
101- },
102- ),
103- TextFormField (
104- controller: pwdCtl,
105- decoration: InputDecoration (
106- labelText: AppLocalizations .$t ('login.password' ),
107- hintText: AppLocalizations .$t ('login.password_tips' ),
108- icon: Icon (Icons .lock),
109- ),
110- obscureText: true ,
111- validator: (v) {
112- return v.trim ().length > 0
113- ? null
114- : AppLocalizations .$t ('login.password_error_tips' );
115- },
116- ),
117- Padding (
118- padding: EdgeInsets .only (top: 50 ),
119- child: Row (
120- children: < Widget > [
121- Expanded (
122- child: RaisedButton (
123- padding: EdgeInsets .all (15 ),
124- color: Theme .of (context).primaryColor,
125- textColor: Theme .of (context)
126- .primaryTextTheme
127- .title
128- .color,
129- child: Text (
130- AppLocalizations .$t ('common.login' ),
131- ),
132- onPressed: () async {
133- if ((_formKey.currentState as FormState )
134- .validate ()) {
135- await Store .value <UserModel >(context)
136- .loginController (context, {
137- 'name' : nameCtl.text.trim (),
138- 'pwd' : pwdCtl.text.trim ()
139- });
140- await Store .value <UserModel >(context).getUserStar ();
141- }
142- },
143- ),
144- )
145- ],
146- ),
82+ // automaticallyImplyLeading: false,
83+ ),
84+ body: Builder (builder: (BuildContext context) {
85+ return SingleChildScrollView (
86+ child: Padding (
87+ padding: EdgeInsets .symmetric (vertical: 50 , horizontal: 24 ),
88+ child: Form (
89+ key: _formKey,
90+ autovalidate: true ,
91+ child: Column (
92+ children: < Widget > [
93+ renderGithubImage (),
94+ TextFormField (
95+ controller: nameCtl,
96+ autofocus: false ,
97+ decoration: InputDecoration (
98+ labelText: AppLocalizations .$t ('login.account' ),
99+ hintText: AppLocalizations .$t ('login.account_tips' ),
100+ icon: Icon (Icons .person),
147101 ),
148- SizedBox (
149- height: 10 ,
102+ validator: (v) {
103+ return v.trim ().length > 0
104+ ? null
105+ : AppLocalizations .$t ('login.account_error_tips' );
106+ },
107+ ),
108+ TextFormField (
109+ controller: pwdCtl,
110+ decoration: InputDecoration (
111+ labelText: AppLocalizations .$t ('login.password' ),
112+ hintText: AppLocalizations .$t ('login.password_tips' ),
113+ icon: Icon (Icons .lock),
150114 ),
151- Row (
152- mainAxisAlignment: MainAxisAlignment .center,
115+ obscureText: true ,
116+ validator: (v) {
117+ return v.trim ().length > 0
118+ ? null
119+ : AppLocalizations .$t ('login.password_error_tips' );
120+ },
121+ ),
122+ Padding (
123+ padding: EdgeInsets .only (top: 50 ),
124+ child: Row (
153125 children: < Widget > [
154- GestureDetector (
155- child: Text (
156- 'Github账户登录说明' ,
157- style: TextStyle (
158- decoration: TextDecoration .underline,
159- textBaseline: TextBaseline .ideographic,
160- decorationColor: Color (0xff000000 ),
126+ Expanded (
127+ child: RaisedButton (
128+ padding: EdgeInsets .all (15 ),
129+ color: Theme .of (context).primaryColor,
130+ textColor:
131+ Theme .of (context).primaryTextTheme.title.color,
132+ child: Text (
133+ AppLocalizations .$t ('common.login' ),
161134 ),
135+ onPressed: () async {
136+ if ((_formKey.currentState as FormState )
137+ .validate ()) {
138+ await Store .value <UserModel >(context)
139+ .loginController (context, {
140+ 'name' : nameCtl.text.trim (),
141+ 'pwd' : pwdCtl.text.trim ()
142+ });
143+ await Store .value <UserModel >(context)
144+ .getUserStar ();
145+ }
146+ },
147+ ),
148+ )
149+ ],
150+ ),
151+ ),
152+ SizedBox (
153+ height: 10 ,
154+ ),
155+ Row (
156+ mainAxisAlignment: MainAxisAlignment .center,
157+ children: < Widget > [
158+ GestureDetector (
159+ child: Text (
160+ 'Github账户登录说明' ,
161+ style: TextStyle (
162+ decoration: TextDecoration .underline,
163+ textBaseline: TextBaseline .ideographic,
164+ decorationColor: Color (0xff000000 ),
162165 ),
163- onTap: () {
164- renderOverlay (" Text 1" );
165- },
166- ),
167- SizedBox (
168- width: 10 ,
169166 ),
170- GestureDetector (
171- child: Text (
172- '软件许可及服务协议' ,
173- style: TextStyle (
174- decoration: TextDecoration .underline,
175- textBaseline: TextBaseline .ideographic,
176- decorationColor: const Color (0xff000000 ),
177- ),
167+ onTap: () {
168+ renderOverlay (" Text 1" );
169+ },
170+ ),
171+ SizedBox (
172+ width: 10 ,
173+ ),
174+ GestureDetector (
175+ child: Text (
176+ '软件许可及服务协议' ,
177+ style: TextStyle (
178+ decoration: TextDecoration .underline,
179+ textBaseline: TextBaseline .ideographic,
180+ decorationColor: const Color (0xff000000 ),
178181 ),
179- onTap: () {
180- renderOverlay (" Text 2" );
181- },
182182 ),
183- ],
184- )
185- ],
186- ),
183+ onTap: () {
184+ renderOverlay (" Text 2" );
185+ },
186+ ),
187+ ],
188+ )
189+ ],
187190 ),
188191 ),
189- );
190- }),
191- ),
192- onWillPop: () {
193- beforeDispose ();
194- },
192+ ),
193+ );
194+ }),
195195 );
196196 }
197+
197198 beforeDispose () {
198199 if (_overlayEntry != null ) {
199200 _overlayEntry.remove ();
0 commit comments