Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我创建了一个有两个按钮的应用程序,第一个按钮是打开摄像机,第二个按钮是使用图像选择器库从图库中打开视频。我的问题是可以像在 TikTok 或 Instagram 中一样在视频视图或相机视图上显示一个按钮。
我实现这一点的方法是使用堆栈,然后将相机视图放在背景上,并将浮动操作按钮放在前面。示例代码:
Widget test() { return Stack( children: <Widget>[ CameraPreview(), Container( margin: EdgeInsets.fromLTRB(1, 1, 1, 1), //margin here child: FloatingActionButton( elevation: 2, onPressed: takePicture, )), ], );
}