mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2025-01-11 18:22:49 +01:00
change: Nicer design for selecting items
This commit is contained in:
parent
689e298865
commit
22ae2608e0
@ -590,20 +590,6 @@ class ChatController extends State<Chat> {
|
||||
inputFocus.requestFocus();
|
||||
}
|
||||
|
||||
void onEventActionPopupMenuSelected(selected) {
|
||||
switch (selected) {
|
||||
case 'copy':
|
||||
copyEventsAction();
|
||||
break;
|
||||
case 'redact':
|
||||
redactEventsAction();
|
||||
break;
|
||||
case 'report':
|
||||
reportEventAction();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void goToNewRoomAction() async {
|
||||
if (OkCancelResult.ok !=
|
||||
await showOkCancelAlertDialog(
|
||||
|
@ -31,6 +31,11 @@ class ChatListView extends StatelessWidget {
|
||||
},
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
actionsIconTheme: IconThemeData(
|
||||
color: controller.selectedRoomIds.isEmpty
|
||||
? null
|
||||
: Theme.of(context).colorScheme.primary,
|
||||
),
|
||||
leading: selectMode == SelectMode.normal
|
||||
? controller.spaces.isEmpty
|
||||
? null
|
||||
@ -43,6 +48,7 @@ class ChatListView extends StatelessWidget {
|
||||
tooltip: L10n.of(context).cancel,
|
||||
icon: Icon(Icons.close_outlined),
|
||||
onPressed: controller.cancelAction,
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
),
|
||||
centerTitle: false,
|
||||
titleSpacing: controller.spaces.isEmpty ? null : 0,
|
||||
@ -89,7 +95,7 @@ class ChatListView extends StatelessWidget {
|
||||
onPressed: controller.toggleMuted,
|
||||
),
|
||||
IconButton(
|
||||
icon: Icon(Icons.archive_outlined),
|
||||
icon: Icon(Icons.delete_outlined),
|
||||
tooltip: L10n.of(context).archive,
|
||||
onPressed: controller.archiveAction,
|
||||
),
|
||||
@ -176,8 +182,7 @@ class ChatListView extends StatelessWidget {
|
||||
title: Text(selectMode == SelectMode.share
|
||||
? L10n.of(context).share
|
||||
: selectMode == SelectMode.select
|
||||
? L10n.of(context).numberSelected(
|
||||
controller.selectedRoomIds.length.toString())
|
||||
? controller.selectedRoomIds.length.toString()
|
||||
: controller.activeSpaceId == null
|
||||
? AppConfig.applicationName
|
||||
: Matrix.of(context)
|
||||
|
@ -64,11 +64,17 @@ class ChatView extends StatelessWidget {
|
||||
},
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
actionsIconTheme: IconThemeData(
|
||||
color: controller.selectedEvents.isEmpty
|
||||
? null
|
||||
: Theme.of(context).colorScheme.primary,
|
||||
),
|
||||
leading: controller.selectMode
|
||||
? IconButton(
|
||||
icon: Icon(Icons.close),
|
||||
onPressed: controller.clearSelectedEvents,
|
||||
tooltip: L10n.of(context).close,
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
)
|
||||
: UnreadBadgeBackButton(roomId: controller.roomId),
|
||||
titleSpacing: 0,
|
||||
@ -140,8 +146,7 @@ class ChatView extends StatelessWidget {
|
||||
],
|
||||
),
|
||||
))
|
||||
: Text(L10n.of(context).numberSelected(
|
||||
controller.selectedEvents.length.toString())),
|
||||
: Text(controller.selectedEvents.length.toString()),
|
||||
actions: controller.selectMode
|
||||
? <Widget>[
|
||||
if (controller.selectedEvents.length == 1 &&
|
||||
@ -153,31 +158,23 @@ class ChatView extends StatelessWidget {
|
||||
tooltip: L10n.of(context).edit,
|
||||
onPressed: controller.editSelectedEventAction,
|
||||
),
|
||||
PopupMenuButton(
|
||||
onSelected: controller.onEventActionPopupMenuSelected,
|
||||
itemBuilder: (_) => [
|
||||
PopupMenuItem(
|
||||
value: 'copy',
|
||||
child: Text(L10n.of(context).copy),
|
||||
),
|
||||
if (controller.canRedactSelectedEvents)
|
||||
PopupMenuItem(
|
||||
value: 'redact',
|
||||
child: Text(
|
||||
L10n.of(context).redactMessage,
|
||||
style: TextStyle(color: Colors.orange),
|
||||
),
|
||||
),
|
||||
if (controller.selectedEvents.length == 1)
|
||||
PopupMenuItem(
|
||||
value: 'report',
|
||||
child: Text(
|
||||
L10n.of(context).reportMessage,
|
||||
style: TextStyle(color: Colors.red),
|
||||
),
|
||||
),
|
||||
],
|
||||
IconButton(
|
||||
icon: Icon(Icons.copy_outlined),
|
||||
tooltip: L10n.of(context).copy,
|
||||
onPressed: controller.copyEventsAction,
|
||||
),
|
||||
if (controller.canRedactSelectedEvents)
|
||||
IconButton(
|
||||
icon: Icon(Icons.report_outlined),
|
||||
tooltip: L10n.of(context).reportMessage,
|
||||
onPressed: controller.reportEventAction,
|
||||
),
|
||||
if (controller.canRedactSelectedEvents)
|
||||
IconButton(
|
||||
icon: Icon(Icons.delete_outlined),
|
||||
tooltip: L10n.of(context).redactMessage,
|
||||
onPressed: controller.redactEventsAction,
|
||||
),
|
||||
]
|
||||
: <Widget>[
|
||||
if (controller.room.canSendDefaultStates)
|
||||
|
Loading…
Reference in New Issue
Block a user