Ajout infos vaisseaux
This commit is contained in:
@@ -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}');
|
||||
|
||||
Reference in New Issue
Block a user