Skip to content

Conversation

@bleroux
Copy link
Contributor

@bleroux bleroux commented Nov 7, 2023

This is a reland of #136624 which was reverted because one new M3 golden test failed. The failure was related to the ink sparkle animation.

Ink sparkle is the M3 default animation, it does not play well with golden because it introduces an element of randomness.
One way to avoid this randomness is to use the InkSparkle.constantTurbulenceSeedSplashFactory.

This PR has two commits:

@github-actions github-actions bot added framework flutter/packages/flutter repository. See also f: labels. f: material design flutter/packages/flutter/material repository. labels Nov 7, 2023
@flutter-dashboard
Copy link

Golden file changes have been found for this pull request. Click here to view and triage (e.g. because this is an intentional change).

If you are still iterating on this change and are not ready to resolve the images on the Flutter Gold dashboard, consider marking this PR as a draft pull request above. You will still be able to view image results on the dashboard, commenting will be silenced, and the check will not try to resolve itself until marked ready for review.

For more guidance, visit Writing a golden file test for package:flutter.

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

Changes reported for pull request #137998 at sha c3856aa

@flutter-dashboard flutter-dashboard bot added the will affect goldens Changes to golden files label Nov 7, 2023
@bleroux
Copy link
Contributor Author

bleroux commented Nov 7, 2023

@Piinks This is an attempt to reland #136624, I found InkSparkle.constantTurbulenceSeedSplashFactory and wanted to give it a try.
I have not approved the golden changes in case you wanted to have a look.
There are 21 one of them to approve, that looks right.

Unfortunately, you won't be able to push commits to this PR because it belongs to the Nevercode organisation on Github. For this same reason, Taha switched to a personnal fork some months ago, I will switch too as soon as possible as It would be easier for you.

@bleroux bleroux requested a review from Piinks November 7, 2023 15:30
@TahaTesser TahaTesser mentioned this pull request Nov 7, 2023
8 tasks
Copy link
Contributor

@Piinks Piinks left a comment

Choose a reason for hiding this comment

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

Just QQ about web using the sparkle

