2026-11-22 17:52:47 +08:00
|
|
|
|
// Scans the QR code a pairing link is shown as in OpenChamber's "connect a
|
|
|
|
|
|
// device" dialog. The camera stream's Y plane goes to zxing2 in a background
|
|
|
|
|
|
// isolate; only a decoded `openchamber://connect` link ends the scan.
|
|
|
|
|
|
import 'dart:async';
|
|
|
|
|
|
import 'dart:math' as math;
|
|
|
|
|
|
|
|
|
|
|
|
import 'package:camera/camera.dart';
|
|
|
|
|
|
import 'package:flutter/foundation.dart';
|
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
|
import 'package:flutter/services.dart';
|
|
|
|
|
|
|
|
|
|
|
|
import '../api/qr_scan.dart';
|
2026-11-26 09:04:25 +08:00
|
|
|
|
import '../l10n.dart';
|
2026-11-22 17:52:47 +08:00
|
|
|
|
|
|
|
|
|
|
/// Opens the scanner and returns the pairing link, or null when cancelled.
|
|
|
|
|
|
Future<String?> scanPairingQr(BuildContext context) {
|
|
|
|
|
|
return Navigator.of(context).push<String>(MaterialPageRoute(
|
|
|
|
|
|
fullscreenDialog: true,
|
|
|
|
|
|
builder: (_) => const ScanQrScreen(),
|
|
|
|
|
|
));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
class ScanQrScreen extends StatefulWidget {
|
|
|
|
|
|
const ScanQrScreen({super.key});
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
|
State<ScanQrScreen> createState() => _ScanQrScreenState();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
class _ScanQrScreenState extends State<ScanQrScreen> {
|
|
|
|
|
|
CameraController? _controller;
|
|
|
|
|
|
String? _error;
|
|
|
|
|
|
String? _hint;
|
|
|
|
|
|
bool _decoding = false;
|
|
|
|
|
|
bool _found = false;
|
|
|
|
|
|
bool _torch = false;
|
|
|
|
|
|
Timer? _hintTimer;
|
2026-11-23 12:26:16 +08:00
|
|
|
|
Timer? _watchdog;
|
|
|
|
|
|
Timer? _slowHint;
|
|
|
|
|
|
|
|
|
|
|
|
/// Frame diagnostics: a scanner that silently does nothing is impossible to
|
|
|
|
|
|
/// tell apart from a camera that sends no frames without these.
|
|
|
|
|
|
int _frames = 0;
|
|
|
|
|
|
int _decodeAttempts = 0;
|
|
|
|
|
|
int _decodeErrors = 0;
|
|
|
|
|
|
bool _loggedFrame = false;
|
|
|
|
|
|
String? _frameShape;
|
2026-11-22 17:52:47 +08:00
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
|
void initState() {
|
|
|
|
|
|
super.initState();
|
|
|
|
|
|
_start();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
|
void dispose() {
|
|
|
|
|
|
_hintTimer?.cancel();
|
2026-11-23 12:26:16 +08:00
|
|
|
|
_watchdog?.cancel();
|
|
|
|
|
|
_slowHint?.cancel();
|
2026-11-22 17:52:47 +08:00
|
|
|
|
_closeCamera();
|
|
|
|
|
|
super.dispose();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void _closeCamera() {
|
|
|
|
|
|
final controller = _controller;
|
|
|
|
|
|
_controller = null;
|
|
|
|
|
|
if (controller == null) return;
|
|
|
|
|
|
controller.stopImageStream().catchError((_) {});
|
|
|
|
|
|
controller.dispose();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Future<void> _start() async {
|
2026-11-23 12:26:16 +08:00
|
|
|
|
_closeCamera();
|
|
|
|
|
|
_watchdog?.cancel();
|
|
|
|
|
|
_hintTimer?.cancel();
|
|
|
|
|
|
_slowHint?.cancel();
|
|
|
|
|
|
_frames = 0;
|
|
|
|
|
|
_decodeAttempts = 0;
|
|
|
|
|
|
_decodeErrors = 0;
|
|
|
|
|
|
_loggedFrame = false;
|
|
|
|
|
|
_frameShape = null;
|
2026-11-22 17:52:47 +08:00
|
|
|
|
setState(() {
|
|
|
|
|
|
_error = null;
|
2026-11-23 12:26:16 +08:00
|
|
|
|
_hint = null;
|
2026-11-22 17:52:47 +08:00
|
|
|
|
_found = false;
|
|
|
|
|
|
});
|
2026-11-23 12:26:16 +08:00
|
|
|
|
|
|
|
|
|
|
final List<CameraDescription> cameras;
|
2026-11-22 17:52:47 +08:00
|
|
|
|
try {
|
2026-11-23 12:26:16 +08:00
|
|
|
|
cameras = await availableCameras();
|
|
|
|
|
|
} on CameraException catch (error) {
|
|
|
|
|
|
if (mounted) setState(() => _error = _cameraError(error));
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (cameras.isEmpty) {
|
2026-11-26 11:48:16 +08:00
|
|
|
|
if (mounted) setState(() => _error = tr('No camera available'));
|
2026-11-23 12:26:16 +08:00
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
CameraDescription pick = cameras.first;
|
|
|
|
|
|
for (final camera in cameras) {
|
|
|
|
|
|
if (camera.lensDirection == CameraLensDirection.back) {
|
|
|
|
|
|
pick = camera;
|
|
|
|
|
|
break;
|
2026-11-22 17:52:47 +08:00
|
|
|
|
}
|
2026-11-23 12:26:16 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// A dense pairing QR needs pixels: 720p first, then 480p for cameras or
|
|
|
|
|
|
// devices that refuse the higher analysis size.
|
|
|
|
|
|
Object? lastError;
|
|
|
|
|
|
for (final preset in const [ResolutionPreset.high, ResolutionPreset.medium]) {
|
2026-11-22 17:52:47 +08:00
|
|
|
|
final controller = CameraController(
|
|
|
|
|
|
pick,
|
2026-11-23 12:26:16 +08:00
|
|
|
|
preset,
|
2026-11-22 17:52:47 +08:00
|
|
|
|
enableAudio: false,
|
|
|
|
|
|
imageFormatGroup: ImageFormatGroup.yuv420,
|
|
|
|
|
|
);
|
2026-11-23 12:26:16 +08:00
|
|
|
|
try {
|
|
|
|
|
|
await controller.initialize();
|
|
|
|
|
|
if (!mounted) {
|
|
|
|
|
|
await controller.dispose();
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
setState(() => _controller = controller);
|
|
|
|
|
|
await controller.startImageStream(_onFrame);
|
|
|
|
|
|
_watchdog = Timer(const Duration(seconds: 4), () {
|
|
|
|
|
|
if (!mounted || _frames > 0 || _error != null) return;
|
2026-11-26 11:48:16 +08:00
|
|
|
|
setState(() => _hint = tr('No camera frames received; close and try again'));
|
2026-11-23 12:26:16 +08:00
|
|
|
|
});
|
|
|
|
|
|
_slowHint = Timer(const Duration(seconds: 12), () {
|
|
|
|
|
|
if (!mounted || _found || _frames == 0) return;
|
2026-11-26 11:48:16 +08:00
|
|
|
|
_showHint(tr('No QR code yet; move closer or fill the frame with the code'),
|
2026-11-26 09:04:25 +08:00
|
|
|
|
sticky: true);
|
2026-11-23 12:26:16 +08:00
|
|
|
|
});
|
2026-11-22 17:52:47 +08:00
|
|
|
|
return;
|
2026-11-23 12:26:16 +08:00
|
|
|
|
} catch (error) {
|
|
|
|
|
|
lastError = error;
|
|
|
|
|
|
try {
|
|
|
|
|
|
await controller.stopImageStream();
|
|
|
|
|
|
} catch (_) {}
|
|
|
|
|
|
try {
|
|
|
|
|
|
await controller.dispose();
|
|
|
|
|
|
} catch (_) {}
|
|
|
|
|
|
if (mounted && _controller == controller) {
|
|
|
|
|
|
setState(() => _controller = null);
|
|
|
|
|
|
}
|
2026-11-22 17:52:47 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2026-11-23 12:26:16 +08:00
|
|
|
|
if (mounted) setState(() => _error = _cameraError(lastError));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
String _cameraError(Object? error) {
|
|
|
|
|
|
if (error is CameraException) {
|
|
|
|
|
|
if (error.code == 'CameraAccessDenied' ||
|
|
|
|
|
|
error.code == 'CameraAccessDeniedWithoutPrompt' ||
|
|
|
|
|
|
error.code == 'CameraAccessRestricted') {
|
2026-11-26 11:48:16 +08:00
|
|
|
|
return tr('Camera permission is required to scan. Allow OpenChamber to use the camera in system settings.');
|
2026-11-23 12:26:16 +08:00
|
|
|
|
}
|
2026-11-26 11:48:16 +08:00
|
|
|
|
return trArgs('Could not open the camera: {0}', [error.description ?? error.code]);
|
2026-11-23 12:26:16 +08:00
|
|
|
|
}
|
2026-11-26 11:48:16 +08:00
|
|
|
|
return trArgs('Could not open the camera: {0}', [error]);
|
2026-11-22 17:52:47 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void _onFrame(CameraImage image) {
|
2026-11-23 12:26:16 +08:00
|
|
|
|
_frames += 1;
|
|
|
|
|
|
if (!_loggedFrame && image.planes.isNotEmpty) {
|
|
|
|
|
|
_loggedFrame = true;
|
|
|
|
|
|
final plane = image.planes.first;
|
|
|
|
|
|
_frameShape =
|
|
|
|
|
|
'${image.width}×${image.height} ${image.format.group.name}';
|
|
|
|
|
|
debugPrint('qr: frame ${image.width}x${image.height} '
|
|
|
|
|
|
'${image.format.group.name} planes=${image.planes.length} '
|
|
|
|
|
|
'row=${plane.bytesPerRow} pixel=${plane.bytesPerPixel} '
|
|
|
|
|
|
'bytes=${plane.bytes.length}');
|
|
|
|
|
|
}
|
|
|
|
|
|
if (mounted && _frames % 10 == 0) {
|
|
|
|
|
|
// Refresh the small diagnostics line without rebuilding 30x a second.
|
|
|
|
|
|
setState(() {});
|
|
|
|
|
|
}
|
2026-11-22 17:52:47 +08:00
|
|
|
|
if (_decoding || _found || !mounted) return;
|
|
|
|
|
|
final frame = _frameOf(image);
|
|
|
|
|
|
if (frame == null) return;
|
|
|
|
|
|
_decoding = true;
|
2026-11-23 12:26:16 +08:00
|
|
|
|
_decodeAttempts += 1;
|
|
|
|
|
|
// Decoding off the UI thread: frames arrive at 30/s and a decode is not
|
|
|
|
|
|
// free, so only one is in flight at a time.
|
2026-11-22 17:52:47 +08:00
|
|
|
|
compute(decodeQrFrame, frame).then((text) {
|
|
|
|
|
|
_decoding = false;
|
|
|
|
|
|
if (!mounted || text == null || _found) return;
|
|
|
|
|
|
if (text.trim().startsWith('openchamber://connect')) {
|
|
|
|
|
|
_accept(text.trim());
|
|
|
|
|
|
} else {
|
2026-11-26 11:48:16 +08:00
|
|
|
|
_showHint(tr('This is not an OpenChamber pairing QR code'));
|
2026-11-22 17:52:47 +08:00
|
|
|
|
}
|
2026-11-23 12:26:16 +08:00
|
|
|
|
}).catchError((Object error) {
|
2026-11-22 17:52:47 +08:00
|
|
|
|
_decoding = false;
|
2026-11-23 12:26:16 +08:00
|
|
|
|
_decodeErrors += 1;
|
|
|
|
|
|
if (_decodeErrors == 1) {
|
|
|
|
|
|
debugPrint('qr: decode failed: $error');
|
2026-11-26 11:48:16 +08:00
|
|
|
|
if (mounted) _showHint(tr('Could not decode the QR code; try again'));
|
2026-11-23 12:26:16 +08:00
|
|
|
|
}
|
2026-11-22 17:52:47 +08:00
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
QrFrame? _frameOf(CameraImage image) {
|
|
|
|
|
|
if (image.planes.isEmpty) return null;
|
|
|
|
|
|
final plane = image.planes.first;
|
|
|
|
|
|
final group = image.format.group;
|
|
|
|
|
|
if (group == ImageFormatGroup.bgra8888) {
|
|
|
|
|
|
// The packed BGRA plane is not luminance yet.
|
|
|
|
|
|
final luminance = bgraToLuminance(
|
|
|
|
|
|
plane.bytes, image.width, image.height, plane.bytesPerRow);
|
|
|
|
|
|
return QrFrame(
|
|
|
|
|
|
luminance: luminance,
|
|
|
|
|
|
width: image.width,
|
|
|
|
|
|
height: image.height,
|
|
|
|
|
|
rowStride: image.width,
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
|
|
|
|
|
return QrFrame(
|
|
|
|
|
|
luminance: plane.bytes,
|
|
|
|
|
|
width: image.width,
|
|
|
|
|
|
height: image.height,
|
|
|
|
|
|
rowStride: plane.bytesPerRow,
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-11-23 12:26:16 +08:00
|
|
|
|
void _showHint(String text, {bool sticky = false}) {
|
2026-11-22 17:52:47 +08:00
|
|
|
|
_hintTimer?.cancel();
|
|
|
|
|
|
if (mounted) setState(() => _hint = text);
|
2026-11-23 12:26:16 +08:00
|
|
|
|
if (sticky) return;
|
2026-11-22 17:52:47 +08:00
|
|
|
|
_hintTimer = Timer(const Duration(seconds: 2), () {
|
|
|
|
|
|
if (mounted) setState(() => _hint = null);
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Future<void> _accept(String text) async {
|
|
|
|
|
|
_found = true;
|
|
|
|
|
|
HapticFeedback.mediumImpact();
|
|
|
|
|
|
try {
|
|
|
|
|
|
await _controller?.stopImageStream();
|
|
|
|
|
|
} catch (_) {}
|
|
|
|
|
|
if (mounted) Navigator.of(context).pop(text);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Future<void> _toggleTorch() async {
|
|
|
|
|
|
final controller = _controller;
|
|
|
|
|
|
if (controller == null) return;
|
|
|
|
|
|
try {
|
|
|
|
|
|
await controller.setFlashMode(_torch ? FlashMode.off : FlashMode.torch);
|
|
|
|
|
|
if (mounted) setState(() => _torch = !_torch);
|
|
|
|
|
|
} catch (_) {
|
2026-11-26 11:48:16 +08:00
|
|
|
|
if (mounted) _showHint(tr('This camera does not support the flashlight'));
|
2026-11-22 17:52:47 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
|
final controller = _controller;
|
2026-11-23 12:26:16 +08:00
|
|
|
|
final ready =
|
|
|
|
|
|
controller != null && controller.value.isInitialized && _error == null;
|
2026-11-22 17:52:47 +08:00
|
|
|
|
return Scaffold(
|
|
|
|
|
|
backgroundColor: Colors.black,
|
|
|
|
|
|
body: Stack(
|
|
|
|
|
|
fit: StackFit.expand,
|
|
|
|
|
|
children: [
|
|
|
|
|
|
if (ready)
|
|
|
|
|
|
Center(child: CameraPreview(controller))
|
|
|
|
|
|
else if (_error != null)
|
|
|
|
|
|
Center(
|
|
|
|
|
|
child: Padding(
|
|
|
|
|
|
padding: const EdgeInsets.all(28),
|
|
|
|
|
|
child: Column(
|
|
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
|
|
children: [
|
|
|
|
|
|
const Icon(Icons.no_photography_outlined,
|
|
|
|
|
|
size: 36, color: Colors.white70),
|
|
|
|
|
|
const SizedBox(height: 12),
|
2026-11-26 11:48:16 +08:00
|
|
|
|
Text(_error!,
|
2026-11-22 17:52:47 +08:00
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
|
|
style: const TextStyle(color: Colors.white70)),
|
|
|
|
|
|
const SizedBox(height: 16),
|
|
|
|
|
|
FilledButton.tonal(
|
|
|
|
|
|
onPressed: _start,
|
2026-11-26 11:48:16 +08:00
|
|
|
|
child: const AppText('Retry'),
|
2026-11-22 17:52:47 +08:00
|
|
|
|
),
|
|
|
|
|
|
],
|
|
|
|
|
|
),
|
|
|
|
|
|
),
|
|
|
|
|
|
)
|
|
|
|
|
|
else
|
|
|
|
|
|
const Center(child: CircularProgressIndicator()),
|
|
|
|
|
|
if (ready) const IgnorePointer(child: CustomPaint(painter: _ScanOverlay())),
|
|
|
|
|
|
SafeArea(
|
|
|
|
|
|
child: Column(
|
|
|
|
|
|
children: [
|
|
|
|
|
|
Row(
|
|
|
|
|
|
children: [
|
|
|
|
|
|
IconButton(
|
2026-11-26 11:48:16 +08:00
|
|
|
|
tooltip: tr('Close'),
|
2026-11-22 17:52:47 +08:00
|
|
|
|
icon: const Icon(Icons.close),
|
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
|
onPressed: () => Navigator.of(context).pop(),
|
|
|
|
|
|
),
|
|
|
|
|
|
const Spacer(),
|
|
|
|
|
|
IconButton(
|
2026-11-26 11:48:16 +08:00
|
|
|
|
tooltip: tr('Flashlight'),
|
2026-11-22 17:52:47 +08:00
|
|
|
|
icon: Icon(_torch ? Icons.flash_on : Icons.flash_off),
|
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
|
onPressed: _toggleTorch,
|
|
|
|
|
|
),
|
|
|
|
|
|
],
|
|
|
|
|
|
),
|
|
|
|
|
|
const Spacer(),
|
|
|
|
|
|
Padding(
|
|
|
|
|
|
padding: const EdgeInsets.fromLTRB(24, 0, 24, 32),
|
|
|
|
|
|
child: Column(
|
|
|
|
|
|
children: [
|
2026-11-26 11:48:16 +08:00
|
|
|
|
Text(
|
|
|
|
|
|
_hint ?? tr('Put the pairing QR code inside the frame'),
|
2026-11-22 17:52:47 +08:00
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
|
|
style: const TextStyle(color: Colors.white, fontSize: 14),
|
|
|
|
|
|
),
|
|
|
|
|
|
const SizedBox(height: 6),
|
2026-11-26 09:04:25 +08:00
|
|
|
|
const AppText(
|
2026-11-26 11:48:16 +08:00
|
|
|
|
'In the OpenChamber web app, open “Connect a device” and choose the QR code',
|
2026-11-22 17:52:47 +08:00
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
|
|
style: TextStyle(color: Colors.white60, fontSize: 12),
|
|
|
|
|
|
),
|
2026-11-23 12:26:16 +08:00
|
|
|
|
if (ready && _frames > 0)
|
|
|
|
|
|
Padding(
|
|
|
|
|
|
padding: const EdgeInsets.only(top: 8),
|
2026-11-26 11:48:16 +08:00
|
|
|
|
child: Text(
|
|
|
|
|
|
trArgs('{0} · {1} frames scanned / {2} decode attempts',
|
2026-11-26 09:04:25 +08:00
|
|
|
|
[_frameShape ?? '', _frames, _decodeAttempts]),
|
2026-11-23 12:26:16 +08:00
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
|
|
style: const TextStyle(
|
|
|
|
|
|
color: Colors.white38,
|
|
|
|
|
|
fontSize: 11,
|
|
|
|
|
|
fontFeatures: [FontFeature.tabularFigures()],
|
|
|
|
|
|
),
|
|
|
|
|
|
),
|
|
|
|
|
|
),
|
2026-11-22 17:52:47 +08:00
|
|
|
|
],
|
|
|
|
|
|
),
|
|
|
|
|
|
),
|
|
|
|
|
|
],
|
|
|
|
|
|
),
|
|
|
|
|
|
),
|
|
|
|
|
|
],
|
|
|
|
|
|
),
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// Dims everything but the scan square and marks its corners.
|
|
|
|
|
|
class _ScanOverlay extends CustomPainter {
|
|
|
|
|
|
const _ScanOverlay();
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
|
void paint(Canvas canvas, Size size) {
|
|
|
|
|
|
final side = math.min(size.width, size.height) * 0.68;
|
|
|
|
|
|
final square = Rect.fromCenter(
|
|
|
|
|
|
center: Offset(size.width / 2, size.height / 2),
|
|
|
|
|
|
width: side,
|
|
|
|
|
|
height: side,
|
|
|
|
|
|
);
|
|
|
|
|
|
final radius = Radius.circular(side * 0.05);
|
|
|
|
|
|
final shade = Path()
|
|
|
|
|
|
..fillType = PathFillType.evenOdd
|
|
|
|
|
|
..addRect(Offset.zero & size)
|
|
|
|
|
|
..addRRect(RRect.fromRectAndRadius(square, radius));
|
|
|
|
|
|
canvas.drawPath(shade, Paint()..color = const Color(0x99000000));
|
|
|
|
|
|
|
|
|
|
|
|
final border = Paint()
|
|
|
|
|
|
..style = PaintingStyle.stroke
|
|
|
|
|
|
..strokeWidth = 2
|
|
|
|
|
|
..color = Colors.white.withValues(alpha: 0.85);
|
|
|
|
|
|
canvas.drawRRect(RRect.fromRectAndRadius(square, radius), border);
|
|
|
|
|
|
|
|
|
|
|
|
final corner = Paint()
|
|
|
|
|
|
..style = PaintingStyle.stroke
|
|
|
|
|
|
..strokeWidth = 4
|
|
|
|
|
|
..strokeCap = StrokeCap.round
|
|
|
|
|
|
..color = const Color(0xFFC6BFFF);
|
|
|
|
|
|
const arm = 28.0;
|
|
|
|
|
|
for (final (dx, dy, sx, sy) in [
|
|
|
|
|
|
(square.left, square.top, 1.0, 1.0),
|
|
|
|
|
|
(square.right, square.top, -1.0, 1.0),
|
|
|
|
|
|
(square.left, square.bottom, 1.0, -1.0),
|
|
|
|
|
|
(square.right, square.bottom, -1.0, -1.0),
|
|
|
|
|
|
]) {
|
|
|
|
|
|
canvas.drawLine(Offset(dx, dy), Offset(dx + arm * sx, dy), corner);
|
|
|
|
|
|
canvas.drawLine(Offset(dx, dy), Offset(dx, dy + arm * sy), corner);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
|
bool shouldRepaint(_ScanOverlay oldDelegate) => false;
|
|
|
|
|
|
}
|