Closed ir2pid closed 3 years ago
Flutter channel beta
[VERBOSE-2:ui_dart_state.cc(157)] Unhandled Exception: PlatformException(unregistered_view_type, trying to create a view with an unregistered type, unregistered view type: 'document_scanner') #0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:569:7) #1 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:156:18) <asynchronous suspension> #2 MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:329:12) #3 AndroidViewController._create (package:flutter/src/services/platform_views.dart:633:54) #4 AndroidViewController.setSize (package:flutter/src/services/platform_views.dart:550:14) #5 RenderAndroidView._sizePlatformView (package:flutter/src/rendering/platform_view.dart:175:29) #6 RenderAndroidView.performResize (package:flutter/src/rendering/platform_view.dart:156:5) #7 RenderObject.layout (package:flutter/src/rendering/object.dart:1746:9) #8 RenderProxyBoxMixin.performL<…>
import 'dart:io'; import 'dart:async'; import 'package:flutter/services.dart'; import 'package:Annoted/layers/util.dart'; import 'package:Annoted/util_ui.dart'; import 'package:document_scanner/document_scanner.dart'; import 'package:flutter/material.dart'; import 'package:Annoted/constants.dart'; class DocumentPage extends StatefulWidget { static String tag = 'document-page'; final String title; DocumentPage({Key key, this.title}) : super(key: key); @override _DocumentPageState createState() => _DocumentPageState(); } class _DocumentPageState extends State<DocumentPage> { String imageLocation; bool enableTorch; _DocumentPageState() {} @override Widget build(BuildContext context) { print("Widget build _DocumentPageState"); //final Map<String, String> args = ModalRoute.of(context).settings.arguments; //String noteId = args["noteId"]; return MaterialApp( home: Scaffold( appBar: AppBar( leading: UtilUI.getIcon(Icons.arrow_back_ios, util.getTheme(context).accentColor, constants.d24, callback: () => {done(context)}), title: UtilUI.getTextH1(constants.sTab2, constants, util.getTheme(context).accentColor)), floatingActionButton: FloatingActionButton( child: Icon(!enableTorch ? Icons.flash_on : Icons.flash_off), onPressed: () { setState(() { enableTorch = !enableTorch; }); }), body: Stack( children: <Widget>[ Column( children: <Widget>[ Expanded( child: imageLocation != null ? Image(image: FileImage(File.fromUri(Uri.file(imageLocation)))) : DocumentScanner( onPictureTaken: (String image) { print("document : " + image); setState(() { imageLocation = image.replaceRange(0, 7, ""); // imageLocation = image; }); print("document : " + imageLocation); }, brightness: 5, contrast: 1.3, enableTorch: enableTorch, ), ), ], ), imageLocation != null ? Positioned( bottom: 20, left: 0, right: 0, child: RaisedButton( child: Text("retry"), onPressed: () { setState(() { imageLocation = null; }); }), ) : Container(), ], ), ), ); } @override void initState() { enableTorch = false; super.initState(); } @override void dispose() { super.dispose(); } done(BuildContext context) { util.navigatePop(context, {"note": null}); } }
This issue should be addressed in the latest version.
Flutter channel beta