LanguageFlag class
A widget that displays a dual flag for a natural language.
When both a primary and secondary flag exist for the given language and they differ, renders a split flag with the primary (conventional) flag as background and the secondary (locale-adapted) flag clipped on top.
When no secondary flag is available or both flags are identical, renders the primary flag as a regular BasicFlag.
Example usage:
LanguageFlag.fromFlagMap(
const LangDeu(),
alternativeMap: context.maps.languageFlags,
)
- Inheritance
- Available extensions
Constructors
-
LanguageFlag.fromFlagMap(NaturalLanguage language, {Map<
NaturalLanguage, BasicFlag> ? alternativeMap = defaultSecondaryCountryLanguageFlags, int splitAngle = 45, bool clipSecondary = true, Clip clipBehavior = Clip.antiAlias, Widget? orElse, double? height, double? width, double? aspectRatio, BoxDecoration? decoration, DecorationPosition? decorationPosition, EdgeInsetsGeometry? padding, FlagShaderDelegate? shader, Widget? child, Key? key}) -
Creates a new instance of LanguageFlag.
const
Properties
-
alternativeMap
→ Map<
NaturalLanguage, BasicFlag> ? -
Map of non-official or alternative flags of the ISO objects.
no setterinherited
- aspectRatio → double?
-
The specified aspect ratio of the flag.
finalinherited
- basicFlag → BasicFlag?
-
Returns the BasicFlag for the specified item from the main map
or the alternative map if available.
no setterinherited
- calculatedAspectRatio → double?
-
Available on DecoratedFlagInterface, provided by the DecoratedFlagInterfaceExtension extension
The calculated aspect ratio of the flag based on its width and height.no setter - child → Widget?
-
A widget to display in the foreground of the flag.
finalinherited
- clipBehavior → Clip
-
The clip behavior for the split edge.
finalinherited
- clipSecondary → bool
-
Whether to clip the secondary flag (default) or the primary flag.
finalinherited
- debugLabel → String
-
Returns a debug label for the flag, which is the ISO code by default.
no setterinherited
- decoration → BoxDecoration?
-
The decoration of the flag.
finalinherited
- decorationPosition → DecorationPosition?
-
The position of the decoration.
finalinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- height → double?
-
The height of the flag.
finalinherited
- item → NaturalLanguage
-
The item for which the flag is to be displayed.
finalinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
-
map
→ Map<
NaturalLanguage, BasicFlag> -
A map of flags for ISO objects.
no setterinherited
- orElse → Widget?
-
A widget to display if the flag is not found in the map.
finalinherited
- padding → EdgeInsetsGeometry?
-
The padding around the flag.
finalinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- shader → FlagShaderDelegate?
-
Optional shader delegate applied when painting the stripes.
finalinherited
- splitAngle → int
-
The angle of the split line in degrees.
finalinherited
- width → double?
-
The width of the flag.
finalinherited
Methods
-
build(
BuildContext context) → Widget -
Describes the part of the user interface represented by this widget.
inherited
-
createElement(
) → StatelessElement -
Creates a StatelessElement to manage this widget's location in the tree.
inherited
-
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, int wrapWidth = 65}) → 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
-
toThemeData(
{Widget? child}) → FlagThemeData -
Available on DecoratedFlagInterface, provided by the DecoratedFlagInterfaceExtension extension
Converts this DecoratedFlagInterface to a FlagThemeData instance.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Constants
-
defaultConventionalLanguageFlags
→ const Map<
NaturalLanguage, BasicFlag> - Default conventional language-to-flag associations.
-
defaultSecondaryCountryLanguageFlags
→ const Map<
NaturalLanguage, BasicFlag> - Default secondary country flags for languages spoken in multiple countries.