diff --git a/lib/pages/itemview.dart b/lib/pages/itemview.dart index 54d7110..ab9e418 100644 --- a/lib/pages/itemview.dart +++ b/lib/pages/itemview.dart @@ -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 { 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( diff --git a/lib/pages/locations.dart b/lib/pages/locations.dart index b8c4b24..b6bbe9f 100644 --- a/lib/pages/locations.dart +++ b/lib/pages/locations.dart @@ -60,11 +60,12 @@ class _LocationsPageState extends State { 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 diff --git a/lib/pages/stats.dart b/lib/pages/stats.dart index 23e6189..b612280 100644 --- a/lib/pages/stats.dart +++ b/lib/pages/stats.dart @@ -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, + ); + } +}