This commit is contained in:
JMARyA 2024-09-24 18:35:28 +02:00
parent 637e74e45b
commit 097e6a6de5
Signed by: jmarya
GPG key ID: 901B2ADDF27C2263

View file

@ -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"))
],),
);
}
}