We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
我尝试了 physics: const NeverScrollableScrollPhysics(), 之后发现左右滑动被禁止了,但仍然能上下滚动。在这之后尝试了在swiper外层套了一层 GestureDetector 并设置了 onVerticalDragUpdate: (detail){}, 还是没有效果。
physics: const NeverScrollableScrollPhysics(),
GestureDetector
onVerticalDragUpdate: (detail){},
这是我的代码:
Widget _Category() { return SizedBox( width: ScreenAdapter.widht(1080), height: ScreenAdapter.height(400), child: Obx(()=>GestureDetector( onVerticalDragUpdate: (detail){}, child: Swiper( physics: const NeverScrollableScrollPhysics(), scrollDirection:Axis.horizontal, autoplayDisableOnInteraction: true, itemCount: controller.categoryList.length~/10, pagination: SwiperPagination( margin: EdgeInsets.only(bottom: 10), builder: SwiperCustomPagination( builder: (BuildContext context, SwiperPluginConfig config) { return ConstrainedBox( constraints: BoxConstraints.expand(height: ScreenAdapter.height(30)), child: Row( children: <Widget>[ Expanded( child: Align( alignment: Alignment.center, child: const RectSwiperPaginationBuilder( size: Size(20, 3), activeSize: Size(20, 3), color: Colors.black12, activeColor: Colors.black54) .build(context, config), ), ) ], ), ); })), loop: false, itemBuilder: (context, index) { return GridView.builder( itemCount: 10, gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( crossAxisCount: 5, crossAxisSpacing: ScreenAdapter.widht(20), mainAxisSpacing: ScreenAdapter.height(20)), itemBuilder: (context, i) { String? pic = controller.categoryList[index*10+i].pic; return Column( children: [ Container( alignment: Alignment.center, width: ScreenAdapter.widht(116), child: Image.network( "https://miapp.itying.com/${pic!.replaceAll("\\", "/")}", fit: BoxFit.fitWidth, ), ), SizedBox( width: ScreenAdapter.height(0), ), Text( "${controller.categoryList[index*10+i].title}", style: TextStyle(fontSize: ScreenAdapter.size(34)), ) ], ); }); }, ), )) ); }
The text was updated successfully, but these errors were encountered:
在你的GridView下面添加physics: const NeverScrollableScrollPhysics(), 我是通过这个解决的
Sorry, something went wrong.
No branches or pull requests
我尝试了
physics: const NeverScrollableScrollPhysics(),
之后发现左右滑动被禁止了,但仍然能上下滚动。在这之后尝试了在swiper外层套了一层GestureDetector
并设置了onVerticalDragUpdate: (detail){},
还是没有效果。这是我的代码:
The text was updated successfully, but these errors were encountered: