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
29a1728a
Commit
29a1728a
authored
Jul 13, 2021
by
jishuaishuai
Browse files
Options
Browse Files
Download
Plain Diff
修改
parents
eb36ba48
83ca9b54
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
327 additions
and
59 deletions
+327
-59
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
AppColors.dart
netrain_flutter_app/lib/common/AppColors.dart
+2
-1
Images.dart
netrain_flutter_app/lib/common/Images.dart
+2
-0
DoctorHomePage.dart
...ain_flutter_app/lib/laishanqi/netrain/DoctorHomePage.dart
+25
-0
PharmacistHomePage.dart
...flutter_app/lib/laishanqi/netrain/PharmacistHomePage.dart
+0
-0
RegisterPage.dart
..._flutter_app/lib/laishanqi/netrain/user/RegisterPage.dart
+172
-33
loginPage.dart
...ain_flutter_app/lib/laishanqi/netrain/user/loginPage.dart
+7
-4
main.dart
netrain_flutter_app/lib/main.dart
+3
-0
LoginApi.dart
netrain_flutter_app/lib/zhangfeng/LoginApi.dart
+1
-0
LoginPage.dart
netrain_flutter_app/lib/zhangfeng/LoginPage.dart
+38
-7
SaveModel.dart
netrain_flutter_app/lib/zhangfeng/Network/SaveModel.dart
+7
-10
TestPage.dart
netrain_flutter_app/lib/zhangfeng/TestPage.dart
+67
-0
UserModel.dart
netrain_flutter_app/lib/zhangfeng/UserModel.dart
+2
-3
pubspec.yaml
netrain_flutter_app/pubspec.yaml
+1
-1
No files found.
netrain_flutter_app/assets/images/2.0x/login_button.png
0 → 100644
View file @
29a1728a
3.75 KB
netrain_flutter_app/assets/images/3.0x/login_button.png
0 → 100644
View file @
29a1728a
7 KB
netrain_flutter_app/assets/images/login_button.png
0 → 100644
View file @
29a1728a
3.75 KB
netrain_flutter_app/lib/common/AppColors.dart
View file @
29a1728a
...
@@ -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/common/Images.dart
View file @
29a1728a
...
@@ -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/laishanqi/netrain/DoctorHomePage.dart
0 → 100644
View file @
29a1728a
import
'package:flutter/material.dart'
;
class
DoctorHomePage
extends
StatefulWidget
{
@override
_DoctorHomePageState
createState
()
=>
_DoctorHomePageState
();
}
class
_DoctorHomePageState
extends
State
<
DoctorHomePage
>{
@override
void
initState
()
{
super
.
initState
();
}
@override
void
dispose
()
{
super
.
dispose
();
}
@override
Widget
build
(
BuildContext
context
)
{
return
Container
();
}
}
netrain_flutter_app/lib/laishanqi/netrain/HomePage.dart
→
netrain_flutter_app/lib/laishanqi/netrain/
Pharmacist
HomePage.dart
View file @
29a1728a
File moved
netrain_flutter_app/lib/laishanqi/netrain/user/RegisterPage.dart
View file @
29a1728a
...
@@ -16,15 +16,33 @@ class _RegisterState extends State {
...
@@ -16,15 +16,33 @@ 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
;
final
GlobalKey
<
FormState
>
_formKey
=
GlobalKey
();
@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 +57,164 @@ class _RegisterState extends State {
...
@@ -39,43 +57,164 @@ 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:
Form
(
children:
[
key:
_formKey
,
_getTextField
(
"请输入姓名"
,
nameController
),
child:
ListView
(
_getTextField
(
"请输入手机号码"
,
phoneController
),
children:
[
Stack
(
children:
[
_getTextField
(
_getTextField
(
"请输入验证码"
,
codeController
),
TextInputType
.
text
,
"请输入姓名"
,
nameController
,
10
,
false
),
// Positioned(child: )
_getTextField
(
TextInputType
.
number
,
"请输入手机号码"
,
phoneController
,
11
,
false
),
Stack
(
children:
[
_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:
onRegisterClick
),
)
],
))),
);
}
onRegisterClick
()
{
if
(
_formKey
.
currentState
.
validate
()){
ScaffoldMessenger
.
of
(
context
).
showSnackBar
(
SnackBar
(
content:
Text
(
"请求注册"
)));
}
}
],),
/// 校验是否全部为空
bool
checkIsAllEmpty
()
{
if
(
phoneController
.
text
.
isNotEmpty
&&
nameController
.
text
.
isNotEmpty
&&
codeController
.
text
.
isNotEmpty
&&
passwordController
.
text
.
isNotEmpty
)
{
return
false
;
}
return
true
;
}
_getTextField
(
"请输入9-16位密码"
,
passwordController
),
Widget
_getPassWordField
()
{
],
TextFormField
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
=
!
isShowPassword
;
// isShowPassword = !password.obscureText;
});
},
))),
],
);
);
}
}
/// 输入框
/// 输入框
Widget
_getTextField
(
String
hintText
,
TextEditingController
controller
){
Widget
_getTextField
(
TextInputType
keyboardType
,
String
hintText
,
return
TextField
(
TextEditingController
controller
,
int
maxLength
,
bool
isPassword
)
{
return
TextFormField
(
validator:
(
value
)
{
if
(
value
.
isEmpty
){
return
"
${hintText}
不能为空"
;
}
else
{
return
null
;
}
},
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 @
29a1728a
...
@@ -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
(
...
...
netrain_flutter_app/lib/main.dart
View file @
29a1728a
...
@@ -3,6 +3,7 @@ import 'package:fluttertoast/fluttertoast.dart';
...
@@ -3,6 +3,7 @@ import 'package:fluttertoast/fluttertoast.dart';
import
'package:netrain_flutter_app/xuehao/car_details.dart'
;
import
'package:netrain_flutter_app/xuehao/car_details.dart'
;
import
'package:netrain_flutter_app/common/AppColors.dart'
;
import
'package:netrain_flutter_app/common/AppColors.dart'
;
import
'package:netrain_flutter_app/xuehao/list_page.dart'
;
import
'package:netrain_flutter_app/xuehao/list_page.dart'
;
import
'package:netrain_flutter_app/zhangfeng/TestPage.dart'
;
import
'laishanqi/Stateful_page.dart'
;
import
'laishanqi/Stateful_page.dart'
;
import
'laishanqi/Stateless_page.dart'
;
import
'laishanqi/Stateless_page.dart'
;
...
@@ -49,6 +50,7 @@ class MyApp extends StatelessWidget {
...
@@ -49,6 +50,7 @@ class MyApp extends StatelessWidget {
"login"
:
(
context
)
=>
LoginPage
(),
"login"
:
(
context
)
=>
LoginPage
(),
"listPage"
:(
context
)
=>
List_Page
(),
"listPage"
:(
context
)
=>
List_Page
(),
"LoginRequestPage"
:(
context
)
=>
LoginRequestPage
(),
"LoginRequestPage"
:(
context
)
=>
LoginRequestPage
(),
"TestPage"
:
(
context
)
=>
SampleAppPage
(),
"main"
:
(
context
)
=>
mainPage
(),
"main"
:
(
context
)
=>
mainPage
(),
"firstVC"
:(
context
)
=>
jssPageDemo
(),
"firstVC"
:(
context
)
=>
jssPageDemo
(),
"car_details"
:(
context
)
=>
CarDetailsPage
()
"car_details"
:(
context
)
=>
CarDetailsPage
()
...
@@ -101,6 +103,7 @@ class _RouterNavigatorState extends State<RouterNavigator> {
...
@@ -101,6 +103,7 @@ class _RouterNavigatorState extends State<RouterNavigator> {
_item
(
"拍照页面"
,
PhotoApp
(),
'photo'
),
_item
(
"拍照页面"
,
PhotoApp
(),
'photo'
),
_item
(
"登陆"
,
LoginPage
(),
'login'
),
_item
(
"登陆"
,
LoginPage
(),
'login'
),
_item
(
"登录网络请求"
,
LoginRequestPage
(),
'LoginRequestPage'
),
_item
(
"登录网络请求"
,
LoginRequestPage
(),
'LoginRequestPage'
),
_item
(
"zhangfengTest页面"
,
List_Page
(),
'TestPage'
),
_item
(
"listview页面"
,
List_Page
(),
'listPage'
),
_item
(
"listview页面"
,
List_Page
(),
'listPage'
),
_item
(
"jssDemo"
,
jssPageDemo
(),
'firstVC'
)
_item
(
"jssDemo"
,
jssPageDemo
(),
'firstVC'
)
],
],
...
...
netrain_flutter_app/lib/zhangfeng/LoginApi.dart
View file @
29a1728a
...
@@ -10,6 +10,7 @@ class LoginApi {
...
@@ -10,6 +10,7 @@ class LoginApi {
BaseHttpModel
httpModel
=
data
;
BaseHttpModel
httpModel
=
data
;
UserModel
userModel
=
UserModel
.
fromJson
(
httpModel
.
data
);
UserModel
userModel
=
UserModel
.
fromJson
(
httpModel
.
data
);
UserModel
.
saveModel
(
userModel
);
UserModel
.
saveModel
(
userModel
);
print
(
UserModel
.
getModel
().
token
);
if
(
onResult
!=
null
){
if
(
onResult
!=
null
){
onResult
(
data
,
errorMsg
);
onResult
(
data
,
errorMsg
);
}
}
...
...
netrain_flutter_app/lib/zhangfeng/LoginPage.dart
View file @
29a1728a
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,15 +59,33 @@ class _LoginState extends State<LoginRequestPage> {
...
@@ -46,15 +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
),
),
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
(
image:
DecorationImage
(
image:
AssetImage
(
Images
.
ic_login_button
))),
),
),
],
],
),
),
...
...
netrain_flutter_app/lib/zhangfeng/Network/SaveModel.dart
View file @
29a1728a
import
'dart:convert'
;
import
'dart:convert'
;
import
'package:
shared_preferences/shared_preference
s.dart'
;
import
'package:
flustars/flustar
s.dart'
;
class
SaveModel
{
class
SaveModel
{
// factory UserData() => getInstance();
// factory UserData() => getInstance();
...
@@ -17,17 +17,15 @@ class SaveModel {
...
@@ -17,17 +17,15 @@ class SaveModel {
//
//
// }
// }
static
saveModel
(
dynamic
model
,
String
modelName
)
async
{
static
saveModel
(
dynamic
model
,
String
modelName
)
{
SharedPreferences
pref
=
await
SharedPreferences
.
getInstance
();
//将data转换成json字符串
//将data转换成json字符串
var
jsonStr
=
json
.
encode
(
model
);
var
jsonStr
=
json
.
encode
(
model
);
pref
.
setString
(
modelName
,
jsonStr
);
SpUtil
.
putString
(
modelName
,
jsonStr
);
}
}
// 读取 SharedPreferences
// 读取 SharedPreferences
static
Future
<
Map
>
getModel
(
String
modelName
)
async
{
static
getModel
(
String
modelName
)
{
SharedPreferences
prefs
=
await
SharedPreferences
.
getInstance
();
final
jsonStr
=
SpUtil
.
getString
(
modelName
);
final
jsonStr
=
prefs
.
getString
(
modelName
);
if
(
jsonStr
!=
null
&&
jsonStr
.
length
>
0
){
if
(
jsonStr
!=
null
&&
jsonStr
.
length
>
0
){
//先将json字符串转json
//先将json字符串转json
Map
json
=
jsonDecode
(
jsonStr
);
Map
json
=
jsonDecode
(
jsonStr
);
...
@@ -36,8 +34,7 @@ class SaveModel {
...
@@ -36,8 +34,7 @@ class SaveModel {
return
null
;
return
null
;
}
}
static
removeModel
(
String
modelName
)
async
{
static
removeModel
(
String
modelName
){
SharedPreferences
prefs
=
await
SharedPreferences
.
getInstance
();
SpUtil
.
putString
(
modelName
,
""
);
prefs
.
setString
(
modelName
,
""
);
}
}
}
}
\ No newline at end of file
netrain_flutter_app/lib/zhangfeng/TestPage.dart
0 → 100644
View file @
29a1728a
import
'package:flutter/cupertino.dart'
;
import
'package:flutter/material.dart'
;
import
'package:dio/dio.dart'
;
import
'dart:convert'
;
class
SampleAppPage
extends
StatefulWidget
{
SampleAppPage
({
Key
key
})
:
super
(
key:
key
);
@override
_SampleAppPageState
createState
()
=>
_SampleAppPageState
();
}
class
_SampleAppPageState
extends
State
<
SampleAppPage
>{
final
PageController
_pageController
=
PageController
();
@override
void
dispose
()
{
_pageController
.
dispose
();
super
.
dispose
();
}
@override
Widget
build
(
BuildContext
context
)
{
return
MaterialApp
(
home:
Scaffold
(
body:
PageView
(
controller:
_pageController
,
children:
<
Widget
>[
Container
(
color:
Colors
.
red
,
child:
Center
(
child:
ElevatedButton
(
onPressed:
()
{
if
(
_pageController
.
hasClients
)
{
_pageController
.
animateToPage
(
1
,
duration:
const
Duration
(
milliseconds:
400
),
curve:
Curves
.
easeInOut
,
);
}
},
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'
),
),
),
),
],
),
),
);
}
}
\ No newline at end of file
netrain_flutter_app/lib/zhangfeng/UserModel.dart
View file @
29a1728a
...
@@ -19,11 +19,10 @@ class UserModel{
...
@@ -19,11 +19,10 @@ class UserModel{
static
UserModel
getModel
(){
static
UserModel
getModel
(){
if
(
sharedModelInstance_
==
null
){
if
(
sharedModelInstance_
==
null
){
SaveModel
.
getModel
(
'UserModel'
).
then
((
json
)
=>
{
Map
json
=
SaveModel
.
getModel
(
'UserModel'
);
if
(
json
!=
null
){
if
(
json
!=
null
){
sharedModelInstance_
=
new
UserModel
.
fromJson
(
json
)
sharedModelInstance_
=
new
UserModel
.
fromJson
(
json
)
;
}
}
});
}
}
return
sharedModelInstance_
;
return
sharedModelInstance_
;
}
}
...
...
netrain_flutter_app/pubspec.yaml
View file @
29a1728a
...
@@ -42,7 +42,7 @@ dependencies:
...
@@ -42,7 +42,7 @@ dependencies:
dio
:
^4.0.0
#网络库
dio
:
^4.0.0
#网络库
convert
:
^3.0.1
#转码器
convert
:
^3.0.1
#转码器
pull_to_refresh
:
^2.0.0
pull_to_refresh
:
^2.0.0
shared_preferences
:
^2.0.6
flustars
:
^2.0.1
#强大的工具类库
dev_dependencies
:
dev_dependencies
:
...
...
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