π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Address review feedback for inline OCR
Amrithesh Kakkoth Ente60fa580f0520
diff --git a/mobile/apps/photos/lib/ui/viewer/file/image_animation_demo.dart b/mobile/apps/photos/lib/ui/viewer/file/image_animation_demo.dartdeleted file mode 100644index b8cfad8e35..0000000000--- a/mobile/apps/photos/lib/ui/viewer/file/image_animation_demo.dart+++ /dev/null@@ -1,524 +0,0 @@-import "dart:math" as math;-import "dart:ui" as ui;--import "package:flutter/material.dart";--void main() {- runApp(- const MaterialApp(- debugShowCheckedModeBanner: false,- home: ImageAnimationDemo(),- ),- );-}--// βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ-// Demo page with animation switcher-// βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ--/// Demo page showcasing two image-overlay animation styles:-/// dot-grid ripple and scan-line with radial pulse.-class ImageAnimationDemo extends StatefulWidget {- const ImageAnimationDemo({super.key});-- @override- State<ImageAnimationDemo> createState() => _ImageAnimationDemoState();-}--class _ImageAnimationDemoState extends State<ImageAnimationDemo> {- bool _useScanPulse = false;-- @override- Widget build(BuildContext context) {- return Scaffold(- backgroundColor: Colors.black,- body: SafeArea(- child: Column(- children: [- const SizedBox(height: 16),- _buildSwitcher(),- const SizedBox(height: 24),- Expanded(- child: Center(- child: Padding(- padding: const EdgeInsets.symmetric(horizontal: 16),- child: AspectRatio(- aspectRatio: 3 / 2,- child: ClipRRect(- borderRadius: BorderRadius.circular(8),- child: _buildContent(),- ),- ),- ),- ),- ),- ],- ),- ),- );- }-- Widget _buildSwitcher() {- Widget tab(String label, bool active, VoidCallback onTap) {- return GestureDetector(- onTap: onTap,- child: Container(- padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),- decoration: BoxDecoration(- color: active- ? Colors.white.withValues(alpha: 0.12)- : Colors.transparent,- borderRadius: BorderRadius.circular(6),- ),- child: Text(- label,- style: TextStyle(- color: Colors.white.withValues(alpha: active ? 0.9 : 0.5),- fontSize: 14,- fontWeight: active ? FontWeight.w600 : FontWeight.w400,- ),- ),- ),- );- }-- return Container(- decoration: BoxDecoration(- color: Colors.white.withValues(alpha: 0.08),- borderRadius: BorderRadius.circular(8),- ),- padding: const EdgeInsets.all(4),- child: Row(- mainAxisSize: MainAxisSize.min,- children: [- tab(- "Dot grid",- !_useScanPulse,- () => setState(() => _useScanPulse = false),- ),- const SizedBox(width: 4),- tab(- "Scan + pulse",- _useScanPulse,- () => setState(() => _useScanPulse = true),- ),- ],- ),- );- }-- Widget _buildContent() {- return Stack(- fit: StackFit.expand,- children: [- // Placeholder image background- Container(- color: const Color(0xFF1A1A1A),- child: Center(- child: Icon(- Icons.landscape,- size: 64,- color: Colors.white.withValues(alpha: 0.3),- ),- ),- ),- // Dark overlay- ColoredBox(color: Colors.black.withValues(alpha: 0.15)),- // Breathe effect (scan+pulse mode only)- if (_useScanPulse) const _BreatheOverlay(),- // Animation overlay- IgnorePointer(- child: AnimatedSwitcher(- duration: const Duration(milliseconds: 300),- child: _useScanPulse- ? const ScanPulseOverlay(key: ValueKey("scan"))- : const DotGridOverlay(key: ValueKey("dots")),- ),- ),- ],- );- }-}--// βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ-// Animation A: Dot grid overlay-// βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ--/// A 24Γ16 grid of dots that pulse outward from the center in a ripple pattern.-class DotGridOverlay extends StatefulWidget {- const DotGridOverlay({super.key});-- @override- State<DotGridOverlay> createState() => _DotGridOverlayState();-}--class _DotGridOverlayState extends State<DotGridOverlay>- with SingleTickerProviderStateMixin {- late final AnimationController _controller;-- @override- void initState() {- super.initState();- _controller = AnimationController(- vsync: this,- duration: const Duration(milliseconds: 2500),- )..repeat();- }-- @override- void dispose() {- _controller.dispose();- super.dispose();- }-- @override- Widget build(BuildContext context) {- return AnimatedBuilder(- animation: _controller,- builder: (context, _) {- return CustomPaint(- painter: _DotGridPainter(progress: _controller.value),- size: Size.infinite,- );- },- );- }-}--class _DotGridPainter extends CustomPainter {- static const int _cols = 24;- static const int _rows = 16;- // sqrt(50^2 + 50^2) β max distance from center in percentage space.- static const double _maxDist = 70.710678;-- final double progress;-- _DotGridPainter({required this.progress});-- @override- void paint(Canvas canvas, Size size) {- for (int r = 0; r < _rows; r++) {- for (int c = 0; c < _cols; c++) {- // Pixel position for drawing- final double x = ((c + 0.5) / _cols) * size.width;- final double y = ((r + 0.5) / _rows) * size.height;-- // Distance in percentage space (0-100) from center for delay- final double dx = ((c + 0.5) / _cols) * 100 - 50;- final double dy = ((r + 0.5) / _rows) * 100 - 50;- final double dist = math.sqrt(dx * dx + dy * dy);-- // Delay: (dist / maxDist) * 1.8s, normalized to cycle: * (1.8 / 2.5)- final double delay = (dist / _maxDist) * 0.72;-- double phase = (progress - delay) % 1.0;- if (phase < 0) phase += 1.0;-- // Ping-pong with ease-in-out within each half- double t;- if (phase < 0.5) {- t = _easeInOut(phase * 2);- } else {- t = _easeInOut((1.0 - phase) * 2);- }-- if (t < 0.01) continue;-- // CSS: scale(0)βscale(1)βscale(0), opacity 0β0.5β0- final double radius = 1.5 * t;- final double opacity = 0.5 * t;-- final paint = Paint()..color = Color.fromRGBO(255, 255, 255, opacity);- canvas.drawCircle(Offset(x, y), radius, paint);- }- }- }-- static double _easeInOut(double t) {- return t < 0.5 ? 2 * t * t : -1 + (4 - 2 * t) * t;- }-- @override- bool shouldRepaint(_DotGridPainter oldDelegate) =>- oldDelegate.progress != progress;-}--// βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ-// Animation B: Scan line + radial pulse + edge glow-// βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ--/// Composite overlay with a scanning line, radial pulse, and edge glow.-class ScanPulseOverlay extends StatefulWidget {- const ScanPulseOverlay({super.key});-- @override- State<ScanPulseOverlay> createState() => _ScanPulseOverlayState();-}--class _ScanPulseOverlayState extends State<ScanPulseOverlay>- with TickerProviderStateMixin {- late final AnimationController _scanController;- late final AnimationController _pulseController;- late final AnimationController _glowController;-- @override- void initState() {- super.initState();- _scanController = AnimationController(- vsync: this,- duration: const Duration(milliseconds: 4000),- )..repeat();- _pulseController = AnimationController(- vsync: this,- duration: const Duration(milliseconds: 4000),- )..repeat();- _glowController = AnimationController(- vsync: this,- duration: const Duration(milliseconds: 3500),- )..repeat();- }-- @override- void dispose() {- _scanController.dispose();- _pulseController.dispose();- _glowController.dispose();- super.dispose();- }-- @override- Widget build(BuildContext context) {- return Stack(- fit: StackFit.expand,- children: [- AnimatedBuilder(- animation: _scanController,- builder: (context, _) => CustomPaint(- painter: _ScanLinePainter(progress: _scanController.value),- size: Size.infinite,- ),- ),- AnimatedBuilder(- animation: _pulseController,- builder: (context, _) => CustomPaint(- painter: _RadialPulsePainter(progress: _pulseController.value),- size: Size.infinite,- ),- ),- AnimatedBuilder(- animation: _glowController,- builder: (context, _) => CustomPaint(- painter: _EdgeGlowPainter(progress: _glowController.value),- size: Size.infinite,- ),- ),- ],- );- }-}--// βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ-// Scan line painter-// βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ--/// Horizontal gradient line that sweeps from top to bottom.-class _ScanLinePainter extends CustomPainter {- final double progress;-- _ScanLinePainter({required this.progress});-- @override- void paint(Canvas canvas, Size size) {- // Position with ease-in-out: -2px β size.height- final double easedPos = _easeInOut(progress);- final double y = -2.0 + (size.height + 2.0) * easedPos;-- // Opacity: fade in 0β5%, full 5β95%, fade out 95β100%- double opacity;- if (progress < 0.05) {- opacity = progress / 0.05;- } else if (progress > 0.95) {- opacity = (1.0 - progress) / 0.05;- } else {- opacity = 1.0;- }-- // Glow behind the line- final glowPaint = Paint()- ..color = Color.fromRGBO(255, 220, 180, 0.1 * opacity)- ..maskFilter = const MaskFilter.blur(BlurStyle.normal, 20);- canvas.drawRect(- Rect.fromCenter(- center: Offset(size.width / 2, y + 1),- width: size.width + 12,- height: 14,- ),- glowPaint,- );-- // Main scan line with horizontal gradient- final lineRect = Rect.fromLTWH(0, y, size.width, 2);- final gradient = ui.Gradient.linear(- Offset(0, y),- Offset(size.width, y),- [- Colors.transparent,- Color.fromRGBO(255, 220, 180, 0.5 * opacity),- Color.fromRGBO(255, 255, 255, 0.4 * opacity),- Color.fromRGBO(255, 220, 180, 0.5 * opacity),- Colors.transparent,- ],- [0.0, 0.25, 0.5, 0.75, 1.0],- );- final linePaint = Paint()..shader = gradient;- canvas.drawRRect(- RRect.fromRectAndRadius(lineRect, const Radius.circular(1)),- linePaint,- );- }-- static double _easeInOut(double t) {- return t < 0.5 ? 2 * t * t : -1 + (4 - 2 * t) * t;- }-- @override- bool shouldRepaint(_ScanLinePainter oldDelegate) =>- oldDelegate.progress != progress;-}--// βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ-// Radial pulse painter-// βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ--/// Radial gradient that breathes from the center, scaling 0.6β1β0.6.-class _RadialPulsePainter extends CustomPainter {- final double progress;-- _RadialPulsePainter({required this.progress});-- @override- void paint(Canvas canvas, Size size) {- // Ping-pong with ease-in-out: scale 0.6β1β0.6, opacity 0β1β0- double t;- if (progress < 0.5) {- t = _easeInOut(progress * 2);- } else {- t = _easeInOut((1.0 - progress) * 2);- }-- final center = Offset(size.width / 2, size.height / 2);- final scale = 0.6 + 0.4 * t;- final double maxDim = math.max(size.width, size.height) * 0.6 * scale;-- final gradient = ui.Gradient.radial(- center,- maxDim,- [Color.fromRGBO(255, 240, 210, 0.08 * t), Colors.transparent],- [0.0, 0.6],- );- final paint = Paint()..shader = gradient;- canvas.drawRect(Offset.zero & size, paint);- }-- static double _easeInOut(double t) {- return t < 0.5 ? 2 * t * t : -1 + (4 - 2 * t) * t;- }-- @override- bool shouldRepaint(_RadialPulsePainter oldDelegate) =>- oldDelegate.progress != progress;-}--// βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ-// Edge glow painter (simulates CSS inset box-shadow)-// βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ--/// Pulsing inset glow around the edges, simulating CSS inset box-shadow.-class _EdgeGlowPainter extends CustomPainter {- final double progress;-- _EdgeGlowPainter({required this.progress});-- @override- void paint(Canvas canvas, Size size) {- // Ping-pong with ease-in-out- double t;- if (progress < 0.5) {- t = _easeInOut(progress * 2);- } else {- t = _easeInOut((1.0 - progress) * 2);- }-- final double blur = 40.0 + 20.0 * t;- final double alpha = 0.02 + 0.05 * t;- final color = Color.fromRGBO(255, 220, 180, alpha);-- // Draw thick stroked rect clipped to bounds β inset glow effect- canvas.save();- canvas.clipRRect(- RRect.fromRectAndRadius(Offset.zero & size, const Radius.circular(2)),- );- final paint = Paint()- ..style = PaintingStyle.stroke- ..strokeWidth = blur * 2- ..color = color- ..maskFilter = MaskFilter.blur(BlurStyle.normal, blur);- canvas.drawRRect(- RRect.fromRectAndRadius(Offset.zero & size, const Radius.circular(2)),- paint,- );- canvas.restore();- }-- static double _easeInOut(double t) {- return t < 0.5 ? 2 * t * t : -1 + (4 - 2 * t) * t;- }-- @override- bool shouldRepaint(_EdgeGlowPainter oldDelegate) =>- oldDelegate.progress != progress;-}--// βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ-// Breathe overlay β subtle brightness dimming for scan+pulse mode-// βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ--/// Simulates CSS `filter: brightness(0.92)` by overlaying a pulsing dark tint.-class _BreatheOverlay extends StatefulWidget {- const _BreatheOverlay();-- @override- State<_BreatheOverlay> createState() => _BreatheOverlayState();-}--class _BreatheOverlayState extends State<_BreatheOverlay>- with SingleTickerProviderStateMixin {- late final AnimationController _controller;-- @override- void initState() {- super.initState();- _controller = AnimationController(- vsync: this,- duration: const Duration(milliseconds: 3000),- )..repeat();- }-- @override- void dispose() {- _controller.dispose();- super.dispose();- }-- @override- Widget build(BuildContext context) {- return AnimatedBuilder(- animation: _controller,- builder: (context, _) {- // Brightness: 1.0 β 0.92 β 1.0 (darken by up to 8%)- final double darken = math.sin(_controller.value * math.pi) * 0.08;- return ColoredBox(color: Colors.black.withValues(alpha: darken));- },- );- }-}diff --git a/mobile/apps/photos/lib/ui/viewer/file/inline_text_detection.dart b/mobile/apps/photos/lib/ui/viewer/file/inline_text_detection.dartindex 1e8c0bb4df..6d7752c8ce 100644--- a/mobile/apps/photos/lib/ui/viewer/file/inline_text_detection.dart+++ b/mobile/apps/photos/lib/ui/viewer/file/inline_text_detection.dart@@ -1,5 +1,6 @@import "dart:async";import "dart:io";+import "dart:math" as math;import "package:flutter/foundation.dart";import "package:flutter/material.dart";@@ -11,7 +12,6 @@ import "package:photos/models/file/file.dart";import "package:photos/models/file/file_type.dart";import "package:photos/models/file/trash_file.dart";import "package:photos/states/detail_page_state.dart";-import "package:photos/ui/viewer/file/image_animation_demo.dart";import "package:photos/utils/file_util.dart";/// Inline text detection widget that mimics Apple's Live Text behavior:@@ -39,7 +39,9 @@ class InlineTextDetection extends StatefulWidget {}class _InlineTextDetectionState extends State<InlineTextDetection> {+ static const int _maxCacheSize = 200;static final Map<String, _HasTextResult> _hasTextCache = {};+ static final ValueNotifier<bool> _defaultZoomNotifier = ValueNotifier(false);final Logger _logger = Logger("InlineTextDetection");final MobileOcr _mobileOcr = MobileOcr();final TextDetectorController _detectorController = TextDetectorController();@@ -48,7 +50,6 @@ class _InlineTextDetectionState extends State<InlineTextDetection> {String? _localFilePath;int _requestId = 0;bool _overlayActive = false;- bool _userTriggered = false;Offset? _pendingLongPressPosition;@override@@ -76,7 +77,6 @@ class _InlineTextDetectionState extends State<InlineTextDetection> {setState(() {_localFilePath = null;_overlayActive = false;- _userTriggered = false;_pendingLongPressPosition = null;});}@@ -94,6 +94,13 @@ class _InlineTextDetectionState extends State<InlineTextDetection> {return "generated_${file.generatedID}";}+ static void _cacheResult(String key, _HasTextResult result) {+ if (_hasTextCache.length >= _maxCacheSize) {+ _hasTextCache.remove(_hasTextCache.keys.first);+ }+ _hasTextCache[key] = result;+ }+bool _isFileEligible(EnteFile file) {return file.fileType == FileType.image ||file.fileType == FileType.livePhoto;@@ -136,7 +143,7 @@ class _InlineTextDetectionState extends State<InlineTextDetection> {final File? localFile = await getFile(widget.file);if (!mounted || requestId != _requestId) return;if (localFile == null || !localFile.existsSync()) {- _hasTextCache[cacheKey] = const _HasTextResult(hasText: false);+ _cacheResult(cacheKey, const _HasTextResult(hasText: false));return;}@@ -165,7 +172,7 @@ class _InlineTextDetectionState extends State<InlineTextDetection> {hasText: hasText,localPath: hasText ? localFile.path : null,);- _hasTextCache[cacheKey] = result;+ _cacheResult(cacheKey, result);setState(() {_localFilePath = result.localPath;@@ -175,7 +182,7 @@ class _InlineTextDetectionState extends State<InlineTextDetection> {} catch (error, stackTrace) {_logger.severe("Text detection pre-check failed", error, stackTrace);if (!mounted || requestId != _requestId) return;- _hasTextCache[cacheKey] = const _HasTextResult(hasText: false);+ _cacheResult(cacheKey, const _HasTextResult(hasText: false));}}@@ -188,7 +195,6 @@ class _InlineTextDetectionState extends State<InlineTextDetection> {void _handleLongPress(LongPressStartDetails details) {if (_overlayActive) return; // Already active, let overlay handle itsetState(() {- _userTriggered = true;_pendingLongPressPosition = details.globalPosition;});// If hasText already completed and file path is ready, activate now@@ -225,7 +231,7 @@ class _InlineTextDetectionState extends State<InlineTextDetection> {}return ValueListenableBuilder<bool>(- valueListenable: isZoomedNotifier ?? ValueNotifier(false),+ valueListenable: isZoomedNotifier ?? _defaultZoomNotifier,builder: (context, isZoomed, _) {final bool shouldHide = widget.isGuestView || isZoomed;@@ -245,48 +251,61 @@ class _InlineTextDetectionState extends State<InlineTextDetection> {Widget _buildInlineOverlay(BuildContext context) {final l10n = context.l10n;- return Stack(- fit: StackFit.expand,- children: [- TextDetectorWidget(- key: ValueKey("ocr_$_localFilePath"),- imagePath: _localFilePath!,- autoDetect: !_userTriggered,- backgroundColor: Colors.transparent,- showUnselectedBoundaries: true,- overlayOnly: true,- showProcessingOverlay: false,- showEditorHint: false,- initialInteractionPosition: _pendingLongPressPosition,- controller: _detectorController,- strings: TextDetectorStrings(- processingOverlayMessage: l10n.ocrProcessingOverlayMessage,- selectionHint: l10n.ocrSelectionHint,- noTextDetected: l10n.ocrNoTextDetected,- retryButtonLabel: l10n.ocrRetryButtonLabel,- modelsNetworkRequiredError: l10n.ocrModelsNetworkRequiredError,- modelsPrepareFailed: l10n.ocrModelsPrepareFailed,- imageNotFoundError: l10n.ocrImageNotFoundError,- imageDecodeFailedError: l10n.ocrImageDecodeFailedError,- genericDetectError: l10n.ocrGenericDetectError,+ return ListenableBuilder(+ listenable: _detectorController,+ builder: (context, child) {+ final bool isProcessing =+ _detectorController.userAttemptedInteraction &&+ _detectorController.isProcessing &&+ !_detectorController.hasSelectableText;+ return IgnorePointer(+ ignoring: isProcessing,+ child: Stack(+ fit: StackFit.expand,+ children: [+ child!,+ if (isProcessing)+ IgnorePointer(+ child: Center(+ child: widget.file.hasDimensions+ ? AspectRatio(+ aspectRatio: widget.file.width / widget.file.height,+ child: const _WhiteDotWaveOverlay(),+ )+ : const _WhiteDotWaveOverlay(),+ ),+ ),+ ],),- onTextCopied: (text) {- HapticFeedback.lightImpact();- },- ),- ListenableBuilder(- listenable: _detectorController,- builder: (context, _) {- if (_detectorController.isProcessing &&- !_detectorController.hasSelectableText) {- return const IgnorePointer(- child: ScanPulseOverlay(),- );- }- return const SizedBox.shrink();- },+ );+ },+ child: TextDetectorWidget(+ key: ValueKey("ocr_$_localFilePath"),+ imagePath: _localFilePath!,+ autoDetect: true,+ backgroundColor: Colors.transparent,+ showUnselectedBoundaries: true,+ overlayOnly: true,+ showProcessingOverlay: false,+ showScanAnimation: false,+ showEditorHint: false,+ initialInteractionPosition: _pendingLongPressPosition,+ controller: _detectorController,+ strings: TextDetectorStrings(+ processingOverlayMessage: l10n.ocrProcessingOverlayMessage,+ selectionHint: l10n.ocrSelectionHint,+ noTextDetected: l10n.ocrNoTextDetected,+ retryButtonLabel: l10n.ocrRetryButtonLabel,+ modelsNetworkRequiredError: l10n.ocrModelsNetworkRequiredError,+ modelsPrepareFailed: l10n.ocrModelsPrepareFailed,+ imageNotFoundError: l10n.ocrImageNotFoundError,+ imageDecodeFailedError: l10n.ocrImageDecodeFailedError,+ genericDetectError: l10n.ocrGenericDetectError,),- ],+ onTextCopied: (text) {+ HapticFeedback.lightImpact();+ },+ ),);}}@@ -297,3 +316,100 @@ class _HasTextResult {const _HasTextResult({required this.hasText, this.localPath});}++/// White dot grid that pulses in a radial wave from center outward.+class _WhiteDotWaveOverlay extends StatefulWidget {+ const _WhiteDotWaveOverlay();++ @override+ State<_WhiteDotWaveOverlay> createState() => _WhiteDotWaveOverlayState();+}++class _WhiteDotWaveOverlayState extends State<_WhiteDotWaveOverlay>+ with SingleTickerProviderStateMixin {+ late final AnimationController _controller;++ @override+ void initState() {+ super.initState();+ _controller = AnimationController(+ vsync: this,+ duration: const Duration(milliseconds: 2500),+ )..repeat();+ }++ @override+ void dispose() {+ _controller.dispose();+ super.dispose();+ }++ @override+ Widget build(BuildContext context) {+ return AnimatedBuilder(+ animation: _controller,+ builder: (context, _) {+ return CustomPaint(+ painter: _WhiteDotWavePainter(progress: _controller.value),+ size: Size.infinite,+ );+ },+ );+ }+}++class _WhiteDotWavePainter extends CustomPainter {+ static const int _cols = 20;+ static const int _rows = 14;+ static const double _maxDelay = 0.72; // 1.8s / 2.5s++ final double progress;++ _WhiteDotWavePainter({required this.progress});++ @override+ void paint(Canvas canvas, Size size) {+ final double cx = size.width / 2;+ final double cy = size.height / 2;+ final double maxDist = math.sqrt(cx * cx + cy * cy);++ for (int r = 0; r < _rows; r++) {+ for (int c = 0; c < _cols; c++) {+ final double x = ((c + 0.5) / _cols) * size.width;+ final double y = ((r + 0.5) / _rows) * size.height;++ final double dist = math.sqrt(+ math.pow(x - cx, 2) + math.pow(y - cy, 2),+ );+ final double delay = (dist / maxDist) * _maxDelay;++ double phase = (progress - delay) % 1.0;+ if (phase < 0) phase += 1.0;++ // Ping-pong with ease-in-out in each half+ double t;+ if (phase < 0.5) {+ t = _easeInOut(phase * 2);+ } else {+ t = _easeInOut((1.0 - phase) * 2);+ }++ if (t < 0.01) continue;++ final double radius = 2.0 * t;+ final double opacity = 0.5 * t;++ final paint = Paint()..color = Color.fromRGBO(255, 255, 255, opacity);+ canvas.drawCircle(Offset(x, y), radius, paint);+ }+ }+ }++ static double _easeInOut(double t) {+ return t < 0.5 ? 2 * t * t : -1 + (4 - 2 * t) * t;+ }++ @override+ bool shouldRepaint(_WhiteDotWavePainter oldDelegate) =>+ oldDelegate.progress != progress;+}diff --git a/mobile/apps/photos/pubspec.lock b/mobile/apps/photos/pubspec.lockindex 2779052be1..240dac25d6 100644--- a/mobile/apps/photos/pubspec.lock+++ b/mobile/apps/photos/pubspec.lock@@ -1800,9 +1800,9 @@ packages:dependency: "direct main"description:path: "."- ref: c550d52- resolved-ref: c550d5256d99ca8a411f6aed3e0da2db738d98df- url: "https://github.com/ente-io/mobile_ocr"+ ref: f92e3a0+ resolved-ref: f92e3a0016f87ed832d0b7824af52076b3d118f8+ url: "https://github.com/Amrithesh-Kakkoth/mobile_ocr"source: gitversion: "1.0.0"mockito:diff --git a/mobile/apps/photos/pubspec.yaml b/mobile/apps/photos/pubspec.yamlindex d4c8bf2f29..ccba7bbdc4 100644--- a/mobile/apps/photos/pubspec.yaml+++ b/mobile/apps/photos/pubspec.yaml@@ -154,8 +154,8 @@ dependencies:ml_linalg: ^13.11.31mobile_ocr:git:- url: https://github.com/ente-io/mobile_ocr- ref: c550d52+ url: https://github.com/Amrithesh-Kakkoth/mobile_ocr+ ref: f92e3a0modal_bottom_sheet: ^3.0.0motionphoto:git: "https://github.com/ente-io/motionphoto.git"