feat: match contact status formatting w/ Resonite + anti-alias recon online indicator
This commit is contained in:
parent
af43af673d
commit
4e7181a20f
2 changed files with 40 additions and 22 deletions
|
@ -5,13 +5,15 @@ import 'package:recon/auxiliary.dart';
|
||||||
import 'package:recon/clients/messaging_client.dart';
|
import 'package:recon/clients/messaging_client.dart';
|
||||||
import 'package:recon/models/message.dart';
|
import 'package:recon/models/message.dart';
|
||||||
import 'package:recon/models/users/friend.dart';
|
import 'package:recon/models/users/friend.dart';
|
||||||
|
import 'package:recon/models/users/online_status.dart';
|
||||||
import 'package:recon/widgets/formatted_text.dart';
|
import 'package:recon/widgets/formatted_text.dart';
|
||||||
import 'package:recon/widgets/friends/friend_online_status_indicator.dart';
|
import 'package:recon/widgets/friends/friend_online_status_indicator.dart';
|
||||||
import 'package:recon/widgets/generic_avatar.dart';
|
import 'package:recon/widgets/generic_avatar.dart';
|
||||||
import 'package:recon/widgets/messages/messages_list.dart';
|
import 'package:recon/widgets/messages/messages_list.dart';
|
||||||
|
|
||||||
class FriendListTile extends StatelessWidget {
|
class FriendListTile extends StatelessWidget {
|
||||||
const FriendListTile({required this.friend, required this.unreads, this.onTap, super.key});
|
const FriendListTile(
|
||||||
|
{required this.friend, required this.unreads, this.onTap, super.key});
|
||||||
|
|
||||||
final Friend friend;
|
final Friend friend;
|
||||||
final int unreads;
|
final int unreads;
|
||||||
|
@ -24,7 +26,8 @@ class FriendListTile extends StatelessWidget {
|
||||||
final mClient = Provider.of<MessagingClient>(context, listen: false);
|
final mClient = Provider.of<MessagingClient>(context, listen: false);
|
||||||
final currentSession = friend.userStatus.currentSessionIndex == -1
|
final currentSession = friend.userStatus.currentSessionIndex == -1
|
||||||
? null
|
? null
|
||||||
: friend.userStatus.decodedSessions.elementAtOrNull(friend.userStatus.currentSessionIndex);
|
: friend.userStatus.decodedSessions
|
||||||
|
.elementAtOrNull(friend.userStatus.currentSessionIndex);
|
||||||
return ListTile(
|
return ListTile(
|
||||||
leading: GenericAvatar(
|
leading: GenericAvatar(
|
||||||
imageUri: imageUri,
|
imageUri: imageUri,
|
||||||
|
@ -32,7 +35,8 @@ class FriendListTile extends StatelessWidget {
|
||||||
trailing: unreads != 0
|
trailing: unreads != 0
|
||||||
? Text(
|
? Text(
|
||||||
"+$unreads",
|
"+$unreads",
|
||||||
style: theme.textTheme.bodyMedium?.copyWith(color: theme.colorScheme.primary),
|
style: theme.textTheme.bodyMedium
|
||||||
|
?.copyWith(color: theme.colorScheme.primary),
|
||||||
)
|
)
|
||||||
: null,
|
: null,
|
||||||
title: Row(
|
title: Row(
|
||||||
|
@ -57,26 +61,36 @@ class FriendListTile extends StatelessWidget {
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
width: 4,
|
width: 4,
|
||||||
),
|
),
|
||||||
Text(toBeginningOfSentenceCase(friend.userStatus.onlineStatus.name) ?? "Unknown"),
|
Text(toBeginningOfSentenceCase(friend.userStatus.onlineStatus.name) ??
|
||||||
if (currentSession != null && currentSession.isVisible) ...[
|
"Unknown"),
|
||||||
const Text(" in "),
|
if (!(friend.userStatus.onlineStatus == OnlineStatus.offline ||
|
||||||
if (currentSession.name.isNotEmpty)
|
friend.userStatus.onlineStatus == OnlineStatus.invisible))
|
||||||
Expanded(
|
if (currentSession != null) ...[
|
||||||
child: FormattedText(
|
const Text(" in "),
|
||||||
currentSession.formattedName,
|
if (currentSession.name.isNotEmpty)
|
||||||
overflow: TextOverflow.ellipsis,
|
Expanded(
|
||||||
maxLines: 1,
|
child: FormattedText(
|
||||||
),
|
currentSession.formattedName,
|
||||||
)
|
overflow: TextOverflow.ellipsis,
|
||||||
else
|
maxLines: 1,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
else
|
||||||
|
Expanded(
|
||||||
|
child: Text(
|
||||||
|
"${currentSession.accessLevel.toReadableString()} World",
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
maxLines: 1,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
] else if (friend.userStatus.appVersion.isNotEmpty)
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Text(
|
child: Text(
|
||||||
"${currentSession.accessLevel.toReadableString()} session",
|
" on version ${friend.userStatus.appVersion}",
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
),
|
),
|
||||||
)
|
),
|
||||||
]
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
import 'package:recon/models/users/online_status.dart';
|
import 'package:recon/models/users/online_status.dart';
|
||||||
import 'package:recon/models/users/user_status.dart';
|
import 'package:recon/models/users/user_status.dart';
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
|
|
||||||
class FriendOnlineStatusIndicator extends StatelessWidget {
|
class FriendOnlineStatusIndicator extends StatelessWidget {
|
||||||
const FriendOnlineStatusIndicator({required this.userStatus, super.key});
|
const FriendOnlineStatusIndicator({required this.userStatus, super.key});
|
||||||
|
@ -9,17 +9,21 @@ class FriendOnlineStatusIndicator extends StatelessWidget {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return userStatus.appVersion.contains("ReCon") && userStatus.onlineStatus != OnlineStatus.offline
|
return userStatus.appVersion.contains("ReCon") &&
|
||||||
|
userStatus.onlineStatus != OnlineStatus.offline
|
||||||
? SizedBox.square(
|
? SizedBox.square(
|
||||||
dimension: 10,
|
dimension: 10,
|
||||||
child: Image.asset(
|
child: Image.asset(
|
||||||
"assets/images/logo-white.png",
|
"assets/images/logo-white.png",
|
||||||
alignment: Alignment.center,
|
|
||||||
color: userStatus.onlineStatus.color(context),
|
color: userStatus.onlineStatus.color(context),
|
||||||
|
filterQuality: FilterQuality.medium,
|
||||||
|
isAntiAlias: true,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
: Icon(
|
: Icon(
|
||||||
userStatus.onlineStatus == OnlineStatus.offline ? Icons.circle_outlined : Icons.circle,
|
userStatus.onlineStatus == OnlineStatus.offline
|
||||||
|
? Icons.circle_outlined
|
||||||
|
: Icons.circle,
|
||||||
color: userStatus.onlineStatus.color(context),
|
color: userStatus.onlineStatus.color(context),
|
||||||
size: 10,
|
size: 10,
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue