Skip to content

On a CustomScrollView, the second sliver disapears visually when having a SliverPadding without child sliver as first element of the slivers array #64506

@andresemartinez

Description

@andresemartinez

Steps to Reproduce

  1. Run flutter create bug.
  2. Update the files as follows:
    main.dart
import 'package:flutter/material.dart';

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

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) => MaterialApp(
        title: 'Bug',
        theme: ThemeData(
          primarySwatch: Colors.blue,
        ),
        home: SomeWidget(),
      );
}

class SomeWidget extends StatelessWidget {
  @override
  Widget build(BuildContext context) => Scaffold(
        appBar: AppBar(
          title: Text('Some title'),
        ),
        body: CustomScrollView(
          slivers: [

            // This padding breaks the next sliver when scrolling
            SliverPadding(
              padding: const EdgeInsets.only(top: 24),
            ),

            // This sliver breaks while scrolling when it touches the app bar
            SliverPadding(
              padding: const EdgeInsets.symmetric(horizontal: 20),
              sliver: SliverToBoxAdapter(
                child: Text('Some Text'),
              ),
            ),

            // The same happens with other widgets
//            SliverPadding(
//              padding: const EdgeInsets.symmetric(horizontal: 20),
//              sliver: SliverToBoxAdapter(
//                child: Container(
//                  height: 50,
//                  width: 50,
//                  color: Colors.red,
//                ),
//              ),
//            ),

            // Some big padding to be able to scroll
            SliverPadding(
              padding: const EdgeInsets.only(top: 1000),
            )
          ],
        ),
      );
}
  1. Scroll the page until the 'Some text' touches the AppBar

Expected results:
The 'Some text' should be visible until its completely behind the AppBar.

Actual results:
The 'Some text' desapears visually when it touches the AppBar.

Removing the first SliverPadding makes it work as intended.

