Skip to content

InkWell and InkResponse not close enough to the real thing #20922

Description

@marcglasberg

When I briefly tap stuff on native Android, I usually can see the highlight and splash very easily. However, in Flutter, both InkRipple.splashFactory and InkSplash.splashFactory are slower to show/hide. InkRipple.splashFactory is better in my opinion, should be the default, but it's not quite right also.

More importantly, in Android native the splash is shown when I REMOVE my finger, while in Flutter it's shown when I hold my finger down.

I wish splash/highlight were tweaked to obtain the exact same effect of native Android.

Activity

  1. zoechi commented on Aug 23, 2018

    @zoechi
    Contributor

    both InkRipple.splashFactory and InkRipple.splashFactory

    seems you meant to mention something else instead of InkRipple.splashFactory twice.

    Please add the output of flutter doctor -v.

  2. added
    frameworkflutter/packages/flutter repository. See also f: labels.
    p: material_uimaterial_ui package in flutter/packages
    a: fidelityMatching the OEM platforms better
    on Aug 23, 2018
  3. added this to the milestone on Aug 23, 2018
  4. marcglasberg commented on Aug 28, 2018

    @marcglasberg
    Author

    Fixed.

    [√] Flutter (Channel dev, v0.7.2, on Microsoft Windows [versão 10.0.17134.228], locale pt-BR)
    [!] Android toolchain - develop for Android devices (Android SDK 28.0.0)
        X Android license status unknown.
    [√] Android Studio (version 3.1)
    [√] IntelliJ IDEA Ultimate Edition (version 2018.2)
    [!] VS Code, 64-bit edition (version 1.21.1)
    [√] Connected devices (1 available)
    
  5. rrousselGit commented on Aug 28, 2018

    @rrousselGit
    Contributor

    There's no documentation about the animation of the ripple effect. At least I see nothing on https://material.io/design/interaction/states.html#pressed

    But from this doc we can see that the highlight color is a black with 16/32% opacity. Which is currently not value used by Flutter.

  6. MasiaVittorio commented on Jan 8, 2019

    @MasiaVittorio

    I feel you, the whole behavior of InkWell is way off, it doesn't seem similar at all to any default android native inkwell.

  7. mzakizadeh commented on Jan 18, 2019

    @mzakizadeh

    More importantly, in Android native the splash is shown when I REMOVE my finger, while in Flutter it's shown when I hold my finger down.

    That is a great point! It is so annoying that the ripple effect is like old Material style

  8. lukef commented on Feb 22, 2019

    @lukef
    Contributor

    Observations when comparing a material.button.MaterialButton in Android to a FlatButton (or other buttons) in Flutter are the following. I'm not saying which one is correct, just that these are the differences:

    1. Flutter has a highlight and a splash layer and that doesn't seem to be the case for the Android implementation. It just has a ripple layer. For comparisons sake, splash (Flutter) == ripple (Android).
    2. The splash animation is "slower" than the ripple animation.
    3. The splash animation is starts with a much smaller initial radius than the ripple animation. This could be why it seems like it is slower.
    4. The splash animation doesn't always fully animate (in my experience) when your finger is lifted off the button. Maybe because highlight + splash compete for animation time (have to double confirm on release)? On Android the ripple always completes.

    It's pretty noticeable when you go back to working on Android for sure. If I had to subjectively choose, I'd say the Flutter implementation is "wrong".

  9. marcos-abreu commented on Apr 27, 2019

    @marcos-abreu

    I'm new to Flutter and to native development in general, and I can definitely see where you all are coming from.

    Here is my 2 cents on this issue, as I'm creating my application in Flutter:

    1. The splash speed is not mentioned (at least nowhere I could find) on the Material docs, but I do agree with some of you here that says both the default implementation InkSplash.splashFactory and the alternative InkRipple.splashFactory are too slow (even though the later is better than the default). What I think would be helpful is to allow developers to change the speed as a ThemeData property as well as a widget parameter (the same way hightlightColor works). I know we can create a custom splashFactory (here is a link on how it could be accomplished) that has a faster splash, but it seems a lot of work to control only the speed.

    2. The highlight behaviour shouldn't be there by default. This would be inline with the material design docs: https://material.io/design/interaction/states.html.

    3. Showing the splash when pressed and not when released as it is currently implemented in Flutter seems to be the right behaviour following the material docs (https://material.io/design/interaction/states.html#pressed).

    Comparing the Material implementation for Flutter with the Material implementation for Android might not be the best comparison. We should be comparing it to the Material guidelines, and if Android's implementation is not following it open a ticket on the Android project.

  10. marcglasberg commented on Apr 28, 2019

    @marcglasberg
    Author

    @marcos-abreu But users couldn't care less about the Material guidelines. They want a consistent experience, and they will judge your app according to that. Besides, if what you say is true, the current Android implementation is much better. I'd suggest Flutter follows Android and you may open a ticket on the Material guidelines instead.

  11. martinory commented on Jun 11, 2019

    @martinory

    What I did was that at ink_well.dart I moved the splash from _handleTapDown to _handleTap and _handleTapCancel and then added a future delayed to cancel of the splash and a _currentTapDownDetails variable to get the latest TapDownDetails.

      void _handleTapDown(TapDownDetails details) {
        _currentTapDownDetails = details;
        if (widget.onTapDown != null) {
          widget.onTapDown(details);
        }
        updateKeepAlive();
        updateHighlight(_HighlightType.pressed, value: true);
      }
    
      void _handleTap(BuildContext context) {
        _showSplash();
        if (widget.onTap != null) {
          if (widget.enableFeedback) Feedback.forTap(context);
          widget.onTap();
        }
      }
    
      void _handleTapCancel() {
        _showSplash();
        if (widget.onTapCancel != null) {
          widget.onTapCancel();
        }
      }
    
      void _showSplash() {
        updateHighlight(_HighlightType.pressed, value: true);
        final InteractiveInkFeature splash = _createInkFeature(_currentTapDownDetails);
        _splashes ??= HashSet<InteractiveInkFeature>();
        _splashes.add(splash);
        _currentSplash = splash;
        Future<void>.delayed(const Duration(milliseconds: 250), () {
          _currentSplash?.cancel();
          _currentSplash = null;
          updateHighlight(_HighlightType.pressed, value: false);
        });
      }
    

    Then I changed ink_splash.dart at line 139:

       _radiusController = AnimationController(duration: _kUnconfirmedSplashDuration, vsync: controller.vsync)
         ..addListener(controller.markNeedsPaint)
         ..forward();
       _radius = _radiusController.drive(CurveTween(curve: _kSplashCurve));
    

    And added _kSplashCurve:
    const Curve _kSplashCurve = Curves.easeOutCubic;
    And at the bottom:
    canvas.drawCircle(center, _radius.value * _targetRadius, paint);

    PS C:\Users\User\flutter> flutter doctor -v
    [√] Flutter (Channel beta, v1.6.3, on Microsoft Windows [Version 10.0.17134.765], locale sv-SE)
        • Flutter version 1.6.3 at C:\Users\User\flutter
        • Framework revision bc7bc94083 (3 weeks ago), 2019-05-23 10:29:07 -0700
        • Engine revision 8dc3a4cde2
        • Dart version 2.3.2 (build 2.3.2-dev.0.0 e3edfd36b2)
    

    I think this gave a somewhat similar appearance to android.

  12. marcglasberg commented on Jun 11, 2019

    @marcglasberg
    Author
  13. martinory commented on Jun 11, 2019

    @martinory

    Okay, so I made some changes and I think it turned out really well and cleaner.
    Here is the GitHub repository with an example https://github.com/martinory/Androidish-InkWell.
    And here is the pub repo: https://pub.dev/packages/androidish_ink_well.

  14. 8 remaining items

  15. added
    P2Important issues not at the top of the work list
    on May 29, 2020
  16. removed this from the milestone on Aug 17, 2020
  17. alberduris commented on Aug 29, 2020

    @alberduris

    This is still an issue. Any update?

  18. willlockwood commented on Dec 21, 2020

    @willlockwood
    Contributor

    Looks like this is and #49957 are duplicates; on the other issue I've been tracking some additional thoughts. I'm working on an implementation now and will open a PR soon that would get Flutter back in line with Android's higher API versions. Currently, it seems like the best path forward might be just to create a new InkFeature factory and set it as the new default, but I'm open to being convinced otherwise.

  19. clocksmith commented on Mar 24, 2022

    @clocksmith
    Contributor

    There is a public doc being worked on to address this issue, and others related to Ink, check it out here:

    https://docs.google.com/document/d/1mtt4nIlK-9-HrjBagwTmyk3b-52kLyv-3rjnPzgcI24

  20. Mayb3Nots commented on May 2, 2023

    @Mayb3Nots
    Contributor

    There is a public doc being worked on to address this issue, and others related to Ink, check it out here:

    https://docs.google.com/document/d/1mtt4nIlK-9-HrjBagwTmyk3b-52kLyv-3rjnPzgcI24

    Hi @clocksmith is the document still public? I cant seem to access it without permission

  21. navaneeth-dev commented on Aug 27, 2023

    @navaneeth-dev

    Is this still being worked on?

  22. added
    packageflutter/packages repository. See also p: labels.
    and removed
    frameworkflutter/packages/flutter repository. See also f: labels.
    on Aug 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work lista: fidelityMatching the OEM platforms bettercustomer: crowdAffects or could affect many people, though not necessarily a specific customer.f: gesturesflutter/packages/flutter/gestures repository.p: material_uimaterial_ui package in flutter/packagespackageflutter/packages repository. See also p: labels.team-designOwned by Design Languages teamtriaged-designTriaged by Design Languages team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions