BankCountryPicker class

Searchable country selection field with an accompanying modal sheet.

The field renders the selected country's flag emoji and name (plus the dial code when showDialCode is true) inside BankTextField-style chrome with a trailing chevron. Tapping it opens a 70 %-height modal bottom sheet (drag handle, pinned search field, alphabetically grouped list with sticky letter headers, 48 px rows, checkmark on the selected row). The sheet can also be presented directly via show.

Use it for residency, nationality, dial-code, or remittance-destination selection in onboarding and transfer flows.

BankCountryPicker(
  onSelected: (country) => setState(() => _country = country),
  selected: _country,
  label: 'Country of residence',
  showDialCode: true,
  recentIsoCodes: const ['AE', 'GB', 'US'],
)

Hosts needing localised country names can pass countriesOverride; otherwise the bundled English BankCountry.all list is used.

Inheritance

Constructors

BankCountryPicker({required ValueChanged<BankCountry> onSelected, Key? key, BankCountry? selected, String? label, bool showDialCode = false, bool enabled = true, List<BankCountry>? countriesOverride, List<String> recentIsoCodes = const <String>[], String placeholder = 'Select country', String searchHint = 'Search by name, code, or dial code', String recentLabel = 'Recent', String emptyLabel = 'No countries found', EdgeInsetsGeometry? padding, BorderRadius? radius, Color? backgroundColor, TextStyle? labelStyle, TextStyle? valueStyle, IconData? expandIcon, IconData? searchIcon, IconData? selectedIcon, double? sheetHeightFactor, String? semanticLabel})
Creates a country picker field.
const

Properties

backgroundColor Color?
Overrides BankThemeData.surface as the field fill while enabled (the disabled fill stays BankThemeData.surfaceVariant).
final
countriesOverride List<BankCountry>?
Replacement country list (e.g. localised names). Defaults to BankCountry.all.
final
emptyLabel String
Message shown when the search query matches no country.
final
enabled bool
When false the field is greyed out and does not open the sheet.
final
expandIcon IconData?
Overrides BankIcons.expand as the field's trailing glyph.
final
hashCode int
The hash code for this object.
no setterinherited
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
label String?
Optional label rendered above the field.
final
labelStyle TextStyle?
Merged over the computed label style (default: BankTokens.labelMedium in BankThemeData.onSurface).
final
onSelected ValueChanged<BankCountry>
Called with the country the user picked from the sheet.
final
padding EdgeInsetsGeometry?
Overrides the field's inner content padding (default: BankTokens.space4 horizontal by BankTokens.space3 vertical).
final
placeholder String
Placeholder text shown in the field when selected is null.
final
radius BorderRadius?
Overrides BankThemeData.buttonRadius as the field radius.
final
recentIsoCodes List<String>
ISO codes rendered in a pinned "Recent" section at the top of the sheet, in the given order. Unknown codes are ignored.
final
recentLabel String
Header label of the recently-selected section in the sheet.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
searchHint String
Hint for the sheet's search field.
final
searchIcon IconData?
Overrides BankIcons.search as the sheet's search-field glyph.
final
selected BankCountry?
The currently selected country, or null when nothing is selected.
final
selectedIcon IconData?
Overrides Icons.check_circle as the selected-row checkmark glyph in the sheet.
final
semanticLabel String?
Overrides the computed field semantics label (default: the label or placeholder followed by the selection).
final
sheetHeightFactor double?
Overrides the sheet's screen-height fraction (default: 0.70).
final
showDialCode bool
Whether to render the dial code next to the country name (field and sheet rows).
final
valueStyle TextStyle?
Merged over the computed value / placeholder style (default: BankTokens.bodyLarge coloured per the selection state).
final

Methods

build(BuildContext context) Widget
Describes the part of the user interface represented by this widget.
override
createElement() StatelessElement
Creates a StatelessElement to manage this widget's location in the tree.
inherited
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object.
inherited
toStringShort() String
A short, textual description of this widget.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

show(BuildContext context, {BankCountry? selected, List<BankCountry>? countriesOverride, List<String> recentIsoCodes = const <String>[], bool showDialCode = false, String searchHint = 'Search by name, code, or dial code', String recentLabel = 'Recent', String emptyLabel = 'No countries found', IconData? searchIcon, IconData? selectedIcon, double? sheetHeightFactor}) Future<BankCountry?>
Presents the country selection sheet and returns the country the user tapped, or null if the sheet was dismissed.