我有一个带有纯色的分隔器小部件,但我想将其设置为渐变颜色。有没有办法做到这一点?
Divider(
height: 20,
thickness: 2.5,
indent: 0,
endIndent: 100,
)
Run Code Online (Sandbox Code Playgroud)
只需使用Container()
[BoxDecoration][1] 来创建渐变。
SizedBox(
width: 200,
height: 4,
child: Container(
decoration: BoxDecoration(
gradient: //...
),
),
),
Run Code Online (Sandbox Code Playgroud)
预定义的分隔线很好,但在定制方面并不强大。[1]:https://api.flutter.dev/flutter/painting/BoxDecoration-class.html
归档时间: |
|
查看次数: |
2590 次 |
最近记录: |