Can someone explain what are Slivers and Delegates in flutter and why to use them?

Issue

“Link to code”

I was following the Flutter State Management tutorial and came across this.

Please explain what are Slivers, Delegates. Especially this part that I have attached.

class MyCatalog extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: CustomScrollView(
        slivers: [
          _MyAppBar(),
          SliverToBoxAdapter(child: SizedBox(height: 12)),
          SliverList(
            delegate: SliverChildBuilderDelegate(
                (context, index) => _MyListItem(index)),
          ),
        ],
      ),
    );
  }
}

Solution

I can say it briefly: Slivers special animation area. Slivers
You have a lot of option slivers widget also normal widgets (SliverGrid => GridView). Sliver scroll affects the biggest difference in normal listview.

Slivers ok, so what is ChildDelegate?

Delegate: Slivers draw type. Maybe sometimes set array builder function need. SliverListDelegate Delagete needs children array also SliverListBuilderDelagate return builder function and children count. Child Delegate

Answered By – vb10

Answer Checked By – Robin (FlutterFixes Admin)

Leave a Reply

Your email address will not be published. Required fields are marked *