Skip to content

Text Decoration

View raw .md

Apply underline, overline, or strikethrough decorations to text, or remove an inherited decoration.

On this page
Preview typography/text_decoration The live demo is not available for this example. text_decoration.dart View source
dart
WText('Underlined text', className: 'underline');
WText('Strikethrough text', className: 'line-through');
WText('No decoration', className: 'no-underline');

Basic Usage#

Apply decoration classes directly in the className of any text widget:

dart
WText(
  'See terms and conditions.',
  className: 'underline text-blue-600 dark:text-blue-400',
);
WText(
  'Original price: \$99',
  className: 'line-through text-gray-500 dark:text-gray-400',
);

Quick Reference#

Class Flutter TextDecoration Description
no-underline TextDecoration.none Removes any text decoration.
underline TextDecoration.underline Adds an underline.
overline TextDecoration.overline Adds an overline.
line-through TextDecoration.lineThrough Adds a strikethrough.

Responsive Design#

Combine with breakpoint prefixes to toggle decoration at certain screen sizes:

dart
WText('Conditional underline', className: 'no-underline md:underline');
esc

Search index did not load.

No match for "".

Try a class like rounded-lg or a widget like WButton.