✨ User last seen
This commit is contained in:
parent
42acffff3e
commit
4f5762c5a9
@ -225,6 +225,7 @@ class SolianMessages extends Translations {
|
||||
'accountStatusInvisible': 'Invisible',
|
||||
'accountStatusInvisibleDesc': 'Will show as offline, but all features still remain normal',
|
||||
'accountStatusOffline': 'Offline',
|
||||
'accountLastSeenAt': 'Last seen at @date ago',
|
||||
},
|
||||
'zh_CN': {
|
||||
'hide': '隐藏',
|
||||
@ -433,6 +434,7 @@ class SolianMessages extends Translations {
|
||||
'accountStatusInvisible': '隐身',
|
||||
'accountStatusInvisibleDesc': '将会在他人界面显示离线,但不影响功能使用',
|
||||
'accountStatusOffline': '离线',
|
||||
'accountLastSeenAt': '最后上线于 @date 前',
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ import 'package:solian/providers/account_status.dart';
|
||||
import 'package:solian/widgets/account/account_avatar.dart';
|
||||
import 'package:solian/widgets/account/account_badge.dart';
|
||||
import 'package:solian/widgets/account/account_status_action.dart';
|
||||
import 'package:timeago/timeago.dart';
|
||||
|
||||
class AccountHeadingWidget extends StatelessWidget {
|
||||
final dynamic avatar;
|
||||
@ -106,15 +107,24 @@ class AccountHeadingWidget extends StatelessWidget {
|
||||
return Text('loading'.tr);
|
||||
}
|
||||
|
||||
final info = StatusProvider.determineStatus(
|
||||
AccountStatus.fromJson(snapshot.data!.body),
|
||||
final status = AccountStatus.fromJson(
|
||||
snapshot.data!.body,
|
||||
);
|
||||
final info = StatusProvider.determineStatus(status);
|
||||
|
||||
return GestureDetector(
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Text(info.$2),
|
||||
if (!status.isOnline && status.lastSeenAt != null)
|
||||
Opacity(
|
||||
opacity: 0.75,
|
||||
child: Text('accountLastSeenAt'.trParams({
|
||||
'date': format(status.lastSeenAt!.toLocal(),
|
||||
locale: 'en_short')
|
||||
})).paddingOnly(left: 4),
|
||||
),
|
||||
info.$1.paddingSymmetric(horizontal: 6),
|
||||
],
|
||||
),
|
||||
|
Loading…
Reference in New Issue
Block a user