TranslationButton class

A button widget that allows users to select or change the current locale.

Supports different styles, optional custom builders, and callback when the locale changes.

Inheritance

Constructors

TranslationButton({Key? key, String reason = "bottom_sheet", String? name, bool ignorePointer = false, BoxDecoration? decoration, EdgeInsets? padding, TranslationButtonType type = TranslationButtonType.flagAndCode, bool markAsDefault = false, TextStyle? textStyle, Widget builder(BuildContext context, String text)?, ValueChanged<Locale>? onChanged})
const

Properties

builder Widget Function(BuildContext context, String text)?
Optional builder to fully customize the button UI.
final
decoration BoxDecoration?
Optional decoration for the button container.
final
hashCode int
The hash code for this object.
no setterinherited
ignorePointer bool
Whether to ignore pointer events (disable interaction).
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
markAsDefault bool
Whether this button should be marked as the default language.
final
name String?
final
onChanged ValueChanged<Locale>?
Callback invoked when the locale changes.
final
padding EdgeInsets?
Padding around the button content.
final
reason String
Reason or context for the button, e.g., "bottom_sheet".
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
textStyle TextStyle?
Text style for the button label.
final
type TranslationButtonType
Type of the button determining what is displayed (flag, code, or both).
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() State<TranslationButton>
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, 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

Operators

operator ==(Object other) bool
The equality operator.
inherited