add stat
This commit is contained in:
parent
86fb3d6370
commit
bb4fab6a11
3 changed files with 41 additions and 3 deletions
lib/pages
|
@ -34,7 +34,7 @@ class _ItemViewState extends State<ItemView> {
|
|||
widget.item.name,
|
||||
style: const TextStyle(fontWeight: FontWeight.bold),
|
||||
),
|
||||
Text(widget.item.category)
|
||||
Text(widget.item.category),
|
||||
],
|
||||
)
|
||||
],
|
||||
|
@ -42,7 +42,29 @@ class _ItemViewState extends State<ItemView> {
|
|||
const SizedBox(height: 10),
|
||||
Row(
|
||||
children: widget.item.variants.entries.map((entry) {
|
||||
return Text(entry.value.name);
|
||||
return Column(children: [
|
||||
Text(
|
||||
entry.value.name,
|
||||
style: TextStyle(fontWeight: FontWeight.bold),
|
||||
),
|
||||
FutureBuilder(
|
||||
future: API().getStat(widget.item.id, entry.key),
|
||||
builder: (context, snapshot) {
|
||||
if (!snapshot.hasData) {
|
||||
return CircularProgressIndicator();
|
||||
}
|
||||
|
||||
var stat = snapshot.data!;
|
||||
|
||||
return Column(
|
||||
children: [
|
||||
Text("Amount: ${stat.amount}"),
|
||||
Text("Total Cost: ${stat.total_price}")
|
||||
],
|
||||
);
|
||||
},
|
||||
)
|
||||
]);
|
||||
}).toList()),
|
||||
FutureBuilder(
|
||||
future: API().getInventory(widget.item.id),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue