WorldPickerIcon class

A customizable widget that displays a country selector with flag and metadata.

This widget shows a tappable interface displaying the selected country's flag and optional information (ISO code, name, currency, dial code). When tapped, it opens a bottom sheet with a searchable list of all countries.

Example usage:

WorldPickerIcon(
  onSelect: (country) {
    print('Selected: ${country.name}');
  },
  selectedCountry: selectedCountry,
  showIsoCode: true,
  showDialCode: true,
)
Inheritance

Constructors

WorldPickerIcon.new({Key? key, required ValueChanged<Country> onSelect, Country? selectedCountry, double? size = 32.0, bool showIsoCode = false, bool showName = false, bool showCurrencyCode = false, bool showDialCode = false, String defaultCountryIsoCode = 'US', WorldPickerOptions options = const WorldPickerOptions()})
Creates a WorldPickerIcon widget.
const

Properties

defaultCountryIsoCode String
The default country ISO code to use when no country is selected. Defaults to "US".
final
hashCode int
The hash code for this object.
no setterinherited
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
onSelect ValueChanged<Country>
Callback function that is called when a country is selected. The selected Country object is passed as a parameter.
final
options WorldPickerOptions
Configuration options for customizing the country picker dialog.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
selectedCountry Country?
The currently selected country. If null, displays a default placeholder.
final
showCurrencyCode bool
Whether to display the currency code (e.g., "USD"). Defaults to false.
final
showDialCode bool
Whether to display the international dial code (e.g., "+1"). Defaults to false.
final
showIsoCode bool
Whether to display the ISO country code (e.g., "US"). Defaults to false.
final
showName bool
Whether to display the country name (e.g., "United States"). Defaults to false.
final
size double?
The size of the flag icon. Defaults to 32.0.
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