Skip to content

DraggableScrollableSheet is rebuilding the screen while dragging #67219

@ganeshrvel

Description

@ganeshrvel

Steps to Reproduce

DraggableScrollableSheet is rebuilding the screen while dragging the sheet and it is causing unnecessary flickers.

class MyPopUpSheet extends StatelessWidget {
  ScrollController _scrollController; //Needed for

  @override
  Widget build(BuildContext context) {
    return Material(
      child: DraggableScrollableSheet(
        initialChildSize: 0.4,
        minChildSize: 0.4,
        builder: (ctx, scrollController) {
          
         print('Rebuilding...');

          return CustomScrollView(
            controller: scrollController,
            slivers: [
              SliverToBoxAdapter(child: Container(Colors.deepOrange)),
              SliverToBoxAdapter(child: Container(Colors.red)),
              SliverToBoxAdapter(child: Container(Colors.green)),
            ],
          );
        },
      ),
    );
  }

Expected results:
It shouldn't rebuild the widget while dragging the sheet.

Actual results:

Logs
[✓] Flutter (Channel stable, 1.20.4, on Mac OS X 10.15.6 19G73, locale en-IN)
    • Flutter version 1.20.4 at /Users/username/Library/Application Support/fvm/versions/1.20.4
    • Framework revision fba99f6cf9 (3 weeks ago), 2020-09-14 15:32:52 -0700
    • Engine revision d1bc06f032
    • Dart version 2.9.2

[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
    • Android SDK at /Users/username/Library/Android/sdk
    • Platform android-29, build-tools 29.0.3
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 11.6)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 11.6, Build version 11E708
    • CocoaPods version 1.9.3

[✓] Android Studio (version 4.0)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 49.0.2
    • Dart plugin version 193.7547
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
 
[✓] Connected device (1 available)            
    • ONEPLUS A6000 (mobile) • 431e5315 • android-arm64 • Android 10 (API 29)

• No issues found!

cc/ @TahaTesser

Metadata

Metadata

Assignees

Labels

P2Important issues not at the top of the work lista: qualityA truly polished experiencecustomer: crowdAffects or could affect many people, though not necessarily a specific customer.f: scrollingViewports, list views, slivers, etc.found in release: 2.0Found to occur in 2.0found in release: 2.1Found to occur in 2.1frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work on

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions