【问题标题】:Visibility on Flutter Speed Dial Children?Flutter Speed Dial Children 上的可见性?
【发布时间】: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 本身不能用可见性小部件包装。所以我需要另一种选择。

有人知道另一种方法来完成这个吗?

【问题讨论】:

标签: flutter dart flutter-layout visibility speed-dial


【解决方案1】:

这是来自 Github 问题队列的答案;

if (thisid==thatid) SpeedDialChild(...)

【讨论】:

    猜你喜欢
    • 2023-03-05
    • 1970-01-01
    • 2020-04-12
    • 2020-06-12
    • 2017-01-25
    • 2020-02-10
    • 2016-03-01
    • 2020-10-16
    • 1970-01-01
    相关资源
    最近更新 更多