fix(scanner): riposiziona chip host e pulsanti su due righe per evitare overflow
This commit is contained in:
1 parent
6935020cac
commit
118311147d
3 files changed
+81
-72
No files matched your search
@@ -43,18 +43,18 @@ class ConnectionStatusChip extends StatelessWidget {
|
|||||||
},
|
},
|
||||||
borderRadius: BorderRadius.circular(20),
|
borderRadius: BorderRadius.circular(20),
|
||||||
child: Container(
|
child: Container(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 6),
|
padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 7),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: AppTheme.darkCard.withValues(alpha: 0.85),
|
color: AppTheme.darkCard.withValues(alpha: 0.9),
|
||||||
borderRadius: BorderRadius.circular(20),
|
borderRadius: BorderRadius.circular(20),
|
||||||
border: Border.all(
|
border: Border.all(
|
||||||
color: dotColor.withValues(alpha: 0.4),
|
color: dotColor.withValues(alpha: 0.5),
|
||||||
width: 1,
|
width: 1,
|
||||||
),
|
),
|
||||||
boxShadow: [
|
boxShadow: [
|
||||||
BoxShadow(
|
BoxShadow(
|
||||||
color: Colors.black.withValues(alpha: 0.2),
|
color: Colors.black.withValues(alpha: 0.3),
|
||||||
blurRadius: 8,
|
blurRadius: 10,
|
||||||
offset: const Offset(0, 2),
|
offset: const Offset(0, 2),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -79,22 +79,22 @@ class ConnectionStatusChip extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
const SizedBox(width: 8),
|
const SizedBox(width: 8),
|
||||||
ConstrainedBox(
|
ConstrainedBox(
|
||||||
constraints: const BoxConstraints(maxWidth: 130),
|
constraints: const BoxConstraints(maxWidth: 240),
|
||||||
child: Text(
|
child: Text(
|
||||||
label,
|
label,
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
color: AppTheme.darkTextPrimary,
|
color: AppTheme.darkTextPrimary,
|
||||||
fontSize: 12,
|
fontSize: 13,
|
||||||
fontWeight: FontWeight.w600,
|
fontWeight: FontWeight.w600,
|
||||||
),
|
),
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(width: 4),
|
const SizedBox(width: 6),
|
||||||
const Icon(
|
const Icon(
|
||||||
Icons.arrow_forward_ios_rounded,
|
Icons.arrow_forward_ios_rounded,
|
||||||
size: 10,
|
size: 11,
|
||||||
color: AppTheme.darkTextSecondary,
|
color: AppTheme.darkTextSecondary,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -92,75 +92,85 @@ class _ScannerScreenState extends State<ScannerScreen> with WidgetsBindingObserv
|
|||||||
// 2. High-Tech Laser Reticle Overlay
|
// 2. High-Tech Laser Reticle Overlay
|
||||||
const ScannerOverlay(),
|
const ScannerOverlay(),
|
||||||
|
|
||||||
// 3. Top Floating Glass Control Bar
|
// 3. Top Floating Glass Control Bar (disposto su due righe per evitare overflow)
|
||||||
SafeArea(
|
SafeArea(
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||||
child: Row(
|
child: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
// Torch Toggle
|
// Riga 1: Stato connessione / Nome host al centro
|
||||||
_CircleGlassButton(
|
const Center(
|
||||||
icon: scannerState.isTorchOn
|
child: ConnectionStatusChip(),
|
||||||
? Icons.flash_on_rounded
|
|
||||||
: Icons.flash_off_rounded,
|
|
||||||
color: scannerState.isTorchOn ? Colors.amber : Colors.white,
|
|
||||||
tooltip: 'Torcia',
|
|
||||||
onPressed: _toggleTorch,
|
|
||||||
),
|
),
|
||||||
const SizedBox(width: 8),
|
const SizedBox(height: 10),
|
||||||
|
|
||||||
// Camera Flip
|
// Riga 2: Pulsanti di controllo rapidi
|
||||||
_CircleGlassButton(
|
Row(
|
||||||
icon: Icons.flip_camera_ios_rounded,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
tooltip: 'Inverti Fotocamera',
|
children: [
|
||||||
onPressed: _switchCamera,
|
// Gruppo Sinistra: Torcia e Inverti Fotocamera
|
||||||
),
|
Row(
|
||||||
const SizedBox(width: 8),
|
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
|
// Gruppo Destra: Cronologia e Impostazioni
|
||||||
const Expanded(
|
Row(
|
||||||
child: Center(
|
mainAxisSize: MainAxisSize.min,
|
||||||
child: ConnectionStatusChip(),
|
children: [
|
||||||
),
|
BlocBuilder<HistoryCubit, HistoryState>(
|
||||||
),
|
builder: (context, historyState) {
|
||||||
const SizedBox(width: 8),
|
final count = historyState.history.length;
|
||||||
|
return Badge(
|
||||||
// History Button with Badge
|
isLabelVisible: count > 0,
|
||||||
BlocBuilder<HistoryCubit, HistoryState>(
|
label: Text(
|
||||||
builder: (context, historyState) {
|
count > 99 ? '99+' : count.toString(),
|
||||||
final count = historyState.history.length;
|
style: const TextStyle(fontSize: 10, fontWeight: FontWeight.bold),
|
||||||
return Badge(
|
),
|
||||||
isLabelVisible: count > 0,
|
backgroundColor: AppTheme.primary,
|
||||||
label: Text(
|
textColor: Colors.white,
|
||||||
count > 99 ? '99+' : count.toString(),
|
offset: const Offset(-2, 2),
|
||||||
style: const TextStyle(fontSize: 10, fontWeight: FontWeight.bold),
|
child: _CircleGlassButton(
|
||||||
),
|
icon: Icons.history_rounded,
|
||||||
backgroundColor: AppTheme.primary,
|
tooltip: 'Cronologia',
|
||||||
textColor: Colors.white,
|
onPressed: () {
|
||||||
offset: const Offset(-2, 2),
|
Navigator.of(context).push(
|
||||||
child: _CircleGlassButton(
|
MaterialPageRoute(builder: (_) => const HistoryScreen()),
|
||||||
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: () {
|
||||||
const SizedBox(width: 8),
|
Navigator.of(context).push(
|
||||||
|
MaterialPageRoute(builder: (_) => const SettingsScreen()),
|
||||||
// Settings Button
|
);
|
||||||
_CircleGlassButton(
|
},
|
||||||
icon: Icons.settings_outlined,
|
),
|
||||||
tooltip: 'Impostazioni',
|
],
|
||||||
onPressed: () {
|
),
|
||||||
Navigator.of(context).push(
|
],
|
||||||
MaterialPageRoute(builder: (_) => const SettingsScreen()),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -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/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/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/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/domain/repositories/connection_repository.dart';
|
||||||
import 'package:barcode_reader_app/features/connection/presentation/cubit/connection_cubit.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';
|
import 'package:barcode_reader_app/features/scanner/data/datasources/scan_history_datasource.dart';
|
||||||
|
|||||||
Reference in new issue
Block a user