Logs
[ +254 ms] executing: [/home/andres/lib/flutter/] git -c log.showSignature=false log -n 1 --pretty=format:%H
[  +62 ms] Exit code 0 from: git -c log.showSignature=false log -n 1 --pretty=format:%H
[        ] bbfbf1770cca2da7c82e887e4e4af910034800b6
[        ] executing: [/home/andres/lib/flutter/] git tag --contains HEAD
[ +401 ms] Exit code 0 from: git tag --contains HEAD
[        ] 1.20.2
[   +9 ms] executing: [/home/andres/lib/flutter/] git rev-parse --abbrev-ref --symbolic @{u}
[   +3 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @{u}
[        ] origin/stable
[        ] executing: [/home/andres/lib/flutter/] git ls-remote --get-url origin
[   +2 ms] Exit code 0 from: git ls-remote --get-url origin
[        ] https://github.com/flutter/flutter.git
[  +61 ms] executing: [/home/andres/lib/flutter/] git rev-parse --abbrev-ref HEAD
[   +3 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD
[        ] stable
[  +84 ms] Artifact Instance of 'AndroidMavenArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[   +3 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[  +23 ms] executing: /home/andres/Android/Sdk/platform-tools/adb devices -l
[  +54 ms] List of devices attached
           emulator-5554          device product:sdk_gphone_x86 model:Android_SDK_built_for_x86 device:generic_x86 transport_id:1
[  +10 ms] /home/andres/Android/Sdk/platform-tools/adb -s emulator-5554 shell getprop
[  +28 ms] Artifact Instance of 'AndroidMavenArtifacts' is not required, skipping update.
[   +8 ms] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[   +1 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[ +231 ms] Generating /home/andres/dev/bug/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java
[  +29 ms] ro.hardware = ranchu
[  +88 ms] Starting incremental build...
[   +2 ms] Initializing file store
[  +13 ms] Skipping target: gen_localizations
[   +6 ms] complete
[  +13 ms] /home/andres/lib/flutter/bin/cache/dart-sdk/bin/dart --disable-dart-dev /home/andres/lib/flutter/bin/cache/artifacts/engine/linux-x64/frontend_server.dart.snapshot --sdk-root /home/andres/lib/flutter/bin/cache/artifacts/engine/common/flutter_patched_sdk/ --incremental --target=flutter --debugger-module-names -Ddart.developer.causal_async_stacks=true -Dflutter.inspector.structuredErrors=true --output-dill /tmp/flutter_tools.SQFROE/flutter_tool.HWHWWQ/app.dill --packages .packages -Ddart.vm.profile=false -Ddart.vm.product=false --bytecode-options=source-positions,local-var-info,debugger-stops,instance-field-initializers,keep-unreachable-code,avoid-closure-call-instructions --enable-asserts --track-widget-creation --initialize-from-dill build/f872507f30e2ff2523f0f1d19160266e.cache.dill.track.dill
[  +14 ms] executing: /home/andres/Android/Sdk/build-tools/29.0.2/aapt dump xmltree /home/andres/dev/bug/build/app/outputs/flutter-apk/app.apk AndroidManifest.xml
Launching lib/main.dart on Android SDK built for x86 in debug mode...
[  +18 ms] Exit code 0 from: /home/andres/Android/Sdk/build-tools/29.0.2/aapt dump xmltree /home/andres/dev/bug/build/app/outputs/flutter-apk/app.apk AndroidManifest.xml
[        ] N: android=http://schemas.android.com/apk/res/android
             E: manifest (line=2)
               A: android:versionCode(0x0101021b)=(type 0x10)0x1
               A: android:versionName(0x0101021c)="1.0.0" (Raw: "1.0.0")
               A: android:compileSdkVersion(0x01010572)=(type 0x10)0x1c
               A: android:compileSdkVersionCodename(0x01010573)="9" (Raw: "9")
               A: package="com.example.bug" (Raw: "com.example.bug")
               A: platformBuildVersionCode=(type 0x10)0x1c
               A: platformBuildVersionName=(type 0x10)0x9
               E: uses-sdk (line=7)
                 A: android:minSdkVersion(0x0101020c)=(type 0x10)0x10
                 A: android:targetSdkVersion(0x01010270)=(type 0x10)0x1c
               E: uses-permission (line=14)
                 A: android:name(0x01010003)="android.permission.INTERNET" (Raw: "android.permission.INTERNET")
               E: application (line=22)
                 A: android:label(0x01010001)="bug" (Raw: "bug")
                 A: android:icon(0x01010002)=@0x7f080000
                 A: android:name(0x01010003)="io.flutter.app.FlutterApplication" (Raw: "io.flutter.app.FlutterApplication")
                 A: android:debuggable(0x0101000f)=(type 0x12)0xffffffff
                 A: android:appComponentFactory(0x0101057a)="androidx.core.app.CoreComponentFactory" (Raw: "androidx.core.app.CoreComponentFactory")
                 E: activity (line=28)
                   A: android:theme(0x01010000)=@0x7f0a0000
                   A: android:name(0x01010003)="com.example.bug.MainActivity" (Raw: "com.example.bug.MainActivity")
                   A: android:launchMode(0x0101001d)=(type 0x10)0x1
                   A: android:configChanges(0x0101001f)=(type 0x11)0x40003fb4
                   A: android:windowSoftInputMode(0x0101022b)=(type 0x11)0x10
                   A: android:hardwareAccelerated(0x010102d3)=(type 0x12)0xffffffff
                   E: intent-filter (line=35)
                     E: action (line=36)
                       A: android:name(0x01010003)="android.intent.action.MAIN" (Raw: "android.intent.action.MAIN")
                     E: category (line=38)
                       A: android:name(0x01010003)="android.intent.category.LAUNCHER" (Raw: "android.intent.category.LAUNCHER")
                 E: meta-data (line=45)
                   A: android:name(0x01010003)="flutterEmbedding" (Raw: "flutterEmbedding")
                   A: android:value(0x01010024)=(type 0x10)0x2
[  +10 ms] executing: /home/andres/Android/Sdk/platform-tools/adb -s emulator-5554 shell -x logcat -v time -t 1
[  +50 ms] Exit code 0 from: /home/andres/Android/Sdk/platform-tools/adb -s emulator-5554 shell -x logcat -v time -t 1
[        ] --------- beginning of main
           08-24 17:24:16.437 E/GnssHAL_GnssInterface( 1749): gnssSvStatusCb: b: input svInfo.flags is 8
[   +1 ms] executing: /home/andres/Android/Sdk/platform-tools/adb -s emulator-5554 shell -x logcat -v time -t 1
[  +18 ms] Exit code 0 from: /home/andres/Android/Sdk/platform-tools/adb -s emulator-5554 shell -x logcat -v time -t 1
[        ] --------- beginning of main
           08-24 17:24:16.437 E/GnssHAL_GnssInterface( 1749): gnssSvStatusCb: b: input svInfo.flags is 8
[  +13 ms] <- compile package:bug/main.dart
[  +11 ms] executing: /home/andres/Android/Sdk/platform-tools/adb version
[  +23 ms] Android Debug Bridge version 1.0.41
           Version 30.0.4-6686687
           Installed as /home/andres/Android/Sdk/platform-tools/adb
[   +3 ms] executing: /home/andres/Android/Sdk/platform-tools/adb start-server
[   +4 ms] Building APK
Running Gradle task 'assembleDebug'...
[  +31 ms] gradle.properties already sets `android.enableR8`
[   +3 ms] Using gradle from /home/andres/dev/bug/android/gradlew.
[   +1 ms] /home/andres/dev/bug/android/gradlew mode: 33261 rwxr-xr-x.
[  +26 ms] executing: /home/andres/bin/android-studio/jre/bin/java -version
[ +142 ms] Exit code 0 from: /home/andres/bin/android-studio/jre/bin/java -version
[        ] openjdk version "1.8.0_202-release"
           OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
           OpenJDK 64-Bit Server VM (build 25.202-b49-5587405, mixed mode)
[   +6 ms] executing: [/home/andres/dev/bug/android/] /home/andres/dev/bug/android/gradlew -q -Ptarget-platform=android-x86 -Ptarget=/home/andres/dev/bug/lib/main.dart -Ptrack-widget-creation=true -Pfilesystem-scheme=org-dartlang-root -Pdart-defines=flutter.inspector.structuredErrors%3Dtrue assembleDebug
[+18163 ms] calculateSha: LocalDirectory: '/home/andres/dev/bug/build/app/outputs/flutter-apk'/app.apk
[  +48 ms] calculateSha: reading file took 47us
[ +611 ms] calculateSha: computing sha took 610us
✓ Built build/app/outputs/flutter-apk/app-debug.apk.
[  +11 ms] executing: /home/andres/Android/Sdk/build-tools/29.0.2/aapt dump xmltree /home/andres/dev/bug/build/app/outputs/flutter-apk/app.apk AndroidManifest.xml
[ +147 ms] Exit code 0 from: /home/andres/Android/Sdk/build-tools/29.0.2/aapt dump xmltree /home/andres/dev/bug/build/app/outputs/flutter-apk/app.apk AndroidManifest.xml
[        ] N: android=http://schemas.android.com/apk/res/android
             E: manifest (line=2)
               A: android:versionCode(0x0101021b)=(type 0x10)0x1
               A: android:versionName(0x0101021c)="1.0.0" (Raw: "1.0.0")
               A: android:compileSdkVersion(0x01010572)=(type 0x10)0x1c
               A: android:compileSdkVersionCodename(0x01010573)="9" (Raw: "9")
               A: package="com.example.bug" (Raw: "com.example.bug")
               A: platformBuildVersionCode=(type 0x10)0x1c
               A: platformBuildVersionName=(type 0x10)0x9
               E: uses-sdk (line=7)
                 A: android:minSdkVersion(0x0101020c)=(type 0x10)0x10
                 A: android:targetSdkVersion(0x01010270)=(type 0x10)0x1c
               E: uses-permission (line=14)
                 A: android:name(0x01010003)="android.permission.INTERNET" (Raw: "android.permission.INTERNET")
               E: application (line=22)
                 A: android:label(0x01010001)="bug" (Raw: "bug")
                 A: android:icon(0x01010002)=@0x7f080000
                 A: android:name(0x01010003)="io.flutter.app.FlutterApplication" (Raw: "io.flutter.app.FlutterApplication")
                 A: android:debuggable(0x0101000f)=(type 0x12)0xffffffff
                 A: android:appComponentFactory(0x0101057a)="androidx.core.app.CoreComponentFactory" (Raw: "androidx.core.app.CoreComponentFactory")
                 E: activity (line=28)
                   A: android:theme(0x01010000)=@0x7f0a0000
                   A: android:name(0x01010003)="com.example.bug.MainActivity" (Raw: "com.example.bug.MainActivity")
                   A: android:launchMode(0x0101001d)=(type 0x10)0x1
                   A: android:configChanges(0x0101001f)=(type 0x11)0x40003fb4
                   A: android:windowSoftInputMode(0x0101022b)=(type 0x11)0x10
                   A: android:hardwareAccelerated(0x010102d3)=(type 0x12)0xffffffff
                   E: intent-filter (line=35)
                     E: action (line=36)
                       A: android:name(0x01010003)="android.intent.action.MAIN" (Raw: "android.intent.action.MAIN")
                     E: category (line=38)
                       A: android:name(0x01010003)="android.intent.category.LAUNCHER" (Raw: "android.intent.category.LAUNCHER")
                 E: meta-data (line=45)
                   A: android:name(0x01010003)="flutterEmbedding" (Raw: "flutterEmbedding")
                   A: android:value(0x01010024)=(type 0x10)0x2
[   +1 ms] Stopping app 'app.apk' on Android SDK built for x86.
[   +2 ms] executing: /home/andres/Android/Sdk/platform-tools/adb -s emulator-5554 shell am force-stop com.example.bug
[ +669 ms] executing: /home/andres/Android/Sdk/platform-tools/adb -s emulator-5554 shell pm list packages com.example.bug
[ +382 ms] package:com.example.bug
[   +3 ms] executing: /home/andres/Android/Sdk/platform-tools/adb -s emulator-5554 shell cat /data/local/tmp/sky.com.example.bug.sha1
[  +32 ms] 05765e010765823bee4595d227323623dd9f8642
[        ] Installing APK.
[   +2 ms] executing: /home/andres/Android/Sdk/platform-tools/adb version
[   +9 ms] Android Debug Bridge version 1.0.41
           Version 30.0.4-6686687
           Installed as /home/andres/Android/Sdk/platform-tools/adb
[        ] executing: /home/andres/Android/Sdk/platform-tools/adb start-server
[   +6 ms] executing: /home/andres/Android/Sdk/platform-tools/adb -s emulator-5554 install -t -r /home/andres/dev/bug/build/app/outputs/flutter-apk/app.apk
Installing build/app/outputs/flutter-apk/app.apk...
[+2298 ms] Performing Streamed Install
           Success
[   +1 ms] executing: /home/andres/Android/Sdk/platform-tools/adb -s emulator-5554 shell echo -n 3d6c13a827b758b7720717034294bb9a5b265971 > /data/local/tmp/sky.com.example.bug.sha1
[ +981 ms] Android SDK built for x86 startApp
[   +8 ms] executing: /home/andres/Android/Sdk/platform-tools/adb -s emulator-5554 shell am start -a android.intent.action.RUN -f 0x20000000 --ez enable-background-compilation true --ez enable-dart-profiling true --ez enable-checked-mode true --ez verify-entry-points true --ez start-paused true com.example.bug/com.example.bug.MainActivity
[ +419 ms] Starting: Intent { act=android.intent.action.RUN flg=0x20000000 cmp=com.example.bug/.MainActivity (has extras) }
[        ] Waiting for observatory port to be available...
[+9592 ms] Observatory URL on device: http://127.0.0.1:39243/SlWONuUSkFI=/
[   +6 ms] executing: /home/andres/Android/Sdk/platform-tools/adb -s emulator-5554 forward tcp:0 tcp:39243
[  +17 ms] 42951
[        ] Forwarded host port 42951 to device port 39243 for Observatory
[  +23 ms] Caching compiled dill
[ +194 ms] Connecting to service protocol: http://127.0.0.1:42951/SlWONuUSkFI=/
[+1764 ms] Successfully connected to service protocol: http://127.0.0.1:42951/SlWONuUSkFI=/
Waiting for Android SDK built for x86 to report its views...
[  +33 ms] DevFS: Creating new filesystem on the device (null)
[  +31 ms] DevFS: Created new filesystem on the device (file:///data/user/0/com.example.bug/code_cache/bugTMHGDW/bug/)
[   +2 ms] Updating assets
Debug service listening on ws://127.0.0.1:42951/SlWONuUSkFI=/ws
Syncing files to device Android SDK built for x86...
[ +102 ms] Scanning asset files
[   +2 ms] <- reset
[        ] Compiling dart to kernel with 0 updated files
[        ] <- recompile package:bug/main.dart acd92c52-3c82-4724-995d-a65d5d51e9fd
[        ] <- acd92c52-3c82-4724-995d-a65d5d51e9fd
[  +86 ms] Updating files
[ +341 ms] DevFS: Sync finished
[   +1 ms] Synced 0.9MB.
[   +1 ms] <- accept
[   +6 ms] Connected to _flutterView/0xdbc8cc10.
D/EGL_emulation(18379): eglMakeCurrent: 0xdf01a120: ver 2 0 (tinfo 0xdf00f000)
D/eglCodecCommon(18379): setVertexArrayObject: set vao to 0 (0) 1 0
I/OpenGLRenderer(18379): Davey! duration=2965ms; Flags=1, IntendedVsync=49215591146977, Vsync=49215591146977, OldestInputEvent=9223372036854775807, NewestInputEvent=0, HandleInputStart=49215598214472, AnimationStart=49215598240932, PerformTraversalsStart=49215598243598, DrawStart=49218439484249, SyncQueued=49218443655797, SyncStart=49218459180809, IssueDrawCommandsStart=49218488721172, SwapBuffers=49218526219109, FrameCompleted=49218572173947, DequeueBufferDuration=28195000, QueueBufferDuration=324000, 
I/Choreographer(18379): Skipped 179 frames!  The application may be doing too much work on its main thread.
D/EGL_emulation(18379): eglMakeCurrent: 0xf227eaa0: ver 2 0 (tinfo 0xdbc55940)
D/eglCodecCommon(18379): setVertexArrayObject: set vao to 0 (0) 1 0
~/dev/bug ➜ flutter analyze                                                                                                                                                                        [17:30:29]
Analyzing bug...                                                        
No issues found! (ran in 4.6s)
~/dev/bug ➜ flutter doctor -v                                                                                                                                                                      [17:31:23]
[✓] Flutter (Channel stable, 1.20.2, on Linux, locale en_US.UTF-8)
    • Flutter version 1.20.2 at /home/andres/lib/flutter
    • Framework revision bbfbf1770c (11 days ago), 2020-08-13 08:33:09 -0700
    • Engine revision 9d5b21729f
    • Dart version 2.9.1

[!] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    • Android SDK at /home/andres/Android/Sdk
    • Platform android-29, build-tools 29.0.2
    • Java binary at: /home/andres/bin/android-studio/jre/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
    ✗ Android license status unknown.
      Try re-installing or updating your Android SDK Manager.
      See https://developer.android.com/studio/#downloads or visit https://flutter.dev/docs/get-started/install/linux#android-setup for detailed instructions.

[!] Android Studio (version 3.5)
    • Android Studio at /home/andres/bin/android-studio
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)

[✓] IntelliJ IDEA Ultimate Edition (version 2019.3)
    • IntelliJ at /home/andres/bin/idea-IU-193.6015.39
    • Flutter plugin version 45.1.2
    • Dart plugin version 193.6911.31

[✓] Connected device (1 available)
    • Android SDK built for x86 (mobile) • emulator-5554 • android-x86 • Android 10 (API 29) (emulator)

! Doctor found issues in 2 categories.

Metadata

Metadata

Assignees

Labels

P1High-priority issues at the top of the work listcustomer: money (g3)f: material designflutter/packages/flutter/material repository.f: scrollingViewports, list views, slivers, etc.found in release: 1.22Found to occur in 1.22frameworkflutter/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 versionwaiting for PR to land (fixed)A fix is in flight

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions