我是Flutter编程新手,我想问是否可以将图像作为按钮背景颤动?这是我的图像资源:
final _backgroundButton = new AssetImage("assets/background_button.png");
这是我的按钮:
RaisedButton(
child: const Text('LANJUTKAN'),
color: Theme.of(context).accentColor,
elevation: 0.0,
splashColor: Colors.blueGrey,
onPressed: () {
// Perform some action
},
),
有人知道该怎么做吗?只要我可以将图像设置为背景,我就可以将凸起按钮更改为平面按钮或其他任何按钮。谢谢你!
“RaishedButton”是一个材质组件,其形状取决于“材质设计”角色,您可以创建自己的自定义按钮小部件
GestureDetector(
child: Container(
width:120,
height: 40,
decoration: BoxDecoration(
color: Colors.black,
image: DecorationImage(
image:AssetImage("assets/background_button.png"),
fit:BoxFit.cover
),
child: Text("clickMe") // button text
)
),onTap:(){
print("you clicked me");
}
)
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)