Repository navigation
[material_ui] Fix SnackBarThemeData.lerp dropping showCloseIcon - #13449
auto-submit[bot] merged 3 commits into
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
There was a problem hiding this comment.
Code Review
This pull request updates SnackBarThemeData.lerp to correctly interpolate the showCloseIcon property, adds a test case to verify this behavior, and includes a pending changelog entry. The review feedback identifies a potential compile-time error in the new test case where a property is accessed directly on the nullable return value of SnackBarThemeData.lerp, suggesting the use of a null-aware operator instead.
| expect(SnackBarThemeData.lerp(a, b, 0.25).showCloseIcon, true); | ||
| expect(SnackBarThemeData.lerp(a, b, 0.75).showCloseIcon, false); | ||
| expect(SnackBarThemeData.lerp(a, null, 0.25).showCloseIcon, true); | ||
| expect(SnackBarThemeData.lerp(null, a, 0.75).showCloseIcon, true); |
There was a problem hiding this comment.
Since SnackBarThemeData.lerp returns a nullable SnackBarThemeData?, accessing .showCloseIcon directly without a null-aware operator (?.) or null assertion operator (!) will cause a compile-time analyzer error. Please use ?.showCloseIcon instead.
| expect(SnackBarThemeData.lerp(a, b, 0.25).showCloseIcon, true); | |
| expect(SnackBarThemeData.lerp(a, b, 0.75).showCloseIcon, false); | |
| expect(SnackBarThemeData.lerp(a, null, 0.25).showCloseIcon, true); | |
| expect(SnackBarThemeData.lerp(null, a, 0.75).showCloseIcon, true); | |
| expect(SnackBarThemeData.lerp(a, b, 0.25)?.showCloseIcon, true); | |
| expect(SnackBarThemeData.lerp(a, b, 0.75)?.showCloseIcon, false); | |
| expect(SnackBarThemeData.lerp(a, null, 0.25)?.showCloseIcon, true); | |
| expect(SnackBarThemeData.lerp(null, a, 0.75)?.showCloseIcon, true); |
There was a problem hiding this comment.
SnackBarThemeData.lerp returns a non-nullable SnackBarThemeData, so .showCloseIcon is fine here. Using ?. gives an invalid_null_aware_operator warning instead, so I've left it as is.
bc64e85 to
08eb86f
Compare
QuncCccccc
left a comment
There was a problem hiding this comment.
LGTM. Thank you for your contribution!
|
Thanks for the reviews, @QuncCccccc and @elliette! The two failed presubmit jobs ( The merge removed the |
|
Gentle follow-up, @QuncCccccc and @elliette: this is approved and up to date with |
…r#196450) flutter/packages@653628e...14f9933 2026-11-12 [email protected] [material_ui] Fix SnackBarThemeData.lerp dropping showCloseIcon (flutter/packages#13449) 2026-11-11 [email protected] [ci] Update repo for 3.50 stable release (flutter/packages#13628) 2026-11-11 [email protected] [vector_graphics] Use font-family lists as a family with fallbacks (flutter/packages#13552) 2026-11-11 [email protected] Roll Flutter (stable) from c197ca5 to ab29120 (1647 revisions) (flutter/packages#13625) 2026-11-11 [email protected] [shared_prferences] Adopts mockito-kotlin in tests (flutter/packages#13624) 2026-11-11 [email protected] [cupertino_ui] Dim disabled CupertinoSlider controls (flutter/packages#13419) 2026-11-11 [email protected] [flutter_svg] Invalidate pending cache entries on clear and evict (flutter/packages#13595) 2026-11-11 [email protected] [cupertino_ui] Fix the tinted button's fill opacity (flutter/packages#13436) 2026-11-11 [email protected] [various] Support SVG filters (blur, offset, feMerge) (flutter/packages#11909) 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 [email protected] 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
SnackBarThemeData.lerpnever passesshowCloseIconto the constructor, so a lerped theme always hasshowCloseIcon == null. This shows up duringAnimatedThemetransitions, where a snack bar loses the close icon its theme asked for.This adds
showCloseIcontolerpusing the samet < 0.5switch as the other non-lerpable fields (behavior,dismissDirection), and a unit test covering both halves of the animation and a null theme on either side.Fixes flutter/flutter#195390
Pre-Review Checklist
[shared_preferences]///).