Skip to content

CustomScrollView's Scrollbar is not draggable when using a center key for a empty sliverlist with an anchor of 1.0 #178863

@JuubiSnake

Description

@JuubiSnake

Steps to reproduce

  1. Create a CustomScrollView.
  2. Give it a center key.
  3. Assign it a anchor of 1.0.
  4. Pass in a normal sliverlist with some children such that the viewport of the application will become scrollable.
  5. Pass in a sliverlist with no children present and have that sliverlist hold the center key.

Expected results

When clicking and dragging the scollbar I should be able to navigate up/down the list.

Actual results

When clicking and dragging the scollbar via the mouse you are not able to navigate up/down the list (you can however scroll it - as shown in the provided video).

Code sample

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

/// Flutter code sample for [CustomScrollView].

void main() => runApp(const CustomScrollViewExampleApp());

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

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(home: CustomScrollViewExample());
  }
}

class CustomScrollViewExample extends StatefulWidget {
  const CustomScrollViewExample({super.key});

  @override
  State<CustomScrollViewExample> createState() => _CustomScrollViewExampleState();
}

class _CustomScrollViewExampleState extends State<CustomScrollViewExample> {
  @override
  Widget build(BuildContext context) {
    final items = List<int>.generate(100, (index) => index);

    const Key centerKey = ValueKey<String>('bottom-sliver-list');
    return Scaffold(
      appBar: AppBar(
        title: const Text('Bug demo'),
      ),
      body: CustomScrollView(
        center: centerKey,
        anchor: 1.0,
        slivers: <Widget>[
          SliverList.builder(
            itemCount: items.length,
            itemBuilder: (BuildContext context, int index) {
              return Container(
                alignment: Alignment.center,
                color: Colors.blue[200 + items[index] % 4 * 100],
                height: 100 + items[index] % 4 * 20.0,
                child: Text('Item: ${items[index]}'),
              );
            },
          ),
          SliverList.builder(
            key: centerKey,
            itemCount: 0,
            itemBuilder: (BuildContext context, int index) {
              return Text("This is not going to be present");
            },
          ),
        ],
      ),
    );
  }
}

Screenshots or Video

Screenshots / Video demonstration
Screen.Recording.2025-11-20.at.13.23.08.mov

Logs

No response

Flutter Doctor output

Doctor output
[✓] Flutter (Channel stable, 3.35.4, on macOS 15.6 24G84 darwin-arm64, locale en-GB) [96ms]
    • Flutter version 3.35.4 on channel stable at /opt/homebrew/share/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision d693b4b9db (9 weeks ago), 2025-09-16 14:27:41 +0000
    • Engine revision c298091351
    • Dart version 3.9.2
    • DevTools version 2.48.0
    • Feature flags: enable-web, enable-linux-desktop, enable-macos-desktop, enable-windows-desktop,
      enable-android, enable-ios, cli-animations, enable-lldb-debugging

[✗] Android toolchain - develop for Android devices [58ms]
    ✗ 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/macos-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.


[✓] Xcode - develop for iOS and macOS (Xcode 16.4) [303ms]
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 16F6
    • CocoaPods version 1.16.2

[✓] Chrome - develop for the web [4ms]
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

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

[✓] Connected device (3 available) [5.5s]
...

[✓] Network resources [172ms]
    • All expected network resources are available.

! Doctor found issues in 2 categories.

Metadata

Metadata

Assignees

No one assigned

    Labels

    f: material designflutter/packages/flutter/material repository.f: scrollingViewports, list views, slivers, etc.found in release: 3.38Found to occur in 3.38found in release: 3.39Found to occur in 3.39frameworkflutter/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-frameworkOwned by Framework team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions