Skip to content

SelectionArea should expand selection by words on Android #104603

@markusaksli-nc

Description

@markusaksli-nc

Android TextView vs Flutter SelectionArea on Pixel 5 Android 12 emulator

android.mp4
flutter.mp4

This applies for both dragging the handles as well as long-press drag (#26394). Selection should expand by words and should not select next/previous line when the gesture extends beyond the current line.

Flutter sample
import 'package:flutter/material.dart';

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

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

  static const String _title = 'Flutter Sample';

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: _title,
      home: SelectionArea(
        child: Scaffold(
          appBar: AppBar(title: const Text(_title)),
          body: const Padding(
            padding: EdgeInsets.all(24.0),
            child: Text('word\nword word biglongwordthing\nword'),
          ),
        ),
      ),
    );
  }
}
flutter doctor -v
[√] Flutter (Channel master, 3.1.0-0.0.pre.898, on Microsoft Windows [Version 10.0.19044.1706], locale en-GB)
    • Flutter version 3.1.0-0.0.pre.898 at C:\Development\flutter_master
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 97452d1a10 (2 hours ago), 2022-05-25 11:40:31 +0300
    • 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.0.0)
    • Android SDK at C:\Users\marku\AppData\Local\Android\sdk
    • Platform android-32, build-tools 32.0.0
    • Java binary at: C:\Users\marku\AppData\Local\JetBrains\Toolbox\apps\AndroidStudio\ch-0\212.5712.43.2112.8512546\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 11.0.12+7-b1504.28-7817840)
    • All Android licenses accepted.

[√] Chrome - develop for the web
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[√] Visual Studio - develop for Windows (Visual Studio Community 2019 16.11.7)
    • Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community
    • Visual Studio Community 2019 version 16.11.31911.196
    • Windows 10 SDK version 10.0.19041.0

[√] Android Studio (version 2021.2)
    • Android Studio at C:\Users\marku\AppData\Local\JetBrains\Toolbox\apps\AndroidStudio\ch-0\212.5712.43.2112.8512546
    • Flutter plugin version 67.1.2
    • Dart plugin version 212.5744
    • Java version OpenJDK Runtime Environment (build 11.0.12+7-b1504.28-7817840)

[√] Connected device (5 available)
    • SM S908B (mobile)            • R5CT20JDJZH   • android-arm64  • Android 12 (API 31)
    • sdk gphone64 x86 64 (mobile) • emulator-5554 • android-x64    • Android 12 (API 31) (emulator)
    • Windows (desktop)            • windows       • windows-x64    • Microsoft Windows [Version 10.0.19044.1706]
    • Chrome (web)                 • chrome        • web-javascript • Google Chrome 101.0.4951.67
    • Edge (web)                   • edge          • web-javascript • Microsoft Edge 101.0.1210.47

[√] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!

cc @chunhtai

Metadata

Metadata

Labels

P2Important issues not at the top of the work listf: selectionSelectableRegion, SelectionArea, SelectionContainer, Selectable, and related APIsframeworkflutter/packages/flutter repository. See also f: labels.platform-androidAndroid applications specificallyteam-androidOwned by Android platform teamtriaged-androidTriaged by Android platform team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions