Change status indicator to not show cpp badge when user is offline
This commit is contained in:
parent
533e4d4297
commit
d9de622995
2 changed files with 44 additions and 29 deletions
|
@ -22,17 +22,27 @@ class FriendListTile extends StatelessWidget {
|
||||||
final imageUri = Aux.neosDbToHttp(friend.userProfile.iconUrl);
|
final imageUri = Aux.neosDbToHttp(friend.userProfile.iconUrl);
|
||||||
final theme = Theme.of(context);
|
final theme = Theme.of(context);
|
||||||
return ListTile(
|
return ListTile(
|
||||||
leading: GenericAvatar(imageUri: imageUri,),
|
leading: GenericAvatar(
|
||||||
|
imageUri: imageUri,
|
||||||
|
),
|
||||||
trailing: unreads != 0
|
trailing: unreads != 0
|
||||||
? Text("+$unreads", style: theme.textTheme.bodyMedium?.copyWith(color: theme.colorScheme.primary),)
|
? Text(
|
||||||
|
"+$unreads",
|
||||||
|
style: theme.textTheme.bodyMedium?.copyWith(color: theme.colorScheme.primary),
|
||||||
|
)
|
||||||
: null,
|
: null,
|
||||||
title: Row(
|
title: Row(
|
||||||
children: [
|
children: [
|
||||||
Text(friend.username),
|
Text(friend.username),
|
||||||
if (friend.isHeadless) Padding(
|
if (friend.isHeadless)
|
||||||
padding: const EdgeInsets.only(left: 8),
|
Padding(
|
||||||
child: Icon(Icons.dns, size: 12, color: theme.colorScheme.onSecondaryContainer.withAlpha(150),),
|
padding: const EdgeInsets.only(left: 8),
|
||||||
),
|
child: Icon(
|
||||||
|
Icons.dns,
|
||||||
|
size: 12,
|
||||||
|
color: theme.colorScheme.onSecondaryContainer.withAlpha(150),
|
||||||
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
subtitle: Row(
|
subtitle: Row(
|
||||||
|
@ -40,13 +50,19 @@ class FriendListTile extends StatelessWidget {
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
FriendOnlineStatusIndicator(userStatus: friend.userStatus),
|
FriendOnlineStatusIndicator(userStatus: friend.userStatus),
|
||||||
const SizedBox(width: 4,),
|
const SizedBox(
|
||||||
|
width: 4,
|
||||||
|
),
|
||||||
Text(toBeginningOfSentenceCase(friend.userStatus.onlineStatus.name) ?? "Unknown"),
|
Text(toBeginningOfSentenceCase(friend.userStatus.onlineStatus.name) ?? "Unknown"),
|
||||||
if (!friend.userStatus.currentSession.isNone)
|
if (!friend.userStatus.currentSession.isNone) ...[
|
||||||
...[
|
const Text(" in "),
|
||||||
const Text(" in "),
|
Expanded(
|
||||||
Expanded(child: FormattedText(friend.userStatus.currentSession.formattedName, overflow: TextOverflow.ellipsis, maxLines: 1,))
|
child: FormattedText(
|
||||||
]
|
friend.userStatus.currentSession.formattedName,
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
maxLines: 1,
|
||||||
|
))
|
||||||
|
]
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
|
@ -65,8 +81,7 @@ class FriendListTile extends StatelessWidget {
|
||||||
mClient.selectedFriend = friend;
|
mClient.selectedFriend = friend;
|
||||||
await Navigator.of(context).push(
|
await Navigator.of(context).push(
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
builder: (context) =>
|
builder: (context) => ChangeNotifierProvider<MessagingClient>.value(
|
||||||
ChangeNotifierProvider<MessagingClient>.value(
|
|
||||||
value: mClient,
|
value: mClient,
|
||||||
child: MessagesList(friend: friend),
|
child: MessagesList(friend: friend),
|
||||||
),
|
),
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
import 'package:contacts_plus_plus/models/friend.dart';
|
import 'package:contacts_plus_plus/models/friend.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
@ -9,18 +8,19 @@ class FriendOnlineStatusIndicator extends StatelessWidget {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return
|
return userStatus.neosVersion.contains("Contacts++") && userStatus.onlineStatus != OnlineStatus.offline
|
||||||
userStatus.neosVersion.contains("Contacts++") ? 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,
|
alignment: Alignment.center,
|
||||||
color: userStatus.onlineStatus.color(context),
|
color: userStatus.onlineStatus.color(context),
|
||||||
),
|
),
|
||||||
) : Icon(
|
)
|
||||||
userStatus.onlineStatus == OnlineStatus.offline ? Icons.circle_outlined : Icons.circle,
|
: Icon(
|
||||||
color: userStatus.onlineStatus.color(context),
|
userStatus.onlineStatus == OnlineStatus.offline ? Icons.circle_outlined : Icons.circle,
|
||||||
size: 10,
|
color: userStatus.onlineStatus.color(context),
|
||||||
);
|
size: 10,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue