Skip to content
This repository was archived by the owner on Apr 30, 2026. It is now read-only.
Open
Show file tree
Hide file tree
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
3 changes: 1 addition & 2 deletions ios/Podfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'
platform :ios, '9.0'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
Expand Down
66 changes: 65 additions & 1 deletion ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,19 @@ PODS:
- FirebaseAnalytics (= 6.2.2)
- Firebase/CoreOnly (6.17.0):
- FirebaseCore (= 6.6.2)
- Firebase/MLVision (6.17.0):
- Firebase/CoreOnly
- FirebaseMLVision (~> 0.19.0)
- firebase_analytics (0.0.1):
- Firebase/Core
- Flutter
- firebase_core (0.0.1):
- Firebase/Core
- Flutter
- firebase_ml_vision (0.1.1):
- Firebase/Core
- Firebase/MLVision
- Flutter
- FirebaseAnalytics (6.2.2):
- FirebaseCore (~> 6.6)
- FirebaseInstanceID (~> 4.3)
Expand Down Expand Up @@ -42,7 +49,30 @@ PODS:
- FirebaseInstallations (~> 1.0)
- GoogleUtilities/Environment (~> 6.5)
- GoogleUtilities/UserDefaults (~> 6.5)
- FirebaseMLCommon (0.19.0):
- FirebaseCore (~> 6.3)
- FirebaseInstanceID (~> 4.2)
- GoogleToolboxForMac/Logger (~> 2.1)
- "GoogleToolboxForMac/NSData+zlib (~> 2.1)"
- "GoogleToolboxForMac/NSDictionary+URLArguments (~> 2.1)"
- GoogleUtilities/UserDefaults (~> 6.0)
- GTMSessionFetcher/Core (~> 1.1)
- Protobuf (~> 3.5)
- FirebaseMLVision (0.19.0):
- FirebaseCore (~> 6.3)
- FirebaseMLCommon (~> 0.19)
- GoogleAPIClientForREST/Core (~> 1.3)
- GoogleAPIClientForREST/Vision (~> 1.3)
- GoogleToolboxForMac/Logger (~> 2.1)
- "GoogleToolboxForMac/NSData+zlib (~> 2.1)"
- GTMSessionFetcher/Core (~> 1.1)
- Protobuf (~> 3.5)
- Flutter (1.0.0)
- GoogleAPIClientForREST/Core (1.3.11):
- GTMSessionFetcher (>= 1.1.7)
- GoogleAPIClientForREST/Vision (1.3.11):
- GoogleAPIClientForREST/Core
- GTMSessionFetcher (>= 1.1.7)
- GoogleAppMeasurement (6.2.2):
- GoogleUtilities/AppDelegateSwizzler (~> 6.0)
- GoogleUtilities/MethodSwizzler (~> 6.0)
Expand All @@ -53,6 +83,18 @@ PODS:
- GoogleDataTransportCCTSupport (1.4.0):
- GoogleDataTransport (~> 4.0)
- nanopb (~> 0.3.901)
- GoogleToolboxForMac/DebugUtils (2.2.2):
- GoogleToolboxForMac/Defines (= 2.2.2)
- GoogleToolboxForMac/Defines (2.2.2)
- GoogleToolboxForMac/Logger (2.2.2):
- GoogleToolboxForMac/Defines (= 2.2.2)
- "GoogleToolboxForMac/NSData+zlib (2.2.2)":
- GoogleToolboxForMac/Defines (= 2.2.2)
- "GoogleToolboxForMac/NSDictionary+URLArguments (2.2.2)":
- GoogleToolboxForMac/DebugUtils (= 2.2.2)
- GoogleToolboxForMac/Defines (= 2.2.2)
- "GoogleToolboxForMac/NSString+URLArguments (= 2.2.2)"
- "GoogleToolboxForMac/NSString+URLArguments (2.2.2)"
- GoogleUtilities/AppDelegateSwizzler (6.5.1):
- GoogleUtilities/Environment
- GoogleUtilities/Logger
Expand All @@ -71,6 +113,11 @@ PODS:
- GoogleUtilities/Logger
- GoogleUtilities/UserDefaults (6.5.1):
- GoogleUtilities/Logger
- GTMSessionFetcher (1.3.1):
- GTMSessionFetcher/Full (= 1.3.1)
- GTMSessionFetcher/Core (1.3.1)
- GTMSessionFetcher/Full (1.3.1):
- GTMSessionFetcher/Core (= 1.3.1)
- nanopb (0.3.9011):
- nanopb/decode (= 0.3.9011)
- nanopb/encode (= 0.3.9011)
Expand All @@ -79,11 +126,13 @@ PODS:
- path_provider (0.0.1):
- Flutter
- PromisesObjC (1.2.8)
- Protobuf (3.11.4)

DEPENDENCIES:
- camera (from `.symlinks/plugins/camera/ios`)
- firebase_analytics (from `.symlinks/plugins/firebase_analytics/ios`)
- firebase_core (from `.symlinks/plugins/firebase_core/ios`)
- firebase_ml_vision (from `.symlinks/plugins/firebase_ml_vision/ios`)
- Flutter (from `Flutter`)
- path_provider (from `.symlinks/plugins/path_provider/ios`)

Expand All @@ -96,12 +145,18 @@ SPEC REPOS:
- FirebaseCoreDiagnosticsInterop
- FirebaseInstallations
- FirebaseInstanceID
- FirebaseMLCommon
- FirebaseMLVision
- GoogleAPIClientForREST
- GoogleAppMeasurement
- GoogleDataTransport
- GoogleDataTransportCCTSupport
- GoogleToolboxForMac
- GoogleUtilities
- GTMSessionFetcher
- nanopb
- PromisesObjC
- Protobuf

