Skip to content

feat: CheckBoxBuilder and RadioButtonBuilder for component parity - #123

Open
ContextFound wants to merge 4 commits into
Infinitix-LLC:mainfrom
ContextFound:feature/custom-builders
Open

feat: CheckBoxBuilder and RadioButtonBuilder for component parity#123
ContextFound wants to merge 4 commits into
Infinitix-LLC:mainfrom
ContextFound:feature/custom-builders

Conversation

@ContextFound

Copy link
Copy Markdown

In a project, I wanted a custom handling of a rendered markdown checkbox to allow checking / unchecking logic, but there is currently no CheckBoxBuilder nor RadioButtonBuilder like there is for imageBuilder, linkBuilder, etc.

This PR implements the builders following the existing pattern used by other component builders.

Changes

  • Added CheckBoxBuilder typedef in markdown_config.dart
  • Added RadioButtonBuilder typedef in markdown_config.dart
  • Added checkBoxBuilder and radioButtonBuilder parameters to GptMarkdown widget and GptMarkdownConfig
  • Updated CheckBoxMd and RadioButtonMd components to use the builders when provided, falling back to the default widgets
  • Created test/custom_builders_test.dart with 12 tests that validates implementation.

- Add custom stable serializer for widget tree comparison (test/utils/serializer.dart)
- Add test helpers: pumpMarkdown, expectMarkdown, expectMarkdownContains (test/utils/test_helpers.dart)
- Add inline element tests: bold, italic, strikethrough, underline, highlight, links
- Add block element tests: headings, lists, code blocks, tables, checkboxes, radio buttons, blockquotes, horizontal rules, indentation
- Add LaTeX tests: inline and block math expressions
- Add image tests with dimension support
- Add regression test folder structure for bug reproduction tests
- Add test framework documentation (test/README.md)

The serializer produces stable, comparable string output that avoids brittle widget equality checks. Tests verify both structural output and widget rendering.

All 123 tests pass.
failing tests in /bugs to identify known bugs
once fixed, move to /regression
test/README outlining approach
complex integration test added
serializer fix to render internal text
two known link rendering bugs identified, but currently skipped
- Introduced CheckBoxBuilder and RadioButtonBuilder types for custom rendering of checkboxes and radio buttons in GptMarkdown.
- Updated GptMarkdownConfig to include new builder properties.
- Modified CheckBoxMd and RadioButtonMd to utilize the new builders, allowing for flexible UI customization.
- Added comprehensive tests to validate the functionality of the new builders and their integration with GptMarkdown.
@ContextFound ContextFound changed the title Feature: CheckBoxBuilder and RadioButtonBuilder for component parity feat: CheckBoxBuilder and RadioButtonBuilder for component parity Jan 20, 2026
- Added rawText property to GptMarkdownConfig to store the original markdown text for checkboxes and radio buttons.
- Updated CheckBoxMd and RadioButtonMd to populate rawText before invoking custom builders.
- Enhanced tests to verify.
@masfour7
masfour7 requested a review from saminsohag May 6, 2026 23:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant