mirror of
https://github.com/krille-chan/fluffychat
synced 2024-09-17 08:15:09 +00:00
Revert "chore: Follow up chat appbar actions"
This reverts commit 08ca53a46d
.
This commit is contained in:
parent
fb98e3cf22
commit
2fadb64bc0
1 changed files with 48 additions and 29 deletions
|
@ -24,6 +24,8 @@ import '../../utils/stream_extension.dart';
|
||||||
import 'chat_emoji_picker.dart';
|
import 'chat_emoji_picker.dart';
|
||||||
import 'chat_input_row.dart';
|
import 'chat_input_row.dart';
|
||||||
|
|
||||||
|
enum _EventContextAction { info, report }
|
||||||
|
|
||||||
class ChatView extends StatelessWidget {
|
class ChatView extends StatelessWidget {
|
||||||
final ChatController controller;
|
final ChatController controller;
|
||||||
|
|
||||||
|
@ -58,30 +60,54 @@ class ChatView extends StatelessWidget {
|
||||||
onPressed: controller.pinEvent,
|
onPressed: controller.pinEvent,
|
||||||
tooltip: L10n.of(context)!.pinMessage,
|
tooltip: L10n.of(context)!.pinMessage,
|
||||||
),
|
),
|
||||||
if (controller.selectedEvents.length == 1) ...[
|
|
||||||
IconButton(
|
|
||||||
icon: const Icon(Icons.info_outlined),
|
|
||||||
tooltip: L10n.of(context)!.messageInfo,
|
|
||||||
onPressed: controller.showEventInfo,
|
|
||||||
),
|
|
||||||
IconButton(
|
|
||||||
icon: const Icon(
|
|
||||||
Icons.shield_outlined,
|
|
||||||
color: Colors.orange,
|
|
||||||
),
|
|
||||||
tooltip: L10n.of(context)!.reportMessage,
|
|
||||||
onPressed: controller.reportEventAction,
|
|
||||||
),
|
|
||||||
if (controller.canRedactSelectedEvents)
|
if (controller.canRedactSelectedEvents)
|
||||||
IconButton(
|
IconButton(
|
||||||
icon: Icon(
|
icon: const Icon(Icons.delete_outlined),
|
||||||
Icons.delete_outlined,
|
|
||||||
color: Theme.of(context).colorScheme.error,
|
|
||||||
),
|
|
||||||
tooltip: L10n.of(context)!.redactMessage,
|
tooltip: L10n.of(context)!.redactMessage,
|
||||||
onPressed: controller.redactEventsAction,
|
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),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
];
|
];
|
||||||
} else if (!controller.room.isArchived) {
|
} else if (!controller.room.isArchived) {
|
||||||
return [
|
return [
|
||||||
|
@ -152,14 +178,7 @@ class ChatView extends StatelessWidget {
|
||||||
),
|
),
|
||||||
titleSpacing: 0,
|
titleSpacing: 0,
|
||||||
title: ChatAppBarTitle(controller),
|
title: ChatAppBarTitle(controller),
|
||||||
actions: _appBarActions(context)
|
actions: _appBarActions(context),
|
||||||
.map(
|
|
||||||
(icon) => Padding(
|
|
||||||
padding: const EdgeInsets.only(left: 8),
|
|
||||||
child: icon,
|
|
||||||
),
|
|
||||||
)
|
|
||||||
.toList(),
|
|
||||||
),
|
),
|
||||||
floatingActionButton: controller.showScrollDownButton &&
|
floatingActionButton: controller.showScrollDownButton &&
|
||||||
controller.selectedEvents.isEmpty
|
controller.selectedEvents.isEmpty
|
||||||
|
|
Loading…
Reference in a new issue