playbook-flutter icon indicating copy to clipboard operation
playbook-flutter copied to clipboard

Dead loop when using CustomScrollView + SliverFillRemaining + ScrollView

Open lcdsmao opened this issue 4 years ago • 0 comments

This two scenarios can cause dead loop during resize snapshot size.

    final story = Story('TestApi', scenarios: [
      Scenario(
        'SliverFillRemaining',
        child: CustomScrollView(
          controller: ScrollController(),
          slivers: [
            SliverToBoxAdapter(
              child: Container(
                color: Colors.red,
                height: 50,
              ),
            ),
            SliverFillRemaining(
              child: ListView.separated(
                itemBuilder: (_, __) => Container(
                  color: Colors.pink,
                  height: 20,
                ),
                separatorBuilder: (_, __) => SizedBox(height: 2),
                itemCount: 10,
              ),
            ),
          ],
        ),
      ),
      Scenario(
        'NestedScrollView',
        child: NestedScrollView(
          headerSliverBuilder: (context, innerBoxIsScrolled) {
            return [
              SliverToBoxAdapter(
                child: Container(
                  color: Colors.red,
                  height: 50,
                ),
              ),
            ];
          },
          body: ListView.separated(
            itemBuilder: (_, __) => Container(
              color: Colors.pink,
              height: 20,
            ),
            separatorBuilder: (_, __) => SizedBox(height: 2),
            itemCount: 50,
          ),
        ),
      ),
    ]);

lcdsmao avatar Oct 13 '21 11:10 lcdsmao