Fixed a bug where the current payment method is duplicated in the payment selection list

This commit is contained in:
Dennis Nemec
2026-01-09 13:02:38 +01:00
parent da0f77e35d
commit 3b5d58eb9d

View File

@ -24,10 +24,13 @@ class _DeliverySummaryState extends State<DeliverySummary> {
super.initState(); super.initState();
final tourState = context.read<TourBloc>().state as TourLoaded; final tourState = context.read<TourBloc>().state as TourLoaded;
_paymentMethods = [ _paymentMethods = [...tourState.paymentOptions];
widget.delivery.payment,
...tourState.paymentOptions, if (!_paymentMethods.any(
]; (payment) => payment.id == widget.delivery.payment.id,
)) {
_paymentMethods.add(widget.delivery.payment);
}
} }
Widget _deliveredArticles() { Widget _deliveredArticles() {
@ -90,8 +93,6 @@ class _DeliverySummaryState extends State<DeliverySummary> {
) )
.toList(); .toList();
debugPrint(widget.delivery.payment.id);
return DropdownMenu( return DropdownMenu(
dropdownMenuEntries: entries, dropdownMenuEntries: entries,
initialSelection: widget.delivery.payment.id, initialSelection: widget.delivery.payment.id,