LocaleSwitcher class
A Widget to switch locale of App.
Use any of these constructors to create widget:
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- LocaleSwitcher
Constructors
-
LocaleSwitcher.custom({GlobalKey<
State< ? key, required LocaleSwitchBuilder builder, int numberOfShown = 4, bool showOsLocale = true})StatefulWidget> > -
A Widget to switch locale of App with your own widget:
factory
-
LocaleSwitcher.grid({GlobalKey<
State< ? key, int numberOfShown = 200, bool showOsLocale = true, SliverGridDelegate? gridDelegate, dynamic setLocaleCallBack(BuildContext)?, int? useNLettersInsteadOfIcon, ShapeBorder? shape = const CircleBorder(eccentricity: 0)})StatefulWidget> > -
A Widget to switch locale of App with GridView.
factory
-
LocaleSwitcher.iconButton({GlobalKey<
State< ? key, String? toolTipPrefix = 'Current language: ', String? title = 'Select language: ', Icon? useStaticIcon, double? iconRadius = 32, int numberOfShown = 200, bool showOsLocale = true, int? useNLettersInsteadOfIcon, ShapeBorder? shape = const CircleBorder(eccentricity: 0), dynamic setLocaleCallBack(BuildContext)?})StatefulWidget> > -
A Widget to switch locale of App with IconButton.
factory
-
A Widget to switch locale of App with DropDownMenu.
factory
-
LocaleSwitcher.segmentedButton({GlobalKey<
State< ? key, int numberOfShown = 4, bool showOsLocale = true, int? useNLettersInsteadOfIcon, ShapeBorder? shape, dynamic setLocaleCallBack(BuildContext)?})StatefulWidget> > -
A Widget to switch locale of App with SegmentedButton.
factory
Properties
- builder → LocaleSwitchBuilder?
-
Create you own locale switcher widget:
final
- gridDelegate → SliverGridDelegate?
-
Only for LocaleSwitcher.grid constructor
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- iconRadius → double?
-
Only for LocaleSwitcher.iconButton.
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- numberOfShown → int
-
Number of shown flags
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- setLocaleCallBack → (dynamic Function(BuildContext)?)
-
Function called after choosing new current
Locale
(actually LocaleName).final - shape → ShapeBorder?
-
Shape of flags.
final
- showLeading → bool
-
Show leading icon in drop down menu
final
- showOsLocale → bool
-
Show option to use language of OS.
final
- title → String?
-
Currently selected entry in supportedLocaleNames that contains Locale.
final
- toolTipPrefix → String?
-
Only for LocaleSwitcher.iconButton.
final
- type → LocaleSwitcherType
-
What constructor was used to create this instance.
final
- useNLettersInsteadOfIcon → int
-
If null or 0 - used Icon, otherwise first N letters of language code.
final
- useStaticIcon → Icon?
-
Only for LocaleSwitcher.iconButton - use static icon.
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< LocaleSwitcher> -
Creates the mutable state for this widget at a given location in the tree.
override
-
debugDescribeChildren(
) → List< DiagnosticsNode> -
Returns a list of DiagnosticsNode objects describing this node's
children.
inherited
-
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
toString(
{DiagnosticLevel minLevel = DiagnosticLevel.info}) → String -
A string representation of this object.
inherited
-
toStringDeep(
{String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a string representation of this node and its descendants.
inherited
-
toStringShallow(
{String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a one-line detailed description of the object.
inherited
-
toStringShort(
) → String -
A short, textual description of this widget.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- current ↔ LocaleName
-
Currently selected entry in supportedLocaleNames that contains Locale.
getter/setter pair
-
locale
→ ValueNotifier<
Locale> -
A ReadOnly ValueNotifier with current locale.
no setter
- localeBestMatch → Locale
-
A ReadOnly Locale, in range of supportedLocales, if selected systemLocale it try to guess.
no setter
-
localeIndex
→ ValueNotifier<
int> -
ValueNotifier with index of supportedLocaleNames currently used.
no setter
- supportedLocaleNames → SupportedLocaleNames
-
A list of generated LocaleNames for supportedLocales.
no setter
Static Methods
-
readLocales(
List< Locale> supportedLocales) → List<Locale> -
Update supportedLocales (that used to generated
LocaleStore.supportedLocaleNames
).