showModalBottomSheet 处理程序和可关闭

问题描述 投票:0回答:1

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
            ],
          ),
        ),
      );
    },
  );
},

); }

flutter handler android-bottomsheetdialog flutter-showmodalbottomsheet dismissible
1个回答
0
投票

默认情况下 isDismissable: true 检查文档 [https://api.flutter.dev/flutter/material/showModalBottomSheet.html] 另请检查如何使用此功能

© www.soinside.com 2019 - 2024. All rights reserved.