scan_tally_mobile_scanner 0.1.1
scan_tally_mobile_scanner: ^0.1.1 copied to clipboard
mobile_scanner camera adapter for scan_tally: continuous barcode counting with duplicate filtering, frame confirmation, undo and GS1 parsing.
scan_tally_mobile_scanner example #
A full app (camera tab, handheld scanner tab, count list with undo, GS1 view) lives in
packages/scan_tally/example.
import 'package:flutter/material.dart';
import 'package:mobile_scanner/mobile_scanner.dart';
import 'package:scan_tally/scan_tally_flutter.dart';
import 'package:scan_tally_mobile_scanner/scan_tally_mobile_scanner.dart';
class CountScreen extends StatefulWidget {
const CountScreen({super.key});
@override
State<CountScreen> createState() => _CountScreenState();
}
class _CountScreenState extends State<CountScreen> {
final controller = MobileScannerSource.createController();
final session = ScanSession(
confirmation: const FrameConfirmation(frames: 2),
feedbackPlayer: const FlutterScanFeedbackPlayer(),
);
@override
void initState() {
super.initState();
session.attach(MobileScannerSource(controller));
}
@override
void dispose() {
session.dispose();
controller.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) => Scaffold(
body: ScanFlash(
session: session,
child: Column(
children: [
Expanded(child: MobileScanner(controller: controller)),
Expanded(
child: ScanSessionBuilder(
session: session,
builder: (context, session) => ListView(
children: [
for (final e in session.entries) ListTile(title: Text(e.key), trailing: Text('${e.quantity}')),
],
),
),
),
],
),
),
floatingActionButton: FloatingActionButton(onPressed: session.undoLast, child: const Icon(Icons.undo)),
);
}