TextTr class

A Text widget that automatically translates its content using Nylo's localization system.

This widget extends Flutter's Text widget and applies the .tr() extension method to automatically translate the provided string.

Example usage:

TextTr('hello_world')

With arguments for dynamic values:

TextTr(
  'welcome_message',
  arguments: {'name': 'John'},
)

With styling:

TextTr(
  'greeting',
  style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
  textAlign: TextAlign.center,
)
Inheritance
Available extensions

Constructors

TextTr(String data, {Key? key, TextStyle? style, TextAlign? textAlign, int? maxLines, TextOverflow? overflow, bool? softWrap, TextDirection? textDirection, Locale? locale, String? semanticsLabel, Map<String, String>? arguments})
Creates a TextTr widget.
TextTr.bodyLarge(String data, {Key? key, TextAlign? textAlign, Map<String, String>? arguments})
Creates a TextTr with bodyLarge text style.
TextTr.bodyMedium(String data, {Key? key, TextAlign? textAlign, Map<String, String>? arguments})
Creates a TextTr with bodyMedium text style.
TextTr.bodySmall(String data, {Key? key, TextAlign? textAlign, Map<String, String>? arguments})
Creates a TextTr with bodySmall text style.
TextTr.displayLarge(String data, {Key? key, TextAlign? textAlign, Map<String, String>? arguments})
Creates a TextTr with displayLarge text style.
TextTr.displayMedium(String data, {Key? key, TextAlign? textAlign, Map<String, String>? arguments})
Creates a TextTr with displayMedium text style.
TextTr.displaySmall(String data, {Key? key, TextAlign? textAlign, Map<String, String>? arguments})
Creates a TextTr with displaySmall text style.
TextTr.headlineLarge(String data, {Key? key, TextAlign? textAlign, Map<String, String>? arguments})
Creates a TextTr with headlineLarge text style.
TextTr.headlineMedium(String data, {Key? key, TextAlign? textAlign, Map<String, String>? arguments})
Creates a TextTr with headlineMedium text style.
TextTr.headlineSmall(String data, {Key? key, TextAlign? textAlign, Map<String, String>? arguments})
Creates a TextTr with headlineSmall text style.
TextTr.labelLarge(String data, {Key? key, TextAlign? textAlign, Map<String, String>? arguments})
Creates a TextTr with labelLarge text style.
TextTr.labelMedium(String data, {Key? key, TextAlign? textAlign, Map<String, String>? arguments})
Creates a TextTr with labelMedium text style.
TextTr.labelSmall(String data, {Key? key, TextAlign? textAlign, Map<String, String>? arguments})
Creates a TextTr with labelSmall text style.
TextTr.titleLarge(String data, {Key? key, TextAlign? textAlign, Map<String, String>? arguments})
Creates a TextTr with titleLarge text style.
TextTr.titleMedium(String data, {Key? key, TextAlign? textAlign, Map<String, String>? arguments})
Creates a TextTr with titleMedium text style.
TextTr.titleSmall(String data, {Key? key, TextAlign? textAlign, Map<String, String>? arguments})
Creates a TextTr with titleSmall text style.

Properties

arguments Map<String, String>?
Optional arguments for string interpolation in the translated text.
final
data String?
The text to display.
finalinherited
hashCode int
The hash code for this object.
no setterinherited
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
locale Locale?
Used to select a font when the same Unicode character can be rendered differently, depending on the locale.
finalinherited
maxLines int?
An optional maximum number of lines for the text to span, wrapping if necessary. If the text exceeds the given number of lines, it will be truncated according to overflow.
finalinherited
overflow TextOverflow?
How visual overflow should be handled.
finalinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
selectionColor Color?
The color to use when painting the selection.
finalinherited
semanticsIdentifier String?
A unique identifier for the semantics node for this widget.
finalinherited
semanticsLabel String?
An alternative semantics label for this text.
finalinherited
softWrap bool?
Whether the text should break at soft line breaks.
finalinherited
strutStyle StrutStyle?
The strut style to use. Strut style defines the strut, which sets minimum vertical layout metrics.
finalinherited
style TextStyle?
If non-null, the style to use for this text.
finalinherited
textAlign TextAlign?
How the text should be aligned horizontally.
finalinherited
textDirection TextDirection?
The directionality of the text.
finalinherited
textHeightBehavior TextHeightBehavior?
Defines how to apply TextStyle.height over and under text.
finalinherited
textScaleFactor double?
Deprecated. Will be removed in a future version of Flutter. Use textScaler instead.
finalinherited
textScaler TextScaler?
The font scaling strategy to use when laying out and rendering the text.
finalinherited
textSpan InlineSpan?
The text to display as a InlineSpan.
finalinherited
textWidthBasis TextWidthBasis?
Defines how to measure the width of the rendered text.
finalinherited

