我想要一个位于整个应用程序顶部的小部件。当我尝试使用Overlay.of(context).insert叠加层执行此操作时,在替换该路线后稍后会消失。有没有一种方法可以让我的应用程序顶部有一个小部件,即使屏幕稍后弹出?
通过在0.2.8版的颤振相机中引入图像流,我尝试将其集成到我的项目中以与AWS一起使用。
Amazon要求图像采用以下格式:
以前,我使用Camera包拍摄图片,加载图片,然后根据需要将其转换为Amazon,但是使用ImageStream更适合我想做的事情。我以前的方法是:
// Take the picutre
await _cameraController.takePicture(path);
// Load it from my filesystem
File imagefile = new File(path);
// Convert to amazon requirements
List<int> imageBytes = imagefile.readAsBytesSync();
String base64Image = base64Encode(imageBytes);
Run Code Online (Sandbox Code Playgroud)
但是,使用图像流,我找不到任何简单的方法将转换为CameraImage亚马逊所需的格式。我对图像没有太多的经验,所以我很困惑。
我试图操纵Firebase ml和相机流演示中使用的代码
final int numBytes =
image.planes.fold(0, (count, plane) => count += plane.bytes.length);
final Uint8List allBytes = Uint8List(numBytes);
int nextIndex = 0;
for (int i = 0; i < image.planes.length; i++) {
allBytes.setRange(nextIndex, nextIndex + image.planes[i].bytes.length,
image.planes[i].bytes);
nextIndex …Run Code Online (Sandbox Code Playgroud)