繁体   English   中英

从 Flutter 中的 RaisedButton 移除阴影

[英]Remove the drop shadow from a RaisedButton in Flutter

有没有办法完全删除RaisedButton下的阴影? 我已经将elevation: 0设置为那个RaisedButton但是点击它时仍然会出现阴影。

有没有一种方法可以完全消除RaisedButton下的RaisedButton 我已经将RaisedButton elevation: 0设置为非常RaisedButton但是点击它时仍会出现阴影。

由于凸起按钮已被弃用。

ElevatedButton(
                style: ElevatedButton.styleFrom(
                  elevation: 0.0,
                  shadowColor: Colors.transparent,
               
                ),),

这应该是解决方案。 它将删除高程和阴影。

由于 RaisedButton 已被弃用而应使用 ElevatedButton,因此解决此问题的方法也很简单。

elevation: MaterialStateProperty.all<double>(0)

你可以在这里找到答案:https://api.flutter.dev/flutter/material/ButtonStyle-class.html

你必须使用:

.copyWith(elevation:ButtonStyleButton.allOrNull(0.0))

//例子

ElevatedButton(child: Text("Your Text"), onPressed: onPressed, style: ElevatedButton.styleFrom( backgroundColor: Color.fromRGBO(255, 255, 255, 1), foregroundColor: Colors.black54, shadowColor: Z5D50889672F6F860D1.transparent,233elevation : 0.0, ).copyWith(elevation:ButtonStyleButton.allOrNull(0.0))

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM