OudsHeadingText class

OUDS Heading Design Guidelines

Reference design version : 1.1.0

Heading styles are used to structure content and define the hierarchy of information within an interface. Available in multiple sizes, they help users quickly understand the organization of a page or section. Their size automatically adjusts across breakpoints to ensure optimal readability on all devices. Headings serve as the primary entry point for visual navigation.

When size is OudsHeadingTextSize.large and marker is true (and the active theme supports it, see OudsTypographyTokens.headingLargeMarker), a small rectangular marker is displayed under the text, using the theme's contentBrandPrimary color. The marker follows these rules independently of the text content: it is shown the same way whether the text is plain, colored, bold or contains a link.

OudsHeadingText(
  text: 'Section title',
  size: OudsHeadingTextSize.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:

OudsHeadingText(
  text: 'Section title',
  size: OudsHeadingTextSize.large,
  color: OudsTheme.of(context).colorScheme(context).contentDefault,
)

Multiple colors can be used simultaneously within the same text. The .rich constructor (OudsHeadingText.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.

OudsHeadingText.rich(
  text: buildOudsAnnotatedText((builder) {
    builder.append('Heading with ');
    builder.withColor((context) => color, () => builder.append('colored text'));
  }),
)
Inheritance

Constructors

OudsHeadingText({Key? key, required String text, Color? color, OudsHeadingTextSize size = OudsHeadingTextSize.large, bool marker = true, int? maxLines, TextAlign? textAlign, TextOverflow? overflow, bool? softWrap})
Creates an OudsHeadingText.
const
OudsHeadingText.rich({Key? key, required OudsAnnotatedText text, Color? color, OudsHeadingTextSize size = OudsHeadingTextSize.large, bool marker = true, int? maxLines, TextAlign? textAlign, TextOverflow? overflow, bool? softWrap})
Creates an OudsHeadingText whose content is composed of multiple spans, some of which can be colored independently of the others. Build text with buildOudsAnnotatedText to color part of the heading text, e.g. to highlight a word or phrase.
const

Properties

color → Color?
An optional color override. When null, the theme's contentDefault color 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
marker → bool
marker Controls the brand-colored marker display below the heading large text OudsHeadingTextSize.large It enhances its visual emphasis and reinforce information hierarchy. This optional decorative element helps highlight important sections and improve content scanability. Use it selectively to maintain its impact and avoid visual clutter. Note: If the current theme doesn't allow marker for heading large texts, this parameter is ignored.
final
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 → OudsHeadingTextSize
The size of the heading text, see OudsHeadingTextSize. Defaults to OudsHeadingTextSize.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 OudsHeadingText.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