Methods

alignCenter() Text

Available on Text, provided by the NyTextExt extension

Aligns text to the center.
alignLeft() Text

Available on Text, provided by the NyTextExt extension

Aligns text to the left.
alignRight() Text

Available on Text, provided by the NyTextExt extension

Aligns text to the right.
bodyLarge({Color? color, double? fontSize, FontWeight? fontWeight, FontStyle? fontStyle, double? letterSpacing, double? wordSpacing, TextBaseline? textBaseline, double? height, Locale? locale, Paint? foreground, Paint? background, List<Shadow>? shadows, List<FontFeature>? fontFeatures, TextDecoration? decoration, Color? decorationColor, TextDecorationStyle? decorationStyle, double? decorationThickness, String? fontFamily, List<String>? fontFamilyFallback, String? package, TextOverflow? overflow, TextDecoration? overline, Color? overlineColor, TextDecorationStyle? overlineStyle, double? overlineThickness, TextDecoration? underline, Color? underlineColor, TextDecorationStyle? underlineStyle, double? underlineThickness, TextHeightBehavior? textHeightBehavior}) Text

Available on Text, provided by the NyTextExt extension

Set the Style to use bodyLarge.
bodyMedium({Color? color, double? fontSize, FontWeight? fontWeight, FontStyle? fontStyle, double? letterSpacing, double? wordSpacing, TextBaseline? textBaseline, double? height, Locale? locale, Paint? foreground, Paint? background, List<Shadow>? shadows, List<FontFeature>? fontFeatures, TextDecoration? decoration, Color? decorationColor, TextDecorationStyle? decorationStyle, double? decorationThickness, String? fontFamily, List<String>? fontFamilyFallback, String? package, TextOverflow? overflow, TextDecoration? overline, Color? overlineColor, TextDecorationStyle? overlineStyle, double? overlineThickness, TextDecoration? underline, Color? underlineColor, TextDecorationStyle? underlineStyle, double? underlineThickness, TextHeightBehavior? textHeightBehavior}) Text

Available on Text, provided by the NyTextExt extension

Set the Style to use bodyMedium.
bodySmall({Color? color, double? fontSize, FontWeight? fontWeight, FontStyle? fontStyle, double? letterSpacing, double? wordSpacing, TextBaseline? textBaseline, double? height, Locale? locale, Paint? foreground, Paint? background, List<Shadow>? shadows, List<FontFeature>? fontFeatures, TextDecoration? decoration, Color? decorationColor, TextDecorationStyle? decorationStyle, double? decorationThickness, String? fontFamily, List<String>? fontFamilyFallback, String? package, TextOverflow? overflow, TextDecoration? overline, Color? overlineColor, TextDecorationStyle? overlineStyle, double? overlineThickness, TextDecoration? underline, Color? underlineColor, TextDecorationStyle? underlineStyle, double? underlineThickness, TextHeightBehavior? textHeightBehavior}) Text

Available on Text, provided by the NyTextExt extension

Set the Style to use bodySmall.
build(BuildContext context) Widget
Describes the part of the user interface represented by this widget.
inherited
connectiveOr({required Widget offline}) Widget

Available on Widget, provided by the ConnectiveExtension extension

