diff --git a/covas_mobile/lib/pages/Camera.dart b/covas_mobile/lib/pages/Camera.dart index a1b93c3..d0922e2 100644 --- a/covas_mobile/lib/pages/Camera.dart +++ b/covas_mobile/lib/pages/Camera.dart @@ -73,54 +73,66 @@ class CameraState extends State { @override Widget build(BuildContext context) { return Scaffold( - appBar: AppBar(title: const Text('Take a picture')), - // You must wait until the controller is initialized before displaying the - // camera preview. Use a FutureBuilder to display a loading spinner until the - // controller has finished initializing. - body: FutureBuilder( - future: _initializeControllerFuture, - builder: (context, snapshot) { - if (snapshot.connectionState == ConnectionState.done) { - // If the Future is complete, display the preview. - return CameraPreview(_controller); - } else { - // Otherwise, display a loading indicator. - return const Center(child: CircularProgressIndicator()); - } - }, - ), - floatingActionButton: FloatingActionButton( - // Provide an onPressed callback. - onPressed: () async { - // Take the Picture in a try / catch block. If anything goes wrong, - // catch the error. - try { - // Ensure that the camera is initialized. - await _initializeControllerFuture; - - // Attempt to take a picture and get the file `image` - // where it was saved. - final image = await _controller.takePicture(); - - if (!context.mounted) return; - - // If the picture was taken, display it on a new screen. - await Navigator.of(context).push( - MaterialPageRoute( - builder: (context) => DisplayPictureScreen( - // Pass the automatically generated path to - // the DisplayPictureScreen widget. - imagePath: image.path, + appBar: AppBar(title: const Text('Take a picture')), + // You must wait until the controller is initialized before displaying the + // camera preview. Use a FutureBuilder to display a loading spinner until the + // controller has finished initializing. + body: FutureBuilder( + future: _initializeControllerFuture, + builder: (context, snapshot) { + if (snapshot.connectionState == ConnectionState.done) { + // If the Future is complete, display the preview. + return CameraPreview(_controller); + } else { + // Otherwise, display a loading indicator. + return const Center(child: CircularProgressIndicator()); + } + }, + ), + floatingActionButton: Padding( + padding: const EdgeInsets.all(8.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + FloatingActionButton( + backgroundColor: Colors.green, + onPressed: () => {}, + child: Icon(Icons.play_arrow), ), - ), - ); - } catch (e) { - // If an error occurs, log the error to the console. - print(e); - } - }, - child: const Icon(Icons.camera_alt), - ), - ); + SizedBox(width: 40), + FloatingActionButton( + // Provide an onPressed callback. + onPressed: () async { + // Take the Picture in a try / catch block. If anything goes wrong, + // catch the error. + try { + // Ensure that the camera is initialized. + await _initializeControllerFuture; + + // Attempt to take a picture and get the file `image` + // where it was saved. + final image = await _controller.takePicture(); + + if (!context.mounted) return; + + // If the picture was taken, display it on a new screen. + await Navigator.of(context).push( + MaterialPageRoute( + builder: (context) => DisplayPictureScreen( + // Pass the automatically generated path to + // the DisplayPictureScreen widget. + imagePath: image.path, + ), + ), + ); + } catch (e) { + // If an error occurs, log the error to the console. + print(e); + } + }, + child: const Icon(Icons.camera_alt), + ) + ], + ))); } }