Files
barcode_reader_pc/app/lib/widgets/scanner_overlay.dart
T

81 lines
2.5 KiB
Dart

import 'package:flutter/material.dart';
class ScannerOverlay extends StatelessWidget {
const ScannerOverlay({super.key});
@override
Widget build(BuildContext context) {
return LayoutBuilder(
builder: (context, constraints) {
final width = constraints.maxWidth * 0.82;
final height = constraints.maxHeight * 0.40;
final left = (constraints.maxWidth - width) / 2;
final top = (constraints.maxHeight - height) / 2;
return Stack(
children: [
// Sfondo semi-trasparente scuro con ritaglio centrale
ColorFiltered(
colorFilter: const ColorFilter.mode(
Colors.black54,
BlendMode.srcOut,
),
child: Stack(
children: [
Container(
decoration: const BoxDecoration(
color: Colors.transparent,
),
child: Container(
margin: EdgeInsets.fromLTRB(left, top, left, constraints.maxHeight - top - height),
decoration: BoxDecoration(
color: Colors.black,
borderRadius: BorderRadius.circular(16),
),
),
),
],
),
),
// Cornice angoli del mirino
Positioned(
left: left,
top: top,
width: width,
height: height,
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(16),
border: Border.all(
color: Theme.of(context).colorScheme.primary.withValues(alpha: 0.8),
width: 2.5,
),
),
),
),
// Linea rossa guida centrale stile laser
Positioned(
left: left + 16,
top: top + (height / 2) - 1,
width: width - 32,
height: 2,
child: Container(
decoration: BoxDecoration(
color: Colors.redAccent.withValues(alpha: 0.85),
boxShadow: [
BoxShadow(
color: Colors.redAccent.withValues(alpha: 0.6),
blurRadius: 4,
spreadRadius: 1,
),
],
),
),
),
],
);
},
);
}
}