AmolGangadhare / flutter_barcode_scanner

Barcode scanner plugin for flutter. Supports barcode scanning for Android and iOS
https://pub.dev/packages/flutter_barcode_scanner
MIT License
379 stars 455 forks source link

BarcodeScanner resizing #22

Closed alsdns016 closed 3 years ago

alsdns016 commented 5 years ago

hello. ( sorry English little. )

flutter_barcode_scanner good! ( Thank you! )

but i want flutter_barcode_scanner resizing.

ex) FlutterBarcodeScanner.getBarcodeStreamReceiver("#ff6666", "Cancel", false) .listen((barcode) { /// barcode to be used });

result full screen => I want a scanner area that matches the size of the layout (container, size box).

How do I resize flutter_barcode_scanner?

Thank you. have a nice day!

AmolGangadhare commented 5 years ago

Hello,

Thank you for using the plugin. This is a good idea to have a native view in flutter app. I've gone through some docs in flutter.dev. As this plugin uses native views to scan a barcode, we need to embed the native views in flutter app to achieve this. As of now, only android views embedding is supported, I don't think ios implementation is available. Also, they mentioned Embedding views is an expensive operation and should be avoided when a Flutter equivalent is possible. So, I'll go through some possible aspects and get back to you.

alsdns016 commented 5 years ago

Thank you for your reply. I want to use the appbar and bottom, and only the body part as a scanner.

Q.1) Embedding views is an expensive operation and should be avoided when a Flutter equivalent is possible ==> Is the part I want cost a lot? ( If the question is rude, please understand. It's hard to translate because I'm not good at English ... I will also study more about flutter. I'm still a beginner. )

thank you!

AmolGangadhare commented 5 years ago

embedding native views means showing plugin(which is a native part) in a container in flutter app (for android which is AndroidView class, please refer https://api.flutter.dev/flutter/widgets/AndroidView-class.html and for ios it is in release preview.). So it will impact the performance of the app as flutter and native both are running at the same time. As your requirement, you need to show scanner in a body part, you need to embed the native part in flutter app. I think this will impact on the performance of your app. Anyway, we can still try it out and check how much it will impact.

alsdns016 commented 5 years ago

Thanks for your reply.

dpatacean commented 5 years ago

@AmolGangadhare I think you can embed vies on iOS too. (Like google maps does), for iOS you need a flag in Info.plist and it should be fine.

AmolGangadhare commented 5 years ago

@dpatacean yes we can embed views in iOS, but the class is in release preview, there might be frequent changes as it is not a stable release yet. https://api.flutter.dev/flutter/widgets/UiKitView-class.html

AmolGangadhare commented 3 years ago

Closing this issue due to no activity and the issue not aligned with plugin roadmap.