|
|
|
|
@ -34,94 +34,96 @@ class ChatView extends StatelessWidget {
|
|
|
|
|
const ChatView(this.controller, {super.key});
|
|
|
|
|
|
|
|
|
|
List<Widget> _appBarActions(BuildContext context) {
|
|
|
|
|
// #Pangea
|
|
|
|
|
// if (controller.selectMode) {
|
|
|
|
|
// return [
|
|
|
|
|
// if (controller.canEditSelectedEvents)
|
|
|
|
|
// IconButton(
|
|
|
|
|
// icon: const Icon(Icons.edit_outlined),
|
|
|
|
|
// tooltip: L10n.of(context)!.edit,
|
|
|
|
|
// onPressed: controller.editSelectedEventAction,
|
|
|
|
|
// ),
|
|
|
|
|
// // #Pangea
|
|
|
|
|
// if (controller.selectedEvents.length == 1 &&
|
|
|
|
|
// controller.selectedEvents.single.messageType == MessageTypes.Text)
|
|
|
|
|
// // Pangea#
|
|
|
|
|
// IconButton(
|
|
|
|
|
// icon: const Icon(Icons.copy_outlined),
|
|
|
|
|
// tooltip: L10n.of(context)!.copy,
|
|
|
|
|
// onPressed: controller.copyEventsAction,
|
|
|
|
|
// ),
|
|
|
|
|
// if (controller.canSaveSelectedEvent)
|
|
|
|
|
// // Use builder context to correctly position the share dialog on iPad
|
|
|
|
|
// Builder(
|
|
|
|
|
// builder: (context) => IconButton(
|
|
|
|
|
// icon: Icon(Icons.adaptive.share),
|
|
|
|
|
// tooltip: L10n.of(context)!.share,
|
|
|
|
|
// onPressed: () => controller.saveSelectedEvent(context),
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
|
|
|
|
// if (controller.canPinSelectedEvents)
|
|
|
|
|
// IconButton(
|
|
|
|
|
// icon: const Icon(Icons.push_pin_outlined),
|
|
|
|
|
// onPressed: controller.pinEvent,
|
|
|
|
|
// tooltip: L10n.of(context)!.pinMessage,
|
|
|
|
|
// ),
|
|
|
|
|
// if (controller.canRedactSelectedEvents)
|
|
|
|
|
// IconButton(
|
|
|
|
|
// icon: const Icon(Icons.delete_outlined),
|
|
|
|
|
// tooltip: L10n.of(context)!.redactMessage,
|
|
|
|
|
// onPressed: controller.redactEventsAction,
|
|
|
|
|
// ),
|
|
|
|
|
// if (controller.selectedEvents.length == 1)
|
|
|
|
|
// PopupMenuButton<_EventContextAction>(
|
|
|
|
|
// onSelected: (action) {
|
|
|
|
|
// switch (action) {
|
|
|
|
|
// case _EventContextAction.info:
|
|
|
|
|
// controller.showEventInfo();
|
|
|
|
|
// controller.clearSelectedEvents();
|
|
|
|
|
// break;
|
|
|
|
|
// case _EventContextAction.report:
|
|
|
|
|
// controller.reportEventAction();
|
|
|
|
|
// break;
|
|
|
|
|
// }
|
|
|
|
|
// },
|
|
|
|
|
// itemBuilder: (context) => [
|
|
|
|
|
// PopupMenuItem(
|
|
|
|
|
// value: _EventContextAction.info,
|
|
|
|
|
// child: Row(
|
|
|
|
|
// mainAxisSize: MainAxisSize.min,
|
|
|
|
|
// children: [
|
|
|
|
|
// const Icon(Icons.info_outlined),
|
|
|
|
|
// const SizedBox(width: 12),
|
|
|
|
|
// Text(L10n.of(context)!.messageInfo),
|
|
|
|
|
// ],
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
|
|
|
|
// if (controller.selectedEvents.single.status.isSent)
|
|
|
|
|
// PopupMenuItem(
|
|
|
|
|
// value: _EventContextAction.report,
|
|
|
|
|
// child: Row(
|
|
|
|
|
// mainAxisSize: MainAxisSize.min,
|
|
|
|
|
// children: [
|
|
|
|
|
// const Icon(
|
|
|
|
|
// Icons.shield_outlined,
|
|
|
|
|
// color: Colors.red,
|
|
|
|
|
// ),
|
|
|
|
|
// const SizedBox(width: 12),
|
|
|
|
|
// Text(L10n.of(context)!.reportMessage),
|
|
|
|
|
// ],
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
|
|
|
|
// ],
|
|
|
|
|
// ),
|
|
|
|
|
// ];
|
|
|
|
|
return [
|
|
|
|
|
ChatSettingsPopupMenu(
|
|
|
|
|
controller.room,
|
|
|
|
|
(!controller.room.isDirectChat && !controller.room.isArchived),
|
|
|
|
|
),
|
|
|
|
|
];
|
|
|
|
|
if (controller.selectMode) {
|
|
|
|
|
return [
|
|
|
|
|
if (controller.canEditSelectedEvents)
|
|
|
|
|
IconButton(
|
|
|
|
|
icon: const Icon(Icons.edit_outlined),
|
|
|
|
|
tooltip: L10n.of(context)!.edit,
|
|
|
|
|
onPressed: controller.editSelectedEventAction,
|
|
|
|
|
),
|
|
|
|
|
// #Pangea
|
|
|
|
|
if (controller.selectedEvents.length == 1 &&
|
|
|
|
|
controller.selectedEvents.single.messageType == MessageTypes.Text)
|
|
|
|
|
// Pangea#
|
|
|
|
|
IconButton(
|
|
|
|
|
icon: const Icon(Icons.copy_outlined),
|
|
|
|
|
tooltip: L10n.of(context)!.copy,
|
|
|
|
|
onPressed: controller.copyEventsAction,
|
|
|
|
|
),
|
|
|
|
|
if (controller.canSaveSelectedEvent)
|
|
|
|
|
// Use builder context to correctly position the share dialog on iPad
|
|
|
|
|
Builder(
|
|
|
|
|
builder: (context) => IconButton(
|
|
|
|
|
icon: Icon(Icons.adaptive.share),
|
|
|
|
|
tooltip: L10n.of(context)!.share,
|
|
|
|
|
onPressed: () => controller.saveSelectedEvent(context),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
if (controller.canPinSelectedEvents)
|
|
|
|
|
IconButton(
|
|
|
|
|
icon: const Icon(Icons.push_pin_outlined),
|
|
|
|
|
onPressed: controller.pinEvent,
|
|
|
|
|
tooltip: L10n.of(context)!.pinMessage,
|
|
|
|
|
),
|
|
|
|
|
if (controller.canRedactSelectedEvents)
|
|
|
|
|
IconButton(
|
|
|
|
|
icon: const Icon(Icons.delete_outlined),
|
|
|
|
|
tooltip: L10n.of(context)!.redactMessage,
|
|
|
|
|
onPressed: controller.redactEventsAction,
|
|
|
|
|
),
|
|
|
|
|
if (controller.selectedEvents.length == 1)
|
|
|
|
|
PopupMenuButton<_EventContextAction>(
|
|
|
|
|
onSelected: (action) {
|
|
|
|
|
switch (action) {
|
|
|
|
|
case _EventContextAction.info:
|
|
|
|
|
controller.showEventInfo();
|
|
|
|
|
controller.clearSelectedEvents();
|
|
|
|
|
break;
|
|
|
|
|
case _EventContextAction.report:
|
|
|
|
|
controller.reportEventAction();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
itemBuilder: (context) => [
|
|
|
|
|
PopupMenuItem(
|
|
|
|
|
value: _EventContextAction.info,
|
|
|
|
|
child: Row(
|
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
|
children: [
|
|
|
|
|
const Icon(Icons.info_outlined),
|
|
|
|
|
const SizedBox(width: 12),
|
|
|
|
|
Text(L10n.of(context)!.messageInfo),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
if (controller.selectedEvents.single.status.isSent)
|
|
|
|
|
PopupMenuItem(
|
|
|
|
|
value: _EventContextAction.report,
|
|
|
|
|
child: Row(
|
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
|
children: [
|
|
|
|
|
const Icon(
|
|
|
|
|
Icons.shield_outlined,
|
|
|
|
|
color: Colors.red,
|
|
|
|
|
),
|
|
|
|
|
const SizedBox(width: 12),
|
|
|
|
|
Text(L10n.of(context)!.reportMessage),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
];
|
|
|
|
|
// #Pangea
|
|
|
|
|
} else {
|
|
|
|
|
return [
|
|
|
|
|
ChatSettingsPopupMenu(
|
|
|
|
|
controller.room,
|
|
|
|
|
(!controller.room.isDirectChat && !controller.room.isArchived),
|
|
|
|
|
),
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
// else if (!controller.room.isArchived) {
|
|
|
|
|
// return [
|
|
|
|
|
// if (Matrix.of(context).voipPlugin != null &&
|
|
|
|
|
@ -188,34 +190,28 @@ class ChatView extends StatelessWidget {
|
|
|
|
|
}
|
|
|
|
|
return Scaffold(
|
|
|
|
|
appBar: AppBar(
|
|
|
|
|
actionsIconTheme: const IconThemeData(
|
|
|
|
|
// #Pangea
|
|
|
|
|
// color: controller.selectedEvents.isEmpty
|
|
|
|
|
// ? null
|
|
|
|
|
// : Theme.of(context).colorScheme.primary,
|
|
|
|
|
// Pangea#
|
|
|
|
|
),
|
|
|
|
|
leading:
|
|
|
|
|
// #Pangea
|
|
|
|
|
// controller.selectMode
|
|
|
|
|
// ? IconButton(
|
|
|
|
|
// icon: const Icon(Icons.close),
|
|
|
|
|
// onPressed: controller.clearSelectedEvents,
|
|
|
|
|
// tooltip: L10n.of(context)!.close,
|
|
|
|
|
// color: Theme.of(context).colorScheme.primary,
|
|
|
|
|
// )
|
|
|
|
|
// :
|
|
|
|
|
// Pangea#
|
|
|
|
|
UnreadRoomsBadge(
|
|
|
|
|
filter: (r) =>
|
|
|
|
|
r.id != controller.roomId
|
|
|
|
|
// #Pangea
|
|
|
|
|
&&
|
|
|
|
|
!r.isAnalyticsRoom,
|
|
|
|
|
// Pangea#
|
|
|
|
|
badgePosition: BadgePosition.topEnd(end: 8, top: 4),
|
|
|
|
|
child: const Center(child: BackButton()),
|
|
|
|
|
actionsIconTheme: IconThemeData(
|
|
|
|
|
color: controller.selectedEvents.isEmpty
|
|
|
|
|
? null
|
|
|
|
|
: Theme.of(context).colorScheme.primary,
|
|
|
|
|
),
|
|
|
|
|
leading: controller.selectMode
|
|
|
|
|
? IconButton(
|
|
|
|
|
icon: const Icon(Icons.close),
|
|
|
|
|
onPressed: controller.clearSelectedEvents,
|
|
|
|
|
tooltip: L10n.of(context)!.close,
|
|
|
|
|
color: Theme.of(context).colorScheme.primary,
|
|
|
|
|
)
|
|
|
|
|
: UnreadRoomsBadge(
|
|
|
|
|
filter: (r) =>
|
|
|
|
|
r.id != controller.roomId
|
|
|
|
|
// #Pangea
|
|
|
|
|
&&
|
|
|
|
|
!r.isAnalyticsRoom,
|
|
|
|
|
// Pangea#
|
|
|
|
|
badgePosition: BadgePosition.topEnd(end: 8, top: 4),
|
|
|
|
|
child: const Center(child: BackButton()),
|
|
|
|
|
),
|
|
|
|
|
titleSpacing: 0,
|
|
|
|
|
title: ChatAppBarTitle(controller),
|
|
|
|
|
actions: _appBarActions(context),
|
|
|
|
|
|