- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我想禁用向下拖动以关闭showModalBottomSheet
我已经尝试使用enableDrag:false,
当我使用enableDrag:false,
向我显示以下错误时
下面是我的代码
modal(BuildContext context) {
showModalBottomSheet(
context: context,
enableDrag:false,
isDismissible: false,
backgroundColor: Colors.transparent,
builder: (context) {
return Container(
width: MediaQuery.of(context).size.width,
child: Stack(
alignment: Alignment.topCenter,
children: <Widget>[
Container(
width: MediaQuery.of(context).size.width,
padding: EdgeInsets.only(top: 30),
child: Stack(
alignment: Alignment.topCenter,
children: <Widget>[
ClipPath(
clipper: OvalTopBorderClipper(),
child: Container(
width: MediaQuery.of(context).size.width,
padding: EdgeInsets.only(top: 80),
color: Colors.white,
height: 440,
child: Text("This is a modal bottom sheet !"),
),
),
],
),
),
Positioned(
top: 5,
child: Container(
width: 50.0,
height: 53.0,
child: Center(
child: Text(
"K",
style: TextStyle(
color: AppColors.textColor, fontSize: 20.0),
),
),
padding:
EdgeInsets.symmetric(horizontal: 10.0, vertical: 10.0),
decoration: BoxDecoration(
border:
Border.all(color: AppColors.textColor, width: 2)),
),
),
],
),
);
});
}
最佳答案
enableDrag
中没有showModalBottomSheet
。我认为该 channel 无法在稳定 channel 中提供。根据当时链接的评论,该链接可在“主 channel ”中使用。但是该链接的第二个答案很好用
builder: (context) => GestureDetector(
onVerticalDragDown: (_) {},
child: ...,
showModalBottomSheet
的文档。您始终可以点击
showModalBottomSheet
并对其进行自定义。
BottomSheet, which becomes the parent of the widget returned by the function passed as the builder argument to showModalBottomSheet.
enableDrag
参数。
关于flutter - Flutter:如何禁用向下拖动以关闭showModalBottomSheet,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60861634/
showModalBottomSheet不会弹出模式。我不熟悉 Dart ,但是我认为这是一个问题,我没有任何帮助。在下面弹出底部工作表模式的简单页面无效。 ``` import 'package
如何在底部工作表模式中禁用/避免向下拖动手势,以便用户可以在模式中进行交互而不会意外关闭模式? 在下方更新了实际的模态底页。 return showModalBottomSheet( cont
是否有可能阻止 ModalBottomSheet 对外部触摸隐藏?就像在 showDialog() 中一样,我们可以使用 barrierDismissible property to prevent
正如标题所说,当 showModalBottomSheet 出现时,我想在主体/屏幕中按下某个按钮而不关闭我已经设置的 showModalBottomSheet isDismissible: fals
我试图让 showModalBottomSheet() 的高度自动适应内容。 我使用了 FractionallySizedBox 和 isScrollControlled: true 但它需要提供 h
在我的应用程序中,我正在尝试实现类似 Badoo 的排序/过滤 showBottomModalSheet 功能。我设法创建了 2 个单独的页面,我可以在它们之间来回导航。但是,我面临的问题是 show
在编写 Flutter 小部件测试时,我遇到了一个错误,其中在 showModalBottomSheet() 期间创建的 Ticker 没有被处理掉。 我想我明白如果我要实现我自己的 Flutter
我们无法更新小部件状态的 BottomSheet 是否有任何限制?正如您在下面的示例中所看到的,我使用的是 Switch,但它的显示没有改变,虽然值更新了,只是它不会再次重新渲染。 现在这是 Stat
我使用 showRoundedModalBottomSheet,如何调整此模态高度直到 appbar? 最佳答案 [更新] 在showModalBottomSheet(...)中设置属性isScrol
我正在使用 showModalBottomSheet 小部件,我想更改大小以使其占据大约 75% 的屏幕(默认情况下它似乎占据 50%)。我试图按照文档进行操作,但找不到大小属性。有人可以建议我一种更
对于 showModalBottomSheet,我想在它周围显示边距。主要是左右。这样它看起来会与屏幕两侧分开。如何实现。另外,如果我想在底部提供边距,如何实现。是否有任何其他小部件提供与 modal
关闭。这个问题需要更多focused .它目前不接受答案。 想改进这个问题吗? 更新问题,使其只关注一个问题 editing this post . 关闭 2 年前。 Improve this qu
我试着这样写 showModalBottomSheet( context: context, // I got error here (Undefined name 'context'.dart
我有一个 showModalBottomSheet如下所示,据我所知继承自 BottomSheet (对?) showModalBottomSheet( context:
我有设计(如图所示)并且我正在使用 showModalBottomSheet 但是当我设置宽度时,它不会改变并保持为屏幕宽度,所以我有几个问题: 1-如何给showModalBottomSheet设置
我是 Flutter 的新手,我一直在尝试创建一个底部工作表,当您单击 float 操作按钮时它会打开。我遵循了很多关于如何做的教程,它们都显示了相同的东西,但每当我尝试实现它时,我就是不起作用,而是
我有一个名为 testWidget 的小部件,它有两个子部件:一个 TextField 和一个 FlatButton。 当用户按下 FlatButton 时,我想对 TextField 中键入的文本执
我在小部件树中有一个 FloatingActionButton,它有一个 BlocProvider来自 flutter_bloc .像这样: BlocProvider( builder: (con
我启动一个模态底部工作表,然后使用返回的数据作为它的 future 。 var modalFuture = showModalBottomSheet( // ...
在我的应用程序中,我使用 2 个 Material 应用程序来处理底部导航栏的导航。 由于我的应用程序非常复杂,这是最好的方法。 在一个屏幕上,当用户未登录时,将打开一个底部表单,用户可以在其中输入他
我是一名优秀的程序员,十分优秀!