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
8d2f6f19
Commit
8d2f6f19
authored
Jul 13, 2021
by
laishanqi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
完成注册页面
parent
f73555e3
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
161 additions
and
37 deletions
+161
-37
AppColors.dart
netrain_flutter_app/lib/common/AppColors.dart
+2
-1
PharmacistHomePage.dart
...flutter_app/lib/laishanqi/netrain/PharmacistHomePage.dart
+0
-0
RegisterPage.dart
..._flutter_app/lib/laishanqi/netrain/user/RegisterPage.dart
+152
-32
loginPage.dart
...ain_flutter_app/lib/laishanqi/netrain/user/loginPage.dart
+7
-4
No files found.
netrain_flutter_app/lib/common/AppColors.dart
View file @
8d2f6f19
...
@@ -12,5 +12,6 @@ class AppColors{
...
@@ -12,5 +12,6 @@ class AppColors{
static
const
scaffoldBackgroundColor
=
0xffffffff
;
static
const
scaffoldBackgroundColor
=
0xffffffff
;
/// 分割线颜色
/// 分割线颜色
static
const
dividerColor
=
0xffeeeeee
;
static
const
dividerColor
=
0xffeeeeee
;
/// 控件禁用时的颜色
static
const
disabledColor
=
0xffdddddd
;
}
}
\ No newline at end of file
netrain_flutter_app/lib/laishanqi/netrain/HomePage.dart
→
netrain_flutter_app/lib/laishanqi/netrain/
Pharmacist
HomePage.dart
View file @
8d2f6f19
File moved
netrain_flutter_app/lib/laishanqi/netrain/user/RegisterPage.dart
View file @
8d2f6f19
...
@@ -16,15 +16,32 @@ class _RegisterState extends State {
...
@@ -16,15 +16,32 @@ class _RegisterState extends State {
final
phoneController
=
TextEditingController
();
final
phoneController
=
TextEditingController
();
final
codeController
=
TextEditingController
();
final
codeController
=
TextEditingController
();
final
passwordController
=
TextEditingController
();
final
passwordController
=
TextEditingController
();
var
isShowPassword
=
false
;
var
isShowClean
=
false
;
@override
@override
Widget
build
(
BuildContext
context
)
{
void
initState
()
{
super
.
initState
();
// 获取上一个页面的传值
List
<
String
>
args
=
ModalRoute
.
of
(
context
).
settings
.
arguments
;
phoneController
.
text
=
args
.
first
;
nameController
.
addListener
(()
{
setState
(()
{});
});
phoneController
.
addListener
(()
{
setState
(()
{});
});
codeController
.
addListener
(()
{
setState
(()
{});
});
passwordController
.
addListener
(()
{
print
(
"密码
${passwordController.text}
"
);
setState
(()
{
isShowClean
=
passwordController
.
text
.
isNotEmpty
;
});
});
}
@override
Widget
build
(
BuildContext
context
)
{
return
registerWidget
();
return
registerWidget
();
}
}
...
@@ -39,43 +56,146 @@ class _RegisterState extends State {
...
@@ -39,43 +56,146 @@ class _RegisterState extends State {
Widget
registerWidget
()
{
Widget
registerWidget
()
{
return
Scaffold
(
return
Scaffold
(
appBar:
AppBar
(
appBar:
AppBar
(
leading:
IconButton
(
leading:
IconButton
(
icon:
Icon
(
Icons
.
arrow_back
),
icon:
Icon
(
Icons
.
arrow_back
),
onPressed:
()
{
onPressed:
()
{
Navigator
.
of
(
context
).
popUntil
(
ModalRoute
.
withName
(
"main"
));
Navigator
.
of
(
context
).
popUntil
(
ModalRoute
.
withName
(
"main"
));
// Navigator.of(context).pushNamed("login2");
// Navigator.of(context).pushNamed("login2");
},
},
),
),
centerTitle:
true
,
centerTitle:
true
,
title:
Text
(
"注册"
),
title:
Text
(
"注册"
),
elevation:
0
,
elevation:
0
,
),
),
body:
Container
(
body:
Container
(
margin:
EdgeInsets
.
fromLTRB
(
16
,
16
,
16
,
0
),
margin:
EdgeInsets
.
fromLTRB
(
16
,
0
,
16
,
0
),
child:
ListView
(
child:
ListView
(
children:
[
children:
[
_getTextField
(
"请输入姓名"
,
nameController
),
_getTextField
(
TextInputType
.
text
,
"请输入姓名"
,
nameController
,
10
,
false
),
_getTextField
(
"请输入手机号码"
,
phoneController
),
_getTextField
(
TextInputType
.
number
,
"请输入手机号码"
,
phoneController
,
11
,
false
),
Stack
(
children:
[
Stack
(
_getTextField
(
"请输入验证码"
,
codeController
),
children:
[
// Positioned(child: )
_getTextField
(
TextInputType
.
number
,
"请输入验证码"
,
codeController
,
8
,
false
),
Positioned
(
child:
Text
(
"获取验证码"
),
right:
16
,
top:
20
,
)
],
),
_getPassWordField
(),
Text
(
"密码由9-16位大小写字母、数字加特殊符号组成"
,
style:
TextStyle
(
color:
Color
(
AppColors
.
mainColor
),
fontSize:
12
),
),
Container
(
margin:
EdgeInsets
.
only
(
top:
20
),
height:
40
,
child:
ElevatedButton
(
style:
ButtonStyle
(
backgroundColor:
MaterialStateProperty
.
resolveWith
((
states
)
{
if
(
states
.
contains
(
MaterialState
.
disabled
))
{
return
Color
(
AppColors
.
disabledColor
);
}
return
Color
(
AppColors
.
mainColor
);
}),
),
child:
Text
(
"注册"
,
style:
TextStyle
(
color:
Colors
.
white
),
),
onPressed:
checkIsAllEmpty
()
?
null
:
onRegisterClick
),
)
],
)),
);
}
],),
onRegisterClick
()
{
ScaffoldMessenger
.
of
(
context
).
showSnackBar
(
SnackBar
(
content:
Text
(
"注册"
)));
}
_getTextField
(
"请输入9-16位密码"
,
passwordController
),
/// 校验是否全部为空
],
bool
checkIsAllEmpty
()
{
)),
if
(
phoneController
.
text
.
isNotEmpty
&&
nameController
.
text
.
isNotEmpty
&&
codeController
.
text
.
isNotEmpty
&&
passwordController
.
text
.
isNotEmpty
)
{
return
false
;
}
return
true
;
}
Widget
_getPassWordField
()
{
TextField
password
=
_getTextField
(
TextInputType
.
number
,
"请输入9-16位密码"
,
passwordController
,
16
,
isShowPassword
);
return
Stack
(
children:
[
password
,
Positioned
(
right:
32
,
top:
10
,
child:
Visibility
(
visible:
isShowClean
,
child:
IconButton
(
icon:
Icon
(
Icons
.
close
),
onPressed:
()
{
setState
(()
{
passwordController
.
text
=
""
;
});
}),
)),
Positioned
(
right:
0
,
top:
10
,
child:
Visibility
(
visible:
isShowClean
,
child:
IconButton
(
icon:
isShowPassword
?
Icon
(
Icons
.
visibility_off
)
:
Icon
(
Icons
.
visibility
),
onPressed:
()
{
setState
(()
{
isShowPassword
=
!
password
.
obscureText
;
});
},
))),
],
);
);
}
}
/// 输入框
/// 输入框
Widget
_getTextField
(
String
hintText
,
TextEditingController
controller
){
Widget
_getTextField
(
TextInputType
keyboardType
,
String
hintText
,
TextEditingController
controller
,
int
maxLength
,
bool
isPassword
)
{
return
TextField
(
return
TextField
(
keyboardType:
keyboardType
,
obscureText:
isPassword
,
buildCounter:
(
context
,
{
currentLength
,
isFocused
,
maxLength
})
=>
null
,
maxLength:
maxLength
,
autofocus:
false
,
// 自动获取焦点
decoration:
InputDecoration
(
decoration:
InputDecoration
(
labelStyle:
TextStyle
(
height:
0.5
),
//装饰
alignLabelWithHint:
true
,
contentPadding:
EdgeInsets
.
only
(
top:
20
,
bottom:
10
),
enabledBorder:
UnderlineInputBorder
(
// 默认输入状态的下划线边框
borderSide:
BorderSide
(
color:
Color
(
AppColors
.
dividerColor
),
width:
0.5
)),
focusedBorder:
UnderlineInputBorder
(
// 获取焦点后
borderSide:
BorderSide
(
color:
Color
(
AppColors
.
mainColor
),
width:
0.5
)),
errorBorder:
UnderlineInputBorder
(
// 错误的时候
borderSide:
BorderSide
(
color:
Colors
.
red
,
width:
0.5
)),
hintText:
hintText
,
hintText:
hintText
,
// labelText: hintText.substring(3)
),
),
controller:
controller
,
controller:
controller
,
);
);
}
}
}
}
\ No newline at end of file
netrain_flutter_app/lib/laishanqi/netrain/user/loginPage.dart
View file @
8d2f6f19
...
@@ -5,7 +5,7 @@ import 'package:netrain_flutter_app/laishanqi/mqtt/MqttClient.dart';
...
@@ -5,7 +5,7 @@ import 'package:netrain_flutter_app/laishanqi/mqtt/MqttClient.dart';
import
'package:netrain_flutter_app/laishanqi/netrain/Http/HttpUtil.dart'
;
import
'package:netrain_flutter_app/laishanqi/netrain/Http/HttpUtil.dart'
;
import
'package:netrain_flutter_app/laishanqi/netrain/user/RegisterPage.dart'
;
import
'package:netrain_flutter_app/laishanqi/netrain/user/RegisterPage.dart'
;
import
'../HomePage.dart'
;
import
'../
Pharmacist
HomePage.dart'
;
import
'../../../common/Images.dart'
;
import
'../../../common/Images.dart'
;
/// 登录页
/// 登录页
...
@@ -21,15 +21,18 @@ class _LoginState extends State<LoginPage> {
...
@@ -21,15 +21,18 @@ class _LoginState extends State<LoginPage> {
final
codeController
=
TextEditingController
();
final
codeController
=
TextEditingController
();
@override
@override
Widget
build
(
BuildContext
context
)
{
void
initState
()
{
print
(
"loginPage.dart initState"
);
super
.
initState
();
var
mqtt
=
MqttClient
();
var
mqtt
=
MqttClient
();
mqtt
.
connect
();
mqtt
.
connect
();
HttpUtil
.
get
(
HttpUtil
.
global_config
).
then
((
Response
value
)
{
HttpUtil
.
get
(
HttpUtil
.
global_config
).
then
((
Response
value
)
{
Fluttertoast
.
showToast
(
msg:
"global_config 请求成功 "
);
Fluttertoast
.
showToast
(
msg:
"global_config 请求成功 "
);
});
});
}
@override
Widget
build
(
BuildContext
context
)
{
return
Scaffold
(
return
Scaffold
(
body:
SingleChildScrollView
(
body:
SingleChildScrollView
(
...
...
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