Default components / Lists & controls
Ordered list
Renders numbered list items while keeping their marker separate from the Markdown child.
What it renders
Live Flutter preview
Starting the Flutter widget
Rendering this component with gpt_markdown…
This is the real GptMarkdown Flutter widget, rendered with the exact Markdown input shown here.
Markdown input
11. Fetch the response
22. Render the Markdown
33. Handle link tapsDefault behavior
Runtime behavior
Any number followed by a period starts an item; the builder receives the marker number as a string.
Accessibility note
Use ordered lists when the sequence matters.
Theming & styling
Theme layering guideListStyle is the component's appearance surface. Set only the values you need; style-sheet values merge field-by-field with the active theme and package defaults.
| Style class | Available fields |
|---|---|
| ListStyle | bulletSize · bulletColor · bulletShape · markerTextStyle · indent · gapAfterMarker |
1GptMarkdown(
2 markdown,
3 styleSheet: const GptMarkdownStyleSheet(
4 list: ListStyle(
5 markerTextStyle: TextStyle(fontWeight: FontWeight.w700),
6 indent: 14,
7 ),
8 ),
9)App-wide or scoped theme
1GptMarkdownThemeData(
2 brightness: Brightness.light,
3 styleSheet: const GptMarkdownStyleSheet(
4 list: ListStyle(
5 // Set only the values your app needs.
6 ),
7 ),
8)Builders & callbacks
orderedListBuilder
Widget Function(BuildContext context, String no, Widget child, GptMarkdownConfig config)
Use this only when the default widget structure is no longer the right shape. The resolved style or configuration is passed where applicable.
Safely override the default
A custom component list replaces a default list entirely. Put your matching component first, then append the package defaults so every other Markdown feature continues to render.
1// Passing components replaces its defaults. Prepend to override matching syntax,
2// then keep every built-in component after it.
3GptMarkdown(
4 markdown,
5 components: [
6 MyOrderedListOverride(),
7 ...MarkdownComponent.globalComponents,
8 ],
9)