itemview listview

This commit is contained in:
JMARyA 2024-09-18 08:09:08 +02:00
parent ca68b8e951
commit 53bfe1763c
Signed by: jmarya
GPG key ID: 901B2ADDF27C2263

View file

@ -11,7 +11,6 @@ Future<void> main() async {
class MyApp extends StatelessWidget {
const MyApp({super.key});
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
@ -36,6 +35,9 @@ class StatsPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
// todo : add global statistics
// todo : demand stat
// todo : stat on origin + destination
return Scaffold(
body: FutureBuilder(
future: _fetchData(),
@ -81,7 +83,9 @@ class FlowsPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
// todo : add locations tree view
// todo : add flow list
// todo : flows by item produced
// todo : flow page
return const Scaffold();
}
}
@ -114,12 +118,10 @@ class ItemsPage extends StatelessWidget {
var items = snapshot.data!;
return GridView.count(
crossAxisCount: 2,
children: items.map((x) {
return ItemCard(x);
}).toList(),
);
return ListView(
children: items.map((x) {
return ItemTile(x);
}).toList());
}),
);
}
@ -168,26 +170,19 @@ class _MyHomePageState extends State<MyHomePage> {
}
}
class ItemCard extends StatelessWidget {
class ItemTile extends StatelessWidget {
final String item;
const ItemCard(this.item, {super.key});
const ItemTile(this.item, {super.key});
@override
Widget build(BuildContext context) {
return InkWell(
return ListTile(
onTap: () {
API().getItem(item).then((itemInfo) => Navigator.push(context,
MaterialPageRoute(builder: (context) => ItemView(item: itemInfo))));
},
child: Row(children: [
/*Image.network(
API().getImageURL(item),
width: 128,
height: 128,
),*/
Text(item)
]),
title: Text(item),
);
}
}