简体   繁体   English

如何在 flutter 中赋予复选框渐变?

[英]How to give checkbox gradient in flutter?

Is there a way to implement a checkbox with a gradient in flutter?有没有办法在 flutter 中实现带有渐变的复选框? I tried using the Checkbox class but was not able to implement a linear gradient?我尝试使用复选框 class 但无法实现线性渐变? How shall I go about it?我该怎么办呢?

You could wrap it with a container and change the height and width like this:你可以用一个容器包裹它并像这样改变高度和宽度:

Container(height: 19,
              width: 19,
              decoration: BoxDecoration(
                  gradient: LinearGradient(
                    begin: Alignment.topLeft, 
                    end: Alignment(10, 3), 
                    colors: <Color>[
                      Colors.white, 
                      Colors.grey,
              ],
            )
            ),
              child: Checkbox(value: false,),
            ),

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

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