简体   繁体   English

Flutter OutlinedButton 带图标波纹颜色

[英]Flutter OutlinedButton with icon ripple color

I am trying to use Outlined Button with icon, when if I set a color for the icon, it also changes the ripple effect color.我正在尝试使用带有图标的轮廓按钮,当我为图标设置颜色时,它也会改变波纹效果颜色。

Widget build(BuildContext context) => Container(
    margin: EdgeInsets.symmetric(horizontal: 20),
    padding: EdgeInsets.all(4),
    child: OutlinedButton.icon(
      label: Text(
        'Sign In With Google',
        style: TextStyle(
            color: Colors.black,
            fontFamily: "RobotoCondensed",
            fontWeight: FontWeight.bold,
            fontSize: 16),
      ),
      style: OutlinedButton.styleFrom(
        shape: StadiumBorder(),
        padding: EdgeInsets.symmetric(horizontal: 12, vertical: 8),
        side: BorderSide(width: 1, color: Colors.black),
      ),
      icon: FaIcon(FontAwesomeIcons.google, color: Colors.red),
      onPressed: () {
        final provider =
            Provider.of<GoogleSignInProvider>(context, listen: false);
        provider.login();
      },
    ),
  );

Can someone help me understand how can I define the ripple color to stay as black?有人可以帮我理解如何将波纹颜色定义为黑色吗?

I don't know if I understood correctly, but try adding primary in style我不知道我是否理解正确,但尝试添加primary style

    style: OutlinedButton.styleFrom(
      ...
      primary: Colors.black, //change colour here
    ),

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

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