Skip to content

armgit / ente

Public Imported from GitHub
0

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

Enable multiline input and tap-to-dismiss keyboard in comments

ashilkncac5c7d19193
diff --git a/mobile/apps/photos/lib/ui/social/comments_screen.dart b/mobile/apps/photos/lib/ui/social/comments_screen.dart
index 2e40ce5e80..87653bc867 100644
--- a/mobile/apps/photos/lib/ui/social/comments_screen.dart
+++ b/mobile/apps/photos/lib/ui/social/comments_screen.dart
@@ -407,48 +407,53 @@ class _FileCommentsScreenState extends State<FileCommentsScreen> {
body: Column(
children: [
Expanded(
- child: _isLoading
- ? const Center(child: CircularProgressIndicator())
- : ListView.builder(
- controller: _scrollController,
- reverse: true,
- padding: const EdgeInsets.only(
- top: 24,
- left: 16,
- right: 16,
- bottom: 24,
- ),
- itemCount: _comments.length + (_hasMoreComments ? 1 : 0),
- itemBuilder: (context, index) {
- if (index == _comments.length) {
- return const Center(
- child: Padding(
- padding: EdgeInsets.all(16),
- child: CircularProgressIndicator(),
- ),
+ child: GestureDetector(
+ onTap: () => FocusScope.of(context).unfocus(),
+ behavior: HitTestBehavior.translucent,
+ child: _isLoading
+ ? const Center(child: CircularProgressIndicator())
+ : ListView.builder(
+ controller: _scrollController,
+ reverse: true,
+ padding: const EdgeInsets.only(
+ top: 24,
+ left: 16,
+ right: 16,
+ bottom: 24,
+ ),
+ itemCount: _comments.length + (_hasMoreComments ? 1 : 0),
+ itemBuilder: (context, index) {
+ if (index == _comments.length) {
+ return const Center(
+ child: Padding(
+ padding: EdgeInsets.all(16),
+ child: CircularProgressIndicator(),
+ ),
+ );
+ }
+ final comment = _comments[index];
+ return CommentBubbleWidget(
+ key: ValueKey(comment.id),
+ comment: comment,
+ user: _getUserForComment(comment),
+ isOwnComment: comment.userID == _currentUserID,
+ currentUserID: _currentUserID,
+ collectionID: _selectedCollectionID,
+ isHighlighted: comment.id == _highlightedCommentID,
+ onFetchParent: comment.isReply
+ ? () =>
+ _getParentComment(comment.parentCommentID!)
+ : null,
+ onFetchReactions: () =>
+ _getReactionsForComment(comment.id),
+ onReplyTap: () => _onReplyTap(comment),
+ userResolver: _getUserForComment,
+ onCommentDeleted: () =>
+ _handleCommentDeleted(comment.id),
);
- }
- final comment = _comments[index];
- return CommentBubbleWidget(
- key: ValueKey(comment.id),
- comment: comment,
- user: _getUserForComment(comment),
- isOwnComment: comment.userID == _currentUserID,
- currentUserID: _currentUserID,
- collectionID: _selectedCollectionID,
- isHighlighted: comment.id == _highlightedCommentID,
- onFetchParent: comment.isReply
- ? () => _getParentComment(comment.parentCommentID!)
- : null,
- onFetchReactions: () =>
- _getReactionsForComment(comment.id),
- onReplyTap: () => _onReplyTap(comment),
- userResolver: _getUserForComment,
- onCommentDeleted: () =>
- _handleCommentDeleted(comment.id),
- );
- },
- ),
+ },
+ ),
+ ),
),
CommentInputWidget(
replyingTo: _replyingTo,
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 c98dcbde3c..9b80329b4d 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
@@ -127,8 +127,10 @@ class _CommentInputWidgetState extends State<CommentInputWidget>
TextField(
controller: widget.controller,
focusNode: widget.focusNode,
- textInputAction: TextInputAction.send,
- onSubmitted: (_) => widget.onSend(),
+ keyboardType: TextInputType.multiline,
+ textInputAction: TextInputAction.newline,
+ minLines: 1,
+ maxLines: widget.replyingTo != null ? 4 : 8,
textAlignVertical: TextAlignVertical.center,
style: textTheme.body.copyWith(
height: 15 / 16,