fix: Remove too sensitive dismiss gesture on chat list items
This commit is contained in:
parent
5c969a1299
commit
7a47a6a595
1 changed files with 270 additions and 291 deletions
|
|
@ -93,20 +93,7 @@ class ChatListItem extends StatelessWidget {
|
||||||
: room.getState(EventTypes.RoomMember, lastEvent.senderId) == null;
|
: room.getState(EventTypes.RoomMember, lastEvent.senderId) == null;
|
||||||
final space = this.space;
|
final space = this.space;
|
||||||
|
|
||||||
return Dismissible(
|
return Padding(
|
||||||
key: ValueKey(room.id),
|
|
||||||
confirmDismiss: (_) => archiveAction(context),
|
|
||||||
onDismissed: (_) {
|
|
||||||
// Empty dismissed callback to trigger the dismiss animation
|
|
||||||
},
|
|
||||||
background: Material(
|
|
||||||
color: theme.colorScheme.errorContainer,
|
|
||||||
child: Icon(
|
|
||||||
Icons.archive_outlined,
|
|
||||||
color: theme.colorScheme.onErrorContainer,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
child: Padding(
|
|
||||||
padding: const EdgeInsets.symmetric(
|
padding: const EdgeInsets.symmetric(
|
||||||
horizontal: 8,
|
horizontal: 8,
|
||||||
vertical: 1,
|
vertical: 1,
|
||||||
|
|
@ -266,8 +253,7 @@ class ChatListItem extends StatelessWidget {
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
width: 16,
|
width: 16,
|
||||||
height: 16,
|
height: 16,
|
||||||
child:
|
child: CircularProgressIndicator.adaptive(strokeWidth: 2),
|
||||||
CircularProgressIndicator.adaptive(strokeWidth: 2),
|
|
||||||
),
|
),
|
||||||
const SizedBox(width: 4),
|
const SizedBox(width: 4),
|
||||||
],
|
],
|
||||||
|
|
@ -291,8 +277,7 @@ class ChatListItem extends StatelessWidget {
|
||||||
room.spaceChildren.length,
|
room.spaceChildren.length,
|
||||||
(room.summary.mJoinedMemberCount ?? 1),
|
(room.summary.mJoinedMemberCount ?? 1),
|
||||||
),
|
),
|
||||||
style:
|
style: TextStyle(color: theme.colorScheme.outline),
|
||||||
TextStyle(color: theme.colorScheme.outline),
|
|
||||||
)
|
)
|
||||||
: typingText.isNotEmpty
|
: typingText.isNotEmpty
|
||||||
? Text(
|
? Text(
|
||||||
|
|
@ -314,8 +299,7 @@ class ChatListItem extends StatelessWidget {
|
||||||
hideEdit: true,
|
hideEdit: true,
|
||||||
plaintextBody: true,
|
plaintextBody: true,
|
||||||
removeMarkdown: true,
|
removeMarkdown: true,
|
||||||
withSenderNamePrefix:
|
withSenderNamePrefix: (!isDirectChat ||
|
||||||
(!isDirectChat ||
|
|
||||||
directChatMatrixId !=
|
directChatMatrixId !=
|
||||||
room.lastEvent?.senderId),
|
room.lastEvent?.senderId),
|
||||||
)
|
)
|
||||||
|
|
@ -341,22 +325,19 @@ class ChatListItem extends StatelessWidget {
|
||||||
?.content
|
?.content
|
||||||
.tryGet<String>('reason') ??
|
.tryGet<String>('reason') ??
|
||||||
(isDirectChat
|
(isDirectChat
|
||||||
? L10n.of(context)
|
? L10n.of(context).newChatRequest
|
||||||
.newChatRequest
|
|
||||||
: L10n.of(context)
|
: L10n.of(context)
|
||||||
.inviteGroupChat)
|
.inviteGroupChat)
|
||||||
: snapshot.data ??
|
: snapshot.data ??
|
||||||
L10n.of(context).emptyChat,
|
L10n.of(context).emptyChat,
|
||||||
softWrap: false,
|
softWrap: false,
|
||||||
maxLines:
|
maxLines: room.notificationCount >= 1 ? 2 : 1,
|
||||||
room.notificationCount >= 1 ? 2 : 1,
|
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: unread || room.hasNewMessages
|
color: unread || room.hasNewMessages
|
||||||
? theme.colorScheme.onSurface
|
? theme.colorScheme.onSurface
|
||||||
: theme.colorScheme.outline,
|
: theme.colorScheme.outline,
|
||||||
decoration:
|
decoration: room.lastEvent?.redacted == true
|
||||||
room.lastEvent?.redacted == true
|
|
||||||
? TextDecoration.lineThrough
|
? TextDecoration.lineThrough
|
||||||
: null,
|
: null,
|
||||||
),
|
),
|
||||||
|
|
@ -370,8 +351,7 @@ class ChatListItem extends StatelessWidget {
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 7),
|
padding: const EdgeInsets.symmetric(horizontal: 7),
|
||||||
height: unreadBubbleSize,
|
height: unreadBubbleSize,
|
||||||
width:
|
width: !hasNotifications && !unread && !room.hasNewMessages
|
||||||
!hasNotifications && !unread && !room.hasNewMessages
|
|
||||||
? 0
|
? 0
|
||||||
: (unreadBubbleSize - 9) *
|
: (unreadBubbleSize - 9) *
|
||||||
room.notificationCount.toString().length +
|
room.notificationCount.toString().length +
|
||||||
|
|
@ -415,7 +395,6 @@ class ChatListItem extends StatelessWidget {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue