custom_scanner_pkg 0.0.1 custom_scanner_pkg: ^0.0.1 copied to clipboard
Flutter package for custom scanning.
example/lib/main.dart
import 'package:custom_scanner_pkg/custom_scanner_pkg.dart';
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Scanner Package Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: const MyHomePage(title: 'Flutter Scanner Package Demo'),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({super.key, required this.title});
final String title;
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
String _scanBarcode = 'Unknown';
@override
void initState() {
super.initState();
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: Container(
alignment: Alignment.center,
child: Scrollbar(
child: Flex(
direction: Axis.vertical,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
SizedBox(
width: 200.0,
height: 300.0,
child: CustomScanner(
type: 'QR Code',
scanResult: (result) => {
setState(() {
_scanBarcode = result;
})
}),
),
SizedBox(
width: 400.0,
height: 300.0,
child: Text('Scan result : $_scanBarcode\n',
style: const TextStyle(fontSize: 20)))
]),
)));
}
}