Toggle navigation
Toggle navigation
This project
Loading...
Sign in
flutter_package
/
mobile_scanner
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
Navaron Bracke
2022-11-21 11:11:11 +0100
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
38168abb2ec2d21a503342fd881324da755c29c3
38168abb
1 parent
3733ca52
Revert "remove obsolete example"
This reverts commit
6957e103
.
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
81 additions
and
0 deletions
example/lib/barcode_scanner_without_controller.dart
example/lib/main.dart
example/lib/barcode_scanner_without_controller.dart
0 → 100644
View file @
38168ab
import
'package:flutter/material.dart'
;
import
'package:mobile_scanner/mobile_scanner.dart'
;
class
BarcodeScannerWithoutController
extends
StatefulWidget
{
const
BarcodeScannerWithoutController
({
Key
?
key
})
:
super
(
key:
key
);
@override
_BarcodeScannerWithoutControllerState
createState
()
=>
_BarcodeScannerWithoutControllerState
();
}
class
_BarcodeScannerWithoutControllerState
extends
State
<
BarcodeScannerWithoutController
>
with
SingleTickerProviderStateMixin
{
BarcodeCapture
?
capture
;
@override
Widget
build
(
BuildContext
context
)
{
return
Scaffold
(
backgroundColor:
Colors
.
black
,
body:
Builder
(
builder:
(
context
)
{
return
Stack
(
children:
[
MobileScanner
(
fit:
BoxFit
.
contain
,
onDetect:
(
capture
)
{
setState
(()
{
this
.
capture
=
capture
;
});
},
),
Align
(
alignment:
Alignment
.
bottomCenter
,
child:
Container
(
alignment:
Alignment
.
bottomCenter
,
height:
100
,
color:
Colors
.
black
.
withOpacity
(
0.4
),
child:
Row
(
mainAxisAlignment:
MainAxisAlignment
.
spaceEvenly
,
children:
[
Center
(
child:
SizedBox
(
width:
MediaQuery
.
of
(
context
).
size
.
width
-
120
,
height:
50
,
child:
FittedBox
(
child:
Text
(
capture
?.
barcodes
.
first
.
rawValue
??
'Scan something!'
,
overflow:
TextOverflow
.
fade
,
style:
Theme
.
of
(
context
)
.
textTheme
.
headline4
!
.
copyWith
(
color:
Colors
.
white
),
),
),
),
),
],
),
),
),
],
);
},
),
);
}
}
...
...
example/lib/main.dart
View file @
38168ab
...
...
@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import
'package:mobile_scanner_example/barcode_list_scanner_controller.dart'
;
import
'package:mobile_scanner_example/barcode_scanner_controller.dart'
;
import
'package:mobile_scanner_example/barcode_scanner_returning_image.dart'
;
import
'package:mobile_scanner_example/barcode_scanner_without_controller.dart'
;
void
main
(
)
=>
runApp
(
const
MaterialApp
(
home:
MyHome
()));
...
...
@@ -50,6 +51,17 @@ class MyHome extends StatelessWidget {
child:
const
Text
(
'MobileScanner with Controller (returning image)'
),
),
ElevatedButton
(
onPressed:
()
{
Navigator
.
of
(
context
).
push
(
MaterialPageRoute
(
builder:
(
context
)
=>
const
BarcodeScannerWithoutController
(),
),
);
},
child:
const
Text
(
'MobileScanner without Controller'
),
),
],
),
),
...
...
Please
register
or
login
to post a comment