Flutter - Country State City Picker | csc_picker package review
Вставка
- Опубліковано 15 вер 2024
- This video explains how to display country, state and city picker. In addition it gives the possibility to select a list of countries, States and Cities depends on Selected, also you can search country, state, and city all around the world.
Source Code: github.com/rit...
Package: pub.dev/packag...
👉 Social Media
► GitHub: github.com/ritsat
► Instagram: / effortlesscodelearning
► Blog: effortlesscode...
#Flutter #flutterdev #flutterdeveloper
Please Like, Share, Subscribe & Click on the Bell button for more video like this
Thanks for watching the video :-)
Hey thanks for using my package, I am glad that my contribution is helpful for flutter community ❤️
Thanks for such amazing package.
Hello. Can I ask why the fields are in disabled state? I can't click it. Appreciate your response
can i just use state and city and not the country option?
Flutter Web engine failed to fetch "assets/packages/csc_picker/lib/assets/country.json". HTTP request succeeded, but the server responded with HTTP status 404.
Error: Unable to load asset: "packages/csc_picker/lib/assets/country.json".
The asset does not exist or has empty data.
I got this error.How to rectify this
Hello altafc22, please i have a question.
Is it possible to use just states but based on a country?
The country and city dropdown will not be used but the states will be based on a particular country.
I didn't know that there was package like this, thanks brother
Welcome
I was scared when I had to do this feature. I didn't know that there is a package about this package. Thank you so much :))
Glad! it helped you. Thanks for watching the video.
شكرا يا أخو 🫂
thnks for video
Welcome
Not useful feature its Working fine as you set value 1st time but in some situations if you want to edit customer details that time controller value cant take CSCPicker
Not sure what happened but whenever I try to select a country, I get this error: @pragma("vm:external-name", "Error_throwWithStackTrace")
external static Never _throw(Object error, StackTrace stackTrace);
but I want to show only cities name not state or country name please tell me how I can resolve it
thank you brother💞...is there any way to hide Country Dropdown...bcoz we want only state and city..we use disableCountry: true, but its not working
does this package support locale? so i can see the dropdown in portuguese, italian, spanish, french, russian, etc...?
Very helpful thank you so much
Glad it was helpful!
Is it possible to use just states but base on a country?
The country and city dropdown would not be used.
Just default country and display hidden this way you will have only state dropdown.
Hello. Can I ask why the fields are in disabled state? I can't click it. Appreciate your response
well done
😊
is the result
how to work with GetX flutter in this package
sir ya error arahy ha.
Error while trying to load an asset: Failed to load asset at "assets/packages/csc_picker/lib/assets/country.json" (404)
Error: Unable to load asset: packages/csc_picker/lib/assets/country.json
Please run pub get, restart the application & check once again.
How to increase the size of the text boxes of this widget , is that possible
You can wrap CSCPicker widget inside SizedBox or Container widget then you can set width on this outer widget.
Hi bro.. can you explain Radiolisttile value save using sharedpreferences I stuck with get the values
You can get selected RadioListTile widget value using onChange callback handler and inside this callback handler you can set the value in SharedPreferences . Below code for the reference. You can further refactor this code. I have just given it for reference.
RadioListTile(
value: 1,
groupValue: val,
onChanged: (value) async { // get selected value here
SharedPreferences prefs = await SharedPreferences.getInstance();
prefs.setString('gender', value);
},
title: Text("Male"),
)
Likewise you can get the value from SharedPreferences & set to RadioListTile,
SharedPreferences prefs = await SharedPreferences.getInstance();
final gender= prefs.getString('gender') ?? '';
setState({});
@@EffortlessCodeLearning okay Thanks I will try let you know
I find the solution bro after debugging save method only I did wrong now able to getting the data properly... Anyway thanks a lot your reply 😊
@@paranthamanarumugam4172 Glad to hear that
@@paranthamanarumugam4172 Glad to hear
How to convert 2 year old flutter code to convert into new flutter SDK 3.5
Below links will help you to upgrade the flutter project,
medium.com/nerd-for-tech/upgrade-your-old-flutter-projects-to-flutter-version-2-with-null-safety-b42f0f21505f
docs.flutter.dev/development/tools/sdk/upgrading
Bro i am getting error package not found
Please run pub get, restart the application & check once again.
I already imported the package but I would like to know if there is a way to delete or take out some countries. For example I want to limit the countries to United States, Canada, Mexico, and England is there a way that I can do that.
As of now, there is no such option available with this package, but I have made this change & raised a pull request to merge the code with this package. Once the code is merged by package creator, option to limit the countries will be available.
I will update you once this change is merged & new version of this package is published.
Meantime I will check & update you for another solution that can be used until this option is available with this package.
This feature is now available with the latest version of this package. Please refer package page for more details,
pub.dev/packages/csc_picker
You can use countryFilter property in CSCPicker widget to show limited countries in the drop down.
You can use countryFilter property like the following way,
//Country Filter, it is optional parameter
countryFilter: [CscCountry.India,CscCountry.United_States,CscCountry.Canada],
I hope it will help.
brother can you check your instagram