作者热门文章
- r - 以节省内存的方式增长 data.frame
- ruby-on-rails - ruby/ruby on rails 内存泄漏检测
- android - 无法解析导入android.support.v7.app
- UNIX 域套接字与共享内存(映射文件)
我正在尝试创建一个登录按钮,按下它时会显示动画。但是当点击按钮(在 PhysicalModel 上)时,涟漪效应只显示在登录文本上,而不是完全在物理模型上。如何为 PhysicalModel 添加涟漪效果或从 MaterialButton 移除涟漪效果?
PhysicalModel(
color: Colors.teal,
borderRadius: BorderRadius.circular(50.0),
child: MaterialButton(
key: _globalKey,
child: Text("Login"),
onPressed: () {
setState(() {
if (_state == 0) {
animateButton();
}
});
},
elevation: 4.0,
minWidth: _width,
height: 20.0,
),
)
最佳答案
如果您想移除 MaterialButton
的启动颜色,只需将这些颜色更改为透明即可。
MaterialButton(
splashColor: Colors.transparent,
highlightColor: Colors.transparent,
如果你想为你的 PhysicalModel
产生链式 react :
PhysicalModel(
color: Colors.teal,
borderRadius: BorderRadius.circular(50.0),
child: RawMaterialButton(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(50.0)),
padding: EdgeInsets.symmetric(vertical: 15.0, horizontal: 30.0),
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
child: Text("Login"),
onPressed: () {
setState(() {});
},
elevation: 4.0,
),
)
关于dart - 如何在 flutter 中为 PhysicalModel 添加波纹效果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53755345/
我是一名优秀的程序员,十分优秀!