我不知道类型 'future dynamic ' 类型 '(() = void) '

i don't know type 'future dynamic ' type '(() = void) '

我试图显示 ModalBottomSheet 但错误代码类型 'future dynamic ' 不是类型 '(() = void) ' 的子类型我不知道是什么问题

我用上一篇文章推荐的方法无法做到

onTap: () => showModalBottomSheet( context: context, builder: bottomSheet), => 它不工作...同样的错误....

Widget imageProfile() {
    return Center(
      child: Stack(
        children: <Widget>[
          CircleAvatar(
              radius: 80,
              backgroundImage: _imageFile == null
                  ? AssetImage('assets/test.jpg') as ImageProvider
                  : FileImage(_imageFile!)),
          Positioned(
            bottom: 20,
            right: 20,
            child: InkWell(
              onTap: () {
                showModalBottomSheet(
                    context: context, builder: bottomSheet);
              },
              child: Icon(Icons.camera_alt, color: Colors.blue, size: 40),
            ),
          )
        ],
      ),
    );
  }

  Widget bottomSheet(BuildContext context) {
    return Container(
      height: 100,
      width: 200,
      margin: EdgeInsets.symmetric(horizontal: 20, vertical: 20),
      child: Column(children: [
        Text('사진선택',
            style: TextStyle(
              fontSize: 20,
            )),
        SizedBox(height: 20),
        Row(
          mainAxisAlignment: MainAxisAlignment.spaceBetween,
          children: [
            TextButton.icon(
                onPressed: takePhoto(ImageSource.gallery),
                icon: Icon(Icons.camera, size: 50),
                label: Text('Camera', style: TextStyle(fontSize: 20))),
            TextButton.icon(
                onPressed: takePhoto(ImageSource.camera),
                icon: Icon(Icons.camera, size: 50),
                label: Text('Camera', style: TextStyle(fontSize: 20)))
          ],
        )
      ]),
    );
  }

您必须在模态生成器中指定上下文

onTap: () {
            showModalBottomSheet(
                context: context, builder: (context) => bottomSheet);
          },