Skip to content

chore: add tests for button inherited text style#1322

Merged
bdlukaa merged 4 commits into
bdlukaa:masterfrom
jacksonb-cs:add-button-text-style-tests
May 27, 2026
Merged

chore: add tests for button inherited text style#1322
bdlukaa merged 4 commits into
bdlukaa:masterfrom
jacksonb-cs:add-button-text-style-tests

Conversation

@jacksonb-cs

@jacksonb-cs jacksonb-cs commented Apr 14, 2026

Copy link
Copy Markdown
Contributor

Fixes #1318.

Pre-launch Checklist

  • I have updated CHANGELOG.md with my changes
  • I have run "dart format ." on the project
  • I have added/updated relevant documentation

Added (failing) tests covering buttons using inherited text style.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds new test cases to test/button_test.dart to verify that Button and FilledButton correctly apply default foreground colors and inherited text styles from the theme. It also introduces a _renderedTextStyle helper function to extract styles during testing. Feedback was provided regarding the fragility of the _renderedTextStyle helper, which may fail if a button contains multiple RichText descendants (e.g., an icon and text).

Comment thread test/button_test.dart
@bdlukaa bdlukaa marked this pull request as ready for review May 27, 2026 15:48
@bdlukaa

bdlukaa commented May 27, 2026

Copy link
Copy Markdown
Owner

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the base button state to resolve the text color using the style's textStyle color, falling back to the resolved foreground color if not specified. It also adds comprehensive widget tests to verify this behavior under various configurations. The feedback suggests using const for ButtonThemeData in the test file to align with Dart best practices and optimize performance.

Comment thread test/button_test.dart
@bdlukaa bdlukaa merged commit da750b5 into bdlukaa:master May 27, 2026
@jacksonb-cs jacksonb-cs deleted the add-button-text-style-tests branch May 27, 2026 19:14
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.

🐛 ButtonStyle.textStyle is not applied to button's Text child

2 participants