Wraps the widget in a Connective that shows an offline placeholder.
copyWith({Key? key, StrutStyle? strutStyle, TextAlign? textAlign, TextDirection? textDirection = TextDirection.ltr, Locale? locale, bool? softWrap, TextOverflow? overflow, TextScaler? textScaler, int? maxLines, String? semanticsLabel, TextWidthBasis? textWidthBasis, TextStyle? style}) Text

Available on Text, provided by the NyTextExt extension

Helper to apply changes.
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
displayLarge({Color? color, double? fontSize, FontWeight? fontWeight, FontStyle? fontStyle, double? letterSpacing, double? wordSpacing, TextBaseline? textBaseline, double? height, Locale? locale, Paint? foreground, Paint? background, List<Shadow>? shadows, List<FontFeature>? fontFeatures, TextDecoration? decoration, Color? decorationColor, TextDecorationStyle? decorationStyle, double? decorationThickness, String? fontFamily, List<String>? fontFamilyFallback, String? package, TextOverflow? overflow, TextDecoration? overline, Color? overlineColor, TextDecorationStyle? overlineStyle, double? overlineThickness, TextDecoration? underline, Color? underlineColor, TextDecorationStyle? underlineStyle, double? underlineThickness, TextHeightBehavior? textHeightBehavior}) Text

Available on Text, provided by the NyTextExt extension

Set the Style to use displayLarge.
displayMedium({Color? color, double? fontSize, FontWeight? fontWeight, FontStyle? fontStyle, double? letterSpacing, double? wordSpacing, TextBaseline? textBaseline, double? height, Locale? locale, Paint? foreground, Paint? background, List<Shadow>? shadows, List<FontFeature>? fontFeatures, TextDecoration? decoration, Color? decorationColor, TextDecorationStyle? decorationStyle, double? decorationThickness, String? fontFamily, List<String>? fontFamilyFallback, String? package, TextOverflow? overflow, TextDecoration? overline, Color? overlineColor, TextDecorationStyle? overlineStyle, double? overlineThickness, TextDecoration? underline, Color? underlineColor, TextDecorationStyle? underlineStyle, double? underlineThickness, TextHeightBehavior? textHeightBehavior}) Text

Available on Text, provided by the NyTextExt extension

Set the Style to use displayMedium.
displaySmall({Color? color, double? fontSize, FontWeight? fontWeight, FontStyle? fontStyle, double? letterSpacing, double? wordSpacing, TextBaseline? textBaseline, double? height, Locale? locale, Paint? foreground, Paint? background, List<Shadow>? shadows, List<FontFeature>? fontFeatures, TextDecoration? decoration, Color? decorationColor, TextDecorationStyle? decorationStyle, double? decorationThickness, String? fontFamily, List<String>? fontFamilyFallback, String? package, TextOverflow? overflow, TextDecoration? overline, Color? overlineColor, TextDecorationStyle? overlineStyle, double? overlineThickness, TextDecoration? underline, Color? underlineColor, TextDecorationStyle? underlineStyle, double? underlineThickness, TextHeightBehavior? textHeightBehavior}) Text

Available on Text, provided by the NyTextExt extension

Set the Style to use displaySmall.
faderBottom({double strength = 0.2, Color color = Colors.black}) FadeOverlay

Available on StatelessWidget, provided by the NyStatelessWidgetExt extension

Make gradient fader from the bottom of the widget. strength ranges from 0.0 (subtle) to 1.0 (strong).
faderFrom({double strength = 0.2, Color color = Colors.black, AlignmentGeometry begin = Alignment.topCenter, AlignmentGeometry end = Alignment.bottomCenter}) FadeOverlay

Available on StatelessWidget, provided by the NyStatelessWidgetExt extension

Make gradient fader with custom alignment. strength ranges from 0.0 (subtle) to 1.0 (strong).
faderLeft({double strength = 0.2, Color color = Colors.black}) FadeOverlay

Available on StatelessWidget, provided by the NyStatelessWidgetExt extension

