CountryFlag class

A widget that displays a flag for a given country.

The CountryFlag widget can be used to display either a simplified or a custom flag for a specified country. It supports various customization options such as height, width, aspect ratio, decoration (and its position), padding, and a child widget.

Example usage:

CountryFlag.simplified(
  country,
  height: 50,
  decoration: BoxDecoration(border: Border.all(color: Colors.black)),
)
Inheritance
Available extensions

Constructors

CountryFlag.custom(WorldCountry item, Map<WorldCountry, BasicFlag> _map, {Map<WorldCountry, BasicFlag>? alternativeMap, double? aspectRatio, BoxDecoration? decoration, DecorationPosition? decorationPosition, EdgeInsetsGeometry? padding, double? height, double? width, FlagShaderDelegate? shader, Widget? orElse, Widget? child, Key? key})
Creates a CountryFlag widget with a custom flag representation.
const
CountryFlag.simplified(WorldCountry country, {Map<WorldCountry, BasicFlag>? alternativeMap, double? height, double? width, double? aspectRatio, BoxDecoration? decoration, DecorationPosition? decorationPosition, EdgeInsetsGeometry? padding, FlagShaderDelegate? shader, Widget? orElse, Widget? child, Key? key})
Creates a CountryFlag widget with a simplified flag representation.
const

Properties

alternativeMap Map<WorldCountry, 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
country WorldCountry

Available on CountryFlag, provided by the CountryFlagExtension extension

The country for which the flag is to be displayed.
no setter
debugLabel String
Returns a debug label for the flag, which is the ISO code by default.
no setteroverride
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 WorldCountry
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<WorldCountry, 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
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.
override
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