diff --git a/lib/ui/app/entity_dropdown.dart b/lib/ui/app/entity_dropdown.dart index 1299706eb08..9079f0961b0 100644 --- a/lib/ui/app/entity_dropdown.dart +++ b/lib/ui/app/entity_dropdown.dart @@ -334,7 +334,9 @@ class _EntityDropdownState extends State { }, onChanged: (value) { _filter = value; - widget.onSelected(null); + if (hasValue) { + widget.onSelected(null); + } }, suffixIconButton: iconButton, ); diff --git a/lib/ui/company_gateway/edit/company_gateway_edit.dart b/lib/ui/company_gateway/edit/company_gateway_edit.dart index b5fdb777cb2..e61a1d1f2de 100644 --- a/lib/ui/company_gateway/edit/company_gateway_edit.dart +++ b/lib/ui/company_gateway/edit/company_gateway_edit.dart @@ -145,22 +145,23 @@ class _CompanyGatewayEditState extends State children: [ if (companyGateway.isNew) EntityDropdown( + autofocus: true, entityType: EntityType.gateway, entityList: memoizedGatewayList(state.staticState.gatewayMap), labelText: localization.provider, entityId: companyGateway.gatewayId, onSelected: (SelectableEntity gateway) { - gateway ??= GatewayEntity(); viewModel.onChanged( companyGateway.rebuild((b) => b - ..feesAndLimitsMap[(gateway as GatewayEntity) + ..feesAndLimitsMap[((gateway ?? GatewayEntity()) + as GatewayEntity) .defaultGatewayTypeId ?? kGatewayTypeCreditCard] = FeesAndLimitsSettings(isEnabled: true) - ..gatewayId = gateway.id + ..gatewayId = gateway?.id ?? '' ..config = '{}' - ..label = gateway.listDisplayName), + ..label = gateway?.listDisplayName ?? ''), ); }, ),