Skip to content

Commit c36f251

Browse files
author
Michel Feinstein
committed
Fix formatting
1 parent f363d57 commit c36f251

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

packages/example/lib/vision_detector_views/text_from_widget_view.dart

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class _TextFromWidgetViewState extends State<TextFromWidgetView> {
1818
final _widgetKey = GlobalKey();
1919
String _extractedText = 'Recognized text will appear here';
2020
bool _isBusy = false;
21-
21+
2222
@override
2323
void dispose() {
2424
_textRecognizer.close();
@@ -90,16 +90,16 @@ class _TextFromWidgetViewState extends State<TextFromWidgetView> {
9090

9191
Future<void> _extractTextFromWidget() async {
9292
if (_isBusy) return;
93-
93+
9494
setState(() {
9595
_isBusy = true;
9696
_extractedText = 'Processing...';
9797
});
9898

9999
try {
100100
// Get the RenderObject from the GlobalKey
101-
final RenderRepaintBoundary? boundary =
102-
_widgetKey.currentContext?.findRenderObject() as RenderRepaintBoundary?;
101+
final RenderRepaintBoundary? boundary = _widgetKey.currentContext
102+
?.findRenderObject() as RenderRepaintBoundary?;
103103

104104
if (boundary == null) {
105105
setState(() {
@@ -111,11 +111,11 @@ class _TextFromWidgetViewState extends State<TextFromWidgetView> {
111111

112112
// Capture the widget as an image
113113
final ui.Image image = await boundary.toImage(pixelRatio: 3.0);
114-
114+
115115
// Convert to byte data in raw RGBA format
116-
final ByteData? byteData =
116+
final ByteData? byteData =
117117
await image.toByteData(format: ui.ImageByteFormat.rawRgba);
118-
118+
119119
if (byteData == null) {
120120
setState(() {
121121
_extractedText = 'Error: Failed to get image byte data';
@@ -125,21 +125,21 @@ class _TextFromWidgetViewState extends State<TextFromWidgetView> {
125125
}
126126

127127
final Uint8List bytes = byteData.buffer.asUint8List();
128-
128+
129129
// Create InputImage from bitmap data with dimensions
130130
final inputImage = InputImage.fromBitmap(
131131
bitmap: bytes,
132132
width: image.width,
133133
height: image.height,
134134
);
135-
135+
136136
// Process the image with the text recognizer
137-
final RecognizedText recognizedText =
137+
final RecognizedText recognizedText =
138138
await _textRecognizer.processImage(inputImage);
139-
139+
140140
setState(() {
141-
_extractedText = recognizedText.text.isNotEmpty
142-
? recognizedText.text
141+
_extractedText = recognizedText.text.isNotEmpty
142+
? recognizedText.text
143143
: 'No text recognized';
144144
_isBusy = false;
145145
});

0 commit comments

Comments
 (0)