[英]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.