Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions lib/ui/camera/camera_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class _CameraScreenState extends State<CameraScreen> {
String imgPath;
double _position;
String _pointId;
bool awaitingCapture = false;

Future initCamera(CameraDescription cameraDescription) async {
if (cameraController != null) {
Expand Down Expand Up @@ -118,9 +119,7 @@ class _CameraScreenState extends State<CameraScreen> {
color: Color.fromRGBO(0, 0, 0, 0.6),
),
backgroundColor: Color.fromRGBO(255, 255, 255, 0.2),
onPressed: () {
onCapture(context);
},
onPressed: awaitingCapture ? null : () => onCapture(context),
),
floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat,
);
Expand All @@ -132,7 +131,9 @@ class _CameraScreenState extends State<CameraScreen> {
final name = DateTime.now();
final path = "${p.path}/$name.png";
try {
awaitingCapture = true;
XFile img = await cameraController.takePicture();
awaitingCapture = false;
await img.saveTo(path);
Navigator.pushNamed(context, PreviewScreen.routeName,
arguments: PreviewScreenArguments(widget.surveyItemId, path,
Expand Down