简体   繁体   中英

ListView.builder inside SliverList SliverChildBuilderDelegate not rendering Images on first load

my images (from api) don't render at first load unless I scroll down and back to top again

here is my code structure

CustomScrollView(
 slivers: [
     SliverList(
       delegate: SliverChildBuilderDelegate(_, index) {
        return Column(children: 
                     [
                     // SLIVERBUILDER INDEX
                     Text(somedata[_index]),
                     // MY IMAGE BUILDER
                     Container(child: ListView.builder(itemBuilder: (_, int index){
                                        return Image.network(arrayOfImages[index]);
                                      }))
                     ]
               );
     }),
 ]
)

Try these:

  1. Wrap a column with a container or any parent that could give its child constraints.
 SliverList( delegate: SliverChildBuilderDelegate( (context, index) { return Container( // warp with container height: 450, child: Column(children: [ // SLIVERBUILDER INDEX Text('title'),
  1. Wrap ListView.builder with Expanded and add itemCount Property. (In your case 'arrayOfImage.length')
 // MY IMAGE BUILDER Expanded( // add this widget child: ListView.builder( itemCount: arrayOfImage.length, // add this line

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM