refresh on pulling down
This commit is contained in:
parent
29f2f296e4
commit
c77e44bc96
@ -18,7 +18,7 @@ class WorkoutsViewState extends State<WorkoutsView>{
|
||||
|
||||
Future<List> getWorkouts() async {
|
||||
var response = await http.get(
|
||||
"http://10.16.17.65/api/index.php?token=satbwertwhbertnwertwertghwertgwertg",
|
||||
"http://10.16.17.18/api/index.php?token=satbwertwhbertnwertwertghwertgwertg",
|
||||
headers: {
|
||||
"Accept": "application/json"
|
||||
}
|
||||
@ -39,20 +39,23 @@ class WorkoutsViewState extends State<WorkoutsView>{
|
||||
Widget build(BuildContext context) {
|
||||
// TODO: implement build
|
||||
return Scaffold(
|
||||
body: ListView.builder(
|
||||
itemCount: data == null ? 0 : data.length,
|
||||
itemBuilder: (BuildContext context, int index){
|
||||
return new ListTile(
|
||||
leading: Icon(Icons.add),
|
||||
title: Text(data[index]['title']),
|
||||
subtitle: Text(data[index]['creator']),
|
||||
onTap: (){
|
||||
Navigator.push(context, MaterialPageRoute(
|
||||
builder: (context) => ExerciseView(data[index]['title'], data[index]['id'])
|
||||
));
|
||||
},
|
||||
);
|
||||
},
|
||||
body: RefreshIndicator(
|
||||
child: ListView.builder(
|
||||
itemCount: data == null ? 0 : data.length,
|
||||
itemBuilder: (BuildContext context, int index){
|
||||
return new ListTile(
|
||||
leading: Icon(Icons.add),
|
||||
title: Text(data[index]['title']),
|
||||
subtitle: Text(data[index]['creator']),
|
||||
onTap: (){
|
||||
Navigator.push(context, MaterialPageRoute(
|
||||
builder: (context) => ExerciseView(data[index]['title'], data[index]['id'])
|
||||
));
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
onRefresh: getWorkouts,
|
||||
),
|
||||
floatingActionButton: FloatingActionButton(
|
||||
onPressed: (){
|
||||
|
Loading…
Reference in New Issue
Block a user