import 'package:flutter/material.dart'; import 'package:gap/gap.dart'; import 'package:mobile_scanner/mobile_scanner.dart'; import 'package:ocbo_esign_validator/widgets/text_widget.dart'; class ValidatePage extends StatelessWidget { const ValidatePage({super.key}); @override Widget build(BuildContext context) { return const MaterialApp(debugShowCheckedModeBanner: false, home: BarcodeScannerScreen()); } } class BarcodeScannerScreen extends StatefulWidget { const BarcodeScannerScreen({super.key}); @override State createState() => _BarcodeScannerScreenState(); } class _BarcodeScannerScreenState extends State { String barcodeResult = "Point the camera at a barcode"; @override Widget build(BuildContext context) { return Scaffold( resizeToAvoidBottomInset: false, body: Container( alignment: Alignment.center, height: MediaQuery.of(context).size.height, decoration: const BoxDecoration( gradient: LinearGradient( begin: Alignment.topCenter, end: Alignment.bottomCenter, colors: [ Color.fromRGBO(39, 26, 47, 1), Color.fromRGBO(22, 33, 44, 1), Color.fromRGBO(22, 33, 44, 1), Color.fromRGBO(24, 45, 40, 1), ], ), ), child: Center( child: Padding( padding: const EdgeInsets.only(top: 64, left: 16, right: 16), child: Column( children: [ Expanded( flex: 2, child: ClipRRect( borderRadius: BorderRadius.circular(20), // Adjust the radius as needed child: MobileScanner( fit: BoxFit.cover, onDetect: (BarcodeCapture capture) { final List barcodes = capture.barcodes; if (barcodes.isNotEmpty && barcodes.first.rawValue != null) { setState(() { barcodeResult = barcodes.first.rawValue!; }); } }, ), ), ), Expanded( flex: 2, child: Column( children: [ Gap(20), TextWidget(text: 'Scan OCBO e-Sign QR', size: 20, bold: true), ], ), ), ], ), ), ), ), ); } }