My Goal
我想顯示Flutter's默認(rèn)SnackBar,內(nèi)容為L(zhǎng)istTile。
The problem
出于某種原因,Snackbar幾乎比我想要的高出三倍,而且Snackbar中似乎沒有設(shè)置高度的參數(shù)。
我檢查了類似的問(wèn)題,沒有找到一個(gè)有效的例子。
The SnackBar
void showSuccessSnackBar({BuildContext context, String message}) {
Scaffold.of(context).showSnackBar(
SnackBar(
content: Container(
child: ListTile(
leading: _successIcon(),
dense: true,
title: Text(
message,
textAlign: TextAlign.center,
style: TextStyle(
color: HATheme.HOPAUT_PINK,
fontWeight: FontWeight.bold
),
)),
),
behavior: SnackBarBehavior.floating,
duration: Duration(seconds: 3),
backgroundColor: Colors.white));
}
Widget _successIcon() {
return Image.asset(
'assets/icons/success.png',
// resizing this doesn't help
height: 30,
width: 30,
);
}
我想要的尺碼:
實(shí)際尺寸:
你可以增加容器的高度,你的問(wèn)題就會(huì)得到解決