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