chore: Follow up select chats

This commit is contained in:
krille-chan 2023-12-30 10:29:01 +01:00
parent 2872448584
commit 2a7744e4c7
No known key found for this signature in database

View file

@ -9,6 +9,7 @@ import 'package:matrix/matrix.dart';
import 'package:fluffychat/config/app_config.dart';
import 'package:fluffychat/utils/matrix_sdk_extensions/matrix_locals.dart';
import 'package:fluffychat/utils/room_status_extension.dart';
import 'package:fluffychat/widgets/hover_builder.dart';
import '../../config/themes.dart';
import '../../utils/date_time_extension.dart';
import '../../widgets/avatar.dart';
@ -191,24 +192,14 @@ class ChatListItem extends StatelessWidget {
color: backgroundColor,
child: FutureBuilder(
future: room.loadHeroUsers(),
builder: (context, snapshot) => ListTile(
builder: (context, snapshot) => HoverBuilder(
builder: (context, hovered) => ListTile(
visualDensity: const VisualDensity(vertical: -0.5),
contentPadding: const EdgeInsets.symmetric(horizontal: 8),
onLongPress: onLongPress,
leading: selected
? SizedBox(
width: Avatar.defaultSize,
height: Avatar.defaultSize,
child: Material(
color: Theme.of(context).colorScheme.primary,
borderRadius: BorderRadius.circular(Avatar.defaultSize),
child: const Icon(Icons.check, color: Colors.white),
),
)
: Avatar(
leading: Avatar(
mxContent: room.avatar,
name: displayname,
onTap: onLongPress,
presenceUserId: room.directChatMatrixID,
presenceBackgroundColor: backgroundColor,
),
@ -314,7 +305,8 @@ class ChatListItem extends StatelessWidget {
? L10n.of(context)!.invitePrivateChat
: L10n.of(context)!.inviteGroupChat
: snapshot.data ??
room.lastEvent?.calcLocalizedBodyFallback(
room.lastEvent
?.calcLocalizedBodyFallback(
MatrixLocals(L10n.of(context)!),
hideReply: true,
hideEdit: true,
@ -360,7 +352,8 @@ class ChatListItem extends StatelessWidget {
: hasNotifications || room.markedUnread
? Theme.of(context).colorScheme.primary
: Theme.of(context).colorScheme.primaryContainer,
borderRadius: BorderRadius.circular(AppConfig.borderRadius),
borderRadius:
BorderRadius.circular(AppConfig.borderRadius),
),
child: Center(
child: hasNotifications
@ -370,7 +363,9 @@ class ChatListItem extends StatelessWidget {
color: room.highlightCount > 0
? Colors.white
: hasNotifications
? Theme.of(context).colorScheme.onPrimary
? Theme.of(context)
.colorScheme
.onPrimary
: Theme.of(context)
.colorScheme
.onPrimaryContainer,
@ -384,7 +379,23 @@ class ChatListItem extends StatelessWidget {
),
onTap: () => clickAction(context),
trailing: onForget == null
? null
? AnimatedSize(
duration: FluffyThemes.animationDuration,
curve: FluffyThemes.animationCurve,
child: hovered || selected
? IconButton(
color: selected
? Theme.of(context).colorScheme.primary
: null,
icon: Icon(
selected
? Icons.check_circle
: Icons.check_circle_outlined,
),
onPressed: onLongPress,
)
: const SizedBox.shrink(),
)
: IconButton(
icon: const Icon(Icons.delete_outlined),
onPressed: onForget,
@ -392,6 +403,7 @@ class ChatListItem extends StatelessWidget {
),
),
),
),
);
}
}