|
|
|
@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
|
|
|
|
import 'package:go_router/go_router.dart';
|
|
|
|
|
|
|
|
|
|
import 'package:fluffychat/config/themes.dart';
|
|
|
|
|
import 'package:fluffychat/pages/chat/chat.dart';
|
|
|
|
|
import 'package:fluffychat/utils/date_time_extension.dart';
|
|
|
|
|
import 'package:fluffychat/utils/matrix_sdk_extensions/matrix_locals.dart';
|
|
|
|
@ -41,33 +42,43 @@ class ChatAppBarTitle extends StatelessWidget {
|
|
|
|
|
),
|
|
|
|
|
const SizedBox(width: 12),
|
|
|
|
|
Expanded(
|
|
|
|
|
child: ListTile(
|
|
|
|
|
contentPadding: EdgeInsets.zero,
|
|
|
|
|
title: Text(
|
|
|
|
|
room.getLocalizedDisplayname(MatrixLocals(L10n.of(context)!)),
|
|
|
|
|
maxLines: 1,
|
|
|
|
|
overflow: TextOverflow.ellipsis,
|
|
|
|
|
style: const TextStyle(
|
|
|
|
|
fontSize: 16,
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Text(
|
|
|
|
|
room.getLocalizedDisplayname(MatrixLocals(L10n.of(context)!)),
|
|
|
|
|
maxLines: 1,
|
|
|
|
|
overflow: TextOverflow.ellipsis,
|
|
|
|
|
style: const TextStyle(
|
|
|
|
|
fontSize: 16,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
subtitle: PresenceBuilder(
|
|
|
|
|
userId: room.directChatMatrixID,
|
|
|
|
|
builder: (context, presence) {
|
|
|
|
|
final lastActiveTimestamp = presence?.lastActiveTimestamp;
|
|
|
|
|
if (presence?.currentlyActive == true) {
|
|
|
|
|
return Text(L10n.of(context)!.currentlyActive);
|
|
|
|
|
}
|
|
|
|
|
if (lastActiveTimestamp != null) {
|
|
|
|
|
return Text(
|
|
|
|
|
L10n.of(context)!.lastActiveAgo(
|
|
|
|
|
lastActiveTimestamp.localizedTimeShort(context),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
return const SizedBox.shrink();
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
AnimatedSize(
|
|
|
|
|
duration: FluffyThemes.animationDuration,
|
|
|
|
|
child: PresenceBuilder(
|
|
|
|
|
userId: room.directChatMatrixID,
|
|
|
|
|
builder: (context, presence) {
|
|
|
|
|
final lastActiveTimestamp = presence?.lastActiveTimestamp;
|
|
|
|
|
final style = Theme.of(context).textTheme.bodySmall;
|
|
|
|
|
if (presence?.currentlyActive == true) {
|
|
|
|
|
return Text(
|
|
|
|
|
L10n.of(context)!.currentlyActive,
|
|
|
|
|
style: style,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
if (lastActiveTimestamp != null) {
|
|
|
|
|
return Text(
|
|
|
|
|
L10n.of(context)!.lastActiveAgo(
|
|
|
|
|
lastActiveTimestamp.localizedTimeShort(context),
|
|
|
|
|
),
|
|
|
|
|
style: style,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
return const SizedBox.shrink();
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|