This commit is contained in:
JMARyA 2024-09-26 15:44:04 +02:00
parent 1131e74691
commit d53080dd32
Signed by: jmarya
GPG key ID: 901B2ADDF27C2263
3 changed files with 36 additions and 4 deletions

View file

@ -1,4 +1,5 @@
import 'package:cdb_ui/api.dart';
import 'package:cdb_ui/pages/stats.dart';
import 'package:cdb_ui/pages/transaction.dart';
import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
@ -25,6 +26,15 @@ class _ItemViewState extends State<ItemView> {
return Scaffold(
appBar: AppBar(
title: Text(widget.item.name),
actions: [
IconButton(
onPressed: () {
Navigator.of(context).push(MaterialPageRoute(
builder: (context) => ItemStatPage(widget.item),
));
},
icon: Icon(Icons.bar_chart))
],
),
body: Column(children: [
Padding(

View file

@ -60,11 +60,12 @@ class _LocationsPageState extends State<LocationsPage> {
title: const Text("Locations"),
),
body: TreeView(
indent: 15,
nodes: locations!.keys
.where((key) => locations![key]!.parent == null)
.map((key) {
return buildTree(context, key);
}).toList()),
return buildTree(context, key);
}).toList()),
floatingActionButton: FloatingActionButton(
onPressed: () {
// scan location code

View file

@ -20,6 +20,8 @@ class StatsPage extends StatelessWidget {
// todo : demand stat
// todo : stat on origin + destination
// global origin / destinations
return Scaffold(
body: FutureBuilder(
future: _fetchData(),
@ -36,9 +38,9 @@ class StatsPage extends StatelessWidget {
return Column(
children: [
Card(
margin: EdgeInsets.all(10.0),
margin: const EdgeInsets.all(10.0),
child: Padding(
padding: EdgeInsets.all(10.0),
padding: const EdgeInsets.all(10.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
@ -77,3 +79,22 @@ class StatsPage extends StatelessWidget {
);
}
}
class ItemStatPage extends StatelessWidget {
final Item item;
const ItemStatPage(this.item, {super.key});
// todo : expiry ratio
// todo : avg time of transaction active
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("Statistics of ${item.name}"),
),
body: null,
);
}
}