cdb_ui/lib/pages/flow/end_flow_page.dart

51 lines
1.3 KiB
Dart
Raw Normal View History

2024-09-24 16:00:13 +00:00
import 'package:cdb_ui/api.dart' as API;
2024-09-24 16:35:28 +00:00
import 'package:cdb_ui/api.dart';
import 'package:cdb_ui/pages/transaction.dart';
2024-09-24 16:00:13 +00:00
import 'package:flutter/material.dart';
2024-09-24 16:35:28 +00:00
class EndFlowWithProduce extends StatefulWidget {
2024-09-24 16:00:13 +00:00
final API.Flow flow;
final API.FlowInfo info;
const EndFlowWithProduce(this.flow, this.info, {super.key});
2024-09-24 16:35:28 +00:00
@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();
});
}
2024-09-24 16:00:13 +00:00
@override
Widget build(BuildContext context) {
// todo : show end screen with produce
2024-09-24 16:35:28 +00:00
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"))
],),
);
2024-09-24 16:00:13 +00:00
}
}