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
|
||||
Future<List<dynamic>> getItems() async {
|
||||
Future<List<Item>> getItems() async {
|
||||
var resp = jsonDecode(await getRequest("$instance/items"));
|
||||
var lst = resp["items"];
|
||||
return lst as List<dynamic>;
|
||||
var lst = resp["items"] as List<dynamic>;
|
||||
return lst.map((x) => Item(x)).toList();
|
||||
}
|
||||
|
||||
Future<GlobalItemStat> getGlobalItemStat() async {
|
||||
|
|
|
@ -30,7 +30,7 @@ class ItemsPage extends StatelessWidget {
|
|||
}
|
||||
|
||||
class ItemTile extends StatelessWidget {
|
||||
final String item;
|
||||
final Item item;
|
||||
|
||||
const ItemTile(this.item, {super.key});
|
||||
|
||||
|
@ -38,10 +38,10 @@ class ItemTile extends StatelessWidget {
|
|||
Widget build(BuildContext context) {
|
||||
return ListTile(
|
||||
onTap: () {
|
||||
API().getItem(item).then((itemInfo) => Navigator.push(context,
|
||||
MaterialPageRoute(builder: (context) => ItemView(item: itemInfo))));
|
||||
Navigator.push(context,
|
||||
MaterialPageRoute(builder: (context) => ItemView(item: item)));
|
||||
},
|
||||
title: Text(item),
|
||||
title: Text(item.name),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue