CountryDropdownField class

A text field-style dropdown for selecting countries with consistent styling.

Use CountrifyFieldStyle to customise every aspect of the field decoration in one place:

CountryDropdownField(
  style: CountrifyFieldStyle.defaultStyle().copyWith(
    labelText: 'Country',
    fillColor: Colors.grey.shade50,
  ),
  onCountrySelected: (country) => print(country.name),
)
Inheritance

Constructors

CountryDropdownField({Key? key, CountryCode? initialCountryCode, ValueChanged<Country>? onCountrySelected, ValueChanged<Country>? onCountryChanged, CountryPickerTheme? theme, CountryPickerConfig? config, CountrifyFieldStyle? style, bool enabled = true, bool showPhoneCode = true, bool showFlag = true, bool searchEnabled = true, bool filterEnabled = false, PickerDisplayType pickerType = PickerDisplayType.bottomSheet})
A text field-style dropdown for selecting countries with consistent styling.
const

Properties

config CountryPickerConfig?
Configuration options for the picker.
final
enabled bool
Whether the field is enabled.
final
filterEnabled bool
Whether filtering is enabled in the picker.
final
hashCode int
The hash code for this object.
no setterinherited
initialCountryCode CountryCode?
Initial selected country by enum code.
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
onCountryChanged ValueChanged<Country>?
Callback when country selection changes.
final
onCountrySelected ValueChanged<Country>?
Callback when a country is selected.
final
pickerType PickerDisplayType
Type of picker to display.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
searchEnabled bool
Whether search is enabled in the picker.
final
showFlag bool
Whether to show country flag in the field.
final
showPhoneCode bool
Whether to show phone code in the field.
final
style CountrifyFieldStyle?
Modular style for the field. Controls every aspect of the InputDecoration plus extras like selectedCountryTextStyle.
final
theme CountryPickerTheme?
Theme configuration for the picker.
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() State<CountryDropdownField>
Creates the mutable state for this widget at a given location in the tree.
override
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