Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Update OCR cta

ashilkn48fbd6530f2e
diff --git a/mobile/apps/photos/assets/detect_text.svg b/mobile/apps/photos/assets/detect_text.svg
deleted file mode 100644
index 195b198b6e..0000000000
--- a/mobile/apps/photos/assets/detect_text.svg
+++ /dev/null
@@ -1,11 +0,0 @@
-<svg width="34" height="34" viewBox="0 0 34 34" fill="none" xmlns="http://www.w3.org/2000/svg">
-<rect x="1" y="1" width="32" height="32" rx="16" fill="black" fill-opacity="0.5"/>
-<rect x="0.5" y="0.5" width="33" height="33" rx="16.5" stroke="white" stroke-opacity="0.16"/>
-<path d="M18.6667 21.3359H16" stroke="white" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round"/>
-<path d="M17.3377 13.3359V21.3363M17.3377 13.3359C17.9543 13.3359 18.7463 13.3495 19.377 13.4144C19.6437 13.4418 19.7771 13.4555 19.8951 13.5039C20.1406 13.6045 20.3385 13.8251 20.413 14.0812C20.4488 14.2043 20.4488 14.3448 20.4488 14.6258M17.3377 13.3359C16.7211 13.3359 15.929 13.3495 15.2984 13.4144C15.0317 13.4418 14.8983 13.4555 14.7803 13.5039C14.5348 13.6045 14.3369 13.8251 14.2624 14.0812C14.2266 14.2043 14.2266 14.3448 14.2266 14.6258" stroke="white" stroke-width="1.3" stroke-linecap="round"/>
-<path d="M10.6953 12.7097V12.5364C10.6953 11.8892 10.6953 11.5656 10.8213 11.3184C10.932 11.101 11.1088 10.9242 11.3263 10.8134C11.5734 10.6875 11.897 10.6875 12.5442 10.6875H12.7175" stroke="white" stroke-width="1.3" stroke-linecap="round"/>
-<path d="M21.9609 10.6875H22.1343C22.7814 10.6875 23.105 10.6875 23.3522 10.8134C23.5696 10.9242 23.7464 11.101 23.8572 11.3184C23.9832 11.5656 23.9832 11.8892 23.9832 12.5364V12.7097" stroke="white" stroke-width="1.3" stroke-linecap="round"/>
-<path d="M23.9832 21.9531V22.1265C23.9832 22.7736 23.9832 23.0972 23.8572 23.3444C23.7464 23.5618 23.5696 23.7386 23.3522 23.8494C23.105 23.9753 22.7814 23.9753 22.1343 23.9753H21.9609" stroke="white" stroke-width="1.3" stroke-linecap="round"/>
-<path d="M10.6953 21.9531V22.1265C10.6953 22.7736 10.6953 23.0972 10.8213 23.3444C10.932 23.5618 11.1088 23.7386 11.3263 23.8494C11.5734 23.9753 11.897 23.9753 12.5442 23.9753H12.7175" stroke="white" stroke-width="1.3" stroke-linecap="round"/>
-</svg>
-
diff --git a/mobile/apps/photos/lib/ui/viewer/file/text_detection_overlay_button.dart b/mobile/apps/photos/lib/ui/viewer/file/text_detection_overlay_button.dart
index d18374ee90..376a246953 100644
--- a/mobile/apps/photos/lib/ui/viewer/file/text_detection_overlay_button.dart
+++ b/mobile/apps/photos/lib/ui/viewer/file/text_detection_overlay_button.dart
@@ -2,12 +2,12 @@ import "dart:io";
import "package:flutter/foundation.dart";
import "package:flutter/material.dart";
-import "package:flutter_svg/flutter_svg.dart";
import "package:logging/logging.dart";
import "package:mobile_ocr/mobile_ocr.dart";
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/theme/ente_theme.dart";
import "package:photos/ui/viewer/file/text_detection_page.dart";
import "package:photos/utils/dialog_util.dart";
import "package:photos/utils/file_util.dart";
@@ -32,7 +32,6 @@ class TextDetectionOverlayButton extends StatefulWidget {
class _TextDetectionOverlayButtonState
extends State<TextDetectionOverlayButton> {
- static const double _buttonSize = 40.0;
static final Map<String, _DetectionResult> _cache = {};
final Logger _logger = Logger("TextDetectionOverlayButton");
final MobileOcr _mobileOcr = MobileOcr();
@@ -185,39 +184,53 @@ class _TextDetectionOverlayButtonState
if (shouldHide) {
return const SizedBox.shrink();
}
- final double bottomOffset = MediaQuery.paddingOf(context).bottom + 60.0;
+ final double bottomOffset = MediaQuery.paddingOf(context).bottom + 72.0;
return Positioned(
bottom: bottomOffset,
left: 0,
right: 0,
- child: Center(child: _buildButton(context)),
+ child: Center(
+ child: GestureDetector(
+ onTap: _onPressed,
+ child: Container(
+ padding: const EdgeInsets.symmetric(
+ horizontal: 12,
+ vertical: 8,
+ ),
+ decoration: BoxDecoration(
+ color: Colors.black.withAlpha(160),
+ borderRadius: BorderRadius.circular(60),
+ border: Border.all(
+ color: Colors.white.withAlpha(60),
+ width: 0.5,
+ ),
+ ),
+ child: Row(
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ Container(
+ width: 8,
+ height: 8,
+ decoration: BoxDecoration(
+ color: getEnteColorScheme(context).primary700,
+ shape: BoxShape.circle,
+ ),
+ ),
+ const SizedBox(width: 8),
+ Text(
+ "Select text",
+ style: getEnteTextTheme(context).mini,
+ ),
+ ],
+ ),
+ ),
+ ),
+ ),
);
},
);
}
- Widget _buildButton(BuildContext context) {
- const String detectTextLabel = "Detect Text";
- return Tooltip(
- message: detectTextLabel,
- child: IconButton(
- tooltip: detectTextLabel,
- constraints: const BoxConstraints.tightFor(
- width: _buttonSize,
- height: _buttonSize,
- ),
- padding: EdgeInsets.zero,
- onPressed: _onPressed,
- icon: SvgPicture.asset(
- "assets/detect_text.svg",
- width: _buttonSize,
- height: _buttonSize,
- semanticsLabel: detectTextLabel,
- ),
- ),
- );
- }
-
Future<void> _onPressed() async {
try {
final String? path = _localFilePath ?? await _ensureLocalFilePath();