update
This commit is contained in:
parent
637e74e45b
commit
097e6a6de5
1 changed files with 38 additions and 2 deletions
|
@ -1,15 +1,51 @@
|
|||
import 'package:cdb_ui/api.dart' as API;
|
||||
import 'package:cdb_ui/api.dart';
|
||||
import 'package:cdb_ui/pages/transaction.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class EndFlowWithProduce extends StatelessWidget {
|
||||
class EndFlowWithProduce extends StatefulWidget {
|
||||
final API.Flow flow;
|
||||
final API.FlowInfo info;
|
||||
|
||||
const EndFlowWithProduce(this.flow, this.info, {super.key});
|
||||
|
||||
@override
|
||||
State<EndFlowWithProduce> createState() => _EndFlowWithProduceState();
|
||||
}
|
||||
|
||||
class _EndFlowWithProduceState extends State<EndFlowWithProduce> {
|
||||
Map<String, int> produces = {};
|
||||
|
||||
List<Widget> addProduceButtons() {
|
||||
List<Widget> ret = [];
|
||||
|
||||
for (var i in widget.info.produces!) {
|
||||
ret.add(ElevatedButton(onPressed: () {
|
||||
// todo : implement adding
|
||||
}, child: Text("Produced $i")));
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
_endFlow() {
|
||||
API.API().endFlow(widget.flow.id, produced: produces).then((x) {
|
||||
Navigator.of(context).pop();
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// todo : show end screen with produce
|
||||
return Scaffold();
|
||||
return Scaffold(
|
||||
appBar: AppBar(title: Text("End ${widget.info.name} Flow"),),
|
||||
body: Column(children: [
|
||||
...addProduceButtons(),
|
||||
const Divider(),
|
||||
// todo : add produced list
|
||||
const SizedBox(height: 10,),
|
||||
ElevatedButton(onPressed: _endFlow, child: const Text("End Flow"))
|
||||
],),
|
||||
);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue