CountryStateCityField class

A composite form field that stacks CountryDropdownField, StateDropdownField, and CityDropdownField into a cascading country → state → city selector.

Changing the country clears the state and city; changing the state clears the city.

All three children share fieldStyle for visual consistency but each exposes picker-level theming and config overrides individually:

CountryStateCityField(
  initialCountryCode: CountryCode.us,
  onChanged: (sel) => print(sel),
  fieldStyle: CountrifyFieldStyle.defaultStyle(),
  countryPickerTheme: CountryPickerTheme(...),
  geoPickerTheme: GeoPickerTheme.light(),
)
Inheritance

Constructors

CountryStateCityField({Key? key, CountryCode? initialCountryCode, int? initialStateId, int? initialCityId, ValueChanged<CountryStateCitySelection>? onChanged, CountrifyFieldStyle? fieldStyle, CountrifyFieldStyle? countryFieldStyle, CountrifyFieldStyle? stateFieldStyle, CountrifyFieldStyle? cityFieldStyle, CountryPickerTheme? countryPickerTheme, CountryPickerConfig? countryPickerConfig, GeoPickerTheme? geoPickerTheme, GeoPickerConfig? geoPickerConfig, CountryPickerMode pickerMode = CountryPickerMode.bottomSheet, bool enabled = true, bool showFlag = true, bool searchEnabled = true, bool showStateType = true, bool showCityCoordinates = false, String countryLabel = 'Country', String stateLabel = 'State / Province', String cityLabel = 'City', double spacing = 12, StateSortBy stateSortBy = StateSortBy.name, CitySortBy citySortBy = CitySortBy.name, GeoRepository? repository})
A composite form field that stacks CountryDropdownField, StateDropdownField, and CityDropdownField into a cascading country → state → city selector.
const

Properties

cityFieldStyle → CountrifyFieldStyle?
Field decoration for the city dropdown.
final
cityLabel → String
Label for the city field.
final
citySortBy → CitySortBy
Sort order in the city picker.
final
countryFieldStyle → CountrifyFieldStyle?
Field decoration for the country dropdown.
final
countryLabel → String
Label for the country field.
final
countryPickerConfig → CountryPickerConfig?
Config applied to the CountryPicker.
final
countryPickerTheme → CountryPickerTheme?
Theme applied to the CountryPicker opened by the country dropdown.
final
enabled → bool
Whether the field accepts input.
final
fieldStyle → CountrifyFieldStyle?
Shared field decoration applied to all three dropdowns. Per-field overrides below take precedence when set.
final
geoPickerConfig → GeoPickerConfig?
Config applied to both the state and city pickers.
final
geoPickerTheme → GeoPickerTheme?
Theme applied to both the state and city pickers.
final
hashCode → int
The hash code for this object.
no setterinherited
initialCityId → int?
Initial city id (only applied if it belongs to initialStateId).
final
initialCountryCode → CountryCode?
Initial country by enum code.
final
initialStateId → int?
Initial state id (only applied if it belongs to initialCountryCode).
final
key → Key?
Controls how one widget replaces another widget in the tree.
finalinherited
onChanged → ValueChanged<CountryStateCitySelection>?
Emits on every selection change.
final
pickerMode → CountryPickerMode
Display style applied to all three pickers.
final
repository → GeoRepository?
Repository override (primarily for tests).
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
searchEnabled → bool
Whether the pickers show search fields.
final
showCityCoordinates → bool
Whether to show lat/lng as a subtitle on city rows.
final
showFlag → bool
Whether to show the country flag inside the country dropdown.
final
showStateType → bool
Whether to show the subdivision type as a subtitle on state rows.
final
spacing → double
Vertical gap between each dropdown.
final
stateFieldStyle → CountrifyFieldStyle?
Field decoration for the state dropdown.
final
stateLabel → String
Label for the state field.
final
stateSortBy → StateSortBy
Sort order in the state picker.
final

Methods

createElement() → StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() → State<CountryStateCityField>
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