gpt4 book ai didi

flutter - 为什么我的 CupertinoActionSheet 从顶部出现?

转载 作者:行者123 更新时间:2023-12-04 07:27:49 25 4
gpt4 key购买 nike

一切正常,只是工作表出现在顶部而不是底部。我希望cupertinoactionsheet从底部显示为默认值。
我目前正在使用 Android 模拟器,但我怀疑这就是工作表从顶部出现的原因。
附上我的代码

Future<bool> showReportDialog({
@required BuildContext context,
}) async {
return showCupertinoDialog(
context: context,
builder: (context) => CupertinoActionSheet(
title: const Text('Make Your Space Safe',
style: TextStyle(
fontSize: 18, color: Colors.black, fontWeight: FontWeight.w600)),
message: const Text('What to report this user for?',
style: TextStyle(
fontSize: 16.5,
color: Colors.black38,
fontWeight: FontWeight.w500)),
actions: <CupertinoActionSheetAction>[
CupertinoActionSheetAction(
child: const Text(
'Scam',
),
onPressed: () {
afterReport();
print("Reported user for SCAM");
},
),
CupertinoActionSheetAction(
child: const Text('Bots/Spam'),
onPressed: () {
afterReport();
print("Reported user for BOTS/SPAM");
},
),
CupertinoActionSheetAction(
child: const Text('Sexually harassing'),
onPressed: () {
afterReport();
print("Reported user for SEXUALLY HARASSSING");
},
),
CupertinoActionSheetAction(
child: const Text('Offensive/abusive behaviour'),
onPressed: () {
afterReport();
print('Reported user for OFFENSIVE/ABUSIVE BEHAVIOUR');
},
),
CupertinoActionSheetAction(
child: const Text('I want to write more',
style: TextStyle(fontWeight: FontWeight.bold)),
onPressed: () {
Navigator.push(
context,
new MaterialPageRoute(
builder: (BuildContext context) => ReportUser()));
},
),
CupertinoActionSheetAction(
child: const Text('Cancel'),
onPressed: () {
Navigator.pop(context);
},
)
],
),
);
}

最佳答案

您需要使用 showCupertinoModalPopup而不是 showCupertinoDialog :

showCupertinoModalPopup(
context: context,
builder: (context) => CupertinoActionSheet(
title: const Text('Make Your Space Safe',
style: TextStyle(
fontSize: 18,
color: Colors.black,
fontWeight: FontWeight.w600)),
...

关于flutter - 为什么我的 CupertinoActionSheet 从顶部出现?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68131930/

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