Queen Ellery
Queen Ellery

Reputation: 521

DraggableScrollableSheet not working in NestedScrollView

enter image description here

What I would like to do

Problem

Architecture

NestedScrollView (
    headerSliver:SliverAppBar(...)
    body: Stack(
        childern: [
            Expanded(
                child: SliverGrid(),
            ),
            Draggable(),
        ],
    ),
),

What I checked

code

NestedScrollView(
          headerSliverBuilder: (context, innerBoxScrolled) {
            return [
              SliverAppBar(
                leading: null,
                elevation: 0,
                expandedHeight: 160,
                pinned: false,
                flexibleSpace: TopNavBar(
                  height: 100,
                ),
                bottom: AppBar(
                  leading: null,
                  toolbarHeight: 100,
                  elevation: 0,
                  actions: [
                    Column(
                      crossAxisAlignment: CrossAxisAlignment.start,
                      children: [
                        AdTopTabBar(),
                        FilterBar(),
                      ],
                    ),
                  ],
                ),
              ),
            ];
          },
          body: Stack(
            children: [
              Expanded(
                child: HomeAdCollection(),
              ),
              MyAdDraggable(),
            ],
          ),
        ),
class MyAdDraggable extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return DraggableScrollableSheet(
      key: key,
      initialChildSize: 0.05,
      minChildSize: 0.05,
      maxChildSize: 0.7,
      expand: true,
      builder: (context, scrollcontroller) {
        return InkWell(
          onTap: () {
            print('ff');
          },
          child: Container(
            decoration: BoxDecoration(
              borderRadius: BorderRadius.only(
                topLeft: Radius.circular(30),
                topRight: Radius.circular(30),
              ),
              color: Colors.blue[100],
            ),
          ),
        );
      },
    );
  }
}

Upvotes: 2

Views: 1306

Answers (1)

Queen Ellery
Queen Ellery

Reputation: 521

There must be at least one child in the DraggableScrollableSheet that uses scrolling. Otherwise, you can't drag it up.

When I put ListView as a child in DraggableScrollableSheet, it works well!

Upvotes: 1

Related Questions