flutterlistviewbuildersinglechildscrollview

I can't use Listview.builder inside SinglechildScrollview


body: (
          SafeArea(
           child: SingleChildScrollView(
             child: Column(
               children: [
                 ListView.builder(
                   itemBuilder: (context,index)
                   {
                     return(
                         Container(
                           height: 100,
                           width: 100,
                           color: Colors.red,
                         )
                     );
                   },
                   itemCount: 20,
                 ),
               ],
             )
           ),
          )
      ),

I want to make it scrollable list of items basically trying to copy the ui of instagram


Solution

  • Since the ListView.builder already includes scrolling you don't need to use the SingleChildScrollView, do you have any specific requirements to use both of them? If so you could try wrapping the ListView into a SizedBox and specify a fixed height.