【发布时间】:2021-09-16 08:23:15
【问题描述】:
我在容器中使用Flutter Speed Dial 插件。我只需要切换其中一个孩子 (SpeedDialChild) 的可见性;
child: Container(
width: 165,
height:400,
child:
SpeedDial(
overlayOpacity: 0.4,
icon: Icons.add,
activeIcon: Icons.expand_less,
buttonSize: 60.0,
backgroundColor: Color(0x00000000),
overlayColor: Color(0x00000000),
foregroundColor: Colors.white,
children: [
SpeedDialChild(
child: Icon(Icons.block),
backgroundColor: Colors.brown,
labelBackgroundColor: Colors.white,
label: 'abuse',
labelStyle: TextStyle(fontSize: 14.0),
onTap: () => print('rude'),
),
SpeedDialChild(
child: Icon(TriangleAll.edit_3),
backgroundColor: Colors.deepPurple[200],
labelBackgroundColor: Colors.white,
label: 'edit',
labelStyle: TextStyle(fontSize: 14.0),
onTap: () {},
onLongPress: () {},
),
],
),
),
我尝试将 Visibility 小部件包裹在图标上,但随后我得到一个空白的白色图标,其中应该有一个空白区域。
SpeedDialChild 本身不能用可见性小部件包装。所以我需要另一种选择。
有人知道另一种方法来完成这个吗?
【问题讨论】:
-
请查看Question 1 和Question 2,它们可能会帮助您实现您的目标
标签: flutter dart flutter-layout visibility speed-dial