fix overlay multipli x stesso codice
This commit is contained in:
1 parent
579ddadeff
commit
b0f19ec5c7
4 files changed
+16
-11
No files matched your search
@@ -287,15 +287,15 @@ class _ScannerScreenState extends State<ScannerScreen>
|
|||||||
|
|
||||||
final now = DateTime.now();
|
final now = DateTime.now();
|
||||||
|
|
||||||
// 1. Update/Add detected items into sticky cache
|
// 1. Update/Add detected items into sticky cache - key is unique code to prevent duplicate badges
|
||||||
for (final item in items) {
|
for (final item in items) {
|
||||||
final key = item.selectionKey;
|
final code = item.code;
|
||||||
if (_trackedArItems.containsKey(key)) {
|
if (_trackedArItems.containsKey(code)) {
|
||||||
final entry = _trackedArItems[key]!;
|
final entry = _trackedArItems[code]!;
|
||||||
entry.item = item; // Update coordinates for live tracking
|
entry.item = item; // Update coordinates for smooth live tracking
|
||||||
entry.lastSeen = now;
|
entry.lastSeen = now;
|
||||||
} else {
|
} else {
|
||||||
_trackedArItems[key] = _TrackedBarcodeEntry(
|
_trackedArItems[code] = _TrackedBarcodeEntry(
|
||||||
item: item,
|
item: item,
|
||||||
lastSeen: now,
|
lastSeen: now,
|
||||||
);
|
);
|
||||||
@@ -451,8 +451,10 @@ class _ScannerScreenState extends State<ScannerScreen>
|
|||||||
if (success) {
|
if (success) {
|
||||||
setState(() {
|
setState(() {
|
||||||
if (_frozenSnapshot != null) {
|
if (_frozenSnapshot != null) {
|
||||||
|
_sentFrozenKeys.add(item.code);
|
||||||
_sentFrozenKeys.add(item.selectionKey);
|
_sentFrozenKeys.add(item.selectionKey);
|
||||||
} else {
|
} else {
|
||||||
|
_sentLiveKeys.add(item.code);
|
||||||
_sentLiveKeys.add(item.selectionKey);
|
_sentLiveKeys.add(item.selectionKey);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -35,7 +35,8 @@ class ArBarcodeOverlay extends StatelessWidget {
|
|||||||
safeBounds: safeBounds,
|
safeBounds: safeBounds,
|
||||||
measureBadge: (item) => _measureBadge(
|
measureBadge: (item) => _measureBadge(
|
||||||
item,
|
item,
|
||||||
isSent: sentKeys.contains(item.selectionKey),
|
isSent: sentKeys.contains(item.code) ||
|
||||||
|
sentKeys.contains(item.selectionKey),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
: const <int, Rect>{};
|
: const <int, Rect>{};
|
||||||
@@ -71,7 +72,8 @@ class ArBarcodeOverlay extends StatelessWidget {
|
|||||||
rect: rect,
|
rect: rect,
|
||||||
child: _ArCodeBadge(
|
child: _ArCodeBadge(
|
||||||
item: item,
|
item: item,
|
||||||
isSent: sentKeys.contains(item.selectionKey),
|
isSent: sentKeys.contains(item.code) ||
|
||||||
|
sentKeys.contains(item.selectionKey),
|
||||||
onTap: onTapBarcode != null ? () => onTapBarcode!(item) : null,
|
onTap: onTapBarcode != null ? () => onTapBarcode!(item) : null,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -197,7 +199,8 @@ class _ArPolygonPainter extends CustomPainter {
|
|||||||
|
|
||||||
final isPrecisionMode = !showBadges;
|
final isPrecisionMode = !showBadges;
|
||||||
final isHighlighted = highlightedIndex == item.index;
|
final isHighlighted = highlightedIndex == item.index;
|
||||||
final isSent = sentKeys.contains(item.selectionKey);
|
final isSent = sentKeys.contains(item.code) ||
|
||||||
|
sentKeys.contains(item.selectionKey);
|
||||||
|
|
||||||
final Color strokeColor;
|
final Color strokeColor;
|
||||||
final double strokeWidth;
|
final double strokeWidth;
|
||||||
|
|||||||
@@ -250,7 +250,7 @@ class _ArFrozenPickerState extends State<ArFrozenPicker> {
|
|||||||
const SizedBox(height: 8),
|
const SizedBox(height: 8),
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
final item = snapshot.items[index];
|
final item = snapshot.items[index];
|
||||||
final isSent =
|
final isSent = widget.sentKeys.contains(item.code) ||
|
||||||
widget.sentKeys.contains(item.selectionKey);
|
widget.sentKeys.contains(item.selectionKey);
|
||||||
return _FrozenCodeRow(
|
return _FrozenCodeRow(
|
||||||
item: item,
|
item: item,
|
||||||
|
|||||||
+1
-1
@@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
|||||||
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
||||||
# In Windows, build-name is used as the major, minor, and patch parts
|
# In Windows, build-name is used as the major, minor, and patch parts
|
||||||
# of the product and file versions while build-number is used as the build suffix.
|
# of the product and file versions while build-number is used as the build suffix.
|
||||||
version: 1.0.2+3
|
version: 1.0.3+4
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ^3.13.4
|
sdk: ^3.13.4
|
||||||
|
|||||||
Reference in new issue
Block a user