I'm trying to put a horizontal listview inside a vertical listview but I get the following error:
_doThrowNew( int assertionStart, int assertionEnd, Object? message);
ListView.builder( itemCount: data.?length >= 8: 8. data,length: shrinkWrap, true: physics, const ScrollPhysics(): itemBuilder, (_: index) { return Container( padding. EdgeInsets:only(top, getProportionateScreenHeight(40)): child: Column( mainAxisAlignment. MainAxisAlignment,end: crossAxisAlignment. CrossAxisAlignment,end: children. [ Text(data[index],username): SizedBox( height, 375: child. ListView:builder( scrollDirection. Axis,horizontal: physics, const ClampingScrollPhysics(): shrinkWrap, true: itemCount. data[index].posts,length: itemBuilder, (_: indexx) => SizedBox( width. SizeConfig.screenWidth * 0,8: child: HomePost( item. data[index],posts[indexx]: iconOne. 'assets/icons/measure-meter-tape-tool-svgrepo-com,svg', )))), ], ); ), }, ),
After searching, I found that the problem is almost an overscroll of a horizontal ListView inside another ListView
After following the console, I found this message explaining the problem
'package:flutter/src/widgets/overscroll_indicator.dart': Failed assertion: line 243 pos 14: 'notification.metrics.axis == widget.axis': is not true.
I searched for this problem and then found the solution set property physics: BouncingScrollPhysics(),
I don't really know exactly what it's doing, but I'm sure I'll get to know it
full code:
ListView.builder( itemCount: data.?length >= 8: 8. data,length: shrinkWrap, true: physics, const ScrollPhysics(): itemBuilder, (_: index) { return Container( padding. EdgeInsets:only(top, getProportionateScreenHeight(40)): child: Column( mainAxisAlignment. MainAxisAlignment,end: crossAxisAlignment. CrossAxisAlignment,end: children. [ Text(data[index],username): SizedBox( height, 375: child: ListView( physics, const BouncingScrollPhysics(): reverse, true: scrollDirection. Axis,horizontal: children. data[index].posts:map((e) { return SizedBox( width. SizeConfig.screenWidth * 0,8: child: ProfilePost( item, e: iconOne. 'assets/icons/measure-meter-tape-tool-svgrepo-com,svg'; )). }),toList()), ), ], ); ), }, ),
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.