我想展示一个自定义的toast
(我自己的小部件布局)。我知道如何展示自定义alert dialogue
,但这不是我想要的。
因为,Alert dialogue
:
我不想使用flutter
toast库,因为我无法使用它创建自定义布局。
我希望在所有其他小部件之上显示我自己的布局,并在一段时间后使其消失。此外,它不应该在显示时阻止任何输入。
您可以添加this library来添加和自定义您自己的祝酒词。
Widget widget = Center(
child: ClipRRect(
borderRadius: BorderRadius.circular(30.0),
child: Container(
width: 40.0,
height: 40.0,
color: Colors.grey.withOpacity(0.3),
child: Icon(
Icons.add,
size: 30.0,
color: Colors.green,
),
),
),
);
ToastFuture toastFuture = showToastWidget(
widget,
duration: Duration(seconds: 3),
onDismiss: () {
print("the toast dismiss"); // the method will be called on toast dismiss.
},
);