isDismissible: true, //不起作用
showDragHandle:true, //在BottomSheet容器之外
这两个功能对此不起作用 底页
void _showBottomSheet(BuildContext上下文){
显示ModalBottomSheet(
context: context,
isScrollControlled: true,
isDismissible: true,
showDragHandle:true,
backgroundColor: Colors.transparent,
builder: (BuildContext context) {
return DraggableScrollableSheet(
initialChildSize: 0.5,
maxChildSize: 0.7, // Set the maximum height to 70% of the screen height
minChildSize: 0.2,
expand: false,
builder: (BuildContext context, ScrollController scrollController) {
return Container(
color: Colors.white, // Background color of the bottom sheet
child: SingleChildScrollView(
controller: scrollController,
child: Column(
children: [
// Your content here
],
),
),
);
},
);
},
); }
默认情况下 isDismissable: true 检查文档 [https://api.flutter.dev/flutter/material/showModalBottomSheet.html] 另请检查如何使用此功能