Skip to content

NestedScrollView does not support a floating app bar #17518

@Steelsmasher

Description

@Steelsmasher

b/136489010

I want to make a floating app bar that's shared across multiple TabBarViews, so I used a NestedScrollView. I would expect the app bar to appear whenever I scroll up at any point of the page but it does not seem to do so?

main.dart

    import 'package:flutter/material.dart';

    void main() {

        Widget getPage(){
            return new ListView.builder(
                itemBuilder: ((context, index){
                    return new ListTile(
                        title: new Text('Item $index')
                    );
                }),
            );
        }

        runApp(
            new MaterialApp(
                home: new DefaultTabController(
                    length: 2,
                    child: new Scaffold(
                        body: new NestedScrollView(
                            headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) {
                                return <Widget>[
                                    new SliverAppBar(
                                        floating: true,
                                        bottom: new TabBar(
                                            tabs: [
                                                new Tab(text: 'tab1'),
                                                new Tab(text: 'tab2'),
                                            ],
                                        ),
                                    ),
                                ];
                            },
                            body: new TabBarView(
                                children: [
                                    getPage(),
                                    getPage(),
                                ],
                            ),
                        ),
                    ),
                ),
            ),
        );
    }

Strangely enough if "snap: true" is set for the SliverAppBar the desired effect is achieved. But I don't want it to snap.

Similar issue here: #11222

Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel beta, v0.3.2, on Microsoft Windows [Version 10.0.16299.431], locale en-GB)
[√] Android toolchain - develop for Android devices (Android SDK 26.0.3)
[X] Android Studio (not installed)
[√] VS Code, 64-bit edition (version 1.23.0)
[!] Connected devices
    ! No devices available
! Doctor found issues in 2 categories.

Metadata

Metadata

Assignees

Labels

P1High-priority issues at the top of the work lista: annoyanceRepeatedly frustrating issues with non-experimental functionalitya: qualityA truly polished experiencecustomer: crowdAffects or could affect many people, though not necessarily a specific customer.customer: quill (g3)f: material designflutter/packages/flutter/material repository.f: scrollingViewports, list views, slivers, etc.found in release: 1.12Found to occur in 1.12found in release: 1.17Found to occur in 1.17found in release: 1.18Occurs in 1.18frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onwaiting for PR to land (fixed)A fix is in flight

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions