Repository navigation
[material_ui] Include layoutBehavior in ButtonThemeData equality - #13517
auto-submit[bot] merged 1 commit into
Conversation
|
Hi @QuncCccccc and @elliette, thanks again for reviewing and landing #13449! This one is out of draft now and is the same kind of fix in Would one of you be able to take a look when you have time? It will also need the |
There was a problem hiding this comment.
Code Review
This pull request updates ButtonThemeData to include layoutBehavior in its equality operator, hashCode, and diagnostics properties, and adds corresponding unit tests. The feedback suggests removing a redundant import of package:flutter/rendering.dart in the test file, as the required diagnostics classes are already exported by package:flutter_test/flutter_test.dart.
| // Use of this source code is governed by a BSD-style license that can be | ||
| // found in the LICENSE file. | ||
|
|
||
| import 'package:flutter/rendering.dart'; |
There was a problem hiding this comment.
The import of package:flutter/rendering.dart is redundant because all necessary diagnostics classes (such as DiagnosticPropertiesBuilder, DiagnosticsNode, and DiagnosticLevel) are already transitively exported by package:flutter_test/flutter_test.dart. Removing this unused import keeps the codebase clean and avoids unnecessary dependencies.
There was a problem hiding this comment.
This import is needed: flutter_test does not re-export package:flutter/foundation.dart, and material_ui (via widgets.dart) only re-exports Brightness and UniqueKey from it. Without package:flutter/rendering.dart, DiagnosticPropertiesBuilder, DiagnosticsNode and DiagnosticLevel are undefined. The other *_theme_test.dart files in this package import it for the same reason, so I have left it as is.
QuncCccccc
left a comment
There was a problem hiding this comment.
LGTM, thanks!
Just for the record: ButtonTheme/ButtonThemeData should have been deprecated, since no Material 3 widget uses it (the M3 buttons have their own themes, like ElevatedButtonTheme). See flutter/flutter#77569. This fix is still worth landing since it's small and correct.
|
Thanks for the review and for adding the label, @QuncCccccc! And thanks for the context on |
|
autosubmit label was removed for flutter/packages/13517, because - The status or check suite scan-pr has failed. Please fix the issues identified (or deflake) before re-applying this label. |
ButtonThemeData's ==, hashCode and debugFillProperties skipped layoutBehavior, so two themes that differ only in layoutBehavior compared equal and ButtonTheme did not notify its dependents.
8bde1e1 to
6899374
Compare
…r#196992) flutter/packages@dca2e58...81b7c44 2026-11-19 36861262+QuncCccccc@users.noreply.github.com [material_ui] Generalize ButtonTemplateM3E to read the tokens of each button variant (flutter/packages#13684) 2026-11-19 engine-flutter-autoroll@skia.org Roll Flutter from 06f32f8 to e8cc6f3 (30 revisions) (flutter/packages#13719) 2026-11-18 katelovett@google.com [ci] Fix workflow permissions (flutter/packages#13713) 2026-11-18 engine-flutter-autoroll@skia.org Roll Flutter from 2f09f96 to 06f32f8 (18 revisions) (flutter/packages#13712) 2026-11-18 53801679+ChandraChaan@users.noreply.github.com [material_ui] Include layoutBehavior in ButtonThemeData equality (flutter/packages#13517) 2026-11-18 21270878+elliette@users.noreply.github.com [tool] Set up the `script/ci_info` package and add initial `find_builds` tool (flutter/packages#13580) If this roll has caused a breakage, revert this CL and set the roller to dry run mode using the controls here: https://autoroll.skia.org/r/flutter-packages-flutter-autoroll Please CC flutter-ecosystem@google.com on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
ButtonThemeData's==,hashCodeanddebugFillPropertiesskiplayoutBehavior, soButtonThemeData()andButtonThemeData(layoutBehavior: ButtonBarLayoutBehavior.constrained)compare equal. SinceButtonTheme.updateShouldNotifycomparesdata, changing onlylayoutBehaviordoesn't notify dependents either.This adds
layoutBehaviorto all three, with tests for equality,hashCodeand the diagnostics output (both fail without the change).Fixes flutter/flutter#195754
Pre-Review Checklist
[shared_preferences]///).