import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; void main() { runApp( const ProviderScope( child: MyApp(), ), ); } class MyApp extends StatelessWidget { const MyApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( title: 'Barcode Scanner', theme: ThemeData( colorScheme: ColorScheme.fromSeed(seedColor: Colors.blue), useMaterial3: true, ), home: const HomePage(), debugShowCheckedModeBanner: false, ); } } class HomePage extends StatelessWidget { const HomePage({super.key}); @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: const Text('Barcode Scanner'), backgroundColor: Theme.of(context).colorScheme.inversePrimary, ), body: Column( children: [ // Scanner area placeholder Expanded( child: Container( color: Colors.black, child: const Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ Icon( Icons.qr_code_scanner, size: 100, color: Colors.white, ), SizedBox(height: 20), Text( 'Scanner will be here', style: TextStyle(color: Colors.white, fontSize: 18), ), Text( '(Camera permissions required)', style: TextStyle(color: Colors.white70, fontSize: 14), ), ], ), ), ), ), // Scan result display Container( padding: const EdgeInsets.all(16), color: Colors.grey[100], child: Row( children: [ const Icon(Icons.qr_code, size: 40), const SizedBox(width: 16), const Expanded( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( 'Last Scanned:', style: TextStyle(fontSize: 12, color: Colors.grey), ), Text( 'No barcode scanned yet', style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold), ), ], ), ), IconButton( icon: const Icon(Icons.edit), onPressed: () { // Navigate to detail page }, ), ], ), ), // History list Expanded( child: Container( color: Colors.white, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( padding: const EdgeInsets.all(16), child: const Text( 'Scan History', style: TextStyle( fontSize: 18, fontWeight: FontWeight.bold, ), ), ), Expanded( child: ListView.builder( itemCount: 5, itemBuilder: (context, index) { return ListTile( leading: const Icon(Icons.qr_code_2), title: Text('Barcode ${1234567890 + index}'), subtitle: Text('Scanned at ${DateTime.now().subtract(Duration(minutes: index * 5)).toString().substring(11, 16)}'), trailing: const Icon(Icons.chevron_right), onTap: () { // Navigate to detail }, ); }, ), ), ], ), ), ), ], ), ); } }