Skip to content

SelectionArea does not vibrate on Android #104551

Closed

Description

@nilsreichardt

When I select text on my Android, for every single character my phone vibrates. I tried to show it my video. If you make the sounds really loud, you can hear the vibrations a bit.

IMG_0020.MOV

I would expect the behavior for the SelectionArea in my Flutter App.

I used Pixel 4a with Android 12.

I also tried it on my iPhone 13 but there are no vibration when selecting text in a native iOS (but I'm also not 100% sure if I maybe disabled it - if it's possible)

My app
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// This example shows how to make a screen selectable..

import 'package:flutter/material.dart';

void main() => runApp(const MyApp());

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      // You need to add the "SelectionArea" to make the text selectable.
      home: SelectionArea(
        child: Scaffold(
          body: Padding(
            padding: const EdgeInsets.all(16),
            child: Center(
              child: Column(
                mainAxisSize: MainAxisSize.min,
                children: <Widget>[
                  Text(
                    'Fast',
                    style: Theme.of(context).textTheme.titleLarge,
                  ),
                  const Text(
                    'Flutter code compiles to ARM or Intel machine code as well as JavaScript, for fast performance on any device.',
                  ),
                  ElevatedButton(
                    onPressed: () {},
                    child: const Text('Try it in DartPad'),
                  )
                ],
              ),
            ),
          ),
        ),
      ),
    );
  }
}

cc: @chunhtai

