Pull down to refresh (yw lingy)

This commit is contained in:
2023-12-27 16:55:37 +02:00
parent c9f990e7fd
commit cecc3a93a8

View File

@@ -24,10 +24,14 @@ class _FetchAPIState extends State<FetchAPI> {
fetchedArrivals = fetchArrivals();
});
},
icon: const Icon(Icons.refresh_rounded))
icon: const Icon(Icons.refresh_sharp),
),
const SizedBox(width: 30,),
],
),
body: Column(
body: RefreshIndicator(
onRefresh: _refreshData,
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Expanded(
@@ -68,9 +72,16 @@ class _FetchAPIState extends State<FetchAPI> {
const SizedBox(height: 35,),
],
),
),
);
}
Future<void> _refreshData() async {
setState(() {
fetchedArrivals = fetchArrivals();
});
}
@override
void initState() {
super.initState();