-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
41d10fd
commit 976b75f
Showing
22 changed files
with
1,585 additions
and
170 deletions.
There are no files selected for viewing
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
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
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
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
Binary file not shown.
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
76 changes: 76 additions & 0 deletions
76
packages/google_vision_flutter/example/lib/document_text_detection_file.dart
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:google_vision_flutter/google_vision_flutter.dart'; | ||
import 'package:vision_demo/show_pdf.dart'; | ||
|
||
class DocumentTextDetectionFile extends StatefulWidget { | ||
const DocumentTextDetectionFile({super.key, required this.title}); | ||
|
||
final String title; | ||
|
||
@override | ||
State<DocumentTextDetectionFile> createState() => _MyHomePageState(); | ||
} | ||
|
||
class _MyHomePageState extends State<DocumentTextDetectionFile> { | ||
static const assetName = 'assets/allswell.pdf'; | ||
|
||
@override | ||
Widget build(BuildContext context) => SafeArea( | ||
child: Scaffold( | ||
appBar: AppBar( | ||
leading: IconButton( | ||
icon: const Icon(Icons.arrow_back, color: Colors.black), | ||
onPressed: () => Navigator.of(context).pop(), | ||
), | ||
title: Text(widget.title), | ||
), | ||
body: SingleChildScrollView( | ||
child: Column( | ||
mainAxisAlignment: MainAxisAlignment.start, | ||
children: <Widget>[ | ||
ElevatedButton( | ||
child: const Text('Show PDF Content'), | ||
onPressed: () => Navigator.of(context).push( | ||
MaterialPageRoute( | ||
builder: (context) => | ||
const ShowPdf(assetName: assetName), | ||
), | ||
)), | ||
const Padding( | ||
padding: EdgeInsets.all(8.0), | ||
child: Text( | ||
'Process result will appear below:', | ||
), | ||
), | ||
Padding( | ||
padding: const EdgeInsets.all(8.0), | ||
child: GoogleVisionFileBuilder.documentTextDetection( | ||
googleVision: GoogleVision.withAsset( | ||
'assets/service_credentials.json'), | ||
inputConfig: InputConfig.fromAsset('assets/allswell.pdf'), | ||
builder: ( | ||
BuildContext context, | ||
List<AnnotateFileResponse>? responses, | ||
Future<InputConfig> inputConfig, | ||
) => | ||
Padding( | ||
padding: const EdgeInsets.all(8.0), | ||
child: Column( | ||
children: responses! | ||
.map((annotateFileResponse) => Row( | ||
children: [ | ||
const Text('Total Pages - '), | ||
Text( | ||
'${annotateFileResponse.totalPages}'), | ||
], | ||
)) | ||
.toList()), | ||
), | ||
), | ||
) | ||
], | ||
), | ||
), | ||
), | ||
); | ||
} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:syncfusion_flutter_pdfviewer/pdfviewer.dart'; | ||
|
||
class ShowPdf extends StatefulWidget { | ||
const ShowPdf({super.key, required this.assetName}); | ||
|
||
final String assetName; | ||
|
||
@override | ||
State<ShowPdf> createState() => _MyHomePageState(); | ||
} | ||
|
||
class _MyHomePageState extends State<ShowPdf> { | ||
@override | ||
Widget build(BuildContext context) => SafeArea( | ||
child: Scaffold( | ||
body: SfPdfViewer.asset(widget.assetName), | ||
)); | ||
} |
Oops, something went wrong.