📅  最后修改于: 2022-03-11 14:48:08.489000             🧑  作者: Mango
FloatingActionButton(
onPressed: () => getImageFromCam(index),
tooltip: 'Pick Image',
child: Icon(Icons.add_a_photo),
);
...
Future getImageFromCam(int index) async {
// Do whatever you want with `index`.
final image = await ImagePicker.pickImage(source: ImageSource.camera);
setState(() => _image = image);
}