Skip to content

codelessly_api 5.1.0: badge, chip and segmented button nodes - #35

Merged
rayliverified merged 1 commit into
masterfrom
claude/hopeful-brown-c8o8x7
Oct 13, 2026
Merged

rayliverified merged 1 commit into
masterfrom
claude/hopeful-brown-c8o8x7

Conversation

@rayliverified

Copy link
Copy Markdown
Contributor

Ports BadgeNode, ChipNode and SegmentedButtonNode from the migrate-json-serializable branch onto 5.0, so CodelesslyEditor can move off that branch.

Changes

  • New nodes in lib/src/api/nodes/ (badge_node.dart, chip_node.dart, segmented_button_node.dart), following the 5.x pattern: json_serializable with default omission, empty()/fromProperties(), copyWith, triggers and property variables.
  • Registered in NodeJsonConverter as badge, chip and segmentedButton.
  • Dart field names match Flutter; JSON keys stay as the branch wrote them:
    • Badge dotSize → smallSize, labelStyle → textStyle
    • SegmentedButton selectedSegments → selected, selectedColor → selectedBackgroundColor, unselectedColor → backgroundColor
    • The segment class is ButtonSegmentModel, to avoid clashing with Flutter's ButtonSegment.
  • New fields that mirror Flutter parameters:
    • Badge: textColor, largeSize, maxCount
    • Chip: showCheckmark, checkmarkColor, deleteIconColor, tooltip
    • SegmentedButton: showSelectedIcon, selectedIcon, direction, foregroundColor, selectedForegroundColor
  • Material 3 defaults:
    • The badge offset is now real pixels, (4, −4).
    • Chip padding is 8.
  • Layouts saved from the branch wrote every field, so stored values still win over the new defaults.

Testing

  • Branch tests ported to package:test.
  • New round-trip, default-omission and branch-format JSON tests.
  • dart test: 155/155 pass.
  • Analyze with --fatal-infos is clean, and build_runner produces no diff.
  • Publish dry-run: 0 warnings.

Pairs with the CodelesslySDK 7.1.0 PR. Publish this first; SDK 7.1.0 depends on ^5.1.0.

🤖 Generated with Claude Code

https://claude.ai/code/session_01A67XoQYsLVvoMtiKcXXUxY


Generated by Claude Code

Port BadgeNode, ChipNode and SegmentedButtonNode from the unmerged
migrate-json-serializable branch onto the 5.x conventions: standard
json_serializable with the json_defaults_builder omit-defaults step,
Equatable props, copyWith, field access, and Material 3 defaults that
follow Flutter 3.47's Badge, chip widgets and SegmentedButton.

Fields renamed to their Flutter names keep the branch's JSON keys
(dotSize, labelStyle, selectedSegments, selectedColor, unselectedColor),
so JSON written with the branch still loads. The segment model is
ButtonSegmentModel to avoid clashing with Flutter's ButtonSegment.

Register the three types with NodeJsonConverter, port the branch's
tests and badge fixtures, and add round-trip and branch-JSON tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01A67XoQYsLVvoMtiKcXXUxY
@rayliverified
rayliverified merged commit 40455c0 into master Oct 13, 2026
2 checks passed
rayliverified added a commit that referenced this pull request Oct 13, 2026
Port BadgeNode, ChipNode and SegmentedButtonNode from the unmerged
migrate-json-serializable branch onto the 5.x conventions: standard
json_serializable with the json_defaults_builder omit-defaults step,
Equatable props, copyWith, field access, and Material 3 defaults that
follow Flutter 3.47's Badge, chip widgets and SegmentedButton.

Fields renamed to their Flutter names keep the branch's JSON keys
(dotSize, labelStyle, selectedSegments, selectedColor, unselectedColor),
so JSON written with the branch still loads. The segment model is
ButtonSegmentModel to avoid clashing with Flutter's ButtonSegment.

Register the three types with NodeJsonConverter, port the branch's
tests and badge fixtures, and add round-trip and branch-JSON tests.
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.

2 participants