diff --git a/app/lib/features/connection/presentation/widgets/connection_status_chip.dart b/app/lib/features/connection/presentation/widgets/connection_status_chip.dart index 74e8b94..a6378ac 100644 --- a/app/lib/features/connection/presentation/widgets/connection_status_chip.dart +++ b/app/lib/features/connection/presentation/widgets/connection_status_chip.dart @@ -43,18 +43,18 @@ class ConnectionStatusChip extends StatelessWidget { }, borderRadius: BorderRadius.circular(20), child: Container( - padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 6), + padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 7), decoration: BoxDecoration( - color: AppTheme.darkCard.withValues(alpha: 0.85), + color: AppTheme.darkCard.withValues(alpha: 0.9), borderRadius: BorderRadius.circular(20), border: Border.all( - color: dotColor.withValues(alpha: 0.4), + color: dotColor.withValues(alpha: 0.5), width: 1, ), boxShadow: [ BoxShadow( - color: Colors.black.withValues(alpha: 0.2), - blurRadius: 8, + color: Colors.black.withValues(alpha: 0.3), + blurRadius: 10, offset: const Offset(0, 2), ), ], @@ -79,22 +79,22 @@ class ConnectionStatusChip extends StatelessWidget { ), const SizedBox(width: 8), ConstrainedBox( - constraints: const BoxConstraints(maxWidth: 130), + constraints: const BoxConstraints(maxWidth: 240), child: Text( label, style: const TextStyle( color: AppTheme.darkTextPrimary, - fontSize: 12, + fontSize: 13, fontWeight: FontWeight.w600, ), maxLines: 1, overflow: TextOverflow.ellipsis, ), ), - const SizedBox(width: 4), + const SizedBox(width: 6), const Icon( Icons.arrow_forward_ios_rounded, - size: 10, + size: 11, color: AppTheme.darkTextSecondary, ), ], diff --git a/app/lib/features/scanner/presentation/screens/scanner_screen.dart b/app/lib/features/scanner/presentation/screens/scanner_screen.dart index 8b6e2af..10b7d17 100644 --- a/app/lib/features/scanner/presentation/screens/scanner_screen.dart +++ b/app/lib/features/scanner/presentation/screens/scanner_screen.dart @@ -92,75 +92,85 @@ class _ScannerScreenState extends State with WidgetsBindingObserv // 2. High-Tech Laser Reticle Overlay const ScannerOverlay(), - // 3. Top Floating Glass Control Bar + // 3. Top Floating Glass Control Bar (disposto su due righe per evitare overflow) SafeArea( child: Padding( padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8), - child: Row( + child: Column( + mainAxisSize: MainAxisSize.min, children: [ - // Torch Toggle - _CircleGlassButton( - icon: scannerState.isTorchOn - ? Icons.flash_on_rounded - : Icons.flash_off_rounded, - color: scannerState.isTorchOn ? Colors.amber : Colors.white, - tooltip: 'Torcia', - onPressed: _toggleTorch, + // Riga 1: Stato connessione / Nome host al centro + const Center( + child: ConnectionStatusChip(), ), - const SizedBox(width: 8), + const SizedBox(height: 10), - // Camera Flip - _CircleGlassButton( - icon: Icons.flip_camera_ios_rounded, - tooltip: 'Inverti Fotocamera', - onPressed: _switchCamera, - ), - const SizedBox(width: 8), + // Riga 2: Pulsanti di controllo rapidi + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + // Gruppo Sinistra: Torcia e Inverti Fotocamera + Row( + mainAxisSize: MainAxisSize.min, + children: [ + _CircleGlassButton( + icon: scannerState.isTorchOn + ? Icons.flash_on_rounded + : Icons.flash_off_rounded, + color: scannerState.isTorchOn ? Colors.amber : Colors.white, + tooltip: 'Torcia', + onPressed: _toggleTorch, + ), + const SizedBox(width: 10), + _CircleGlassButton( + icon: Icons.flip_camera_ios_rounded, + tooltip: 'Inverti Fotocamera', + onPressed: _switchCamera, + ), + ], + ), - // Center: Connection Status Chip - const Expanded( - child: Center( - child: ConnectionStatusChip(), - ), - ), - const SizedBox(width: 8), - - // History Button with Badge - BlocBuilder( - builder: (context, historyState) { - final count = historyState.history.length; - return Badge( - isLabelVisible: count > 0, - label: Text( - count > 99 ? '99+' : count.toString(), - style: const TextStyle(fontSize: 10, fontWeight: FontWeight.bold), - ), - backgroundColor: AppTheme.primary, - textColor: Colors.white, - offset: const Offset(-2, 2), - child: _CircleGlassButton( - icon: Icons.history_rounded, - tooltip: 'Cronologia', - onPressed: () { - Navigator.of(context).push( - MaterialPageRoute(builder: (_) => const HistoryScreen()), - ); - }, - ), - ); - }, - ), - const SizedBox(width: 8), - - // Settings Button - _CircleGlassButton( - icon: Icons.settings_outlined, - tooltip: 'Impostazioni', - onPressed: () { - Navigator.of(context).push( - MaterialPageRoute(builder: (_) => const SettingsScreen()), - ); - }, + // Gruppo Destra: Cronologia e Impostazioni + Row( + mainAxisSize: MainAxisSize.min, + children: [ + BlocBuilder( + builder: (context, historyState) { + final count = historyState.history.length; + return Badge( + isLabelVisible: count > 0, + label: Text( + count > 99 ? '99+' : count.toString(), + style: const TextStyle(fontSize: 10, fontWeight: FontWeight.bold), + ), + backgroundColor: AppTheme.primary, + textColor: Colors.white, + offset: const Offset(-2, 2), + child: _CircleGlassButton( + icon: Icons.history_rounded, + tooltip: 'Cronologia', + onPressed: () { + Navigator.of(context).push( + MaterialPageRoute(builder: (_) => const HistoryScreen()), + ); + }, + ), + ); + }, + ), + const SizedBox(width: 10), + _CircleGlassButton( + icon: Icons.settings_outlined, + tooltip: 'Impostazioni', + onPressed: () { + Navigator.of(context).push( + MaterialPageRoute(builder: (_) => const SettingsScreen()), + ); + }, + ), + ], + ), + ], ), ], ), diff --git a/app/test/cubits_test.dart b/app/test/cubits_test.dart index 711a432..893df23 100644 --- a/app/test/cubits_test.dart +++ b/app/test/cubits_test.dart @@ -5,7 +5,6 @@ import 'package:barcode_reader_app/features/connection/data/datasources/connecti import 'package:barcode_reader_app/features/connection/data/datasources/connection_remote_datasource.dart'; import 'package:barcode_reader_app/features/connection/data/datasources/udp_discovery_datasource.dart'; import 'package:barcode_reader_app/features/connection/data/repositories/connection_repository_impl.dart'; -import 'package:barcode_reader_app/features/connection/domain/entities/server_connection_info.dart'; import 'package:barcode_reader_app/features/connection/domain/repositories/connection_repository.dart'; import 'package:barcode_reader_app/features/connection/presentation/cubit/connection_cubit.dart'; import 'package:barcode_reader_app/features/scanner/data/datasources/scan_history_datasource.dart';