南通网络科技的公司网站,外汇交易平台,珠海新闻,深圳最新消息公布上效果 预期的是通过拖动一条边界线改变窗口大小#xff0c;类似vscode里拖动效果。这个是简单的拖动实现
上代码#xff1a;
import package:flutter/material.dart;class MyDraggableViewDemo extends StatelessWidget {const MyDraggableViewDemo({super.key});override…上效果 预期的是通过拖动一条边界线改变窗口大小类似vscode里拖动效果。这个是简单的拖动实现
上代码
import package:flutter/material.dart;class MyDraggableViewDemo extends StatelessWidget {const MyDraggableViewDemo({super.key});overrideWidget build(BuildContext context) {return MaterialApp(home: Scaffold(appBar: AppBar(title: Text(MyDraggableViewDemo),),body: DraggableDemo(),),);}
}class DraggableDemo extends StatefulWidget {const DraggableDemo({super.key});overrideStateStatefulWidget createState() {return _DraggableDemoState();}
}class _DraggableDemoState extends StateDraggableDemo {double width 200.0;double height 200.0;overrideWidget build(BuildContext context) {return Center(child: GestureDetector(onPanUpdate: (details) {setState(() {width width details.delta.dx;height height details.delta.dy;});},child: Container(width: width,height: height,color: Colors.blue,child: Center(child: Text(点击 拖动后改变窗口大小,style: TextStyle(color: Colors.white),),),),),);}
}
所以预期的边界线效果应该是对边界线进行处理然后和关联的 widget 进行联动 下一篇见
End