如何从 TextButton 颤动中删除边框半径

问题描述 投票:0回答:3

我是颤振新手,我遇到了这个问题,我的

TextButton
有一点边界半径。有谁知道如何从
TextButton
中删除边框半径?

我的输出

我的代码很抱歉没有早点包含 My Code

android flutter dart flutter-layout
3个回答
18
投票

您可以将 shape 参数添加到您的 TextButton

TextButton(
      style: TextButton.styleFrom(
          backgroundColor: Colors.yellow,
          shape: const RoundedRectangleBorder(
              borderRadius: BorderRadius.all(Radius.zero))),
      child: const Text("BUtton"),
      onPressed: () {},
    )

0
投票

将此行代码添加到您的 TextButton()

style: TextButton.styleFrom(
              shape: const BeveledRectangleBorder(borderRadius: BorderRadius.zero),
            ),

0
投票

对 Danny Rufus 的答案进行一些改进,您可以使用

BorderRadius.zero
将所有角的边框半径设置为 0

TextButton(
      style: TextButton.styleFrom(
          backgroundColor: Colors.yellow,
          shape: const RoundedRectangleBorder(
              borderRadius: BorderRadius.zero
          )
      ),
      child: const Text("Button"),
      onPressed: () {},
    )

或者您可以删除

borderRadius
参数,因为默认值为
BorderRadius.zero
,如 doc

所示

这样就可以直接使用

const RoundedRectangleBorder()

© www.soinside.com 2019 - 2024. All rights reserved.