Activity

  1. added
    platform-androidAndroid applications specifically
    frameworkflutter/packages/flutter repository. See also f: labels.
    f: selectionSelectableRegion, SelectionArea, SelectionContainer, Selectable, and related APIs
    on May 24, 2022
  2. chunhtai commented on May 24, 2022

    @chunhtai
    Contributor

    there is also a magnify glass when you select text in Android as well. Yes this is also in my radar.
    cc @justinmc this may also apply to text field and the magnify glass project

  3. nilsreichardt commented on May 24, 2022

    @nilsreichardt
    ContributorAuthor

    there is also a magnify glass when you select text in Android as well.

    Indeed. Didn't notice it 😅 I will create a separate issue to track this better 👍

  4. nilsreichardt commented on May 24, 2022

    @nilsreichardt
    ContributorAuthor

    there is also a magnify glass when you select text in Android as well. Yes this is also in my radar.
    cc @justinmc this may also apply to text field and the magnify glass project

    @justinmc Do you know if there are already open tickets for these two behaviors? We need one ticket for the magnifying glass and one for the vibrations when selecting. I tested it and the TextField does not have both. If there are no tickets, let me know - I can then create two tickets.

  5. nilsreichardt commented on May 25, 2022

    @nilsreichardt
    ContributorAuthor

    For the magnifying glass I found the ticket #17617 👍

  6. exaby73 commented on May 25, 2022

    @exaby73
    Member

    I am able to reproduce this on the current version of master. Along with that, selection on Android is very buggy as seen in the video below.

    Note: this was tested using a production build (flutter build web) of the sample code
    and served locally using python3 -m http.server --directory build/web.

    Video showing buggy selection
    Screenrecording_20220525_193541.mp4
    Code sample
    import 'package:flutter/material.dart';
    
    void main() {
      runApp(const MyApp());
    }
    
    class MyApp extends StatelessWidget {
      const MyApp({super.key});
    
      @override
      Widget build(BuildContext context) {
        return const MaterialApp(
          title: 'Multiline text copy demo',
          home: HomePage(),
        );
      }
    }
    
    class HomePage extends StatelessWidget {
      const HomePage({super.key});
    
      @override
      Widget build(BuildContext context) {
        return Scaffold(
          appBar: AppBar(title: const Text('Multiline text copy demo')),
          body: SelectionArea(
            child: Center(
              child: Column(
                mainAxisAlignment: MainAxisAlignment.center,
                children: [
                  Text(
                    'This is a title',
                    style: Theme.of(context).textTheme.headline6,
                  ),
                  const SizedBox(height: 20),
                  const Text(
                    'Lorem ipsum dolor sit amet, consectetur adipiscing elit. '
                    'Fusce gravida sollicitudin.',
                  ),
                ],
              ),
            ),
          ),
        );
      }
    }
    flutter doctor -v (Master)
    [✓] Flutter (Channel master, 3.1.0-0.0.pre.897, on macOS 12.4 21F79 darwin-arm, locale en-US)
        • Flutter version 3.1.0-0.0.pre.897 at /Users/nabeelparkar/fvm/versions/master
        • Upstream repository https://github.com/flutter/flutter.git
        • Framework revision 680a8192b0 (2 hours ago), 2022-05-24 21:23:09 -0700
        • Engine revision 7274f79325
        • Dart version 2.18.0 (build 2.18.0-149.0.dev)
        • DevTools version 2.13.1
    
    [✓] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
        • Android SDK at /Users/nabeelparkar/Library/Android/sdk/
        • Platform android-32, build-tools 32.1.0-rc1
        • ANDROID_SDK_ROOT = /Users/nabeelparkar/Library/Android/sdk/
        • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
        • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)
        • All Android licenses accepted.
    
    [✓] Xcode - develop for iOS and macOS (Xcode 13.4)
        • Xcode at /Applications/Xcode.app/Contents/Developer
        • CocoaPods version 1.11.3
    
    [✓] Chrome - develop for the web
        • CHROME_EXECUTABLE = /Applications/Brave Browser.app/Contents/MacOS/Brave Browser
    
    [✓] Android Studio (version 2021.2)
        • Android Studio at /Applications/Android Studio.app/Contents
        • Flutter plugin can be installed from:
          🔨 https://plugins.jetbrains.com/plugin/9212-flutter
        • Dart plugin can be installed from:
          🔨 https://plugins.jetbrains.com/plugin/6351-dart
        • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)
    
    [✓] IntelliJ IDEA Ultimate Edition (version 2022.1.1)
        • IntelliJ at /Applications/IntelliJ IDEA.app
        • Flutter plugin version 67.1.4
        • Dart plugin version 221.5591.58
    
    [✓] VS Code (version 1.67.1)
        • VS Code at /Applications/Visual Studio Code.app/Contents
        • Flutter extension version 3.40.0
    
    [✓] Connected device (3 available)
        • iPhone 13 Pro Max (mobile) • 16B8F156-111C-489F-A6E5-2D79142036B4 • ios            • com.apple.CoreSimulator.SimRuntime.iOS-15-5 (simulator)
        • macOS (desktop)            • macos                                • darwin-arm64   • macOS 12.4 21F79 darwin-arm
        • Chrome (web)               • chrome                               • web-javascript • Brave Browser 101.1.38.119
    
    [✓] HTTP Host Availability
        • All required HTTP hosts are available
    
    • No issues found!
    
  7. nilsreichardt commented on May 25, 2022

    @nilsreichardt
    ContributorAuthor

    @exaby73 Great catch! Should we extract this into a separate issue?

  8. markusaksli-nc commented on May 25, 2022

    @markusaksli-nc
    Contributor
  9. justinmc commented on May 25, 2022

    @justinmc
    Contributor

    @nilsreichardt There's also another magnifying glass issue for iOS: #9507.

    I'm not aware of any issues about the vibration thing.

  10. nilsreichardt commented on May 25, 2022

    @nilsreichardt
    ContributorAuthor

    @justinmc Good to know, thanks!

    I'm not aware of any issues about the vibration thing.

    Great, I created two issues:

  11. added
    P2Important issues not at the top of the work list
    on May 25, 2022
  12. moved this to In progress in Nevercodeon Jul 18, 2022
  13. removed their assignment
    on Sep 28, 2022
  14. added
    r: fixedIssue is closed as already fixed in a newer version
    on Nov 21, 2022
  15. github-actions commented on Dec 5, 2022

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  16. locked as resolved and limited conversation to collaborators on Dec 5, 2022
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 listf: selectionSelectableRegion, SelectionArea, SelectionContainer, Selectable, and related APIsfound in release: 3.1Found to occur in 3.1frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onplatform-androidAndroid applications specificallyr: fixedIssue is closed as already fixed in a newer version

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions