Skip to content

armgit / ente

Public Imported from GitHub
0

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

Make the comments screen UI more similar to figma

ashilkn95e7b7e3bb85
diff --git a/mobile/apps/photos/lib/ui/social/comments_screen.dart b/mobile/apps/photos/lib/ui/social/comments_screen.dart
index 545d996e4e..77846494b4 100644
--- a/mobile/apps/photos/lib/ui/social/comments_screen.dart
+++ b/mobile/apps/photos/lib/ui/social/comments_screen.dart
@@ -162,16 +162,21 @@ class _CommentsScreenState extends State<CommentsScreen> {
return Scaffold(
appBar: AppBar(
- leading: IconButton(
- icon: const Icon(Icons.close),
- onPressed: () => Navigator.of(context).pop(),
- ),
+ automaticallyImplyLeading: false,
+ titleSpacing: 16,
+ backgroundColor: colorScheme.backgroundBase,
+ elevation: 0,
title: Text(
"${_comments.length} comments",
- style: textTheme.body,
+ style: textTheme.largeBold,
),
- backgroundColor: colorScheme.backgroundBase,
- elevation: 0,
+ actions: [
+ IconButton(
+ icon: const Icon(Icons.close),
+ onPressed: () => Navigator.of(context).pop(),
+ ),
+ const SizedBox(width: 4),
+ ],
),
body: Column(
children: [
@@ -181,6 +186,12 @@ class _CommentsScreenState extends State<CommentsScreen> {
: ListView.builder(
controller: _scrollController,
reverse: true,
+ padding: const EdgeInsets.only(
+ top: 12,
+ left: 4,
+ right: 4,
+ bottom: 24,
+ ),
itemCount: _comments.length + (_hasMoreComments ? 1 : 0),
itemBuilder: (context, index) {
if (index == _comments.length) {
diff --git a/mobile/apps/photos/lib/ui/social/widgets/comment_actions_capsule.dart b/mobile/apps/photos/lib/ui/social/widgets/comment_actions_capsule.dart
index 8205ab3fdf..e9b0977eb3 100644
--- a/mobile/apps/photos/lib/ui/social/widgets/comment_actions_capsule.dart
+++ b/mobile/apps/photos/lib/ui/social/widgets/comment_actions_capsule.dart
@@ -21,10 +21,11 @@ class CommentActionsCapsule extends StatelessWidget {
final textTheme = getEnteTextTheme(context);
return Container(
- padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
+ padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 6),
decoration: BoxDecoration(
- color: colorScheme.fillFaint,
- borderRadius: BorderRadius.circular(16),
+ color: colorScheme.backgroundBase,
+ border: Border.all(color: colorScheme.strokeFaint),
+ borderRadius: BorderRadius.circular(18),
),
child: Row(
mainAxisSize: MainAxisSize.min,
@@ -35,7 +36,7 @@ class CommentActionsCapsule extends StatelessWidget {
children: [
Icon(
isLiked ? Icons.favorite : Icons.favorite_border,
- size: 16,
+ size: 18,
color:
isLiked ? colorScheme.primary500 : colorScheme.textMuted,
),
@@ -56,7 +57,7 @@ class CommentActionsCapsule extends StatelessWidget {
onTap: onReplyTap,
child: Icon(
Icons.reply,
- size: 16,
+ size: 18,
color: colorScheme.textMuted,
),
),
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.dart
index 97d93cccc0..88b14b8e40 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
@@ -93,77 +93,113 @@ class _CommentBubbleWidgetState extends State<CommentBubbleWidget> {
final colorScheme = getEnteColorScheme(context);
final textTheme = getEnteTextTheme(context);
+ final bubbleTextColor =
+ widget.isOwnComment ? colorScheme.backgroundBase : colorScheme.textBase;
+ final bubbleBackgroundColor =
+ widget.isOwnComment ? colorScheme.primary500 : colorScheme.fillBaseGrey;
+
return Padding(
padding: EdgeInsets.only(
- left: widget.isOwnComment ? 48 : 16,
- right: widget.isOwnComment ? 16 : 48,
- top: 8,
- bottom: 8,
+ left: widget.isOwnComment ? 48 : 20,
+ right: widget.isOwnComment ? 20 : 48,
+ top: 12,
+ bottom: 28,
),
child: Column(
crossAxisAlignment: widget.isOwnComment
? CrossAxisAlignment.end
: CrossAxisAlignment.start,
children: [
- // Parent quote (if reply)
- if (widget.comment.isReply) _buildParentQuote(colorScheme, textTheme),
-
- // Comment bubble
- Container(
- padding: const EdgeInsets.all(12),
- decoration: BoxDecoration(
- color: widget.isOwnComment
- ? colorScheme.primary500.withValues(alpha: 0.15)
- : colorScheme.fillFaint,
- borderRadius: BorderRadius.only(
- topLeft: const Radius.circular(16),
- topRight: const Radius.circular(16),
- bottomLeft: Radius.circular(widget.isOwnComment ? 16 : 4),
- bottomRight: Radius.circular(widget.isOwnComment ? 4 : 16),
- ),
- ),
+ Padding(
+ padding: const EdgeInsets.only(bottom: 8),
child: Text(
- widget.comment.data,
- style: textTheme.body,
+ formatRelativeTime(widget.comment.createdAt),
+ style: textTheme.mini.copyWith(color: colorScheme.textMuted),
),
),
-
- const SizedBox(height: 4),
-
- // Timestamp and actions row
- Row(
- mainAxisSize: MainAxisSize.min,
- children: [
- Text(
- formatRelativeTime(widget.comment.createdAt),
- style: textTheme.mini.copyWith(color: colorScheme.textMuted),
- ),
- const SizedBox(width: 8),
- if (!_isLoadingReactions)
- CommentActionsCapsule(
+ _buildBubble(
+ colorScheme: colorScheme,
+ textTheme: textTheme,
+ textColor: bubbleTextColor,
+ bubbleColor: bubbleBackgroundColor,
+ ),
+ if (!_isLoadingReactions) ...[
+ const SizedBox(height: 2),
+ Transform.translate(
+ offset: const Offset(0, -12),
+ child: Align(
+ alignment: widget.isOwnComment
+ ? Alignment.centerRight
+ : Alignment.centerLeft,
+ child: CommentActionsCapsule(
isLiked: _isLiked,
likeCount: _reactions.where((r) => !r.isDeleted).length,
onLikeTap: _toggleLike,
onReplyTap: widget.onReplyTap,
),
- ],
+ ),
+ ),
+ ],
+ ],
+ ),
+ );
+ }
+
+ Widget _buildBubble({
+ required EnteColorScheme colorScheme,
+ required EnteTextTheme textTheme,
+ required Color textColor,
+ required Color bubbleColor,
+ }) {
+ final bubbleBorderRadius = BorderRadius.only(
+ topLeft: const Radius.circular(18),
+ topRight: const Radius.circular(18),
+ bottomLeft: Radius.circular(widget.isOwnComment ? 18 : 10),
+ bottomRight: Radius.circular(widget.isOwnComment ? 10 : 18),
+ );
+
+ return Container(
+ padding: const EdgeInsets.fromLTRB(14, 12, 14, 16),
+ decoration: BoxDecoration(
+ color: bubbleColor,
+ borderRadius: bubbleBorderRadius,
+ ),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ if (widget.comment.isReply)
+ _buildInlineParent(
+ colorScheme: colorScheme,
+ textTheme: textTheme,
+ textColor: textColor,
+ ),
+ Text(
+ widget.comment.data,
+ style: textTheme.body.copyWith(
+ color: textColor,
+ height: 1.25,
+ ),
),
],
),
);
}
- Widget _buildParentQuote(
- EnteColorScheme colorScheme,
- EnteTextTheme textTheme,
- ) {
+ Widget _buildInlineParent({
+ required EnteColorScheme colorScheme,
+ required EnteTextTheme textTheme,
+ required Color textColor,
+ }) {
if (_isLoadingParent) {
return Container(
- margin: const EdgeInsets.only(bottom: 4),
- padding: const EdgeInsets.all(8),
+ margin: const EdgeInsets.only(bottom: 8),
+ height: 16,
+ width: 16,
+ alignment: Alignment.centerLeft,
child: const SizedBox(
- width: 16,
- height: 16,
+ width: 14,
+ height: 14,
child: CircularProgressIndicator(strokeWidth: 2),
),
);
@@ -172,21 +208,26 @@ class _CommentBubbleWidgetState extends State<CommentBubbleWidget> {
final parentText = _parentComment?.data ?? "Original comment unavailable";
return Container(
- margin: const EdgeInsets.only(bottom: 4),
+ margin: const EdgeInsets.only(bottom: 8),
+ padding: const EdgeInsets.only(left: 10),
decoration: BoxDecoration(
- color: colorScheme.primary500.withValues(alpha: 0.1),
- borderRadius: BorderRadius.circular(8),
border: Border(
left: BorderSide(
- color: colorScheme.primary500,
- width: 3,
+ color: widget.isOwnComment
+ ? colorScheme.backgroundBase.withValues(alpha: 0.6)
+ : colorScheme.strokeMuted,
+ width: 2,
),
),
),
- padding: const EdgeInsets.all(8),
child: Text(
parentText,
- style: textTheme.small.copyWith(color: colorScheme.textMuted),
+ style: textTheme.small.copyWith(
+ color: widget.isOwnComment
+ ? colorScheme.backgroundBase.withValues(alpha: 0.9)
+ : colorScheme.textMuted,
+ height: 1.2,
+ ),
maxLines: 2,
overflow: TextOverflow.ellipsis,
),
diff --git a/mobile/apps/photos/lib/ui/social/widgets/comment_input_widget.dart b/mobile/apps/photos/lib/ui/social/widgets/comment_input_widget.dart
index fa9a9f8bd1..cf13438c2e 100644
--- a/mobile/apps/photos/lib/ui/social/widgets/comment_input_widget.dart
+++ b/mobile/apps/photos/lib/ui/social/widgets/comment_input_widget.dart
@@ -48,52 +48,45 @@ class CommentInputWidget extends StatelessWidget {
replyingTo: replyingTo!,
onDismiss: onDismissReply!,
),
- Row(
- children: [
- Expanded(
- child: TextField(
- controller: controller,
- focusNode: focusNode,
- decoration: InputDecoration(
- hintText: "Say something nice!",
- hintStyle: textTheme.body.copyWith(
- color: colorScheme.textMuted,
- ),
- border: InputBorder.none,
- filled: true,
- fillColor: colorScheme.fillFaint,
- contentPadding: const EdgeInsets.symmetric(
- horizontal: 16,
- vertical: 12,
- ),
- enabledBorder: OutlineInputBorder(
- borderRadius: BorderRadius.circular(24),
- borderSide: BorderSide.none,
- ),
- focusedBorder: OutlineInputBorder(
- borderRadius: BorderRadius.circular(24),
- borderSide: BorderSide.none,
- ),
- ),
- ),
+ TextField(
+ controller: controller,
+ focusNode: focusNode,
+ textInputAction: TextInputAction.send,
+ onSubmitted: (_) => onSend(),
+ textAlignVertical: TextAlignVertical.center,
+ decoration: InputDecoration(
+ hintText: "Say something nice!",
+ hintStyle: textTheme.body.copyWith(
+ color: colorScheme.textMuted,
),
- const SizedBox(width: 8),
- GestureDetector(
- onTap: onSend,
- child: Container(
- padding: const EdgeInsets.all(10),
- decoration: BoxDecoration(
- color: colorScheme.primary500,
- shape: BoxShape.circle,
- ),
- child: const Icon(
+ border: InputBorder.none,
+ filled: true,
+ fillColor: colorScheme.fillFaint,
+ contentPadding: const EdgeInsets.symmetric(
+ horizontal: 18,
+ vertical: 14,
+ ),
+ suffixIcon: Padding(
+ padding: const EdgeInsets.only(right: 10),
+ child: GestureDetector(
+ onTap: onSend,
+ child: Icon(
Icons.send,
- size: 20,
- color: Colors.white,
+ color: colorScheme.textMuted,
+ size: 22,
),
),
),
- ],
+ suffixIconConstraints: const BoxConstraints(minWidth: 36),
+ enabledBorder: OutlineInputBorder(
+ borderRadius: BorderRadius.circular(24),
+ borderSide: BorderSide(color: colorScheme.strokeFaint),
+ ),
+ focusedBorder: OutlineInputBorder(
+ borderRadius: BorderRadius.circular(24),
+ borderSide: BorderSide(color: colorScheme.strokeMuted),
+ ),
+ ),
),
],
),