首页 > 解决方案 > 如何在颤动中给出复选框渐变?

问题描述

有没有办法在颤动中实现一个带有渐变的复选框?我尝试使用 Checkbox 类但无法实现线性渐变?我该怎么办?

标签: androidflutterdart

解决方案


你可以用一个容器包裹它并像这样改变高度和宽度:

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,),
            ),

推荐阅读