gpt4 book ai didi

flutter - 为什么我的 Flutter BottomSheet 会出现 GestureDetector 错误?

转载 作者:行者123 更新时间:2023-12-03 10:11:36 33 4
gpt4 key购买 nike

我对这个 BottomSheet 有问题,它工作正常,但一旦我点击它,我就会收到错误......

bottomSheet: showBottomSheet
? BottomSheet(
enableDrag: true,
onClosing: () {},
builder: (ctx) => Container(
height: 200,
width: double.infinity,
color: Colors.red,
),
)

为什么我会收到此错误?

════════ Exception caught by gesture ═══════════════════════════════════════════
The following NoSuchMethodError was thrown while handling a gesture:
The getter 'status' was called on null.
Receiver: null
Tried calling: status

When the exception was thrown, this was the stack
#0 Object.noSuchMethod (dart:core-patch/object_patch.dart:53:5)
#1 _BottomSheetState._dismissUnderway
package:flutter/…/material/bottom_sheet.dart:187
#2 _BottomSheetState._handleDragEnd
package:flutter/…/material/bottom_sheet.dart:204
#3 DragGestureRecognizer._checkEnd.<anonymous closure>
package:flutter/…/gestures/monodrag.dart:439
#4 GestureRecognizer.invokeCallback
package:flutter/…/gestures/recognizer.dart:182
...
Handler: "onEnd"
Recognizer: VerticalDragGestureRecognizer#22607
debugOwner: GestureDetector
start behavior: start

我需要添加什么?我想我需要添加一个 OnDragEnd 函数?请帮忙,谢谢

最佳答案

正如评论所述,只需输入 enableDrag: false, 即可工作。

关于flutter - 为什么我的 Flutter BottomSheet 会出现 GestureDetector 错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61697449/

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com