Rich Text
Loading interactive example…Open in new tab ↗
Installs the Rich Text extension and reconfigures two core shapes for it. The standalone text is a richText element. The Comment and the rectangle are the core shapes, installed as copies made with withText(const RichTextDefinition()) in the example's own extension, which replace the plain core definitions. The Comment holds a heading, a bulleted item with bold text, and a checked checklist item. Select text and use Command/Ctrl+B; list prefixes such as - are interpreted by the extension, and the Comment tool creates rich comments.
See Rich text in shapes.
Source
dart
Widget buildExample() => ExampleCanvas(
title: 'Rich Text',
instructions: 'Double-click the text, the comment or the rectangle to edit. Select words and press Command/Ctrl+B for bold. Type a list prefix such as "- " to start a list; Command/Ctrl+Alt+2 makes a heading.',
createController: createRichTextController,
);
/// The core Comment and rectangle, reconfigured to hold rich text. The
/// shapes declare only their text parts; this application chooses rich text
/// for them, and installing the copies replaces the core definitions.