在颤动中创建可拖动元素

问题描述 投票:0回答:1

免责声明:我对这个网站还是陌生的。感谢您对我的耐心!

我正在开发一个测试应用程序以学习抖动。我正在从android studio的默认仿真器上调试,并且以下代码在尝试用鼠标拖动框时无响应。帮助!

Widget _foreground(BuildContext context) {
return Draggable(
  axis: Axis.vertical,
  child: Container(
    height: 50,
    width: 50,
    child: Column(
      children: <widget>[],
    ),
  ),
  feedback: Container(
    height: 50.0,
    width: 50.0,
    child: Column(
      children: <widget>[],
    ),
  ),
  childWhenDragging: Container(),
);

}

flutter widget draggable
1个回答
0
投票

之所以看不到任何东西,是因为您没有在屏幕上呈现任何颤动,请尝试给容器这样的颜色

Draggable(
          axis: Axis.vertical,
          child: Container(
            color: Colors.red,
            height: 50,
            width: 50,
            child: Column(
              children: <Widget>[],
            ),
          ),
          feedback: Container(
            color: Colors.blue,
            height: 50.0,
            width: 50.0,
            child: Column(
              children: <Widget>[],
            ),
          ),
        ),
© www.soinside.com 2019 - 2024. All rights reserved.