EXTERNAL SOURCES:
camera:
Expand All @@ -110,6 +165,8 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/firebase_analytics/ios"
firebase_core:
:path: ".symlinks/plugins/firebase_core/ios"
firebase_ml_vision:
:path: ".symlinks/plugins/firebase_ml_vision/ios"
Flutter:
:path: Flutter
path_provider:
Expand All @@ -120,21 +177,28 @@ SPEC CHECKSUMS:
Firebase: 2672e5636b42f977177716317e68346ae5e9de25
firebase_analytics: bd50d8f5d3f42dcab6da67944a849062470b0a19
firebase_core: ce5006bb48508ee4e71e0f429a3f519bb8ee2961
firebase_ml_vision: a40524ef47717f380239e19567c9dc050d8cc1de
FirebaseAnalytics: cf95d3aab897612783020fbd98401d5366f135ee
FirebaseCore: a1dd9dd6355a8356dd30a8f076839e242285a81c
FirebaseCoreDiagnostics: 5e78803ab276bc5b50340e3c539c06c3de35c649
FirebaseCoreDiagnosticsInterop: 296e2c5f5314500a850ad0b83e9e7c10b011a850
FirebaseInstallations: 575cd32f2aec0feeb0e44f5d0110a09e5e60b47b
FirebaseInstanceID: 031d7d0c8e7b5c030bbeb4d2a690550375e83fec
FirebaseMLCommon: 074a67e05122b1c9f6401a4e33b2cea3b4efd224
FirebaseMLVision: 7a456009787690e3b53436092ae9b635563de8f3
Flutter: 0e3d915762c693b495b44d77113d4970485de6ec
GoogleAPIClientForREST: 0f19a8280dfe6471f76016645d26eb5dae305101
GoogleAppMeasurement: d0560d915abf15e692e8538ba1d58442217b6aff
GoogleDataTransport: 47fe3b8e1673e5187dfd615656a3c5034f150d69
GoogleDataTransportCCTSupport: 36f69887fd212db6d7ef4dd45ba44523717a434e
GoogleToolboxForMac: 800648f8b3127618c1b59c7f97684427630c5ea3
GoogleUtilities: 06eb53bb579efe7099152735900dd04bf09e7275
GTMSessionFetcher: cea130bbfe5a7edc8d06d3f0d17288c32ffe9925
nanopb: 18003b5e52dab79db540fe93fe9579f399bd1ccd
path_provider: fb74bd0465e96b594bb3b5088ee4a4e7bb1f2a9d
PromisesObjC: c119f3cd559f50b7ae681fa59dc1acd19173b7e6
Protobuf: 176220c526ad8bd09ab1fb40a978eac3fef665f7

PODFILE CHECKSUM: 1b66dae606f75376c5f2135a8290850eeb09ae83
PODFILE CHECKSUM: 836bcbcff58bec3d0a1a7a17cf269f9fcc45b6cb

COCOAPODS: 1.8.4
28 changes: 25 additions & 3 deletions lib/widgets/screens/camera.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'dart:async';
import 'dart:io';

import 'package:camera/camera.dart';
import 'package:firebase_ml_vision/firebase_ml_vision.dart';
import 'package:flutter/material.dart';
import 'package:flutter_sandbox/widgets/components/drawer.dart';
import 'package:path/path.dart' show join;
Expand Down Expand Up @@ -89,11 +90,21 @@ class TakePictureScreenState extends State<TakePictureScreen> {
// Attempt to take a picture and log where it's been saved.
await _controller.takePicture(path);

// Recognize text from image using Cloud Vision API
final File imageFile = File(path);
final FirebaseVisionImage visionImage =
FirebaseVisionImage.fromFile(imageFile);
final TextRecognizer textRecognizer =
FirebaseVision.instance.cloudTextRecognizer();
final VisionText visionText =
await textRecognizer.processImage(visionImage);

// If the picture was taken, display it on a new screen.
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => DisplayPictureScreen(imagePath: path),
builder: (context) => DisplayPictureScreen(
imagePath: path, recognizedText: visionText.text),
),
);
} catch (e) {
Expand All @@ -109,16 +120,27 @@ class TakePictureScreenState extends State<TakePictureScreen> {
// A widget that displays the picture taken by the user.
class DisplayPictureScreen extends StatelessWidget {
final String imagePath;
final String recognizedText;

const DisplayPictureScreen({Key key, this.imagePath}) : super(key: key);
const DisplayPictureScreen({Key key, this.imagePath, this.recognizedText})
: super(key: key);

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text('Display the Picture')),
// The image is stored as a file on the device. Use the `Image.file`
// constructor with the given path to display the image.
body: Image.file(File(imagePath)),
body: Center(
child: SingleChildScrollView(
child: Column(
children: <Widget>[
Image.file(File(imagePath)),
Text(recognizedText),
],
),
),
),
);
}
}
7 changes: 7 additions & 0 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.5+1"
firebase_ml_vision:
dependency: "direct main"
description:
name: firebase_ml_vision
url: "https://pub.dartlang.org"
source: hosted
version: "0.9.3+5"
flutter:
dependency: "direct main"
description: flutter
Expand Down
1 change: 1 addition & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ dependencies:
cupertino_icons: ^0.1.2
firebase_core: ^0.2.5
firebase_analytics: ^1.0.4
firebase_ml_vision: ^0.9.3+5
flutter:
sdk: flutter
path: ^1.6.4
Expand Down