LocaleSwitcher.custom constructor
- {Key? key,
- required LocaleSwitchBuilder builder,
- int numberOfShown = 200,
- bool showOsLocale = true}
A Widget to switch locale of App with your own widget:
Example:
LocaleSwitcher.custom(
builder: (locales) {
return AnimatedToggleSwitch<String>.rolling(
current: LocaleManager.realLocaleNotifier.value,
values: locales,
loading: false,
onChanged: (langCode) async {
if (langCode == showOtherLocales) {
showSelectLocaleDialog(context);
} else {
LocaleManager.realLocaleNotifier.value = langCode;
}
},
iconBuilder: getIconForLanguage,
);
})
Implementation
factory LocaleSwitcher.custom({
Key? key,
required LocaleSwitchBuilder builder,
int numberOfShown = 200,
bool showOsLocale = true,
}) {
return LocaleSwitcher._(
key: key,
title: null,
showOsLocale: showOsLocale,
numberOfShown: numberOfShown,
type: _Switcher.custom,
builder: builder);
}