// Regression test for: https://github.com/flutter/flutter/issues/22226
Widget runTest() {
int currentIndex = 0;
const bool useInkSparkle = !kIsWeb;
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not on web?

Copy link
Contributor

Choose a reason for hiding this comment

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

I am pretty sure web supports shaders now, I wonder if we need to update the InkSparkle then...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think InkSparkle shader would work on web + Android mobile (web might support shaders but it is probably on CanvasKit). But we might need to ask someone who knows more.

InkSparkle documentation explicitly mentionned it is not supported with the HTML renderer, see

/// This effect relies on a shader and therefore is unsupported on the Flutter
/// Web HTML backend.

As of today InkSparkle is deactived on Web. For instance, the useInkSparkle variable I used in this test is direcly inspired by the ThemeData implementation, see

final bool useInkSparkle = platform == TargetPlatform.android && !kIsWeb;

And tests for InkSparkle are deactivated on Web, see

skip: kIsWeb, // [intended] shaders are not yet supported for web.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah I inquired about this yesterday after I noticed the same in the docs. I know that shaders are supported in canvaskit, maybe we need to update the sparkle and the docs to have it on canvaskit then? We could use this flag: https://api.flutter.dev/flutter/foundation/isCanvasKit.html

Copy link
Contributor

Choose a reason for hiding this comment

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

(We could also file a bug about this and follow up in a separate change 🙂 )

Copy link
Contributor Author

Choose a reason for hiding this comment

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

FYI, I filed #138487.


return MaterialApp(
// Because this test relies on golden, fo a constant seed for the ink sparkle animation.
theme: ThemeData(splashFactory: useInkSparkle ? InkSparkle.constantTurbulenceSeedSplashFactory : null),
Copy link
Contributor

Choose a reason for hiding this comment

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

Yes! constantTurbulenceSeedSplashFactory should eliminate the randomness we saw in the previous PR. 👍

Copy link
Contributor

Choose a reason for hiding this comment

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

Just double checking - this is the only test in this PR with the sparkle?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, this is the only golden test in this PR.

For future M3 test migration PRs, this issue will surface on any golden test that simulates a tap on a widget tree that contains an InkWell. I don't know if there are a lot of them, the tricky part will be to be aware of this (Taha and me will take care on our migration PRs).

Copy link
Contributor

@Piinks Piinks Nov 20, 2023

Choose a reason for hiding this comment

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

Yeah, I wonder, should we create an M3 test utility for this? You could create just a simple wrapper class that creates a MaterialApp with the turbulence seed set, and then re-use it in every M3 test so we'll know it is consistently being applied.

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh! Actually scratch that. How about this instead - let's update InkSparkle so that in debug mode it always uses the fixed turbulence seed. That would be the best way to prevent this issue from reoccurring. Probably in the InkSparkle constructor, set the seed in an assert statement so in debug mode (including tests) it will always be fixed and consistent!

cc @TahaTesser

Copy link
Contributor

@Piinks Piinks left a comment

Choose a reason for hiding this comment

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

LGTM

@Piinks Piinks added the autosubmit Merge PR when tree becomes green via auto submit App label Nov 20, 2023
@auto-submit auto-submit bot merged commit 1a9e866 into flutter:master Nov 20, 2023
@bleroux
Copy link
Contributor Author

bleroux commented Nov 21, 2023

I will push an update once #138757 will be merged.

engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 21, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 21, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 21, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 21, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 21, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 21, 2023
auto-submit bot pushed a commit to flutter/packages that referenced this pull request Nov 21, 2023
Manual roll requested by [email protected]

flutter/flutter@9c9e061...ab721f9

2023-11-21 [email protected] Roll Flutter Engine from 6da31e1bff67 to 746697c27569 (1 revision) (flutter/flutter#138826)
2023-11-21 [email protected] Add mhbdev to AUTHORS (flutter/flutter#138311)
2023-11-21 [email protected] Manual roll Flutter Engine from 70b1c7341255 to 6da31e1bff67 (10 revisions) (flutter/flutter#138817)
2023-11-21 [email protected] Fix Chips with Tooltip throw an assertion when enabling or disabling (flutter/flutter#138799)
2023-11-21 [email protected] Roll Packages from c5443ad to c9933fc (2 revisions) (flutter/flutter#138809)
2023-11-21 [email protected] Roll Flutter Engine from 3348fb0ca302 to 70b1c7341255 (1 revision) (flutter/flutter#138774)
2023-11-21 [email protected] Roll Flutter Engine from f3e9b38a2588 to 3348fb0ca302 (1 revision) (flutter/flutter#138772)
2023-11-21 [email protected] Roll Flutter Engine from 39fb4581cff2 to f3e9b38a2588 (3 revisions) (flutter/flutter#138770)
2023-11-21 [email protected] Add dartdoc warnings (flutter/flutter#138766)
2023-11-21 [email protected] Roll Flutter Engine from 6e8e55ef1a7f to 39fb4581cff2 (2 revisions) (flutter/flutter#138765)
2023-11-20 [email protected] Added Features requested in #137530 (flutter/flutter#137532)
2023-11-20 [email protected] Bump dartdoc to 7.0.2 (flutter/flutter#138760)
2023-11-20 [email protected] Roll Flutter Engine from 7a31543b4630 to 6e8e55ef1a7f (4 revisions) (flutter/flutter#138761)
2023-11-20 [email protected] [Reland] Introduce `AnimationStyle` (flutter/flutter#138721)
2023-11-20 [email protected] Roll Flutter Engine from 337ab58e81f7 to 7a31543b4630 (2 revisions) (flutter/flutter#138759)
2023-11-20 [email protected] Reland update bottom navigation bar test for m3 (flutter/flutter#137998)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages
Please CC [email protected],[email protected],[email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Packages: 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
auto-submit bot pushed a commit that referenced this pull request Dec 4, 2023
This PR removes the call to `InkSparkle.constantTurbulenceSeedSplashFactory` which was introduced in #137998.

This is now obsolete since #138757 was merged and InkSparkle randomness is no more active in tests.
@bleroux bleroux deleted the reland_update_bottom_navigation_bar_test_for_M3 branch December 10, 2023 14:54
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 16, 2024
@Eerey
Copy link

Eerey commented May 2, 2024

So just to be clear, InkSparkle.constantTurbulenceSeedSplashFactory is now additionally unavailable for a web-build with CanvasKit? Because it worked on flutter 3.13.9, but now on 3.19.6 it shows basically no visual onPress/onTap shader effect on my buttons.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

autosubmit Merge PR when tree becomes green via auto submit App f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels. will affect goldens Changes to golden files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants