Skip to content

Conversation

@SoutaTanaka
Copy link
Contributor

This PR updates the test suite to be compatible with Flutter 3.38+, which introduced a breaking change in MaterialApp's page transition implementation. Flutter 3.38 added a transparent ColoredBox widget for page transitions (flutter/flutter#167032), which caused existing tests that used type-based widget finders to fail with Bad state: Too many elements errors.

The solution replaces all type-based ColoredBox finders with Key-based finders, making tests more explicit and robust against framework changes. Additionally, the minimum Flutter SDK version has been bumped to 3.38.0 and accessibility_tools has been updated to ^2.8.0 for compatibility.

List of issues which are fixed by the PR

  • Fixes test failures when running with Flutter 3.38+ due to additional transparent ColoredBox widgets added by MaterialApp for page transitions
  • Resolves Bad state: Too many elements errors in builder_addon_test.dart, device_frame_addon_test.dart, and color_knob_test.dart

Screenshots

Not applicable - this PR only contains test fixes and dependency updates.

Checklist

  • I signed the CLA.
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making.
  • All existing and new tests are passing.

If you need help, consider asking for advice on Discord.

Fix test failures caused by Flutter 3.38+ adding a transparent
ColoredBox for page transitions (flutter/flutter#167032).

Replace type-based widget finders with Key-based finders to
explicitly target test widgets and avoid conflicts with
framework-added ColoredBox widgets.
- Bump Flutter SDK minimum version: 3.32.0 -> 3.38.0
- Update accessibility_tools: ^2.0.0 -> ^2.8.0

Required for compatibility with MaterialApp page transition changes
introduced in Flutter 3.38 (flutter/flutter#167032).
@vercel
Copy link

vercel bot commented Nov 17, 2025

@SoutaTanaka is attempting to deploy a commit to the Widgetbook Team on Vercel.

A member of the Team first needs to authorize it.

@docs-page
Copy link

docs-page bot commented Nov 17, 2025

To view this pull requests documentation preview, visit the following URL:

docs.page/widgetbook/widgetbook~1736

Documentation is deployed and generated using docs.page.

@yousinix yousinix changed the title fix: Update tests for Flutter 3.38+ compatibility test: fix ColoredBox tests on flutter >=3.38 Nov 17, 2025
Copy link
Contributor

@yousinix yousinix left a comment

Choose a reason for hiding this comment

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

Thanks for your efforts to fix those tests and the detailed information! We have some little changes requested for maintaining code style and backwards compatibility.

@yousinix yousinix changed the title test: fix ColoredBox tests on flutter >=3.38 test: fix ColoredBox tests on flutter 3.38 Nov 17, 2025
@SoutaTanaka
Copy link
Contributor Author

Thank you for the review! I've addressed your feedback:

  1. Regarding Flutter minimum version and accessibility_tools version bump
    Kept the Flutter minimum version at >=3.32.0 to maintain backward compatibility
    Kept accessibility_tools at ^2.0.0 as well
  2. Regarding Key variable names
    Updated builder_addon_test.dart and color_knob_test.dart to use UniqueKey()
    Simplified variable names to just key for consistency

All changes have been applied. Please review when you have a chance.

Copy link
Contributor

@yousinix yousinix left a comment

Choose a reason for hiding this comment

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

Thanks for taking care of fixing the tests! 💙

@yousinix yousinix merged commit a32d7e7 into widgetbook:main Nov 18, 2025
7 of 8 checks passed
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