Skip to content

Instantly share code, notes, and snippets.

@ashishrawat2911
Created January 29, 2020 10:53
Show Gist options
  • Select an option

  • Save ashishrawat2911/167a980ce78726bf428eede41ab381d0 to your computer and use it in GitHub Desktop.

Select an option

Save ashishrawat2911/167a980ce78726bf428eede41ab381d0 to your computer and use it in GitHub Desktop.
@override
Widget build(BuildContext context) {
return Scaffold(
body: Stack(
fit: StackFit.expand,
children: <Widget>[
_camera == null
? Container(
color: Colors.black,
)
: Container(
height: MediaQuery
.of(context)
.size
.height - 150,
child: CameraPreview(_camera)),
_buildResults(_textScanResults),
],
),
);
}
Widget _buildResults(VisionText scanResults) {
CustomPainter painter;
if (scanResults != null) {
final Size imageSize = Size(
_camera.value.previewSize.height - 100,
_camera.value.previewSize.width,
);
painter = TextDetectorPainter(imageSize, scanResults);
getWords(scanResults);
return CustomPaint(
painter: painter,
);
} else {
return Container();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment