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
1f6adc8e
Commit
1f6adc8e
authored
Jul 09, 2021
by
xuehao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
listView新增下拉刷新,上拉加载,bug修复
parent
1dcb6ffa
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
12 deletions
+29
-12
list_page.dart
netrain_flutter_app/lib/xuehao/list_page.dart
+29
-12
No files found.
netrain_flutter_app/lib/xuehao/list_page.dart
View file @
1f6adc8e
...
...
@@ -40,11 +40,11 @@ class _ListPageState extends State<List_Page> {
itemBuilder:
_getDatas
,
),
onRefresh:
()
async
{
setState
(()
{
refreshData
();
});
refreshData
();
},
onLoad:
()
async
{
loadData
();
},
onLoad:
()
async
{},
),
));
}
...
...
@@ -76,15 +76,32 @@ class _ListPageState extends State<List_Page> {
},
));
}
}
Future
<
void
>
refreshData
()
async
{
await
Future
.
delayed
(
Duration
(
seconds:
3
),
()
{
for
(
int
i
=
0
;
i
<
datas
.
length
;
i
++)
{
datas
[
i
].
name
=
"刷新后的数据
$i
"
;
}
_controller
.
finishRefresh
(
success:
true
);
});
Future
<
void
>
refreshData
()
async
{
await
Future
.
delayed
(
Duration
(
seconds:
3
),
()
{
setState
(()
{
for
(
int
i
=
0
;
i
<
datas
.
length
;
i
++)
{
datas
[
i
].
name
=
"刷新后的数据
$i
"
;
}
_controller
.
finishRefresh
(
success:
true
);
});
});
}
///加载数据
Future
<
void
>
loadData
()
async
{
await
Future
.
delayed
(
Duration
(
seconds:
3
),
()
{
setState
(()
{
for
(
int
i
=
0
;
i
<
10
;
i
++)
{
datas
.
add
(
Car
(
name:
"新增数据
$i
"
,
imageUrl:
"https://img2.baidu.com/it/u=2010980676,2375641500&fm=11&fmt=auto&gp=0.jpg"
));
}
_controller
.
finishLoad
(
success:
true
);
});
});
}
}
//定义一个全局的变量:模型数组
...
...
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