Make gradient fader from the left of the widget. strength ranges from 0.0 (subtle) to 1.0 (strong).
faderRight({double strength = 0.2, Color color = Colors.black}) FadeOverlay

Available on StatelessWidget, provided by the NyStatelessWidgetExt extension

Make gradient fader from the right of the widget. strength ranges from 0.0 (subtle) to 1.0 (strong).
faderTop({double strength = 0.2, Color color = Colors.black}) FadeOverlay

Available on StatelessWidget, provided by the NyStatelessWidgetExt extension

Make gradient fader from the top of the widget. strength ranges from 0.0 (subtle) to 1.0 (strong).
flexible({Key? key, int flex = 1, FlexFit fit = FlexFit.loose}) Flexible

Available on StatelessWidget, provided by the NyStatelessWidgetExt extension

Make a StatelessWidget Flexible.
fontWeightBold() Text

Available on Text, provided by the NyTextExt extension

Make the font bold.
fontWeightLight() Text

Available on Text, provided by the NyTextExt extension

Make the font light.
headingLarge({Color? color, double? fontSize, FontWeight? fontWeight, FontStyle? fontStyle, double? letterSpacing, double? wordSpacing, TextBaseline? textBaseline, double? height, Locale? locale, Paint? foreground, Paint? background, List<Shadow>? shadows, List<FontFeature>? fontFeatures, TextDecoration? decoration, Color? decorationColor, TextDecorationStyle? decorationStyle, double? decorationThickness, String? fontFamily, List<String>? fontFamilyFallback, String? package, TextOverflow? overflow, TextDecoration? overline, Color? overlineColor, TextDecorationStyle? overlineStyle, double? overlineThickness, TextDecoration? underline, Color? underlineColor, TextDecorationStyle? underlineStyle, double? underlineThickness, TextHeightBehavior? textHeightBehavior}) Text

Available on Text, provided by the NyTextExt extension

Set the Style to use headlineLarge.
headingMedium({Color? color, double? fontSize, FontWeight? fontWeight, FontStyle? fontStyle, double? letterSpacing, double? wordSpacing, TextBaseline? textBaseline, double? height, Locale? locale, Paint? foreground, Paint? background, List<Shadow>? shadows, List<FontFeature>? fontFeatures, TextDecoration? decoration, Color? decorationColor, TextDecorationStyle? decorationStyle, double? decorationThickness, String? fontFamily, List<String>? fontFamilyFallback, String? package, TextOverflow? overflow, TextDecoration? overline, Color? overlineColor, TextDecorationStyle? overlineStyle, double? overlineThickness, TextDecoration? underline, Color? underlineColor, TextDecorationStyle? underlineStyle, double? underlineThickness, TextHeightBehavior? textHeightBehavior}) Text

Available on Text, provided by the NyTextExt extension

Set the Style to use headlineMedium.
headingSmall({Color? color, double? fontSize, FontWeight? fontWeight, FontStyle? fontStyle, double? letterSpacing, double? wordSpacing, TextBaseline? textBaseline, double? height, Locale? locale, Paint? foreground, Paint? background, List<Shadow>? shadows, List<FontFeature>? fontFeatures, TextDecoration? decoration, Color? decorationColor, TextDecorationStyle? decorationStyle, double? decorationThickness, String? fontFamily, List<String>? fontFamilyFallback, String? package, TextOverflow? overflow, TextDecoration? overline, Color? overlineColor, TextDecorationStyle? overlineStyle, double? overlineThickness, TextDecoration? underline, Color? underlineColor, TextDecorationStyle? underlineStyle, double? underlineThickness, TextHeightBehavior? textHeightBehavior}) Text

Available on Text, provided by the NyTextExt extension

