Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
N
netrain_flutter_app
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
邹志胜
netrain_flutter_app
Commits
83ca9b54
Commit
83ca9b54
authored
Jul 13, 2021
by
“Icebear”
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加登录页,完成两个输入框和边框
parent
713d82dd
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
87 additions
and
39 deletions
+87
-39
login_button.png
netrain_flutter_app/assets/images/2.0x/login_button.png
+0
-0
login_button.png
netrain_flutter_app/assets/images/3.0x/login_button.png
+0
-0
login_button.png
netrain_flutter_app/assets/images/login_button.png
+0
-0
Images.dart
netrain_flutter_app/lib/common/Images.dart
+2
-0
LoginPage.dart
netrain_flutter_app/lib/zhangfeng/LoginPage.dart
+38
-9
TestPage.dart
netrain_flutter_app/lib/zhangfeng/TestPage.dart
+47
-30
No files found.
netrain_flutter_app/assets/images/2.0x/login_button.png
0 → 100644
View file @
83ca9b54
3.75 KB
netrain_flutter_app/assets/images/3.0x/login_button.png
0 → 100644
View file @
83ca9b54
7 KB
netrain_flutter_app/assets/images/login_button.png
0 → 100644
View file @
83ca9b54
3.75 KB
netrain_flutter_app/lib/common/Images.dart
View file @
83ca9b54
...
@@ -18,4 +18,6 @@ class Images{
...
@@ -18,4 +18,6 @@ class Images{
static
const
ic_privacy
=
"
${imagesPath}
ic_privacy.png"
;
static
const
ic_privacy
=
"
${imagesPath}
ic_privacy.png"
;
static
const
ic_sign
=
"
${imagesPath}
ic_sign.png"
;
static
const
ic_sign
=
"
${imagesPath}
ic_sign.png"
;
static
const
ic_back_black
=
"
${imagesPath}
ic_back_black.png"
;
static
const
ic_back_black
=
"
${imagesPath}
ic_back_black.png"
;
static
const
ic_login_button
=
"
${imagesPath}
login_button.png"
;
}
}
\ No newline at end of file
netrain_flutter_app/lib/zhangfeng/LoginPage.dart
View file @
83ca9b54
import
'package:flutter/material.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/widgets.dart'
;
import
'package:fluttertoast/fluttertoast.dart'
;
import
'package:fluttertoast/fluttertoast.dart'
;
import
'package:netrain_flutter_app/zhangfeng/UserModel.dart'
;
import
'package:netrain_flutter_app/zhangfeng/UserModel.dart'
;
import
'LoginApi.dart'
;
import
'LoginApi.dart'
;
import
'package:netrain_flutter_app/common/Images.dart'
;
class
LoginRequestPage
extends
StatefulWidget
{
class
LoginRequestPage
extends
StatefulWidget
{
final
String
title
=
"登录页"
;
final
String
title
=
"登录页"
;
...
@@ -12,6 +14,17 @@ class LoginRequestPage extends StatefulWidget {
...
@@ -12,6 +14,17 @@ class LoginRequestPage extends StatefulWidget {
class
_LoginState
extends
State
<
LoginRequestPage
>
{
class
_LoginState
extends
State
<
LoginRequestPage
>
{
// This widget is the root of your application.
// This widget is the root of your application.
final
phoneTextField
=
TextEditingController
();
final
pwdTextField
=
TextEditingController
();
@override
void
dispose
()
{
// Clean up the controller when disposing of the Widget.
phoneTextField
.
dispose
();
pwdTextField
.
dispose
();
super
.
dispose
();
}
void
_loginAction
()
{
void
_loginAction
()
{
if
(
UserModel
.
getModel
()
!=
null
){
if
(
UserModel
.
getModel
()
!=
null
){
Fluttertoast
.
showToast
(
msg:
'已经登录'
);
Fluttertoast
.
showToast
(
msg:
'已经登录'
);
...
@@ -46,17 +59,33 @@ class _LoginState extends State<LoginRequestPage> {
...
@@ -46,17 +59,33 @@ class _LoginState extends State<LoginRequestPage> {
),
),
body:
Center
(
body:
Center
(
child:
Column
(
child:
Column
(
mainAxisAlignment:
MainAxisAlignment
.
center
,
children:
<
Widget
>[
children:
<
Widget
>[
FloatingActionButton
(
Container
(
onPressed:
_loginAction
,
child:
Image
(
image:
AssetImage
(
Images
.
logo_01
)),
child:
Icon
(
Icons
.
add
),
padding:
EdgeInsets
.
only
(
top:
50
,
left:
50
,
right:
50
),
heroTag:
0
,
),
Container
(
padding:
EdgeInsets
.
only
(
top:
100
,
left:
16
,
right:
16
),
child:
TextField
(
controller:
phoneTextField
,
decoration:
InputDecoration
(
hintText:
"请输入手机号码"
,
border:
OutlineInputBorder
(
borderRadius:
BorderRadius
.
circular
(
30.0
),
borderSide:
BorderSide
()),),
),
),
Container
(
padding:
EdgeInsets
.
only
(
top:
20
,
left:
16
,
right:
16
),
child:
TextField
(
controller:
pwdTextField
,
decoration:
InputDecoration
(
hintText:
"请输入密码"
,
border:
OutlineInputBorder
(
borderRadius:
BorderRadius
.
circular
(
30.0
),
borderSide:
BorderSide
()),),
),
),
),
FloatingActionButton
(
Container
(
onPressed:
_logoutAction
,
padding:
EdgeInsets
.
only
(
top:
50
,
left:
16
,
right:
16
)
,
child:
Icon
(
Icons
.
add
),
decoration:
BoxDecoration
(
heroTag:
1
,
image:
DecorationImage
(
image:
AssetImage
(
Images
.
ic_login_button
)))
,
),
),
],
],
),
),
...
...
netrain_flutter_app/lib/zhangfeng/TestPage.dart
View file @
83ca9b54
...
@@ -10,41 +10,58 @@ class SampleAppPage extends StatefulWidget{
...
@@ -10,41 +10,58 @@ class SampleAppPage extends StatefulWidget{
}
}
class
_SampleAppPageState
extends
State
<
SampleAppPage
>{
class
_SampleAppPageState
extends
State
<
SampleAppPage
>{
String
_errorText
;
final
PageController
_pageController
=
PageController
();
@override
void
dispose
()
{
_pageController
.
dispose
();
super
.
dispose
();
}
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
return
Scaffold
(
return
MaterialApp
(
appBar:
AppBar
(
home:
Scaffold
(
title:
Text
(
"Sample App"
),
body:
PageView
(
),
controller:
_pageController
,
body:
Center
(
children:
<
Widget
>[
child:
TextField
(
Container
(
onSubmitted:
(
String
text
)
{
color:
Colors
.
red
,
setState
(()
{
child:
Center
(
if
(!
isEmail
(
text
))
{
child:
ElevatedButton
(
_errorText
=
'Error: This is not an email'
;
onPressed:
()
{
}
else
{
if
(
_pageController
.
hasClients
)
{
_errorText
=
null
;
_pageController
.
animateToPage
(
}
1
,
});
duration:
const
Duration
(
milliseconds:
400
),
},
curve:
Curves
.
easeInOut
,
decoration:
InputDecoration
(
hintText:
"This is a hint"
,
errorText:
_getErrorText
()),
);
}
},
child:
const
Text
(
'Next'
),
),
),
),
Container
(
color:
Colors
.
blue
,
child:
Center
(
child:
ElevatedButton
(
onPressed:
()
{
if
(
_pageController
.
hasClients
)
{
_pageController
.
animateToPage
(
0
,
duration:
const
Duration
(
milliseconds:
400
),
curve:
Curves
.
easeInOut
,
);
}
},
child:
const
Text
(
'Previous'
),
),
),
),
],
),
),
),
),
);
);
}
}
_getErrorText
()
{
return
_errorText
;
}
bool
isEmail
(
String
em
)
{
String
emailRegexp
=
r'^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$'
;
RegExp
regExp
=
RegExp
(
emailRegexp
);
return
regExp
.
hasMatch
(
em
);
}
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment