gpt4 book ai didi

dart - showGeneralDialog无法正常工作

转载 作者:行者123 更新时间:2023-12-03 02:53:16 25 4
gpt4 key购买 nike

码:

void showNow() {
showGeneralDialog(
context: context,
pageBuilder: (BuildContext buildContext, Animation<double> animation, Animation<double> secondaryAnimation) {
return Container(
width: 200.0,
height: 200.0,
color: Colors.orange,
);
},
barrierDismissible: true,
barrierLabel: MaterialLocalizations.of(context).modalBarrierDismissLabel,
barrierColor: Colors.black,
transitionDuration: const Duration(milliseconds: 200),
);
}

但是此对话框占用了整个空间,而不是我使用的200.0 widthheight。我尝试将 Container包装在 Scaffold中,但是 barrierDismissiblebarrierColor似乎不起作用。我也改变了他们的值(value)观,但没有运气。

最佳答案

在包装小部件中包装容器:

void showNow() {
showGeneralDialog(
context: context,
pageBuilder: (BuildContext buildContext, Animation<double> animation,
Animation<double> secondaryAnimation) {
return Wrap(
children: <Widget>[
Container(
width: 200.0,
height: 200.0,
color: Colors.orange,
),
],
);
},
barrierDismissible: true,
barrierLabel: MaterialLocalizations.of(context).modalBarrierDismissLabel,
barrierColor: Colors.black,
transitionDuration: const Duration(milliseconds: 200),
);
}

关于dart - showGeneralDialog无法正常工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53140478/

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