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
0c56b7ac
Commit
0c56b7ac
authored
Jul 09, 2021
by
xuehao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增注释
parent
1f6adc8e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
2 deletions
+15
-2
list_page.dart
netrain_flutter_app/lib/xuehao/list_page.dart
+15
-2
No files found.
netrain_flutter_app/lib/xuehao/list_page.dart
View file @
0c56b7ac
...
...
@@ -22,26 +22,37 @@ class _ListPageState extends State<List_Page> {
appBar:
AppBar
(
title:
Text
(
"ListView"
),
centerTitle:
true
,
//leading 返回按键
//GestureDetector 用于事件触发
leading:
GestureDetector
(
onTap:
()
{
//当前页面出栈
Navigator
.
pop
(
context
);
},
//左上角返回的小箭头
child:
Icon
(
Icons
.
arrow_back_ios
),
),
),
body:
EasyRefresh
(
header:
MaterialHeader
(),
footer:
MaterialFooter
(),
//下拉刷新头布局、可以自定义
header:
TaurusHeader
(),
//上拉加载尾布局,可以自定义
footer:
TaurusFooter
(),
enableControlFinishRefresh:
true
,
enableControlFinishLoad:
true
,
//刷新和加载的控制器,用于控制刷新和加载
controller:
_controller
,
child:
ListView
.
builder
(
//返回数据条数
itemCount:
datas
.
length
,
//itemBuilder 需要返回一个Widget
itemBuilder:
_getDatas
,
),
//刷新动作被触发
onRefresh:
()
async
{
refreshData
();
},
//加载动作被触发
onLoad:
()
async
{
loadData
();
},
...
...
@@ -49,6 +60,7 @@ class _ListPageState extends State<List_Page> {
));
}
///获取item视图
Widget
_getDatas
(
BuildContext
context
,
int
position
)
{
return
Container
(
child:
GestureDetector
(
...
...
@@ -77,6 +89,7 @@ class _ListPageState extends State<List_Page> {
));
}
///刷新数据
Future
<
void
>
refreshData
()
async
{
await
Future
.
delayed
(
Duration
(
seconds:
3
),
()
{
setState
(()
{
...
...
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