locale_switcher library
A widget for switching the locale of your application.
Classes
- LangIconWithToolTip
- Icon representing the language (with tooltip).
- LocaleManager
- This should be a parent to either MaterialApp or CupertinoApp.
- LocaleMatcher
- Helper, allow to find LocaleName in LocaleSwitcher.supportedLocaleNames.
- LocaleName
- Wrapper around Locale, it's name, flag, language and few helpers.
- LocaleSwitcher
- A Widget to switch locale of App.
- MultiLangFlag
- A Widget to display multi language locales for LocaleSwitcher.
- SupportedLocaleNames
- A list of generated LocaleNames for supportedLocales.
- TitleForLocaleSwitch
-
Just a little helper - title for the widget
LocaleSwitch
.
Enums
- FlagNotFoundFallBack
-
Parameter for
Locale.flag
extension. - IfLocaleNotFound
- Parameter for LocaleMatcher.trySetLocale and LocaleMatcher.tryFindLocale.
- LocaleSwitcherType
- Names of possible LocaleSwitcher constructors.
- MultiLangCountries
- How to display Locales for countries with multiple languages:
Extensions
- LocaleFlag on Locale
- An extension on Locale add emoji and flag methods.
- StringToLocale on String
- Extension on String to convert it to Locale.
Constants
- emojiOffset → const int
- Offset of the emoji flags in Unicode table.
- showOtherLocales → const String
- A special name for wrapper LocaleName to use as button that show other locales.
- systemLocale → const String
- A special name for wrapper LocaleName to use as system locale option.
Properties
-
countriesWithMulti
→ Map<
String, String> -
A map to connect language to country, only for country with multiple languages.
final
-
languageToCountry
→ Map<
String, List> -
Map language to country, (and -optionally- a custom flag).
final
-
popularInCountry
→ Map<
String, String> -
For MultiLangCountries.auto - country most popular language.
final
Functions
-
findFlagFor(
{String? language, String? country}) → Widget? - Try to find a flag by language or country string.
-
showSelectLocaleDialog(
BuildContext context, {String title = 'Select language', double? width, double? height, SliverGridDelegate? gridDelegate, dynamic setLocaleCallBack(BuildContext)?, bool useEmoji = false}) → Future< void> - Show popup dialog to select Language.
Typedefs
- ItemBuilder = Widget Function(LocaleName e)
- A widget that represent a language, something like LangIconWithToolTip.
- LocaleSwitchBuilder = Widget Function(SupportedLocaleNames, BuildContext)
- A custom builder type for LocaleSwitcher.custom.
- MultiLangBuilder = Widget Function(Widget wTop, Widget wDown, [double? radius, Key? key])
- Builder function for LocaleSwitcher.multiLangWidget.