ListView construction properly done

This commit is contained in:
2023-12-26 21:08:23 +02:00
parent 09a8774423
commit e9b9e49509

View File

@@ -23,9 +23,11 @@ class _FetchAPIState extends State<FetchAPI> {
appBar: AppBar(
title: const Text("Fetching API"),
),
body: ListView(
children: [
FutureBuilder<List<Arrival>>(
body: Row(
children: <Widget>[
Expanded(
child: SizedBox(
child: FutureBuilder<List<Arrival>>(
future: fetchedArrivals,
builder: (context, snapshot) {
if (snapshot.connectionState == ConnectionState.waiting) {
@@ -44,10 +46,11 @@ class _FetchAPIState extends State<FetchAPI> {
}
},
),
),
),
InkWell(
onTap: () {
Navigator.pushNamedAndRemoveUntil(
context, '/', (route) => false);
Navigator.pushNamedAndRemoveUntil(context, '/', (route) => false);
},
child: Container(
padding: const EdgeInsets.all(20.0),
@@ -58,4 +61,10 @@ class _FetchAPIState extends State<FetchAPI> {
),
);
}
@override
void initState() {
super.initState();
fetchedArrivals = fetchArrivals();
}
}