是否可以将FAB的backgroundColor设置为渐变色而不是纯色?
我的按钮:
floatingActionButton: FloatingActionButton(
backgroundColor: const Color(0xFFFF006E),
child: const Icon(Icons.add, size: 40.0),
onPressed: () {
print('Start');
},
),
答案 0 :(得分:6)
希望这样做,
floatingActionButton: FloatingActionButton(
child: Container(
width: 60,
height: 60,
child: Icon(
Icons.add,
size: 40,
),
decoration: BoxDecoration(
shape: BoxShape.circle,
gradient: LinearGradient(colors: [Colors.red, Colors.blue])),
),
onPressed: () {},
)
答案 1 :(得分:2)
使用可以将var condition = [{firstname:"mark"},{gender:"male"}];
jobs.user.find(condition)
与所需的渐变一起使用
Container
答案 2 :(得分:0)
我希望这会....
FloatingActionButton(
onPressed: () {},
child: Container(
height: 60,
width: 60,
decoration: BoxDecoration(
shape: BoxShape.circle,
gradient: LinearGradient(
colors: [
Colors.teal,
Colors.tealAcent
],
),
),
child: Icon(
Icons.add,
color: Colors.white,
),
),
)