Showing
5 changed files
with
100 additions
and
7 deletions
| @@ -3,7 +3,7 @@ | @@ -3,7 +3,7 @@ | ||
| 3 | archiveVersion = 1; | 3 | archiveVersion = 1; |
| 4 | classes = { | 4 | classes = { |
| 5 | }; | 5 | }; |
| 6 | - objectVersion = 51; | 6 | + objectVersion = 54; |
| 7 | objects = { | 7 | objects = { |
| 8 | 8 | ||
| 9 | /* Begin PBXBuildFile section */ | 9 | /* Begin PBXBuildFile section */ |
| @@ -199,6 +199,7 @@ | @@ -199,6 +199,7 @@ | ||
| 199 | /* Begin PBXShellScriptBuildPhase section */ | 199 | /* Begin PBXShellScriptBuildPhase section */ |
| 200 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { | 200 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { |
| 201 | isa = PBXShellScriptBuildPhase; | 201 | isa = PBXShellScriptBuildPhase; |
| 202 | + alwaysOutOfDate = 1; | ||
| 202 | buildActionMask = 2147483647; | 203 | buildActionMask = 2147483647; |
| 203 | files = ( | 204 | files = ( |
| 204 | ); | 205 | ); |
| @@ -213,6 +214,7 @@ | @@ -213,6 +214,7 @@ | ||
| 213 | }; | 214 | }; |
| 214 | 9740EEB61CF901F6004384FC /* Run Script */ = { | 215 | 9740EEB61CF901F6004384FC /* Run Script */ = { |
| 215 | isa = PBXShellScriptBuildPhase; | 216 | isa = PBXShellScriptBuildPhase; |
| 217 | + alwaysOutOfDate = 1; | ||
| 216 | buildActionMask = 2147483647; | 218 | buildActionMask = 2147483647; |
| 217 | files = ( | 219 | files = ( |
| 218 | ); | 220 | ); |
| @@ -49,5 +49,7 @@ | @@ -49,5 +49,7 @@ | ||
| 49 | </array> | 49 | </array> |
| 50 | <key>UIViewControllerBasedStatusBarAppearance</key> | 50 | <key>UIViewControllerBasedStatusBarAppearance</key> |
| 51 | <false/> | 51 | <false/> |
| 52 | + <key>UIApplicationSupportsIndirectInputEvents</key> | ||
| 53 | + <true/> | ||
| 52 | </dict> | 54 | </dict> |
| 53 | </plist> | 55 | </plist> |
example/lib/barcode_scanner_pageview.dart
0 → 100644
| 1 | +import 'package:flutter/material.dart'; | ||
| 2 | +import 'package:mobile_scanner/mobile_scanner.dart'; | ||
| 3 | +import 'package:mobile_scanner_example/scanner_error_widget.dart'; | ||
| 4 | + | ||
| 5 | +class BarcodeScannerPageView extends StatefulWidget { | ||
| 6 | + const BarcodeScannerPageView({Key? key}) : super(key: key); | ||
| 7 | + | ||
| 8 | + @override | ||
| 9 | + _BarcodeScannerPageViewState createState() => _BarcodeScannerPageViewState(); | ||
| 10 | +} | ||
| 11 | + | ||
| 12 | +class _BarcodeScannerPageViewState extends State<BarcodeScannerPageView> | ||
| 13 | + with SingleTickerProviderStateMixin { | ||
| 14 | + BarcodeCapture? capture; | ||
| 15 | + | ||
| 16 | + Widget cameraView() { | ||
| 17 | + return Builder( | ||
| 18 | + builder: (context) { | ||
| 19 | + return Stack( | ||
| 20 | + children: [ | ||
| 21 | + MobileScanner( | ||
| 22 | + startDelay: true, | ||
| 23 | + controller: MobileScannerController(torchEnabled: true), | ||
| 24 | + fit: BoxFit.contain, | ||
| 25 | + errorBuilder: (context, error, child) { | ||
| 26 | + return ScannerErrorWidget(error: error); | ||
| 27 | + }, | ||
| 28 | + onDetect: (capture) { | ||
| 29 | + setState(() { | ||
| 30 | + this.capture = capture; | ||
| 31 | + }); | ||
| 32 | + }, | ||
| 33 | + ), | ||
| 34 | + Align( | ||
| 35 | + alignment: Alignment.bottomCenter, | ||
| 36 | + child: Container( | ||
| 37 | + alignment: Alignment.bottomCenter, | ||
| 38 | + height: 100, | ||
| 39 | + color: Colors.black.withOpacity(0.4), | ||
| 40 | + child: Row( | ||
| 41 | + mainAxisAlignment: MainAxisAlignment.spaceEvenly, | ||
| 42 | + children: [ | ||
| 43 | + Center( | ||
| 44 | + child: SizedBox( | ||
| 45 | + width: MediaQuery.of(context).size.width - 120, | ||
| 46 | + height: 50, | ||
| 47 | + child: FittedBox( | ||
| 48 | + child: Text( | ||
| 49 | + capture?.barcodes.first.rawValue ?? | ||
| 50 | + 'Scan something!', | ||
| 51 | + overflow: TextOverflow.fade, | ||
| 52 | + style: Theme.of(context) | ||
| 53 | + .textTheme | ||
| 54 | + .headlineMedium! | ||
| 55 | + .copyWith(color: Colors.white), | ||
| 56 | + ), | ||
| 57 | + ), | ||
| 58 | + ), | ||
| 59 | + ), | ||
| 60 | + ], | ||
| 61 | + ), | ||
| 62 | + ), | ||
| 63 | + ), | ||
| 64 | + ], | ||
| 65 | + ); | ||
| 66 | + }, | ||
| 67 | + ); | ||
| 68 | + } | ||
| 69 | + | ||
| 70 | + @override | ||
| 71 | + Widget build(BuildContext context) { | ||
| 72 | + return Scaffold( | ||
| 73 | + backgroundColor: Colors.black, | ||
| 74 | + body: PageView( | ||
| 75 | + children: [ | ||
| 76 | + cameraView(), | ||
| 77 | + Container(), | ||
| 78 | + cameraView(), | ||
| 79 | + cameraView(), | ||
| 80 | + ], | ||
| 81 | + ), | ||
| 82 | + ); | ||
| 83 | + } | ||
| 84 | +} |
| 1 | import 'package:flutter/material.dart'; | 1 | import 'package:flutter/material.dart'; |
| 2 | import 'package:mobile_scanner_example/barcode_list_scanner_controller.dart'; | 2 | import 'package:mobile_scanner_example/barcode_list_scanner_controller.dart'; |
| 3 | import 'package:mobile_scanner_example/barcode_scanner_controller.dart'; | 3 | import 'package:mobile_scanner_example/barcode_scanner_controller.dart'; |
| 4 | +import 'package:mobile_scanner_example/barcode_scanner_pageview.dart'; | ||
| 4 | import 'package:mobile_scanner_example/barcode_scanner_returning_image.dart'; | 5 | import 'package:mobile_scanner_example/barcode_scanner_returning_image.dart'; |
| 5 | import 'package:mobile_scanner_example/barcode_scanner_window.dart'; | 6 | import 'package:mobile_scanner_example/barcode_scanner_window.dart'; |
| 6 | import 'package:mobile_scanner_example/barcode_scanner_without_controller.dart'; | 7 | import 'package:mobile_scanner_example/barcode_scanner_without_controller.dart'; |
| @@ -84,6 +85,16 @@ class MyHome extends StatelessWidget { | @@ -84,6 +85,16 @@ class MyHome extends StatelessWidget { | ||
| 84 | }, | 85 | }, |
| 85 | child: const Text('MobileScanner with zoom slider'), | 86 | child: const Text('MobileScanner with zoom slider'), |
| 86 | ), | 87 | ), |
| 88 | + ElevatedButton( | ||
| 89 | + onPressed: () { | ||
| 90 | + Navigator.of(context).push( | ||
| 91 | + MaterialPageRoute( | ||
| 92 | + builder: (context) => const BarcodeScannerPageView(), | ||
| 93 | + ), | ||
| 94 | + ); | ||
| 95 | + }, | ||
| 96 | + child: const Text('MobileScanner pageView'), | ||
| 97 | + ), | ||
| 87 | ], | 98 | ], |
| 88 | ), | 99 | ), |
| 89 | ), | 100 | ), |
-
Please register or login to post a comment