Remove references to selected messages in chat view AppBar (#3604)

To avoid inaccessible options from being displayed
pull/2245/head
avashilling 3 months ago committed by GitHub
parent f6420624d1
commit 696330880a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -19,14 +19,16 @@ class ChatAppBarTitle extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final room = controller.room; final room = controller.room;
if (controller.selectedEvents.isNotEmpty) { // #Pangea
return Text( // if (controller.selectedEvents.isNotEmpty) {
controller.selectedEvents.length.toString(), // return Text(
style: TextStyle( // controller.selectedEvents.length.toString(),
color: Theme.of(context).colorScheme.onTertiaryContainer, // style: TextStyle(
), // color: Theme.of(context).colorScheme.onTertiaryContainer,
); // ),
} // );
// }
// Pangea#
return InkWell( return InkWell(
hoverColor: Colors.transparent, hoverColor: Colors.transparent,
splashColor: Colors.transparent, splashColor: Colors.transparent,

@ -32,89 +32,92 @@ class ChatView extends StatelessWidget {
const ChatView(this.controller, {super.key}); const ChatView(this.controller, {super.key});
List<Widget> _appBarActions(BuildContext context) { List<Widget> _appBarActions(BuildContext context) {
if (controller.selectMode) { // #Pangea
return [ // if (controller.selectMode) {
if (controller.canEditSelectedEvents) // return [
IconButton( // if (controller.canEditSelectedEvents)
icon: const Icon(Icons.edit_outlined), // IconButton(
tooltip: L10n.of(context).edit, // icon: const Icon(Icons.edit_outlined),
onPressed: controller.editSelectedEventAction, // tooltip: L10n.of(context).edit,
), // onPressed: controller.editSelectedEventAction,
IconButton( // ),
icon: const Icon(Icons.copy_outlined), // IconButton(
tooltip: L10n.of(context).copy, // icon: const Icon(Icons.copy_outlined),
onPressed: controller.copyEventsAction, // tooltip: L10n.of(context).copy,
), // onPressed: controller.copyEventsAction,
if (controller.canPinSelectedEvents) // ),
IconButton( // if (controller.canPinSelectedEvents)
icon: const Icon(Icons.push_pin_outlined), // IconButton(
onPressed: controller.pinEvent, // icon: const Icon(Icons.push_pin_outlined),
tooltip: L10n.of(context).pinMessage, // onPressed: controller.pinEvent,
), // tooltip: L10n.of(context).pinMessage,
if (controller.canRedactSelectedEvents) // ),
IconButton( // if (controller.canRedactSelectedEvents)
icon: const Icon(Icons.delete_outlined), // IconButton(
tooltip: L10n.of(context).redactMessage, // icon: const Icon(Icons.delete_outlined),
onPressed: controller.redactEventsAction, // tooltip: L10n.of(context).redactMessage,
), // onPressed: controller.redactEventsAction,
if (controller.selectedEvents.length == 1) // ),
PopupMenuButton<_EventContextAction>( // if (controller.selectedEvents.length == 1)
useRootNavigator: true, // PopupMenuButton<_EventContextAction>(
onSelected: (action) { // useRootNavigator: true,
switch (action) { // onSelected: (action) {
case _EventContextAction.info: // switch (action) {
controller.showEventInfo(); // case _EventContextAction.info:
controller.clearSelectedEvents(); // controller.showEventInfo();
break; // controller.clearSelectedEvents();
case _EventContextAction.report: // break;
controller.reportEventAction(); // case _EventContextAction.report:
break; // controller.reportEventAction();
} // break;
}, // }
itemBuilder: (context) => [ // },
if (controller.canSaveSelectedEvent) // itemBuilder: (context) => [
PopupMenuItem( // if (controller.canSaveSelectedEvent)
onTap: () => controller.saveSelectedEvent(context), // PopupMenuItem(
value: null, // onTap: () => controller.saveSelectedEvent(context),
child: Row( // value: null,
mainAxisSize: MainAxisSize.min, // child: Row(
children: [ // mainAxisSize: MainAxisSize.min,
const Icon(Icons.download_outlined), // children: [
const SizedBox(width: 12), // const Icon(Icons.download_outlined),
Text(L10n.of(context).downloadFile), // const SizedBox(width: 12),
], // Text(L10n.of(context).downloadFile),
), // ],
), // ),
PopupMenuItem( // ),
value: _EventContextAction.info, // PopupMenuItem(
child: Row( // value: _EventContextAction.info,
mainAxisSize: MainAxisSize.min, // child: Row(
children: [ // mainAxisSize: MainAxisSize.min,
const Icon(Icons.info_outlined), // children: [
const SizedBox(width: 12), // const Icon(Icons.info_outlined),
Text(L10n.of(context).messageInfo), // const SizedBox(width: 12),
], // Text(L10n.of(context).messageInfo),
), // ],
), // ),
if (controller.selectedEvents.single.status.isSent) // ),
PopupMenuItem( // if (controller.selectedEvents.single.status.isSent)
value: _EventContextAction.report, // PopupMenuItem(
child: Row( // value: _EventContextAction.report,
mainAxisSize: MainAxisSize.min, // child: Row(
children: [ // mainAxisSize: MainAxisSize.min,
const Icon( // children: [
Icons.shield_outlined, // const Icon(
color: Colors.red, // Icons.shield_outlined,
), // color: Colors.red,
const SizedBox(width: 12), // ),
Text(L10n.of(context).reportMessage), // const SizedBox(width: 12),
], // Text(L10n.of(context).reportMessage),
), // ],
), // ),
], // ),
), // ],
]; // ),
} else if (!controller.room.isArchived) { // ];
// } else
// Pangea#
if (!controller.room.isArchived) {
// #Pangea // #Pangea
return [ return [
IconButton( IconButton(
@ -194,23 +197,31 @@ class ChatView extends StatelessWidget {
} }
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
actionsIconTheme: IconThemeData( // #Pangea
color: controller.selectedEvents.isEmpty // actionsIconTheme:
? null // IconThemeData(
: theme.colorScheme.onTertiaryContainer, // #Pangea
), // color: controller.selectedEvents.isEmpty
backgroundColor: controller.selectedEvents.isEmpty // ? null
? null // : theme.colorScheme.onTertiaryContainer,
: theme.colorScheme.tertiaryContainer, // ),
// backgroundColor: controller.selectedEvents.isEmpty
// ? null
// : theme.colorScheme.tertiaryContainer,
// Pangea#
automaticallyImplyLeading: false, automaticallyImplyLeading: false,
leading: controller.selectMode leading:
? IconButton( // #Pangea
icon: const Icon(Icons.close), // controller.selectMode
onPressed: controller.clearSelectedEvents, // ? IconButton(
tooltip: L10n.of(context).close, // icon: const Icon(Icons.close),
color: theme.colorScheme.onTertiaryContainer, // onPressed: controller.clearSelectedEvents,
) // tooltip: L10n.of(context).close,
: FluffyThemes.isColumnMode(context) // color: theme.colorScheme.onTertiaryContainer,
// )
// :
// Pangea#
FluffyThemes.isColumnMode(context)
? null ? null
: StreamBuilder<Object>( : StreamBuilder<Object>(
stream: stream:

Loading…
Cancel
Save