From 097e6a6de52b37bed2ebc01bfc0603a1c42403fb Mon Sep 17 00:00:00 2001 From: JMARyA Date: Tue, 24 Sep 2024 18:35:28 +0200 Subject: [PATCH] update --- lib/pages/flow/end_flow_page.dart | 40 +++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/lib/pages/flow/end_flow_page.dart b/lib/pages/flow/end_flow_page.dart index 215e40d..af94e50 100644 --- a/lib/pages/flow/end_flow_page.dart +++ b/lib/pages/flow/end_flow_page.dart @@ -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 createState() => _EndFlowWithProduceState(); +} + +class _EndFlowWithProduceState extends State { + Map produces = {}; + + List addProduceButtons() { + List 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")) + ],), + ); } } \ No newline at end of file