fix item id
This commit is contained in:
parent
4b9e616581
commit
db0841d716
2 changed files with 7 additions and 7 deletions
|
@ -52,10 +52,10 @@ class API {
|
||||||
}
|
}
|
||||||
|
|
||||||
// /items
|
// /items
|
||||||
Future<List<dynamic>> getItems() async {
|
Future<List<Item>> getItems() async {
|
||||||
var resp = jsonDecode(await getRequest("$instance/items"));
|
var resp = jsonDecode(await getRequest("$instance/items"));
|
||||||
var lst = resp["items"];
|
var lst = resp["items"] as List<dynamic>;
|
||||||
return lst as List<dynamic>;
|
return lst.map((x) => Item(x)).toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<GlobalItemStat> getGlobalItemStat() async {
|
Future<GlobalItemStat> getGlobalItemStat() async {
|
||||||
|
|
|
@ -30,7 +30,7 @@ class ItemsPage extends StatelessWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
class ItemTile extends StatelessWidget {
|
class ItemTile extends StatelessWidget {
|
||||||
final String item;
|
final Item item;
|
||||||
|
|
||||||
const ItemTile(this.item, {super.key});
|
const ItemTile(this.item, {super.key});
|
||||||
|
|
||||||
|
@ -38,10 +38,10 @@ class ItemTile extends StatelessWidget {
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return ListTile(
|
return ListTile(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
API().getItem(item).then((itemInfo) => Navigator.push(context,
|
Navigator.push(context,
|
||||||
MaterialPageRoute(builder: (context) => ItemView(item: itemInfo))));
|
MaterialPageRoute(builder: (context) => ItemView(item: item)));
|
||||||
},
|
},
|
||||||
title: Text(item),
|
title: Text(item.name),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue