简体   繁体   English

勾选框上的 Flutter 圆角

[英]Flutter rounded corners on Tick box

my app has a very rounded type design and I am looking to use tick boxes as part of the UI.我的应用程序有一个非常圆润的类型设计,我希望使用复选框作为 UI 的一部分。 The design doesn't look good with completely circular tick 'boxes'.带有完全圆形勾选“框”的设计看起来不太好。 I was looking to round the corners of a standard tick box, as you would fo with a container.我正在寻找圆角的标准勾选框,就像您使用容器一样。 Any ideas on how this can be achieved.关于如何实现这一目标的任何想法。 I have tried to contain the tickbox inside a container and round the corners of the container, doesn't work.我试图将复选框包含在容器内并绕过容器的角,但没有用。

You can create your own checkbox like this:您可以像这样创建自己的复选框:

InkWell(
  onTap: () {
    setState(() {
      _value = !_value;
    });
  },
  child: Container(
    decoration: BoxDecoration(
      border: Border.all(color: Colors.blue, width: 4),
      borderRadius: BorderRadius.circular(8),
    ),
    child: _value
      ? Icon(
          Icons.check,
          size: 30.0,
          color: Colors.blue,
        )
      : Icon(
          null,
          size: 30.0,
        ),
  ),
),

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

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