Flutter按鈕添加背景圖片及文字的一種方法,記錄下,上代碼
Widget picAndTextButton(String imgpath,String text) {
return Container(
width: 200,
height: 60,
decoration: BoxDecoration(
color: Colors.white,
image: DecorationImage(
image: AssetImage(path),
fit: BoxFit.fill
),
),
alignment: Alignment.center,
child: FlatButton(
onPressed: _theDayBefor,
child: Text(text),
color: Colors.transparent,
),
);
}