如何在按钮颤振中赋予条件

时间:2019-09-01 07:33:22

标签: flutter dart

如何通过按钮/墨水池等来赋予条件?

示例

InkWell(
          borderRadius: BorderRadius.all(Radius.circular(50.0)),
          if => onTap: () {
            capturephoto
            });
          },
          else => onLongPress: () {
            recordvideo
            });
          },
          child: Container(
            padding: EdgeInsets.all(4.0),
            child: Image.asset(
              'assets/images/ic_switch_camera_3.png',
              color: Colors.grey[200],
              width: 42.0,
              height: 42.0,
            ),
          ),
        ),

当我点击它时可能是照片,如果我按下它可能会被记录

1 个答案:

答案 0 :(得分:0)

您不需要条件,只需给出两个值即可。

InkWell(
      borderRadius: BorderRadius.all(Radius.circular(50.0)),
      onTap: () {
       // capturephoto
      },
      onLongPress: () {
        //recordvideo
      },
      child: Container(
        padding: EdgeInsets.all(4.0),
        child: Image.asset(
          'assets/images/ic_switch_camera_3.png',
          color: Colors.grey[200],
          width: 42.0,
          height: 42.0,
        ),
      ),
    ),