Created
December 12, 2019 08:20
-
-
Save BoshiLee/6e5c5aa0bb645e695629a5c5c1883710 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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. | |
FutureBuilder<void>( | |
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 Center(child: CircularProgressIndicator()); | |
} | |
}, | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment