gpt4 book ai didi

flutter - Flutter OutlinedButton 小部件中奇怪的黑色背景

转载 作者:IT王子 更新时间:2023-10-29 06:57:54 25 4
gpt4 key购买 nike

我正在使用 Flutter 的 OutlineButton 小部件,但我不知道如何在单击/按下按钮时删除那个奇怪的黑色背景突出显示。

CLICK FOR VIDEO OF ISSUE

这是按钮:

OutlineButton(
highlightElevation: 1.0,
onPressed: () => onRequestAllowLocation(context),
child: Text(
"ALLOW LOCATION",
style: TextStyle(fontWeight: FontWeight.w600, fontSize: 16),
),
borderSide: BorderSide(color: MyApp.accentColor, width: 2.0),
textColor: MyApp.accentColor,
shape: new RoundedRectangleBorder(borderRadius: new BorderRadius.circular(16.0))),
)

这是应用程序的主题:

ThemeData(
fontFamily: 'Dosis',
brightness: Brightness.dark,
primarySwatch: Colors.blue,
accentColor: accentColor,
highlightColor: highlightColor,
buttonColor: accentColor,
indicatorColor: accentColor,
backgroundColor: primaryColor,
scaffoldBackgroundColor: primaryColor,
primaryColor: primaryColor,
)

附言我在上面提供的 const 颜色都不是黑色。

最佳答案

是影子。停止设置 highlightElevation,它就会消失。来自 OutlineButton class docs :

The button's highlightElevation, which defines the size of the drop shadow when the button is pressed, is 0.0 (no shadow) by default. If highlightElevation is given a value greater than 0.0 then the button becomes a cross between RaisedButton and FlatButton: a bordered button whose elevation increases and whose background becomes opaque when the button is pressed.

关于flutter - Flutter OutlinedButton 小部件中奇怪的黑色背景,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55110464/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com