shadcn_flutter icon indicating copy to clipboard operation
shadcn_flutter copied to clipboard

Consider bundling country_flags directly in the package

Open sunarya-thito opened this issue 1 year ago • 2 comments

country_flags is a package used for phone input to display country flags. Currently, it has an issue with flag caching. I made a PR, but I don't think it's going anywhere. And since a package cannot depend on a git-based package, it's either wait until the PR gets accepted, release our own country_flags package, or directly bundle them in this package.

sunarya-thito avatar Aug 10 '24 23:08 sunarya-thito

Why not replace PhoneInput with intl_phone_number_input Of course, directly using intl_phone_number_input will not work but we can copy internal logic from github and replace the Flutter widget with the Shadcn widget

intl_phone_number_input also has its own problem like it uses separate image for every flag instead of sprite sheet

we can make it either part of shadcn_flutter or create a separate project with a customizable widget and then import it into shadcn_flutter

In my personal project, I am loading the country list from the server and also used currency_picker

so I am thinking of building a merged version intl_phone_number_input and currency_picker with customizable widget and may be making country and currency list make part of the documentation instead of hard coding it in the project so any one can add things like fantom country in games and crypto currency in currencies

KushagraVasal avatar Oct 10 '24 08:10 KushagraVasal

and add x-rates.com in currencies to add the feature of displaying exchange rates add the feature of displaying exchange rates in currency_picker

KushagraVasal avatar Oct 10 '24 08:10 KushagraVasal

Why not replace PhoneInput with intl_phone_number_input Of course, directly using intl_phone_number_input will not work but we can copy internal logic from github and replace the Flutter widget with the Shadcn widget

intl_phone_number_input also has its own problem like it uses separate image for every flag instead of sprite sheet

we can make it either part of shadcn_flutter or create a separate project with a customizable widget and then import it into shadcn_flutter

In my personal project, I am loading the country list from the server and also used currency_picker

so I am thinking of building a merged version intl_phone_number_input and currency_picker with customizable widget and may be making country and currency list make part of the documentation instead of hard coding it in the project so any one can add things like fantom country in games and crypto currency in currencies

What's wrong with the current PhoneInput?

and add x-rates.com in currencies to add the feature of displaying exchange rates add the feature of displaying exchange rates in currency_picker

I don't think the package should fetch anything outside of its scope, the package is only a Widget provider, providing a currency picker? should be fine, but providing extra API to fetch current rates? that's too much

sunarya-thito avatar Oct 17 '24 05:10 sunarya-thito

PhoneInput don't have parsing, formatting, and validating For more information, you can check out E.164 standard And https://github.com/google/libphonenumber

Example: https://libphonenumber.appspot.com/phonenumberparser?number=%2B919876543210, https://libphonenumber.appspot.com

In some packages, I have seen that typing the dial code automatically changes the country selection

KushagraVasal avatar Oct 17 '24 12:10 KushagraVasal

may be adding https://github.com/superakabo/dlibphonenumber in doc with sample code can be enough

KushagraVasal avatar Oct 17 '24 12:10 KushagraVasal

To make the code lighter you can look into this

String getFlagEmoji(String countryCode) { List<int> codePoints = countryCode.toUpperCase().split('').map((char) { return 127397 + char.codeUnitAt(0); }).toList(); return String.fromCharCodes(codePoints); }

Text(getFlagEmoji('IN')),

But the problem with this code is that it don't work well on the web

KushagraVasal avatar Oct 17 '24 12:10 KushagraVasal

And BottomSheet is preferred in place of dropdown on small screen devices

KushagraVasal avatar Oct 17 '24 12:10 KushagraVasal