MyText class
A customized Text widget that wraps Text with common styling options and provides named constructors for semantic text styles from the theme.
Provides convenient parameters for font size, weight, color, alignment, etc., while allowing for full customization by passing a custom TextStyle. default TextOverflow is TextOverflow.ellipsis
- Inheritance
- Available extensions
- Annotations
Constructors
-
MyText.new(String? data, {Key? key, TextStyle? style, TextAlign? textAlign, TextDirection? textDirection, TextOverflow? overflow, bool? softWrap, Locale? locale, int? maxLines, String? semanticsLabel, TextWidthBasis? textWidthBasis, TextHeightBehavior? textHeightBehavior, Color? color, double? fontSize, FontWeight? fontWeight, FontStyle? fontStyle, double? height, double? letterSpacing, double? wordSpacing, TextBaseline? textBaseline, TextLeadingDistribution? leadingDistribution, Paint? foreground, Paint? background, List<
Shadow> ? shadows, List<FontFeature> ? fontFeatures, TextDecoration? decoration, Color? decorationColor, TextDecorationStyle? decorationStyle, double? decorationThickness}) -
Creates a customized Text widget using the default body text style from the theme.
This is the default constructor.
factory
-
MyText.bodyLarge(String? data, {Key? key, TextStyle? style, TextAlign? textAlign, TextDirection? textDirection, TextOverflow? overflow, bool? softWrap, Locale? locale, int? maxLines, String? semanticsLabel, TextWidthBasis? textWidthBasis, TextHeightBehavior? textHeightBehavior, Color? color, double? fontSize, FontWeight? fontWeight, FontStyle? fontStyle, double? height, double? letterSpacing, double? wordSpacing, TextBaseline? textBaseline, TextLeadingDistribution? leadingDistribution, Paint? foreground, Paint? background, List<
Shadow> ? shadows, List<FontFeature> ? fontFeatures, TextDecoration? decoration, Color? decorationColor, TextDecorationStyle? decorationStyle, double? decorationThickness}) -
Creates a customized Text widget using the bodyLarge style from the theme.
factory
-
MyText.bodyMedium(String? data, {Key? key, TextStyle? style, TextAlign? textAlign, TextDirection? textDirection, TextOverflow? overflow, bool? softWrap, Locale? locale, int? maxLines, String? semanticsLabel, TextWidthBasis? textWidthBasis, TextHeightBehavior? textHeightBehavior, Color? color, double? fontSize, FontWeight? fontWeight, FontStyle? fontStyle, double? height, double? letterSpacing, double? wordSpacing, TextBaseline? textBaseline, TextLeadingDistribution? leadingDistribution, Paint? foreground, Paint? background, List<
Shadow> ? shadows, List<FontFeature> ? fontFeatures, TextDecoration? decoration, Color? decorationColor, TextDecorationStyle? decorationStyle, double? decorationThickness}) -
Creates a customized Text widget using the bodyMedium style from the theme.
factory
-
MyText.bodySmall(String? data, {Key? key, TextStyle? style, TextAlign? textAlign, TextDirection? textDirection, TextOverflow? overflow, bool? softWrap, Locale? locale, int? maxLines, String? semanticsLabel, TextWidthBasis? textWidthBasis, TextHeightBehavior? textHeightBehavior, Color? color, double? fontSize, FontWeight? fontWeight, FontStyle? fontStyle, double? height, double? letterSpacing, double? wordSpacing, TextBaseline? textBaseline, TextLeadingDistribution? leadingDistribution, Paint? foreground, Paint? background, List<
Shadow> ? shadows, List<FontFeature> ? fontFeatures, TextDecoration? decoration, Color? decorationColor, TextDecorationStyle? decorationStyle, double? decorationThickness}) -
Creates a customized Text widget using the bodySmall style from the theme.
factory
-
MyText.displayLarge(String? data, {Key? key, TextStyle? style, TextAlign? textAlign, TextDirection? textDirection, TextOverflow? overflow, bool? softWrap, Locale? locale, int? maxLines, String? semanticsLabel, TextWidthBasis? textWidthBasis, TextHeightBehavior? textHeightBehavior, Color? color, double? fontSize, FontWeight? fontWeight, FontStyle? fontStyle, double? height, double? letterSpacing, double? wordSpacing, TextBaseline? textBaseline, TextLeadingDistribution? leadingDistribution, Paint? foreground, Paint? background, List<
Shadow> ? shadows, List<FontFeature> ? fontFeatures, TextDecoration? decoration, Color? decorationColor, TextDecorationStyle? decorationStyle, double? decorationThickness}) -
Creates a customized Text widget using the displayLarge style from the theme.
factory
-
MyText.displayMedium(String? data, {Key? key, TextStyle? style, TextAlign? textAlign, TextDirection? textDirection, TextOverflow? overflow, bool? softWrap, Locale? locale, int? maxLines, String? semanticsLabel, TextWidthBasis? textWidthBasis, TextHeightBehavior? textHeightBehavior, Color? color, double? fontSize, FontWeight? fontWeight, FontStyle? fontStyle, double? height, double? letterSpacing, double? wordSpacing, TextBaseline? textBaseline, TextLeadingDistribution? leadingDistribution, Paint? foreground, Paint? background, List<
Shadow> ? shadows, List<FontFeature> ? fontFeatures, TextDecoration? decoration, Color? decorationColor, TextDecorationStyle? decorationStyle, double? decorationThickness}) -
Creates a customized Text widget using the displayMedium style from the theme.
factory
-
MyText.displaySmall(String? data, {Key? key, TextStyle? style, TextAlign? textAlign, TextDirection? textDirection, TextOverflow? overflow, bool? softWrap, Locale? locale, int? maxLines, String? semanticsLabel, TextWidthBasis? textWidthBasis, TextHeightBehavior? textHeightBehavior, Color? color, double? fontSize, FontWeight? fontWeight, FontStyle? fontStyle, double? height, double? letterSpacing, double? wordSpacing, TextBaseline? textBaseline, TextLeadingDistribution? leadingDistribution, Paint? foreground, Paint? background, List<
Shadow> ? shadows, List<FontFeature> ? fontFeatures, TextDecoration? decoration, Color? decorationColor, TextDecorationStyle? decorationStyle, double? decorationThickness}) -
Creates a customized Text widget using the displaySmall style from the theme.
factory
-
MyText.headlineLarge(String? data, {Key? key, TextStyle? style, TextAlign? textAlign, TextDirection? textDirection, TextOverflow? overflow, bool? softWrap, Locale? locale, int? maxLines, String? semanticsLabel, TextWidthBasis? textWidthBasis, TextHeightBehavior? textHeightBehavior, Color? color, double? fontSize, FontWeight? fontWeight, FontStyle? fontStyle, double? height, double? letterSpacing, double? wordSpacing, TextBaseline? textBaseline, TextLeadingDistribution? leadingDistribution, Paint? foreground, Paint? background, List<
Shadow> ? shadows, List<FontFeature> ? fontFeatures, TextDecoration? decoration, Color? decorationColor, TextDecorationStyle? decorationStyle, double? decorationThickness}) -
Creates a customized Text widget using the headlineLarge style from the theme.
factory
-
MyText.headlineMedium(String? data, {Key? key, TextStyle? style, TextAlign? textAlign, TextDirection? textDirection, TextOverflow? overflow, bool? softWrap, Locale? locale, int? maxLines, String? semanticsLabel, TextWidthBasis? textWidthBasis, TextHeightBehavior? textHeightBehavior, Color? color, double? fontSize, FontWeight? fontWeight, FontStyle? fontStyle, double? height, double? letterSpacing, double? wordSpacing, TextBaseline? textBaseline, TextLeadingDistribution? leadingDistribution, Paint? foreground, Paint? background, List<
Shadow> ? shadows, List<FontFeature> ? fontFeatures, TextDecoration? decoration, Color? decorationColor, TextDecorationStyle? decorationStyle, double? decorationThickness}) -
Creates a customized Text widget using the headlineMedium style from the theme.
factory
-
MyText.headlineSmall(String? data, {Key? key, TextStyle? style, TextAlign? textAlign, TextDirection? textDirection, TextOverflow? overflow, bool? softWrap, Locale? locale, int? maxLines, String? semanticsLabel, TextWidthBasis? textWidthBasis, TextHeightBehavior? textHeightBehavior, Color? color, double? fontSize, FontWeight? fontWeight, FontStyle? fontStyle, double? height, double? letterSpacing, double? wordSpacing, TextBaseline? textBaseline, TextLeadingDistribution? leadingDistribution, Paint? foreground, Paint? background, List<
Shadow> ? shadows, List<FontFeature> ? fontFeatures, TextDecoration? decoration, Color? decorationColor, TextDecorationStyle? decorationStyle, double? decorationThickness}) -
Creates a customized Text widget using the headlineSmall style from the theme.
factory
-
MyText.labelLarge(String? data, {Key? key, TextStyle? style, TextAlign? textAlign, TextDirection? textDirection, TextOverflow? overflow, bool? softWrap, Locale? locale, int? maxLines, String? semanticsLabel, TextWidthBasis? textWidthBasis, TextHeightBehavior? textHeightBehavior, Color? color, double? fontSize, FontWeight? fontWeight, FontStyle? fontStyle, double? height, double? letterSpacing, double? wordSpacing, TextBaseline? textBaseline, TextLeadingDistribution? leadingDistribution, Paint? foreground, Paint? background, List<
Shadow> ? shadows, List<FontFeature> ? fontFeatures, TextDecoration? decoration, Color? decorationColor, TextDecorationStyle? decorationStyle, double? decorationThickness}) -
Creates a customized Text widget using the labelLarge style from the theme.
factory
-
MyText.labelMedium(String? data, {Key? key, TextStyle? style, TextAlign? textAlign, TextDirection? textDirection, TextOverflow? overflow, bool? softWrap, Locale? locale, int? maxLines, String? semanticsLabel, TextWidthBasis? textWidthBasis, TextHeightBehavior? textHeightBehavior, Color? color, double? fontSize, FontWeight? fontWeight, FontStyle? fontStyle, double? height, double? letterSpacing, double? wordSpacing, TextBaseline? textBaseline, TextLeadingDistribution? leadingDistribution, Paint? foreground, Paint? background, List<
Shadow> ? shadows, List<FontFeature> ? fontFeatures, TextDecoration? decoration, Color? decorationColor, TextDecorationStyle? decorationStyle, double? decorationThickness}) -
Creates a customized Text widget using the labelMedium style from the theme.
factory
-
MyText.labelSmall(String? data, {Key? key, TextStyle? style, TextAlign? textAlign, TextDirection? textDirection, TextOverflow? overflow, bool? softWrap, Locale? locale, int? maxLines, String? semanticsLabel, TextWidthBasis? textWidthBasis, TextHeightBehavior? textHeightBehavior, Color? color, double? fontSize, FontWeight? fontWeight, FontStyle? fontStyle, double? height, double? letterSpacing, double? wordSpacing, TextBaseline? textBaseline, TextLeadingDistribution? leadingDistribution, Paint? foreground, Paint? background, List<
Shadow> ? shadows, List<FontFeature> ? fontFeatures, TextDecoration? decoration, Color? decorationColor, TextDecorationStyle? decorationStyle, double? decorationThickness}) -
Creates a customized Text widget using the labelSmall style from the theme.
factory
-
MyText.titleLarge(String? data, {Key? key, TextStyle? style, TextAlign? textAlign, TextDirection? textDirection, TextOverflow? overflow, bool? softWrap, Locale? locale, int? maxLines, String? semanticsLabel, TextWidthBasis? textWidthBasis, TextHeightBehavior? textHeightBehavior, Color? color, double? fontSize, FontWeight? fontWeight, FontStyle? fontStyle, double? height, double? letterSpacing, double? wordSpacing, TextBaseline? textBaseline, TextLeadingDistribution? leadingDistribution, Paint? foreground, Paint? background, List<
Shadow> ? shadows, List<FontFeature> ? fontFeatures, TextDecoration? decoration, Color? decorationColor, TextDecorationStyle? decorationStyle, double? decorationThickness}) -
Creates a customized Text widget using the titleLarge style from the theme.
factory
-
MyText.titleMedium(String? data, {Key? key, TextStyle? style, TextAlign? textAlign, TextDirection? textDirection, TextOverflow? overflow, bool? softWrap, Locale? locale, int? maxLines, String? semanticsLabel, TextWidthBasis? textWidthBasis, TextHeightBehavior? textHeightBehavior, Color? color, double? fontSize, FontWeight? fontWeight, FontStyle? fontStyle, double? height, double? letterSpacing, double? wordSpacing, TextBaseline? textBaseline, TextLeadingDistribution? leadingDistribution, Paint? foreground, Paint? background, List<
Shadow> ? shadows, List<FontFeature> ? fontFeatures, TextDecoration? decoration, Color? decorationColor, TextDecorationStyle? decorationStyle, double? decorationThickness}) -
Creates a customized Text widget using the titleMedium style from the theme.
factory
-
MyText.titleSmall(String? data, {Key? key, TextStyle? style, TextAlign? textAlign, TextDirection? textDirection, TextOverflow? overflow, bool? softWrap, Locale? locale, int? maxLines, String? semanticsLabel, TextWidthBasis? textWidthBasis, TextHeightBehavior? textHeightBehavior, Color? color, double? fontSize, FontWeight? fontWeight, FontStyle? fontStyle, double? height, double? letterSpacing, double? wordSpacing, TextBaseline? textBaseline, TextLeadingDistribution? leadingDistribution, Paint? foreground, Paint? background, List<
Shadow> ? shadows, List<FontFeature> ? fontFeatures, TextDecoration? decoration, Color? decorationColor, TextDecorationStyle? decorationStyle, double? decorationThickness}) -
Creates a customized Text widget using the titleSmall style from the theme.
factory
Properties
- background → Paint?
-
final
- color → Color?
-
final
- data → String?
-
The text to display.
final
- decoration → TextDecoration?
-
final
- decorationColor → Color?
-
final
- decorationStyle → TextDecorationStyle?
-
final
- decorationThickness → double?
-
final
-
fontFeatures
→ List<
FontFeature> ? -
final
- fontSize → double?
-
final
- fontStyle → FontStyle?
-
final
- fontWeight → FontWeight?
-
final
- foreground → Paint?
-
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- height → double?
-
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- leadingDistribution → TextLeadingDistribution?
-
final
- letterSpacing → double?
-
final
- locale → Locale?
-
Used to select a font.
final
- maxLines → int?
-
An optional maximum number of lines for the text to span.
final
- overflow → TextOverflow?
-
How visual overflow should be handled.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- semanticsLabel → String?
-
An alternative semantics label for this text.
final
-
shadows
→ List<
Shadow> ? -
final
- softWrap → bool?
-
Whether the text should break across multiple lines or not.
final
- style → TextStyle?
-
The style to use for the text.
final
- textAlign → TextAlign?
-
How the text should be aligned horizontally.
final
- textBaseline → TextBaseline?
-
final
- textDirection → TextDirection?
-
The directionality of the text.
final
- textHeightBehavior → TextHeightBehavior?
-
Defines how the vertical space around the text should be handled.
final
- textWidthBasis → TextWidthBasis?
-
Defines how the width of the text and the placement of the soft wrap breaks is determined.
final
- wordSpacing → double?
-
final
Methods
-
align(
[Alignment alignment = Alignment.center]) → Widget -
Available on Widget, provided by the WidgetExtension extension
Wraps the widget in an Align widget with the given alignment. -
animatedOpacity(
{required double opacity, required Duration duration, Curve curve = Curves.linear}) → Widget -
Available on Widget, provided by the WidgetExtension extension
Wraps the widget in an AnimatedOpacity for animated opacity changes. -
animatedSize(
{required Duration duration, Curve curve = Curves.linear, AlignmentGeometry alignment = Alignment.center}) → Widget -
Available on Widget, provided by the WidgetExtension extension
Wraps the widget in an AnimatedSize for animated size changes. -
asSliver(
) → Widget -
Available on Widget, provided by the WidgetExtension extension
Wraps the widget in a SliverToBoxAdapter for use in a CustomScrollView. -
build(
BuildContext context) → Widget -
Describes the part of the user interface represented by this widget.
override
-
center(
) → Widget -
Available on Widget, provided by the WidgetExtension extension
Wraps the widget in a Center widget. -
clippedOval(
{Clip clipBehavior = Clip.antiAlias}) → Widget -
Available on Widget, provided by the WidgetExtension extension
Wraps the widget in a ClipOval for an oval or circular clip. -
clippedRRect(
{required BorderRadiusGeometry borderRadius, Clip clipBehavior = Clip.antiAlias}) → Widget -
Available on Widget, provided by the WidgetExtension extension
Wraps the widget in a ClipRRect with the given border radius. -
constrained(
{double minWidth = 0.0, double maxWidth = double.infinity, double minHeight = 0.0, double maxHeight = double.infinity}) → Widget -
Available on Widget, provided by the WidgetExtension extension
Wraps the widget in a ConstrainedBox to apply constraints. -
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
-
decorated(
{required Decoration decoration}) → Widget -
Available on Widget, provided by the WidgetExtension extension
Wraps the widget in a DecoratedBox with the given decoration. -
expand(
[int flex = 1]) → Widget -
Available on Widget, provided by the WidgetExtension extension
Wraps the widget in an Expanded widget with the given flex. -
flexible(
{int flex = 1, FlexFit fit = FlexFit.loose}) → Widget -
Available on Widget, provided by the WidgetExtension extension
Wraps the widget in a Flexible widget with the given flex and fit. -
height(
[double value = double.infinity]) → Widget -
Available on Widget, provided by the WidgetExtension extension
Wraps the widget in a SizedBox to set its height. -
hero(
{required String tag}) → Widget -
Available on Widget, provided by the WidgetExtension extension
Wraps the widget in a Hero widget for animated transitions. -
loadingEffect(
) → Widget -
Available on Widget, provided by the WidgetExtension extension
Wraps the widget in a MyLoadingEffect widget. -
m(
[double n = 16.0]) → Widget -
Available on Widget, provided by the WidgetExtension extension
Wraps the widget in a Container with margin on all sides. -
mb(
[double n = 16.0]) → Widget -
Available on Widget, provided by the WidgetExtension extension
Applies bottom margin to the widget. -
ml(
[double n = 16.0]) → Widget -
Available on Widget, provided by the WidgetExtension extension
Applies left margin to the widget. -
mOnly(
{double l = 0.0, double t = 0.0, double r = 0.0, double b = 0.0}) → Widget -
Available on Widget, provided by the WidgetExtension extension
Applies margin to specific sides of the widget. -
mr(
[double n = 16.0]) → Widget -
Available on Widget, provided by the WidgetExtension extension
Applies right margin to the widget. -
mt(
[double n = 16.0]) → Widget -
Available on Widget, provided by the WidgetExtension extension
Applies top margin to the widget. -
mx(
[double x = 16.0]) → Widget -
Available on Widget, provided by the WidgetExtension extension
Applies horizontal margin to the widget. -
mxy(
[double x = 16.0, double y = 16.0]) → Widget -
Available on Widget, provided by the WidgetExtension extension
Applies horizontal and vertical margin respectively to the widget. -
my(
[double y = 16.0]) → Widget -
Available on Widget, provided by the WidgetExtension extension
Applies vertical margin to the widget. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onTap(
void onTap()?) → Widget -
Available on Widget, provided by the WidgetExtension extension
Wraps the widget in a GestureDetector for tap detection. -
opacity(
[double opacity = 1.0]) → Widget -
Available on Widget, provided by the WidgetExtension extension
Wraps the widget in an Opacity widget. -
p(
[double n = 16.0]) → Widget -
Available on Widget, provided by the WidgetExtension extension
Applies padding to all sides of the widget. -
pb(
[double n = 16.0]) → Widget -
Available on Widget, provided by the WidgetExtension extension
Applies bottom padding to the widget. -
pl(
[double n = 16.0]) → Widget -
Available on Widget, provided by the WidgetExtension extension
Applies left padding to the widget. -
pOnly(
{double l = 0.0, double t = 0.0, double r = 0.0, double b = 0.0}) → Widget -
Available on Widget, provided by the WidgetExtension extension
Applies padding to specific sides of the widget. -
positioned(
{double? left, double? top, double? right, double? bottom, double? width, double? height}) → Widget -
Available on Widget, provided by the WidgetExtension extension
Wraps the widget in a Positioned widget for use in a Stack. -
pr(
[double n = 16.0]) → Widget -
Available on Widget, provided by the WidgetExtension extension
Applies right padding to the widget. -
pt(
[double n = 16.0]) → Widget -
Available on Widget, provided by the WidgetExtension extension
Applies top padding to the widget. -
px(
[double x = 16.0]) → Widget -
Available on Widget, provided by the WidgetExtension extension
Applies horizontal padding to the widget. -
pxy(
[double x = 16.0, double y = 16.0]) → Widget -
Available on Widget, provided by the WidgetExtension extension
Applies horizontal and vertical padding respectively to the widget. -
py(
[double y = 16.0]) → Widget -
Available on Widget, provided by the WidgetExtension extension
Applies vertical padding to the widget. -
rotated(
{required int quarterTurns}) → Widget -
Available on Widget, provided by the WidgetExtension extension
Wraps the widget in a RotatedBox to rotate it by a quarter turn. -
scrollableX(
) → Widget -
Available on Widget, provided by the WidgetExtension extension
Wraps the widget in a SingleChildScrollView for horizontal scrolling. -
scrollableY(
) → Widget -
Available on Widget, provided by the WidgetExtension extension
Wraps the widget in a SingleChildScrollView for vertical scrolling. -
size(
[double value = double.infinity]) → Widget -
Available on Widget, provided by the WidgetExtension extension
Wraps the widget in a SizedBox to set its size (width and height). -
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
tooltip(
String message) → Widget -
Available on Widget, provided by the WidgetExtension extension
Wraps the widget in a Tooltip to display a message on long press or hover. -
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
-
visible(
[bool visible = true]) → Widget -
Available on Widget, provided by the WidgetExtension extension
Wraps the widget in a Visibility widget. -
width(
[double value = double.infinity]) → Widget -
Available on Widget, provided by the WidgetExtension extension
Wraps the widget in a SizedBox to set its width. -
withAspectRatio(
{required double aspectRatio}) → Widget -
Available on Widget, provided by the WidgetExtension extension
Wraps the widget in an AspectRatio widget.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited