實現(xiàn)下圖的一個按鈕
代碼如下
/// 登錄按鈕
Widget buildLoginButtonWidget() {
return Container(
margin: EdgeInsets.only(top: 40, left: 16, right: 16),
width: MediaQuery.of(context).size.width - 32,
height: 50,
decoration: BoxDecoration(
color: Colors.transparent,
image: DecorationImage(
image: AssetImage('images/login_button.png'), fit: BoxFit.fill),
borderRadius: BorderRadius.circular(25.0),
),
child: FlatButton(
onPressed: () {
},
child: Text("登錄"),
textColor: Colors.white,
color: Colors.transparent, // 透明色
)
);
}