Default components / Lists & controls
Task checkbox
Renders checked and unchecked task-list items from Markdown source.
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
1- [x] Parse the response
2- [ ] Save the conversationDefault behavior
Runtime behavior
The source drives checked state. Set interactive: true and update your source in onCheckboxChanged to keep user changes.
Accessibility note
An interactive checkbox needs an application callback and source update; read-only task lists remain descriptive.
Theming & styling
Theme layering guideCheckboxStyle 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 |
|---|---|
| CheckboxStyle | size · checkedColor · uncheckedColor · checkColor · borderRadius · gapAfterBox · interactive |
1GptMarkdown(
2 markdown,
3 styleSheet: const GptMarkdownStyleSheet(
4 checkbox: CheckboxStyle(
5 interactive: true,
6 checkedColor: Colors.indigo,
7 borderRadius: Radius.circular(4),
8 ),
9 ),
10 onCheckboxChanged: (checked) {
11 setState(() => markdown = rewriteTask(markdown, checked));
12 },
13)App-wide or scoped theme
1GptMarkdownThemeData(
2 brightness: Brightness.light,
3 styleSheet: const GptMarkdownStyleSheet(
4 checkbox: CheckboxStyle(
5 // Set only the values your app needs.
6 ),
7 ),
8)Builders & callbacks
checkboxBuilder
Widget Function(BuildContext context, bool checked, Widget content, CheckboxStyle style)
Use this only when the default widget structure is no longer the right shape. The resolved style or configuration is passed where applicable.
onCheckboxChanged
void Function(bool value)
The callback fires only when CheckboxStyle(interactive: true) is enabled.
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 MyCheckBoxMdOverride(),
7 ...MarkdownComponent.globalComponents,
8 ],
9)