playbook-ui/playbook-flutter

Dead loop when using CustomScrollView + SliverFillRemaining + ScrollView

lcdsmao opened this issue · 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,
          ),
        ),
      ),
    ]);