Skip to content

paragraph.dart _cachedRect is not refreshed after the window width changes, which results in limited selection #155143

@yuuuuuzj

Description

@yuuuuuzj

Steps to reproduce

After the first rendering, the selected file can be selected. After reducing the window size, some selected areas are limited and cannot be selected

Expected results

It is expected that after the window width is adjusted, the selection can also be normal, and the area is not limited.

Actual results

After the first rendering, the selected file can be selected. After reducing the window size, some selected areas are limited and cannot be selected

Code sample

code sample
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';

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

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: Text('Selectable Text with Dynamic Layout'),
        ),
        body: const DynamicLayoutWidget(),
      ),
    );
  }
}

class DynamicLayoutWidget extends StatefulWidget {
  const DynamicLayoutWidget({Key? key}) : super(key: key);

  @override
  _DynamicLayoutWidgetState createState() => _DynamicLayoutWidgetState();
}

class _DynamicLayoutWidgetState extends State<DynamicLayoutWidget> {
  @override
  Widget build(BuildContext context) {
    return const Material(
      color: Colors.transparent,
      child: SelectionArea(
          child: Text(
        'This is a selectable text.Selectable Text with WrapSelectable Text with WrapSelectable Text with WrapSelectable Text with WrapSelectable Text with Wrap',
        style: TextStyle(fontSize: 18),
        selectionColor: Colors.blue,
      )),
    );
  }
}

Screenshots or Video

Screenshots / Video demonstration
2024-09-13.141244.mp4

Logs

Logs
[Paste your logs here]

Flutter Doctor output

Flutter assets will be downloaded from https://storage.flutter-io.cn. Make sure you trust this source!
[√] Flutter (Channel stable, 3.24.1, on Microsoft Windows [版本 10.0.22631.4169], locale zh-CN)
• Flutter version 3.24.1 on channel stable at D:\flutter_windows_3.24.1-stable\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 5874a72 (3 weeks ago), 2024-08-20 16:46:00 -0500
• Engine revision c9b9d5780d
• Dart version 3.5.1
• DevTools version 2.37.2
• Pub download mirror https://pub.flutter-io.cn
• Flutter download mirror https://storage.flutter-io.cn

[√] Windows Version (Installed version of Windows is version 10 or higher)

[X] Android toolchain - develop for Android devices
X Unable to locate Android SDK.
Install Android Studio from: https://developer.android.com/studio/index.html
On first launch it will assist you in installing the Android SDK components.
(or visit https://flutter.dev/to/windows-android-setup for detailed instructions).
If the Android SDK has been installed to a custom location, please use
flutter config --android-sdk to update to that location.

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

[√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.10.2)
• Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
• Visual Studio Community 2022 version 17.10.35004.147
• Windows 10 SDK version 10.0.22621.0

[!] Android Studio (not installed)
• Android Studio not found; download from https://developer.android.com/studio/index.html
(or visit https://flutter.dev/to/windows-android-setup for detailed instructions).

[√] Connected device (3 available)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [版本 10.0.22631.4169]
• Chrome (web) • chrome • web-javascript • Google Chrome 128.0.6613.138
• Edge (web) • edge • web-javascript • Microsoft Edge 128.0.2739.67

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

! Doctor found issues in 2 categories.

Metadata

Metadata

Labels

f: selectionSelectableRegion, SelectionArea, SelectionContainer, Selectable, and related APIsfound in release: 3.24Found to occur in 3.24found in release: 3.26Found to occur in 3.26frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onr: fixedIssue is closed as already fixed in a newer versionteam-text-inputOwned by Text Input team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions