Thanks to visit codestin.com
Credit goes to github.com

Skip to content

SelectionArea on desktop platform can not select some part from bottom to top since 3.24.0+ sdk #168045

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
zhangc20 opened this issue Apr 30, 2025 · 3 comments
Labels
r: duplicate Issue is closed as a duplicate of an existing issue

Comments

@zhangc20
Copy link

Steps to reproduce

Write a demo like this:

SelectionArea(
      child: Column(
        mainAxisAlignment: MainAxisAlignment.center,
        crossAxisAlignment: CrossAxisAlignment.start,
        children: <Widget>[
          Text.rich(TextSpan(
              children: [
                  TextSpan(children: [
                    TextSpan(text: '12345'),
                    WidgetSpan(child: SizedBox.shrink()),
                    TextSpan(text: '11111'),
                    WidgetSpan(child: SizedBox.shrink()),
                    TextSpan(text: '22222'),
                    WidgetSpan(child: SizedBox.shrink()),
                    TextSpan(text: '33333'),
                    WidgetSpan(child: Icon(Icons.abc),),
                    WidgetSpan(child: SizedBox.shrink()),
                    TextSpan(text: '44444'),
                  ]),
                ],
            )),
            Text.rich(TextSpan(
              children: [
                  TextSpan(children: [
                    TextSpan(text: '12345'),
                  ]),
                ],
            )),
        ],
      ),
    )

Use mouse drag to select textarea from bottom to top cannot select some part of span

Expected results

Select all parts, like 3.22.x sdk

Actual results

cannot select some part of span

Code sample

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

void main() {
  runApp(const MyApp());
}

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

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: [ThemeData(](url)
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      home: const MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  int _counter = 0;

  void _incrementCounter() {
    setState(() {
      // This call to setState tells the Flutter framework that something has
      // changed in this State, which causes it to rerun the build method below
      // so that the display can reflect the updated values. If we changed
      // _counter without calling setState(), then the build method would not be
      // called again, and so nothing would appear to happen.
      _counter++;
    });
  }

  @override
  Widget build(BuildContext context) {
    // This method is rerun every time setState is called, for instance as done
    // by the _incrementCounter method above.
    //
    // The Flutter framework has been optimized to make rerunning build methods
    // fast, so that you can just rebuild anything that needs updating rather
    // than having to individually change instances of widgets.
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: const Center(
        child:  SelectionArea(
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            crossAxisAlignment: CrossAxisAlignment.start,
            children: <Widget>[
              Text.rich(TextSpan(
                  children: [
                      TextSpan(children: [
                        TextSpan(text: '12345'),
                        WidgetSpan(child: SizedBox.shrink()),
                        TextSpan(text: '11111'),
                        WidgetSpan(child: SizedBox.shrink()),
                        TextSpan(text: '22222'),
                        WidgetSpan(child: SizedBox.shrink()),
                        TextSpan(text: '33333'),
                        WidgetSpan(child: Icon(Icons.abc),),
                        WidgetSpan(child: SizedBox.shrink()),
                        TextSpan(text: '44444'),
                      ]),
                    ],
                )),
                Text.rich(TextSpan(
                  children: [
                      TextSpan(children: [
                        TextSpan(text: '12345'),
                      ]),
                    ],
                )),
            ],
          ),
        ),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: _incrementCounter,
        tooltip: 'Increment',
        child: const Icon(Icons.add),
      ), // This trailing comma makes auto-formatting nicer for build methods.
    );
  }
}

Screenshots or Video

Screenshots / Video demonstration

Logs

Logs
[Paste your logs here]

Flutter Doctor output

Doctor output
Doctor summary (to see all details, run flutter doctor -v):
[!] Flutter (Channel stable, 3.29.3, on macOS 12.6.8 21G725 darwin-x64, locale zh-Hans-CN)
    ! Upstream repository https://github.com/flutter/flutter.git is not the same as FLUTTER_GIT_URL
[!] Android toolchain - develop for Android devices (Android SDK version 35.0.1)
    ✗ cmdline-tools component is missing
      Run `path/to/sdkmanager --install "cmdline-tools;latest"`
      See https://developer.android.com/studio/command-line for more details.
    ✗ Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/to/macos-android-setup for more details.
[!] Xcode - develop for iOS and macOS (Xcode 14.2)
    ! Flutter recommends a minimum Xcode version of 15.
      Download the latest version or update via the Mac App Store.
    ! CocoaPods 1.12.1 out of date (1.16.2 is recommended).
        CocoaPods is a package manager for iOS or macOS platform code.
        Without CocoaPods, plugins will not work on iOS or macOS.
        For more info, see https://flutter.dev/to/platform-plugins
      To update CocoaPods, see https://guides.cocoapods.org/using/getting-started.html#updating-cocoapods
[✓] Chrome - develop for the web
[✓] Android Studio (version 2024.3)
[✓] IntelliJ IDEA Ultimate Edition (version 2020.1)
[✓] IntelliJ IDEA Ultimate Edition (version 2020.1)
[✓] VS Code (version 1.99.1)
[✓] Connected device (2 available)
[✓] Network resources

! Doctor found issues in 3 categories.
@zhangc20
Copy link
Author

zhangc20 commented Apr 30, 2025

This is the video on flutter sdk 3.29.3,cannot select some parts

Jietu20250430-155643.mp4

@zhangc20
Copy link
Author

This is the video on flutter sdk 3.22.3,works well

Jietu20250430-160417.mp4

@darshankawar darshankawar added the in triage Presently being triaged by the triage team label Apr 30, 2025
@darshankawar
Copy link
Member

This looks similar to #166462, so please follow-up in it for further updates.
Closing this as a duplicate.

@darshankawar darshankawar added r: duplicate Issue is closed as a duplicate of an existing issue and removed in triage Presently being triaged by the triage team labels Apr 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
r: duplicate Issue is closed as a duplicate of an existing issue
Projects
None yet
Development

No branches or pull requests

2 participants