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