Default components / Lists & controls

Radio option

Renders selected and unselected radio-style options from compact Markdown syntax.

RadioButtonMdblock componentCheckboxStyleradioOptionBuilderonCheckboxChanged

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

input.md
1- (x) Use the package default 2- ( ) Replace the component

Default behavior

Runtime behavior

The x between parentheses controls selected state. It shares the checkbox style and change callback surface.

Accessibility note

Keep the selected state synchronized with the source if the option is interactive.

Theming & styling

Theme layering guide

CheckboxStyle 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 classAvailable fields
CheckboxStylesize · checkedColor · uncheckedColor · checkColor · borderRadius · gapAfterBox · interactive
radio-option_style.dart
1GptMarkdown( 2 markdown, 3 styleSheet: const GptMarkdownStyleSheet( 4 checkbox: CheckboxStyle(interactive: true, checkedColor: Colors.indigo), 5 ), 6 onCheckboxChanged: (selected) => saveSelection(selected), 7)

App-wide or scoped theme

theme.dart
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

radioOptionBuilder

Widget Function(BuildContext context, bool selected, 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 same callback is used for task checkboxes and radio options.

Full builder and callback signatures

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.

keep_defaults.dart
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 MyRadioButtonMdOverride(), 7 ...MarkdownComponent.globalComponents, 8 ], 9)
Custom component guide

Related components