Skip to content

Add ButtonStyle customization for OK and Cancel buttons#96

Merged
rydmike merged 2 commits into
masterfrom
admiring-buck
Nov 26, 2025
Merged

Add ButtonStyle customization for OK and Cancel buttons#96
rydmike merged 2 commits into
masterfrom
admiring-buck

Conversation

@rydmike

@rydmike rydmike commented Nov 26, 2025

Copy link
Copy Markdown
Owner

This commit adds support for custom ButtonStyle properties to the ColorPickerActionButtons class, allowing developers to fully customize the appearance of the OK and Cancel dialog action buttons.

New properties:

  • dialogOkButtonStyle: Optional ButtonStyle for the OK button
  • dialogCancelButtonStyle: Optional ButtonStyle for the Cancel button

These styles override the default theme styling for the button type, enabling customization of foreground color, background color, padding, elevation, shape, and other button style properties.

This addresses issue #95 by providing a flexible way to customize button appearance without needing to wrap the picker in a Theme widget.

Usage example:

ColorPickerActionButtons(
  dialogOkButtonType: ColorPickerActionButtonType.elevated,
  dialogOkButtonStyle: ElevatedButton.styleFrom(
    foregroundColor: Colors.white,
    backgroundColor: Colors.blue,
  ),
  dialogCancelButtonStyle: TextButton.styleFrom(
    foregroundColor: Colors.red,
  ),
)

Tests: Added comprehensive unit tests for ButtonStyle functionality


Note

Adds optional dialogOkButtonStyle and dialogCancelButtonStyle to ColorPickerActionButtons and applies them to dialog buttons.

  • Models (lib/src/models/color_picker_action_buttons.dart):
    • Add dialogOkButtonStyle and dialogCancelButtonStyle ButtonStyle? properties.
    • Update copyWith, ==, hashCode, and debugFillProperties to include new fields.
  • UI (lib/src/color_picker.dart):
    • Apply actionButtons.dialogOkButtonStyle/dialogCancelButtonStyle to all dialog button variants (TextButton, OutlinedButton, ElevatedButton, FilledButton, FilledButton.tonal).
  • Tests (test/color_picker_action_buttons_test.dart):
    • Add comprehensive tests for the new style properties (set/get, copyWith, equality/inequality, null-retain behavior).
    • Relax toString test to check key substrings and update constants where appropriate.

Written by Cursor Bugbot for commit 381e44e. This will update automatically on new commits. Configure here.

rydmike and others added 2 commits November 26, 2025 02:06
This commit adds support for custom ButtonStyle properties to the
ColorPickerActionButtons class, allowing developers to fully customize
the appearance of the OK and Cancel dialog action buttons.

New properties:
- dialogOkButtonStyle: Optional ButtonStyle for the OK button
- dialogCancelButtonStyle: Optional ButtonStyle for the Cancel button

These styles override the default theme styling for the button type,
enabling customization of foreground color, background color, padding,
elevation, shape, and other button style properties.

This addresses issue #95 by providing a flexible way to customize
button appearance without needing to wrap the picker in a Theme widget.

Usage example:
```dart
ColorPickerActionButtons(
  dialogOkButtonType: ColorPickerActionButtonType.elevated,
  dialogOkButtonStyle: ElevatedButton.styleFrom(
    foregroundColor: Colors.white,
    backgroundColor: Colors.blue,
  ),
  dialogCancelButtonStyle: TextButton.styleFrom(
    foregroundColor: Colors.red,
  ),
)
```

Tests: Added comprehensive unit tests for ButtonStyle functionality

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.06%. Comparing base (63b97eb) to head (381e44e).
⚠️ Report is 4 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master      #96      +/-   ##
==========================================
+ Coverage   90.95%   91.06%   +0.11%     
==========================================
  Files          24       24              
  Lines        2354     2384      +30     
==========================================
+ Hits         2141     2171      +30     
  Misses        213      213              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@rydmike rydmike merged commit fc0783e into master Nov 26, 2025
2 checks passed
@rydmike rydmike deleted the admiring-buck branch November 26, 2025 02:31
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