Set the Style to use headlineSmall.
labelLarge({Color? color, double? fontSize, FontWeight? fontWeight, FontStyle? fontStyle, double? letterSpacing, double? wordSpacing, TextBaseline? textBaseline, double? height, Locale? locale, Paint? foreground, Paint? background, List<Shadow>? shadows, List<FontFeature>? fontFeatures, TextDecoration? decoration, Color? decorationColor, TextDecorationStyle? decorationStyle, double? decorationThickness, String? fontFamily, List<String>? fontFamilyFallback, String? package, TextOverflow? overflow, TextDecoration? overline, Color? overlineColor, TextDecorationStyle? overlineStyle, double? overlineThickness, TextDecoration? underline, Color? underlineColor, TextDecorationStyle? underlineStyle, double? underlineThickness, TextHeightBehavior? textHeightBehavior}) Text

Available on Text, provided by the NyTextExt extension

Set the Style to use labelLarge.
labelMedium({Color? color, double? fontSize, FontWeight? fontWeight, FontStyle? fontStyle, double? letterSpacing, double? wordSpacing, TextBaseline? textBaseline, double? height, Locale? locale, Paint? foreground, Paint? background, List<Shadow>? shadows, List<FontFeature>? fontFeatures, TextDecoration? decoration, Color? decorationColor, TextDecorationStyle? decorationStyle, double? decorationThickness, String? fontFamily, List<String>? fontFamilyFallback, String? package, TextOverflow? overflow, TextDecoration? overline, Color? overlineColor, TextDecorationStyle? overlineStyle, double? overlineThickness, TextDecoration? underline, Color? underlineColor, TextDecorationStyle? underlineStyle, double? underlineThickness, TextHeightBehavior? textHeightBehavior}) Text

Available on Text, provided by the NyTextExt extension

Set the Style to use labelMedium.
labelSmall({Color? color, double? fontSize, FontWeight? fontWeight, FontStyle? fontStyle, double? letterSpacing, double? wordSpacing, TextBaseline? textBaseline, double? height, Locale? locale, Paint? foreground, Paint? background, List<Shadow>? shadows, List<FontFeature>? fontFeatures, TextDecoration? decoration, Color? decorationColor, TextDecorationStyle? decorationStyle, double? decorationThickness, String? fontFamily, List<String>? fontFamilyFallback, String? package, TextOverflow? overflow, TextDecoration? overline, Color? overlineColor, TextDecorationStyle? overlineStyle, double? overlineThickness, TextDecoration? underline, Color? underlineColor, TextDecorationStyle? underlineStyle, double? underlineThickness, TextHeightBehavior? textHeightBehavior}) Text

Available on Text, provided by the NyTextExt extension

Set the Style to use labelSmall.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onlyOffline() Widget

Available on Widget, provided by the ConnectiveExtension extension

Only shows the widget when offline, otherwise shows nothing.
onlyOnline() Widget

Available on Widget, provided by the ConnectiveExtension extension

Only shows the widget when online, otherwise shows nothing.
onTap(dynamic action(), {LoadingStyle? loadingStyle}) Widget

Available on StatelessWidget, provided by the NyStatelessWidgetExt extension

On tap run a action.
onTapRoute(dynamic routeName, {dynamic data, Map<String, dynamic>? queryParameters, NavigationType navigationType = NavigationType.push, dynamic result, bool removeUntilPredicate(Route route)?, TransitionType? transitionType, PageTransitionType? pageTransitionType, PageTransitionSettings? pageTransitionSettings, dynamic onPop(dynamic value)?}) InkWell

Available on StatelessWidget, provided by the NyStatelessWidgetExt extension

Route to a new page.
paddingOnly({double left = 0.0, double top = 0.0, double right = 0.0, double bottom = 0.0}) Padding

Available on StatelessWidget, provided by the NyStatelessWidgetExt extension

Add padding to the widget.
paddingOnly({double left = 0.0, double top = 0.0, double right = 0.0, double bottom = 0.0}) Padding

Available on Text, provided by the NyTextExt extension

Add padding to the text.
paddingSymmetric({double horizontal = 0.0, double vertical = 0.0}) Padding

Available on StatelessWidget, provided by the NyStatelessWidgetExt extension

Add symmetric padding to the widget.
pullable({required Future<void> onRefresh()?, PullableConfig? pullableConfig}) Widget

