Ajout infos vaisseaux

This commit is contained in:
Gabriel
2023-05-31 11:21:49 +02:00
parent 6d17b302d6
commit 84682ddc30
2 changed files with 23 additions and 8 deletions

View File

@@ -70,14 +70,29 @@ class _HomePageState extends State<HomePage> {
builder: (BuildContext context, AsyncSnapshot<List<ShipModel>> snapshot) {
if (snapshot.hasData) {
List<ShipModel> ships = snapshot.data!;
return Column(
children: ships.map((ship) {
return Card(
child: ListTile(
title: Text(ship.symbol ?? 'N/A'),
),
);
return SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: ships.map((ship) {
return Card(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Row(
children: [
Text('${ship.symbol ?? 'N/A'}'),
SizedBox(width: 16),
Text('${ship.nav?.status ?? 'N/A'}'),
SizedBox(width: 16),
Text('Fuel: ${ship.fuel?.current ?? 'N/A'} / ${ship.fuel?.capacity ?? 'N/A'}'),
SizedBox(width: 16),
Text('Cargo: ${ship.cargo?.units ?? 'N/A'} / ${ship.cargo?.capacity ?? 'N/A'}'),
],
),
),
);
}).toList(),
),
);
}else if (snapshot.hasError) {
return Text('Error: ${snapshot.error}');