如何在OutlinedButton中移除边框?

4

我想要移除OutlineButton上的边框,但是遇到了问题。

 OutlinedButton(
  onPressed: () {},
  child: const Text('Pext Page'),
 )

please help me!!

1个回答

11
尝试下面的代码,希望它对你有所帮助。
使用透明边框颜色。
  OutlinedButton(
    onPressed: () {},
    child: Text('Outlined button'),
    style: OutlinedButton.styleFrom(
      side: BorderSide(
         color: Colors.transparent,
      ),
    ),
  ),

使用无边框

OutlinedButton(
  onPressed: () {},
  style: OutlinedButton.styleFrom(
    side: BorderSide.none,
  ),
  child: const Text('Outlined button'),
),

您的结果屏幕-> 图像

或者您也可以使用TextButton

 TextButton(
    onPressed: () {},
    child: Text('Text button'),
  ),

您的结果屏幕使用TextButton-> image


3
你应该可以将 BorderSide(color: Colors.transparent) 替换为 BorderSide.none,并且达到相同的效果。 - Najki

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接