flutter/flutter

`SelectionArea` throws exception when scrolling fast on web

クローズ

#122,680 opened on 2023/03/15

 (13 件のコメント) (3 件のリアクション) (0 人の担当者)Dart (30,366 件のフォーク)batch import
P2c: crashf: scrollingf: selectionfound in release: 3.7found in release: 3.9frameworkgood first issuehas reproducible stepsplatform-webteam-webtriaged-web

Repository metrics

Stars
 (176,322 個のスター)
PR merge metrics
 (平均マージ 7d 7h) (30d で 491 merged PRs)

説明

Use case

#error video https://user-images.githubusercontent.com/16702158/225249332-e67ed649-a3a2-47b2-bb95-815a393993fc.mov

Test Code

import 'package:flutter/material.dart';

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

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',

      home: MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

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

  final String title;

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

class _MyHomePageState extends State<MyHomePage> {

  ScrollController scrollController = ScrollController();
  List<Widget> list = [];

  @override
  void initState() {
    super.initState();

    for(int i = 0; i < 10; i++) {
      list.addAll([
        SelectionArea(
          child: Container(
            color: Colors.grey,
            height: 300,
            child: Text("123213213123123123123123123123123"),
          ),
        ),
        SelectionArea(
          child: Container(
            color: Colors.green,
            height: 300,
            child: Text("123213213123123123123123123123123"),
          ),
        ),
        SelectionArea(
          child: Container(
            color: Colors.lightBlueAccent,
            height: 300,
            child: Text("123213213123123123123123123123123"),
          ),
        ),
        SelectionArea(
          child: Container(
            color: Colors.orange,
            height: 300,
            child: Text("123213213123123123123123123123123"),
          ),
        ),
        SelectionArea(
          child: Container(
            color: Colors.grey,
            height: 300,
            child: Text("123213213123123123123123123123123"),
          ),
        ),
        SelectionArea(
          child: Container(
            color: Colors.green,
            height: 300,
            child: Text("123213213123123123123123123123123"),
          ),
        ),
        SelectionArea(
          child: Container(
            color: Colors.lightBlueAccent,
            height: 300,
            child: Text("123213213123123123123123123123123"),
          ),
        ),
        SelectionArea(
          child: Container(
            color: Colors.orange,
            height: 300,
            child: Text("123213213123123123123123123123123"),
          ),
        ),
        SelectionArea(
          child: Container(
            color: Colors.grey,
            height: 300,
            child: Text("123213213123123123123123123123123"),
          ),
        ),
        SelectionArea(
          child: Container(
            color: Colors.green,
            height: 300,
            child: Text("123213213123123123123123123123123"),
          ),
        ),
        SelectionArea(
          child: Container(
            color: Colors.lightBlueAccent,
            height: 300,
            child: Text("123213213123123123123123123123123"),
          ),
        )
      ]);
    }
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Column(
        mainAxisAlignment: MainAxisAlignment.center,
        children: [
          Expanded(
            child: Container(
              margin: const EdgeInsets.symmetric(horizontal: 10),
              child: ListView(
                controller: scrollController,
                reverse: true,
                children: list,
              ),
            ),
          )
        ],
      ),

      bottomSheet: GestureDetector(
        onTap: () {
          scrollController.animateTo(0, duration: const Duration(milliseconds: 300), curve: Curves.linear);
        },
        child: Container(
          width: 50,
          height: 50,
          color: Colors.orange,
        ),
      ),
    );
  }
}


flutter doctor

Doctor summary (to see all details, run flutter doctor -v): [!] Flutter (Channel stable, 3.7.0, on macOS 12.6.3 21G419 darwin-x64, locale ko-KR) ! Warning: dart on your path resolves to /usr/local/Cellar/dart/2.17.0/libexec/bin/dart, which is not inside your current Flutter SDK checkout at /Users/toby/Desktop/flutter. Consider adding /Users/toby/Desktop/flutter/bin to the front of your path. [!] Android toolchain - develop for Android devices (Android SDK version 33.0.0) ✗ 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/docs/get-started/install/macos#android-setup for more details. [✓] Xcode - develop for iOS and macOS (Xcode 14.2) [✓] Chrome - develop for the web [✓] Android Studio (version 4.1) [!] Android Studio ✗ Unable to find bundled Java version. [✓] IntelliJ IDEA Ultimate Edition (version 2021.3.2) [✓] VS Code (version 1.76.1) [✓] Connected device (2 available) [✓] HTTP Host Availability

! Doctor found issues in 3 categories.

コントリビューターガイド