Answers for "custom scrollview inside futurebuilder"

0

custom scrollview inside futurebuilder

// build fixed items outside of the FutureBuilder for efficiency
final someOtherSliver = SliverToBoxAdapter(...);

return FutureBuilder<List<Data>>(
  future: getQuake(), // this is a code smell. Make sure that the future is NOT recreated when build is called. Create the future in initState instead.
  builder: (context, snapshot){
    Widget newsListSliver;
    if(snapshot.hasData) {
      newsListSliver = SliverList(delegate: SliverChildBuilderDelegate(...))
    } else {
      newsListSliver = SliverToBoxAdapter(child: CircularProgressIndicator(),);
    }

    return CustomScrollView(
      slivers: <Widget>[
        someOtherSliver,
        newsListSliver
      ],
    );
  },
);
Posted by: Guest on March-14-2020

Code answers related to "custom scrollview inside futurebuilder"

Browse Popular Code Answers by Language