import 'package:barcode_scanner/pages/login_page/login_page_model.dart'; import 'package:barcode_scanner/router/go_router_builder.dart'; import 'package:barcode_scanner/router/go_secure_router_builder.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; class HomePage extends ConsumerStatefulWidget { const HomePage({super.key}); @override ConsumerState createState() => _HomePageState(); } class _HomePageState extends ConsumerState { @override Widget build(BuildContext context) { final primaryColor = Theme.of(context).primaryColor; return Scaffold( appBar: AppBar( backgroundColor: Colors.white, automaticallyImplyLeading: false, actions: [ IconButton( onPressed: () async { await ref.read(loginPageModelProvider.notifier).logOut(); WidgetsBinding.instance.addPostFrameCallback((timeStamp) { SplashRoute().go(context); }); }, icon: Icon(Icons.login), ), ], ), backgroundColor: Colors.white, body: Center( child: SingleChildScrollView( padding: const EdgeInsets.all(24), child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ /// HEADER ICON Container( width: 100, height: 100, decoration: BoxDecoration( color: primaryColor, shape: BoxShape.circle, boxShadow: [ BoxShadow( color: Color(0x225F3DFF), blurRadius: 20, offset: Offset(0, 12), ), ], ), child: const Center( child: Icon( Icons.qr_code_scanner_rounded, color: Colors.white, size: 50, ), ), ), const SizedBox(height: 24), /// TITLE const Text( 'Barcode Scanner', style: TextStyle(fontSize: 24, fontWeight: FontWeight.bold), ), const SizedBox(height: 12), /// SUBTITLE const Text( 'Scannez facilement tous vos code barre\nen quelques secondes', textAlign: TextAlign.center, style: TextStyle(fontSize: 16, color: Colors.grey), ), const SizedBox(height: 36), /// SCANNER PREVIEW AREA (placeholder) Container( width: 260, height: 200, padding: const EdgeInsets.all(40), decoration: BoxDecoration( color: const Color(0xFFF6F8FA), borderRadius: BorderRadius.circular(24), boxShadow: const [ BoxShadow( color: Color(0x11000000), blurRadius: 10, offset: Offset(0, 8), ), ], ), child: const Icon( Icons.qr_code_2_rounded, size: 60, color: Colors.black87, ), ), const SizedBox(height: 16), const Text( 'Pointez votre caméra vers le code\nbarre', textAlign: TextAlign.center, style: TextStyle(color: Colors.grey), ), const SizedBox(height: 40), /// START BUTTON SizedBox( width: double.infinity, child: ElevatedButton.icon( onPressed: () { ScannerRoute().push(context); }, style: ElevatedButton.styleFrom( backgroundColor: primaryColor, padding: const EdgeInsets.symmetric(vertical: 18), shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(16), ), ), icon: const Icon( Icons.qr_code_scanner_rounded, color: Colors.white, size: 30, ), label: const Text( 'Commencer le scan', style: TextStyle( fontSize: 16, fontWeight: FontWeight.bold, color: Colors.white, ), ), ), ), ], ), ), ), ); } }