LoToSS
LoToSS

Reputation: 11

NestedScrollView and CupertionSliverRefreshControl flutter 3.19.4

I need to put pull-to-refresh with CupertinoSliverRefreshControl into NestedScrollView

Here is code example

Scaffold(
      appBar: AppBar(
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,
        title: Text(widget.title),
      ),
      body: NestedScrollView(
        physics: BouncingScrollPhysics(),
        headerSliverBuilder: (context, innerBoxIsScrolled) => [
          // Should work but isn't
          CupertinoSliverRefreshControl(),
          SliverToBoxAdapter(
            child: Container(
              color: Colors.yellow,
              height: 300,
              child: Text('AppBar'),
            ),
          ),
        ],
        body: PageView.builder(
          itemCount: 2,
          itemBuilder: (context, index) {
            return CustomScrollView(slivers: [
              SliverMainAxisGroup(
                slivers: [
                  SliverAppBar(pinned: true, title: Text('SliverAppBar 1')),
                  SliverToBoxAdapter(
                    child: Container(
                      color: Colors.red,
                      height: 300,
                      child: Text('Some items'),
                    ),
                  ),
                ],
              ),
              SliverAppBar(pinned: true, title: Text('SliverAppBar 2')),
              SliverToBoxAdapter(
                child: Container(
                  color: Colors.red,
                  height: 10000,
                ),
              ),
            ]);
          },
        ),
      ),
    );

Help please

I need to use CustomScrollView inside of NestedScrollView body, but it isn't work If there will be not scrollable widget everything is okey

Upvotes: 0

Views: 85

Answers (0)

Related Questions