diff --git a/lib/pages/chat/chat_input_row.dart b/lib/pages/chat/chat_input_row.dart index bd1653fe0..30ad9c434 100644 --- a/lib/pages/chat/chat_input_row.dart +++ b/lib/pages/chat/chat_input_row.dart @@ -2,14 +2,11 @@ import 'package:animations/animations.dart'; import 'package:fluffychat/config/app_config.dart'; import 'package:fluffychat/pangea/choreographer/widgets/it_bar.dart'; import 'package:fluffychat/pangea/choreographer/widgets/send_button.dart'; -import 'package:fluffychat/pangea/widgets/chat/message_actions.dart'; import 'package:fluffychat/utils/platform_infos.dart'; import 'package:fluffychat/widgets/avatar.dart'; import 'package:fluffychat/widgets/matrix.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; import 'package:flutter_gen/gen_l10n/l10n.dart'; -import 'package:keyboard_shortcuts/keyboard_shortcuts.dart'; import 'package:matrix/matrix.dart'; import '../../config/themes.dart'; @@ -103,175 +100,186 @@ class ChatInputRow extends StatelessWidget { : const SizedBox.shrink(), ] : [ - KeyBoardShortcuts( - keysToPress: { - LogicalKeyboardKey.altLeft, - LogicalKeyboardKey.keyA, - }, - onKeysPressed: () => - controller.onAddPopupMenuButtonSelected('file'), - helpLabel: L10n.of(context)!.sendFile, - child: AnimatedContainer( - duration: FluffyThemes.animationDuration, - curve: FluffyThemes.animationCurve, - height: 56, - //#Pangea - // width: controller.sendController.text.isEmpty ? 56 : 0, - width: controller.sendController.text.isEmpty && - controller.pangeaController.permissionsController - .showChatInputAddButton(controller.roomId) - ? 56 - : 0, - //Pangea# - alignment: Alignment.center, - clipBehavior: Clip.hardEdge, - decoration: const BoxDecoration(), - child: PopupMenuButton( - icon: const Icon(Icons.add_outlined), - onSelected: controller.onAddPopupMenuButtonSelected, - itemBuilder: (BuildContext context) => - >[ - //#Pangea - if (controller.pangeaController.permissionsController - .canShareFile(controller.roomId)) - //Pangea# - PopupMenuItem( - value: 'file', - child: ListTile( - leading: const CircleAvatar( - backgroundColor: Colors.green, - foregroundColor: Colors.white, - child: Icon(Icons.attachment_outlined), - ), - title: Text(L10n.of(context)!.sendFile), - contentPadding: const EdgeInsets.all(0), + // #Pangea + // KeyBoardShortcuts( + // keysToPress: { + // LogicalKeyboardKey.altLeft, + // LogicalKeyboardKey.keyA, + // }, + // onKeysPressed: () => + // controller.onAddPopupMenuButtonSelected('file'), + // helpLabel: L10n.of(context)!.sendFile, + // child: + // Pangea# + AnimatedContainer( + duration: FluffyThemes.animationDuration, + curve: FluffyThemes.animationCurve, + height: 56, + //#Pangea + // width: controller.sendController.text.isEmpty ? 56 : 0, + width: controller.sendController.text.isEmpty && + controller.pangeaController.permissionsController + .showChatInputAddButton(controller.roomId) + ? 56 + : 0, + //Pangea# + alignment: Alignment.center, + clipBehavior: Clip.hardEdge, + decoration: const BoxDecoration(), + child: PopupMenuButton( + icon: const Icon(Icons.add_outlined), + onSelected: controller.onAddPopupMenuButtonSelected, + itemBuilder: (BuildContext context) => + >[ + //#Pangea + if (controller.pangeaController.permissionsController + .canShareFile(controller.roomId)) + //Pangea# + PopupMenuItem( + value: 'file', + child: ListTile( + leading: const CircleAvatar( + backgroundColor: Colors.green, + foregroundColor: Colors.white, + child: Icon(Icons.attachment_outlined), ), + title: Text(L10n.of(context)!.sendFile), + contentPadding: const EdgeInsets.all(0), ), - //#Pangea - if (controller.pangeaController.permissionsController - .canSharePhoto(controller.roomId)) - //Pangea# - PopupMenuItem( - value: 'image', - child: ListTile( - leading: const CircleAvatar( - backgroundColor: Colors.blue, - foregroundColor: Colors.white, - child: Icon(Icons.image_outlined), - ), - title: Text(L10n.of(context)!.sendImage), - contentPadding: const EdgeInsets.all(0), + ), + //#Pangea + if (controller.pangeaController.permissionsController + .canSharePhoto(controller.roomId)) + //Pangea# + PopupMenuItem( + value: 'image', + child: ListTile( + leading: const CircleAvatar( + backgroundColor: Colors.blue, + foregroundColor: Colors.white, + child: Icon(Icons.image_outlined), ), + title: Text(L10n.of(context)!.sendImage), + contentPadding: const EdgeInsets.all(0), ), + ), //#Pangea - // if (PlatformInfos.isMobile) - if (PlatformInfos.isMobile && - controller.pangeaController.permissionsController - .canSharePhoto(controller.roomId)) - //Pangea# - PopupMenuItem( - value: 'camera', - child: ListTile( - leading: const CircleAvatar( - backgroundColor: Colors.purple, - foregroundColor: Colors.white, - child: Icon(Icons.camera_alt_outlined), - ), - title: Text(L10n.of(context)!.openCamera), - contentPadding: const EdgeInsets.all(0), + // if (PlatformInfos.isMobile) + if (PlatformInfos.isMobile && + controller.pangeaController.permissionsController + .canSharePhoto(controller.roomId)) + //Pangea# + PopupMenuItem( + value: 'camera', + child: ListTile( + leading: const CircleAvatar( + backgroundColor: Colors.purple, + foregroundColor: Colors.white, + child: Icon(Icons.camera_alt_outlined), ), + title: Text(L10n.of(context)!.openCamera), + contentPadding: const EdgeInsets.all(0), ), - //#Pangea - // if (PlatformInfos.isMobile) - if (PlatformInfos.isMobile && - controller.pangeaController.permissionsController - .canShareVideo(controller.roomId)) - //Pangea# - PopupMenuItem( - value: 'camera-video', - child: ListTile( - leading: const CircleAvatar( - backgroundColor: Colors.red, - foregroundColor: Colors.white, - child: Icon(Icons.videocam_outlined), - ), - title: Text(L10n.of(context)!.openVideoCamera), - contentPadding: const EdgeInsets.all(0), + ), + //#Pangea + // if (PlatformInfos.isMobile) + if (PlatformInfos.isMobile && + controller.pangeaController.permissionsController + .canShareVideo(controller.roomId)) + //Pangea# + PopupMenuItem( + value: 'camera-video', + child: ListTile( + leading: const CircleAvatar( + backgroundColor: Colors.red, + foregroundColor: Colors.white, + child: Icon(Icons.videocam_outlined), ), + title: Text(L10n.of(context)!.openVideoCamera), + contentPadding: const EdgeInsets.all(0), ), - if (controller.room - .getImagePacks(ImagePackUsage.sticker) - .isNotEmpty) - PopupMenuItem( - value: 'sticker', - child: ListTile( - leading: const CircleAvatar( - backgroundColor: Colors.orange, - foregroundColor: Colors.white, - child: Icon(Icons.emoji_emotions_outlined), - ), - title: Text(L10n.of(context)!.sendSticker), - contentPadding: const EdgeInsets.all(0), + ), + if (controller.room + .getImagePacks(ImagePackUsage.sticker) + .isNotEmpty) + PopupMenuItem( + value: 'sticker', + child: ListTile( + leading: const CircleAvatar( + backgroundColor: Colors.orange, + foregroundColor: Colors.white, + child: Icon(Icons.emoji_emotions_outlined), ), + title: Text(L10n.of(context)!.sendSticker), + contentPadding: const EdgeInsets.all(0), ), - //#Pangea - // if (PlatformInfos.isMobile) - if (PlatformInfos.isMobile && - controller.pangeaController.permissionsController - .canShareLocation(controller.roomId)) - //Pangea# - PopupMenuItem( - value: 'location', - child: ListTile( - leading: const CircleAvatar( - backgroundColor: Colors.brown, - foregroundColor: Colors.white, - child: Icon(Icons.gps_fixed_outlined), - ), - title: Text(L10n.of(context)!.shareLocation), - contentPadding: const EdgeInsets.all(0), + ), + //#Pangea + // if (PlatformInfos.isMobile) + if (PlatformInfos.isMobile && + controller.pangeaController.permissionsController + .canShareLocation(controller.roomId)) + //Pangea# + PopupMenuItem( + value: 'location', + child: ListTile( + leading: const CircleAvatar( + backgroundColor: Colors.brown, + foregroundColor: Colors.white, + child: Icon(Icons.gps_fixed_outlined), ), + title: Text(L10n.of(context)!.shareLocation), + contentPadding: const EdgeInsets.all(0), ), - ], - ), + ), + ], ), ), + // #Pangea + // ), + // Pangea# Container( height: 56, alignment: Alignment.center, - child: KeyBoardShortcuts( - keysToPress: { - LogicalKeyboardKey.altLeft, - LogicalKeyboardKey.keyE, - }, - onKeysPressed: controller.emojiPickerAction, - helpLabel: L10n.of(context)!.emojis, - child: IconButton( - tooltip: L10n.of(context)!.emojis, - icon: PageTransitionSwitcher( - transitionBuilder: ( - Widget child, - Animation primaryAnimation, - Animation secondaryAnimation, - ) { - return SharedAxisTransition( - animation: primaryAnimation, - secondaryAnimation: secondaryAnimation, - transitionType: SharedAxisTransitionType.scaled, - fillColor: Colors.transparent, - child: child, - ); - }, - child: Icon( - controller.showEmojiPicker - ? Icons.keyboard - : Icons.emoji_emotions_outlined, - key: ValueKey(controller.showEmojiPicker), - ), + child: + // #Pangea + // KeyBoardShortcuts( + // keysToPress: { + // LogicalKeyboardKey.altLeft, + // LogicalKeyboardKey.keyE, + // }, + // onKeysPressed: controller.emojiPickerAction, + // helpLabel: L10n.of(context)!.emojis, + // child: + // Pangea# + IconButton( + tooltip: L10n.of(context)!.emojis, + icon: PageTransitionSwitcher( + transitionBuilder: ( + Widget child, + Animation primaryAnimation, + Animation secondaryAnimation, + ) { + return SharedAxisTransition( + animation: primaryAnimation, + secondaryAnimation: secondaryAnimation, + transitionType: SharedAxisTransitionType.scaled, + fillColor: Colors.transparent, + child: child, + ); + }, + child: Icon( + controller.showEmojiPicker + ? Icons.keyboard + : Icons.emoji_emotions_outlined, + key: ValueKey(controller.showEmojiPicker), ), - onPressed: controller.emojiPickerAction, ), + onPressed: controller.emojiPickerAction, ), + // #Pangea + // ), + // Pangea# ), // #Pangea // if (Matrix.of(context).isMultiAccount && diff --git a/lib/pages/chat_list/client_chooser_button.dart b/lib/pages/chat_list/client_chooser_button.dart index 74c3f34b7..ca6f9d3d8 100644 --- a/lib/pages/chat_list/client_chooser_button.dart +++ b/lib/pages/chat_list/client_chooser_button.dart @@ -12,7 +12,6 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_gen/gen_l10n/l10n.dart'; import 'package:go_router/go_router.dart'; -import 'package:keyboard_shortcuts/keyboard_shortcuts.dart'; import 'package:matrix/matrix.dart'; import '../../utils/fluffy_share.dart'; @@ -279,38 +278,40 @@ class ClientChooserButton extends StatelessWidget { builder: (context, snapshot) => Stack( alignment: Alignment.center, children: [ - ...List.generate( - clientCount, - (index) => KeyBoardShortcuts( - keysToPress: _buildKeyboardShortcut(index + 1), - helpLabel: L10n.of(context)!.switchToAccount(index + 1), - onKeysPressed: () => _handleKeyboardShortcut( - matrix, - index, - context, - ), - child: const SizedBox.shrink(), - ), - ), - KeyBoardShortcuts( - keysToPress: { - LogicalKeyboardKey.controlLeft, - LogicalKeyboardKey.tab, - }, - helpLabel: L10n.of(context)!.nextAccount, - onKeysPressed: () => _nextAccount(matrix, context), - child: const SizedBox.shrink(), - ), - KeyBoardShortcuts( - keysToPress: { - LogicalKeyboardKey.controlLeft, - LogicalKeyboardKey.shiftLeft, - LogicalKeyboardKey.tab, - }, - helpLabel: L10n.of(context)!.previousAccount, - onKeysPressed: () => _previousAccount(matrix, context), - child: const SizedBox.shrink(), - ), + // #Pangea + // ...List.generate( + // clientCount, + // (index) => KeyBoardShortcuts( + // keysToPress: _buildKeyboardShortcut(index + 1), + // helpLabel: L10n.of(context)!.switchToAccount(index + 1), + // onKeysPressed: () => _handleKeyboardShortcut( + // matrix, + // index, + // context, + // ), + // child: const SizedBox.shrink(), + // ), + // ), + // KeyBoardShortcuts( + // keysToPress: { + // LogicalKeyboardKey.controlLeft, + // LogicalKeyboardKey.tab, + // }, + // helpLabel: L10n.of(context)!.nextAccount, + // onKeysPressed: () => _nextAccount(matrix, context), + // child: const SizedBox.shrink(), + // ), + // KeyBoardShortcuts( + // keysToPress: { + // LogicalKeyboardKey.controlLeft, + // LogicalKeyboardKey.shiftLeft, + // LogicalKeyboardKey.tab, + // }, + // helpLabel: L10n.of(context)!.previousAccount, + // onKeysPressed: () => _previousAccount(matrix, context), + // child: const SizedBox.shrink(), + // ), + // Pangea# PopupMenuButton( onSelected: (o) => _clientSelected(o, context), itemBuilder: _bundleMenuItems, diff --git a/lib/widgets/chat_settings_popup_menu.dart b/lib/widgets/chat_settings_popup_menu.dart index 92a4df408..6c1078167 100644 --- a/lib/widgets/chat_settings_popup_menu.dart +++ b/lib/widgets/chat_settings_popup_menu.dart @@ -6,11 +6,9 @@ import 'package:fluffychat/pangea/extensions/pangea_room_extension.dart'; import 'package:fluffychat/pangea/models/class_model.dart'; import 'package:fluffychat/pangea/utils/download_chat.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; import 'package:flutter_gen/gen_l10n/l10n.dart'; import 'package:future_loading_dialog/future_loading_dialog.dart'; import 'package:go_router/go_router.dart'; -import 'package:keyboard_shortcuts/keyboard_shortcuts.dart'; import 'package:matrix/matrix.dart'; import 'matrix.dart'; @@ -152,15 +150,17 @@ class ChatSettingsPopupMenuState extends State { return Stack( alignment: Alignment.center, children: [ - KeyBoardShortcuts( - keysToPress: { - LogicalKeyboardKey.controlLeft, - LogicalKeyboardKey.keyI, - }, - helpLabel: L10n.of(context)!.chatDetails, - onKeysPressed: _showChatDetails, - child: const SizedBox.shrink(), - ), + // #Pangea + // KeyBoardShortcuts( + // keysToPress: { + // LogicalKeyboardKey.controlLeft, + // LogicalKeyboardKey.keyI, + // }, + // helpLabel: L10n.of(context)!.chatDetails, + // onKeysPressed: _showChatDetails, + // child: const SizedBox.shrink(), + // ), + // Pangea# PopupMenuButton( onSelected: (String choice) async { switch (choice) {