Skip to content

SliverFillRemaining with hasScrollBody: false "hides" child behind scrollable #35758

Closed

Description

@goderbauer
import 'package:flutter/material.dart';

class HomeScreen extends StatefulWidget {
  @override
  _HomeScreenState createState() => _HomeScreenState();
}

class _HomeScreenState extends State<HomeScreen> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('Repro'),
      ),
      body: CustomScrollView(
        slivers: <Widget>[
          SliverFixedExtentList(
            itemExtent: 150.0,
            delegate: SliverChildBuilderDelegate(
              (BuildContext context, int index) {
                return Container(
                  color: index % 2 == 0 ? Colors.red : Colors.green,
                );
              },
              childCount: 30, 
            ),
          ),
          SliverFillRemaining(
            hasScrollBody: false,
            child: Align(
              alignment: Alignment.bottomCenter,
              child: RaisedButton(
                color: Colors.blue,
                textColor: Colors.white,
                child: Text('Go to settings'),
                onPressed: () {
                  print('Hello');
                },
              ),
            ),
          )
        ],
      ),
    );
  }
}

Run the code above, scroll all the way to the end. On iOS the "Go to settings" button is only visible when you overscroll. As soon as you let go, the button disappears again. I assume, that the button is never visible on Android.

Activity

  1. goderbauer commented on Jul 8, 2019

    @goderbauer
    MemberAuthor
  2. self-assigned this
    on Jul 8, 2019
  3. Piinks commented on Jul 8, 2019

    @Piinks
    Contributor

    Gist that combines this repro and several others here: https://gist.github.com/Piinks/1dc5d8c424f6e1a09749c8939dc435a9
    Makes it easy to switch between edge cases and observe behavior.
    This includes the repro from #33627, where the hasScrollBody flag was added.

  4. added
    f: scrollingViewports, list views, slivers, etc.
    frameworkflutter/packages/flutter repository. See also f: labels.
    on Jul 9, 2019
  5. added this to the August 2019 milestone on Jul 9, 2019
  6. github-actions commented on Aug 29, 2021

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  7. locked as resolved and limited conversation to collaborators on Aug 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

f: scrollingViewports, list views, slivers, etc.frameworkflutter/packages/flutter repository. See also f: labels.

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions