0 purchases
brazilian locations
Flutter Brazilian Locations From Guilherme Queiroz
Flutter package to display list of States and Cities from Brazil.
Brazilian Locations you can build highly customizable input, that your designers can't even draw in Figma 🤭
How to Use #
To use this Package, add brazilian_locations as a dependency in your pubspec.yaml.
BrazilianLocations(
showStates: true,
showCities: true,
stateDropdownLabel: "State",
cityDropdownLabel: "City",
stateSearchPlaceholder: "State",
citySearchPlaceholder: "City",
onStateChanged: (value) {
if (value != null) {
setState(() => stateValue = value);
}
},
onCityChanged: (value) {
if (value != null) {
setState(() => cityValue = value);
}
},
);
copied to clipboard
you will get feedback in onChanged functions
Cache Service #
The package now includes a cache service that stores the data retrieved from the IBGE API using Hive, allowing faster loading times for subsequent app launches.
Optional Initialization:: You can choose to initialize the cache service before running your app to ensure data is preloaded and dropdowns are ready for user interaction immediately.
Example:
void main() async {
/// Optionally initialize BrazilianLocations
/// - Initializes Hive and loads cached data.
/// - Ensures dropdowns are populated and responsive upon first app load.
await BrazilianLocations.initialize();
runApp(const MyApp());
}
copied to clipboard
Parameters #
ParametersTypeDescription
showStatesBoolean Enable disable States dropdown (true / false)
showCitiesBoolean Enable disable Cities dropdown (true / false)
dropdownDecorationBoxDecorationDropdown box decoration to style your dropdown selector [OPTIONAL PARAMETER] (USE with disabledDropdownDecoration)
disabledDropdownDecorationBoxDecorationDisabled Dropdown box decoration to style your dropdown selector [OPTIONAL PARAMETER] (USE with disabled dropdownDecoration)
selectedItemStyleTextStyleTo change selected item style
dropdownHeadingStyleTextStyleTo change DropdownDialog Heading style
dropdownItemStyleTextStyleTo change DropdownDialog Item style
dropdownDialogRadiusdoubleTo change DropdownDialogBox radius
searchBarRadiusdoubleTo change search bar radius
stateSearchPlaceholderStringPlaceholder for state search field
citySearchPlaceholderStringPlaceholder for city search field
stateDropdownLabelStringLabel/Title for state dropdown
cityDropdownLabelStringLabel/Title for city dropdown
Support #
Guilherme Queiroz Ribeiro
Don't forget to give it a star ⭐
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.