Skip to content

[SelectionArea] Long press, text in chinese is not selected by default and selected state exception #126652

@MeandNi

Description

@MeandNi

Is there an existing issue for this?

Steps to reproduce

run sample code:

import 'package:flutter/material.dart';

void main() {
  runApp(
    MaterialApp(
      title: 'Demo',
      home: TestPage(),
    ),
  );
}

class TestPage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("SelectionArea"),
      ),
      body: Center(
        child: SelectionArea(
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: [
              Text("测试文本测试文本测试文本测试文本测试文本测试文本"),
              SizedBox(
                height: 20,
              ),
              Text("text text text text text text"),
            ],
          ),
        ),
      ),
    );
  }
}
20230512-173118.mp4

Expected results

The closest text is selected by default and when I choose English, the selected state will change.

Actual results

nothing is selected

Code sample

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

void main() {
  runApp(
    MaterialApp(
      title: 'Demo',
      home: TestPage(),
    ),
  );
}

class TestPage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("SelectionArea"),
      ),
      body: Center(
        child: SelectionArea(
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: [
              Text("测试文本测试文本测试文本测试文本测试文本测试文本"),
              SizedBox(
                height: 20,
              ),
              Text("text text text text text text"),
            ],
          ),
        ),
      ),
    );
  }
}

Screenshots or Video

Screenshots / Video demonstration

[Upload media here]

Logs

Logs
[Paste your logs here]

Flutter Doctor output

Doctor output
[!] Flutter (Channel unknown, 3.11.0-2.0.pre.51, on macOS 13.0.1 22A400
    darwin-arm64, locale zh-Hans-CN)
    ! Flutter version 3.11.0-2.0.pre.51 on channel unknown at
      /Users/yangjiakang/flutter/framework
      Currently on an unknown channel. Run `flutter channel` to switch to an
      official channel.
      If that doesn't fix the issue, reinstall Flutter by following instructions
      at https://flutter.dev/docs/get-started/install.
    ! Unknown upstream repository.
      Reinstall Flutter by following instructions at
      https://flutter.dev/docs/get-started/install.
    • Framework revision 7c356d047d (4 天前), 2023-05-06 12:22:11 +0800
    • Engine revision 876968833e
    • Dart version 3.1.0 (build 3.1.0-82.0.dev)
    • DevTools version 2.23.1
    • If those were intentional, you can disregard the above warnings; however
      it is recommended to use "git" directly to perform update checks and
      upgrades.

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.1)
    • Android SDK at /Users/yangjiakang/Library/Android/sdk
    • Platform android-33, build-tools 33.0.1
    • ANDROID_HOME = /Users/yangjiakang/Library/Android/sdk
    • ANDROID_SDK_ROOT = /Users/yangjiakang/Library/Android/sdk
    • Java binary at: /Applications/Android
      Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build
      11.0.15+0-b2043.56-8887301)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.0.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 14A400
    • CocoaPods version 1.11.3

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio
    • Android Studio at /Applications/Android Studio Preview.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
      17.0.4.1+0-17.0.4.1b469.62-9127311)

[✓] Android Studio (version 2022.1)
    • 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.15+0-b2043.56-8887301)

[✓] Android Studio
    • Android Studio at
      /Users/yangjiakang/Code/androidx/studio/android-studio-2022.2.1.7-mac_arm/
      Android Studio Preview.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
      17.0.4.1+0-17.0.4.1b469.62-9127311)

[✓] IntelliJ IDEA Ultimate Edition (version 2022.3.2)
    • IntelliJ at /Applications/IntelliJ IDEA.app
    • 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

[✓] VS Code (version 1.78.0)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension can be installed from:
      🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[!] Proxy Configuration
    • HTTP_PROXY is set
    • NO_PROXY is localhost,127.0.0.1
    • NO_PROXY contains localhost
    • NO_PROXY contains 127.0.0.1
    ! NO_PROXY does not contain ::1

[✓] Connected device (3 available)
    • PERM00 (mobile) • XOCAQ87LIR597TEA • android-arm64  • Android 12 (API 31)
    • macOS (desktop) • macos            • darwin-arm64   • macOS 13.0.1 22A400
      darwin-arm64
    • Chrome (web)    • chrome           • web-javascript • Google Chrome
      113.0.5672.92

[✓] Network resources
    • All expected network resources are available.

! Doctor found issues in 2 categories.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work lista: internationalizationSupporting other languages or locales. (aka i18n)c: crashStack traces logged to the consolef: selectionSelectableRegion, SelectionArea, SelectionContainer, Selectable, and related APIsfound in release: 3.10Found to occur in 3.10found in release: 3.11Found to occur in 3.11frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onteam-frameworkOwned by Framework teamtriaged-frameworkTriaged by Framework team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions