import 'package:flutter/material.dart'; import 'package:mobile_scanner/mobile_scanner.dart'; class BarcodeScannerScreen extends StatelessWidget { const BarcodeScannerScreen({Key? key}) : super(key: key); @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: const Text("バーコードスキャン"), backgroundColor: Colors.black, ), body: MobileScanner( onDetect: (capture) { final List barcodes = capture.barcodes; if (barcodes.isNotEmpty) { final String? code = barcodes.first.rawValue; if (code != null) { Navigator.pop(context, code); } } }, ), ); } }