前言
防止ListView / 或其他控件滑动时候出现蓝色做一下相关笔记
代码示例
自定义滑动配置
/**
* @author Marinda
* @date 2022/9/25
* @desc 自定义滑动行为配置
*/
class MyBehavior extends ScrollBehavior{
@override
Widget buildViewportChrome(BuildContext context, Widget child, AxisDirection axisDirection) {
if(Platform.isAndroid||Platform.isFuchsia){
return child;
}else{
return super.buildViewportChrome(context,child,axisDirection);
}
}
}
自定义滑动规则
ListView
Expanded( child: MediaQuery.removePadding(context: context,removeTop: true, child: ScrollConfiguration( behavior: MyBehavior(), child: ListView( shrinkWrap: true, children: getBeginMeetingRoomList(), ), )) ),
SingChildScrollView
Container(
height: 370,
margin: EdgeInsets.fromLTRB(0, 15, 0, 0),
child: ScrollConfiguration(
behavior: MyBehavior(),
child: SingleChildScrollView(
child: Column(
children: getMeetingTopicsList(),
),
),
)
),