stats
This commit is contained in:
parent
1131e74691
commit
d53080dd32
3 changed files with 36 additions and 4 deletions
|
@ -1,4 +1,5 @@
|
||||||
import 'package:cdb_ui/api.dart';
|
import 'package:cdb_ui/api.dart';
|
||||||
|
import 'package:cdb_ui/pages/stats.dart';
|
||||||
import 'package:cdb_ui/pages/transaction.dart';
|
import 'package:cdb_ui/pages/transaction.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:intl/intl.dart';
|
import 'package:intl/intl.dart';
|
||||||
|
@ -25,6 +26,15 @@ class _ItemViewState extends State<ItemView> {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: Text(widget.item.name),
|
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: [
|
body: Column(children: [
|
||||||
Padding(
|
Padding(
|
||||||
|
|
|
@ -60,11 +60,12 @@ class _LocationsPageState extends State<LocationsPage> {
|
||||||
title: const Text("Locations"),
|
title: const Text("Locations"),
|
||||||
),
|
),
|
||||||
body: TreeView(
|
body: TreeView(
|
||||||
|
indent: 15,
|
||||||
nodes: locations!.keys
|
nodes: locations!.keys
|
||||||
.where((key) => locations![key]!.parent == null)
|
.where((key) => locations![key]!.parent == null)
|
||||||
.map((key) {
|
.map((key) {
|
||||||
return buildTree(context, key);
|
return buildTree(context, key);
|
||||||
}).toList()),
|
}).toList()),
|
||||||
floatingActionButton: FloatingActionButton(
|
floatingActionButton: FloatingActionButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
// scan location code
|
// scan location code
|
||||||
|
|
|
@ -20,6 +20,8 @@ class StatsPage extends StatelessWidget {
|
||||||
// todo : demand stat
|
// todo : demand stat
|
||||||
// todo : stat on origin + destination
|
// todo : stat on origin + destination
|
||||||
|
|
||||||
|
// global origin / destinations
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
body: FutureBuilder(
|
body: FutureBuilder(
|
||||||
future: _fetchData(),
|
future: _fetchData(),
|
||||||
|
@ -36,9 +38,9 @@ class StatsPage extends StatelessWidget {
|
||||||
return Column(
|
return Column(
|
||||||
children: [
|
children: [
|
||||||
Card(
|
Card(
|
||||||
margin: EdgeInsets.all(10.0),
|
margin: const EdgeInsets.all(10.0),
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: EdgeInsets.all(10.0),
|
padding: const EdgeInsets.all(10.0),
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
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,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue