cpd_2022_zi/lib/pages/scanner_page.dart

35 lines
978 B
Dart
Raw Normal View History

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