Default components / Data & citations
Table
Renders GFM-style pipe tables with parsed header alignment and horizontal overflow support.
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| Model | Status |
2| :--- | ---: |
3| GPT Markdown | Ready |Default behavior
Runtime behavior
The separator row declares alignment and is not rendered. The default table scrolls horizontally when needed.
Accessibility note
Keep column headers meaningful and avoid tables for simple visual layout.
Theming & styling
Theme layering guideTableStyle 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 |
|---|---|
| TableStyle | borderColor · borderWidth · borderRadius · cellPadding · headerBackground · headerTextStyle · rowStripeColor |
1GptMarkdown(
2 markdown,
3 styleSheet: const GptMarkdownStyleSheet(
4 table: TableStyle(
5 cellPadding: EdgeInsets.symmetric(horizontal: 12, vertical: 8),
6 headerTextStyle: TextStyle(fontWeight: FontWeight.w700),
7 borderRadius: Radius.circular(8),
8 ),
9 ),
10)App-wide or scoped theme
1GptMarkdownThemeData(
2 brightness: Brightness.light,
3 styleSheet: const GptMarkdownStyleSheet(
4 table: TableStyle(
5 // Set only the values your app needs.
6 ),
7 ),
8)Builders & callbacks
tableBuilder
Widget Function(BuildContext context, List<CustomTableRow> rows, TextStyle style, 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// This component participates in BOTH parser registries.
2// Passing either list replaces that registry, so preserve both default lists.
3GptMarkdown(
4 markdown,
5 components: [
6 MyTableMdOverride(),
7 ...MarkdownComponent.globalComponents,
8 ],
9 inlineComponents: [
10 MyTableMdOverride(),
11 ...MarkdownComponent.inlineComponents,
12 ],
13)