OudsDisplayText class
OUDS Display Design Guidelines
Reference design version : 1.0.0
Display styles are intended for high-impact content such as landing pages, marketing campaigns, and key messages. Their large type sizes help capture attention and establish strong visual emphasis. Variants automatically adapt across breakpoints to maintain a consistent visual hierarchy on every screen size. Use them sparingly to preserve their impact and effectiveness.
Use this widget instead of a plain Text with a hardcoded TextStyle so the text always renders with the token defined by the active theme.
OudsDisplayText(
text: 'Welcome',
size: OudsDisplayTextSize.large
)
A color override can be provided when the default theme color is not suitable, for example when the text is displayed on a colored surface:
OudsDisplayText(
text: 'Welcome',
size: OudsDisplayTextSize.large,
color: OudsTheme.of(context).colorScheme(context).contentDefault,
)
Multiple colors can be used simultaneously within the same text.
The .rich constructor (OudsDisplayText.rich) is exposed to color only part of the text. Build the .rich
constructor's text argument with buildOudsAnnotatedText.
The user must ensure that the contrast between the colors used meets current accessibility standards and that the colors align with the brand’s and its entity’s visual identity.
OudsDisplayText.rich(
text: buildOudsAnnotatedText((builder) {
builder.append('Welcome ');
builder.withColor((context) => color, () => builder.append('back'));
}),
)
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatelessWidget
- OudsDisplayText
Constructors
- OudsDisplayText({Key? key, required String text, Color? color, OudsDisplayTextSize size = OudsDisplayTextSize.large, int? maxLines, TextAlign? textAlign, TextOverflow? overflow, bool? softWrap})
-
Creates an OudsDisplayText.
const
- OudsDisplayText.rich({Key? key, required OudsAnnotatedText text, Color? color, OudsDisplayTextSize size = OudsDisplayTextSize.large, int? maxLines, TextAlign? textAlign, TextOverflow? overflow, bool? softWrap})
-
Creates an OudsDisplayText whose content is composed of multiple spans, some of which can
be colored independently of the others. Build
textwith buildOudsAnnotatedText to color part of the text, e.g. to highlight a word or phrase.const
Properties
- color → Color?
-
An optional color override. When null, the theme's
contentDefaultcolor is used.final - hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
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 and
softWrap.
final
- overflow → TextOverflow?
-
How visual overflow should be handled.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- size → OudsDisplayTextSize
-
The size of the display text, see OudsDisplayTextSize. Defaults to OudsDisplayTextSize.large.
final
- softWrap → bool?
-
Whether the text should break at soft line breaks. If false, the glyphs in the
text will be positioned as if there was unlimited horizontal space. If softWrap is false,
overflow and TextAlign may have unexpected effects.
final
- text → String
-
The text to display. Empty when built via OudsDisplayText.rich.
final
- textAlign → TextAlign?
-
Alignment of the text within the lines of the paragraph. See TextAlign.
final
Methods
-
build(
BuildContext context) → Widget -
Describes the part of the user interface represented by this widget.
override
-
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
-
textStyle(
BuildContext context) → TextStyle - Returns the TextStyle associated with size in the active theme.
-
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