Available on Widget, provided by the NyWidgetExt extension

Make a widget pullable using the Pullable widget.
setFontFamily(String fontFamily) Text

Available on Text, provided by the NyTextExt extension

Change the fontFamily.
setFontSize(double fontSize) Text

Available on Text, provided by the NyTextExt extension

Change the fontSize.
setMaxLines(int maxLines) Text

Available on Text, provided by the NyTextExt extension

Aligns text to the center.
setStyle(TextStyle? style) Text

Available on Text, provided by the NyTextExt extension

Change the style.
shadow(int strength, {Color? color, double? blurRadius, double? spreadRadius, Offset? offset, double? rounded}) Container

Available on StatelessWidget, provided by the NyStatelessWidgetExt extension

Add a shadow to the container.
titleLarge({Color? color, double? fontSize, FontWeight? fontWeight, FontStyle? fontStyle, double? letterSpacing, double? wordSpacing, TextBaseline? textBaseline, double? height, Locale? locale, Paint? foreground, Paint? background, List<Shadow>? shadows, List<FontFeature>? fontFeatures, TextDecoration? decoration, Color? decorationColor, TextDecorationStyle? decorationStyle, double? decorationThickness, String? fontFamily, List<String>? fontFamilyFallback, String? package, TextOverflow? overflow, TextDecoration? overline, Color? overlineColor, TextDecorationStyle? overlineStyle, double? overlineThickness, TextDecoration? underline, Color? underlineColor, TextDecorationStyle? underlineStyle, double? underlineThickness, TextHeightBehavior? textHeightBehavior}) Text

Available on Text, provided by the NyTextExt extension

Set the Style to use titleLarge.
titleMedium({Color? color, double? fontSize, FontWeight? fontWeight, FontStyle? fontStyle, double? letterSpacing, double? wordSpacing, TextBaseline? textBaseline, double? height, Locale? locale, Paint? foreground, Paint? background, List<Shadow>? shadows, List<FontFeature>? fontFeatures, TextDecoration? decoration, Color? decorationColor, TextDecorationStyle? decorationStyle, double? decorationThickness, String? fontFamily, List<String>? fontFamilyFallback, String? package, TextOverflow? overflow, TextDecoration? overline, Color? overlineColor, TextDecorationStyle? overlineStyle, double? overlineThickness, TextDecoration? underline, Color? underlineColor, TextDecorationStyle? underlineStyle, double? underlineThickness, TextHeightBehavior? textHeightBehavior}) Text

Available on Text, provided by the NyTextExt extension

Set the Style to use titleMedium.
titleSmall({Color? color, double? fontSize, FontWeight? fontWeight, FontStyle? fontStyle, double? letterSpacing, double? wordSpacing, TextBaseline? textBaseline, double? height, Locale? locale, Paint? foreground, Paint? background, List<Shadow>? shadows, List<FontFeature>? fontFeatures, TextDecoration? decoration, Color? decorationColor, TextDecorationStyle? decorationStyle, double? decorationThickness, String? fontFamily, List<String>? fontFamilyFallback, String? package, TextOverflow? overflow, TextDecoration? overline, Color? overlineColor, TextDecorationStyle? overlineStyle, double? overlineThickness, TextDecoration? underline, Color? underlineColor, TextDecorationStyle? underlineStyle, double? underlineThickness, TextHeightBehavior? textHeightBehavior}) Text

Available on Text, provided by the NyTextExt extension

Set the Style to use titleSmall.
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toSkeleton({Key? key, bool? ignoreContainers, bool? justifyMultiLineText, Color? containersColor, bool ignorePointers = true, bool enabled = true, PaintingEffect? effect, TextBoneBorderRadius? textBoneBorderRadius}) → Skeletonizer

Available on Widget, provided by the NyWidgetExt extension

Make a widget a skeleton using the Skeletonizer package.
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
visibleWhen(bool condition) Widget

Available on StatelessWidget, provided by the NyStatelessWidgetExt extension

Make a widget visible when a condition is true.

Operators

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