Ste*_*pan 7 dialog android-alertdialog dart flutter
在对话框上,barrierDismissible
如果要禁用对话框外部的触摸事件,可以设置为 false。然而,可以仅在屏幕的某些部分监听这些触摸事件,例如。AppBar
?
Ede*_*ril -1
我们知道一切都是Widget,所以我们可以利用这个属性来创建我们自己的Dialog。有一些可能性可以做你想做的事,但这在很大程度上取决于你的应用程序的动态。我认为它会这样做:
调用对话框如下:
showDialog(
context: context,
barrierDismissible: false,
child: DialogFeelingCalendar(),
);
Run Code Online (Sandbox Code Playgroud)
它使用一个小部件来进行个性化。像这样:
class DialogFeelingCalendar extends StatefulWidget {
@override
_DialogFeelingCalendarState createState() => _DialogFeelingCalendarState();
}
class _DialogFeelingCalendarState extends State<DialogFeelingCalendar> {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.transparent,
appBar: AppBar(
title: Text(
"Title",
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.white,
),
),
),
body: SafeArea(
child: Center(
child: Container(
color: Colors.white,
height: 50,
width: 50,
),
),
)
);
}
}
Run Code Online (Sandbox Code Playgroud)
我希望您可以定制它以供您使用。如果您需要更多详细信息,请告诉我。
归档时间: |
|
查看次数: |
1147 次 |
最近记录: |