cpd_2022_zi/lib/pages/scanner_page.dart

35 lines
978 B
Dart

import 'package:flutter/material.dart';
import 'package:mobile_scanner/mobile_scanner.dart';
import 'package:smoke_cess_app/service/settings_service.dart';
class ScannerPage extends StatelessWidget {
const ScannerPage({super.key});
@override
Widget build(BuildContext context) {
return Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Expanded(child: MobileScanner(fit: BoxFit.contain,onDetect: (capture) {
final List<Barcode> barcodes = capture.barcodes;
for (final barcode in barcodes) {
debugPrint('Barcode found! ${barcode.rawValue}');
} },
))
,
const SizedBox(height: 30),
ElevatedButton(
style: ElevatedButton.styleFrom(
textStyle: const TextStyle(fontSize: 20)),
onPressed: () {
loadSettings();
},
child: const Text('Read JSON'),
)
],
));
}
}