π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Use overlay highlight for jump-to-comment feature
ashilkn9f71781367b4
diff --git a/mobile/apps/photos/lib/models/social/feed_data_provider.dart b/mobile/apps/photos/lib/models/social/feed_data_provider.dartindex 264d3e50b2..5e943dae04 100644--- a/mobile/apps/photos/lib/models/social/feed_data_provider.dart+++ b/mobile/apps/photos/lib/models/social/feed_data_provider.dart@@ -178,6 +178,7 @@ class FeedDataProvider {type: FeedItemType.comment,collectionID: comments.first.collectionID,fileID: comments.first.fileID,+ commentID: comments.first.id,actorUserIDs: uniqueUserIDs,actorAnonIDs: uniqueAnonIDs,createdAt: comments.first.createdAt,diff --git a/mobile/apps/photos/lib/ui/social/comments_screen.dart b/mobile/apps/photos/lib/ui/social/comments_screen.dartindex aecd580e44..c6b47f4ee3 100644--- a/mobile/apps/photos/lib/ui/social/comments_screen.dart+++ b/mobile/apps/photos/lib/ui/social/comments_screen.dart@@ -254,20 +254,14 @@ class _FileCommentsScreenState extends State<FileCommentsScreen> {// Estimate scroll position (since ListView is reversed, index 0 is at bottom)// Each comment is roughly 100-150px, we'll use 120px as estimateconst estimatedItemHeight = 120.0;- final scrollPosition = index * estimatedItemHeight;+ final maxScroll = _scrollController.position.maxScrollExtent;+ final scrollPosition = (index * estimatedItemHeight).clamp(0.0, maxScroll);_scrollController.animateTo(scrollPosition,- duration: const Duration(milliseconds: 300),- curve: Curves.easeOut,+ duration: const Duration(milliseconds: 150),+ curve: Curves.easeOutExpo,);-- // Clear highlight after a delay- Future.delayed(const Duration(seconds: 2), () {- if (mounted) {- setState(() => _highlightedCommentID = null);- }- });});}@@ -488,6 +482,11 @@ class _FileCommentsScreenState extends State<FileCommentsScreen> {userResolver: _getUserForComment,onCommentDeleted: () =>_handleCommentDeleted(comment.id),+ onAutoHighlightDismissed: () {+ if (mounted) {+ setState(() => _highlightedCommentID = null);+ }+ },);},),diff --git a/mobile/apps/photos/lib/ui/social/widgets/comment_bubble_widget.dart b/mobile/apps/photos/lib/ui/social/widgets/comment_bubble_widget.dartindex 86b3f687e2..f1c560cd10 100644--- a/mobile/apps/photos/lib/ui/social/widgets/comment_bubble_widget.dart+++ b/mobile/apps/photos/lib/ui/social/widgets/comment_bubble_widget.dart@@ -37,6 +37,9 @@ class CommentBubbleWidget extends StatefulWidget {/// Whether this comment should be visually highlighted.final bool isHighlighted;+ /// Callback invoked when auto-highlight animation completes (dismissed).+ final VoidCallback? onAutoHighlightDismissed;+const CommentBubbleWidget({required this.comment,required this.user,@@ -50,6 +53,7 @@ class CommentBubbleWidget extends StatefulWidget {required this.userResolver,this.onCommentDeleted,this.isHighlighted = false,+ this.onAutoHighlightDismissed,super.key,});@@ -75,6 +79,7 @@ class _CommentBubbleWidgetState extends State<CommentBubbleWidget>final LayerLink _layerLink = LayerLink();final GlobalKey _contentKey = GlobalKey();Size? _contentSize;+ bool _isAutoHighlight = false;late final AnimationController _overlayAnimationController;late final Animation<double> _overlayAnimation;@@ -104,6 +109,15 @@ class _CommentBubbleWidgetState extends State<CommentBubbleWidget>});_loadData();_measureContent();++ // Trigger auto-highlight if widget is created with isHighlighted = true+ if (widget.isHighlighted) {+ WidgetsBinding.instance.addPostFrameCallback((_) {+ if (mounted) {+ _triggerAutoHighlight();+ }+ });+ }}@override@@ -117,6 +131,11 @@ class _CommentBubbleWidgetState extends State<CommentBubbleWidget>_loadData();_measureContent();}++ // Trigger auto-highlight when isHighlighted becomes true+ if (widget.isHighlighted && !oldWidget.isHighlighted) {+ _triggerAutoHighlight();+ }}@override@@ -197,6 +216,9 @@ class _CommentBubbleWidgetState extends State<CommentBubbleWidget>}void _showHighlight() {+ if (_isAutoHighlight) {+ return; // Don't allow long-press during auto-highlight+ }HapticFeedback.mediumImpact();setState(() => _dragOffset = 0.0);_overlayController.show();@@ -208,6 +230,29 @@ class _CommentBubbleWidgetState extends State<CommentBubbleWidget>if (mounted) _overlayController.hide();}+ void _triggerAutoHighlight() {+ _isAutoHighlight = true;+ setState(() => _dragOffset = 0.0);+ _overlayController.show();+ _overlayAnimationController.forward();++ // Auto-dismiss after 750ms+ Future.delayed(const Duration(milliseconds: 750), () {+ if (mounted && _isAutoHighlight) {+ _hideAutoHighlight();+ }+ });+ }++ Future<void> _hideAutoHighlight() async {+ await _overlayAnimationController.reverse();+ if (mounted) {+ _overlayController.hide();+ _isAutoHighlight = false;+ widget.onAutoHighlightDismissed?.call();+ }+ }+void _onHorizontalDragStart(DragStartDetails details) {if (!_isOverlayDismissed) return;_hasTriggeredReply = false;@@ -257,7 +302,7 @@ class _CommentBubbleWidgetState extends State<CommentBubbleWidget>Widget build(BuildContext context) {final colorScheme = getEnteColorScheme(context);- Widget content = OverlayPortal(+ final content = OverlayPortal(controller: _overlayController,overlayChildBuilder: _buildOverlayContent,child: GestureDetector(@@ -316,18 +361,6 @@ class _CommentBubbleWidgetState extends State<CommentBubbleWidget>),);- // Add highlight effect if needed- if (widget.isHighlighted) {- content = AnimatedContainer(- duration: const Duration(milliseconds: 500),- decoration: BoxDecoration(- color: colorScheme.fillFaint,- borderRadius: BorderRadius.circular(12),- ),- child: content,- );- }-return content;}@@ -340,11 +373,11 @@ class _CommentBubbleWidgetState extends State<CommentBubbleWidget>_overlayAnimationController.status == AnimationStatus.reverse;return Stack(children: [- // Full-screen barrier with black opacity 0.7+ // Full-screen barrier with black opacity 0.3GestureDetector(- onTap: _hideHighlight,+ onTap: _isAutoHighlight ? _hideAutoHighlight : _hideHighlight,child: Container(- color: Colors.black.withValues(alpha: 0.7 * value),+ color: Colors.black.withValues(alpha: 0.3 * value),),),// Highlighted comment + popup menu@@ -355,31 +388,31 @@ class _CommentBubbleWidgetState extends State<CommentBubbleWidget>widget.isOwnComment ? Alignment.topRight : Alignment.topLeft,followerAnchor:widget.isOwnComment ? Alignment.topRight : Alignment.topLeft,- child:- _contentSize != null && _contentSize!.width >= _minPopupWidth- ? SizedBox(- width: _contentSize!.width,- child: Opacity(- opacity: isReversing ? 1.0 : value,- child: _buildCommentContent(- showActionsCapsule: isReversing,- showActionsPopup: !isReversing,- showHeader: false,- bubbleScale: 1 + (0.025 * value),- capsuleOpacity: 1 - value,- ),- ),- )- : Opacity(- opacity: isReversing ? 1.0 : value,- child: _buildCommentContent(- showActionsCapsule: isReversing,- showActionsPopup: !isReversing,- showHeader: false,- bubbleScale: 1 + (0.025 * value),- capsuleOpacity: 1 - value,- ),+ child: _contentSize != null &&+ _contentSize!.width >= _minPopupWidth+ ? SizedBox(+ width: _contentSize!.width,+ child: Opacity(+ opacity: isReversing ? 1.0 : value,+ child: _buildCommentContent(+ showActionsCapsule: isReversing,+ showActionsPopup: !isReversing && !_isAutoHighlight,+ showHeader: false,+ bubbleScale: 1 + (0.025 * value),+ capsuleOpacity: 1 - value,),+ ),+ )+ : Opacity(+ opacity: isReversing ? 1.0 : value,+ child: _buildCommentContent(+ showActionsCapsule: isReversing,+ showActionsPopup: !isReversing && !_isAutoHighlight,+ showHeader: false,+ bubbleScale: 1 + (0.025 * value),+ capsuleOpacity: 1 - value,+ ),+ ),),],);