commented out references to keyboard_shortcuts

pull/1077/head
Gabby Gurdin 2 years ago
parent a2fb362bde
commit ede472e0e8

@ -2,14 +2,11 @@ import 'package:animations/animations.dart';
import 'package:fluffychat/config/app_config.dart'; import 'package:fluffychat/config/app_config.dart';
import 'package:fluffychat/pangea/choreographer/widgets/it_bar.dart'; import 'package:fluffychat/pangea/choreographer/widgets/it_bar.dart';
import 'package:fluffychat/pangea/choreographer/widgets/send_button.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/utils/platform_infos.dart';
import 'package:fluffychat/widgets/avatar.dart'; import 'package:fluffychat/widgets/avatar.dart';
import 'package:fluffychat/widgets/matrix.dart'; import 'package:fluffychat/widgets/matrix.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart'; import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:keyboard_shortcuts/keyboard_shortcuts.dart';
import 'package:matrix/matrix.dart'; import 'package:matrix/matrix.dart';
import '../../config/themes.dart'; import '../../config/themes.dart';
@ -103,175 +100,186 @@ class ChatInputRow extends StatelessWidget {
: const SizedBox.shrink(), : const SizedBox.shrink(),
] ]
: <Widget>[ : <Widget>[
KeyBoardShortcuts( // #Pangea
keysToPress: { // KeyBoardShortcuts(
LogicalKeyboardKey.altLeft, // keysToPress: {
LogicalKeyboardKey.keyA, // LogicalKeyboardKey.altLeft,
}, // LogicalKeyboardKey.keyA,
onKeysPressed: () => // },
controller.onAddPopupMenuButtonSelected('file'), // onKeysPressed: () =>
helpLabel: L10n.of(context)!.sendFile, // controller.onAddPopupMenuButtonSelected('file'),
child: AnimatedContainer( // helpLabel: L10n.of(context)!.sendFile,
duration: FluffyThemes.animationDuration, // child:
curve: FluffyThemes.animationCurve, // Pangea#
height: 56, AnimatedContainer(
//#Pangea duration: FluffyThemes.animationDuration,
// width: controller.sendController.text.isEmpty ? 56 : 0, curve: FluffyThemes.animationCurve,
width: controller.sendController.text.isEmpty && height: 56,
controller.pangeaController.permissionsController //#Pangea
.showChatInputAddButton(controller.roomId) // width: controller.sendController.text.isEmpty ? 56 : 0,
? 56 width: controller.sendController.text.isEmpty &&
: 0, controller.pangeaController.permissionsController
//Pangea# .showChatInputAddButton(controller.roomId)
alignment: Alignment.center, ? 56
clipBehavior: Clip.hardEdge, : 0,
decoration: const BoxDecoration(), //Pangea#
child: PopupMenuButton<String>( alignment: Alignment.center,
icon: const Icon(Icons.add_outlined), clipBehavior: Clip.hardEdge,
onSelected: controller.onAddPopupMenuButtonSelected, decoration: const BoxDecoration(),
itemBuilder: (BuildContext context) => child: PopupMenuButton<String>(
<PopupMenuEntry<String>>[ icon: const Icon(Icons.add_outlined),
//#Pangea onSelected: controller.onAddPopupMenuButtonSelected,
if (controller.pangeaController.permissionsController itemBuilder: (BuildContext context) =>
.canShareFile(controller.roomId)) <PopupMenuEntry<String>>[
//Pangea# //#Pangea
PopupMenuItem<String>( if (controller.pangeaController.permissionsController
value: 'file', .canShareFile(controller.roomId))
child: ListTile( //Pangea#
leading: const CircleAvatar( PopupMenuItem<String>(
backgroundColor: Colors.green, value: 'file',
foregroundColor: Colors.white, child: ListTile(
child: Icon(Icons.attachment_outlined), leading: const CircleAvatar(
), backgroundColor: Colors.green,
title: Text(L10n.of(context)!.sendFile), foregroundColor: Colors.white,
contentPadding: const EdgeInsets.all(0), child: Icon(Icons.attachment_outlined),
), ),
title: Text(L10n.of(context)!.sendFile),
contentPadding: const EdgeInsets.all(0),
), ),
//#Pangea ),
if (controller.pangeaController.permissionsController //#Pangea
.canSharePhoto(controller.roomId)) if (controller.pangeaController.permissionsController
//Pangea# .canSharePhoto(controller.roomId))
PopupMenuItem<String>( //Pangea#
value: 'image', PopupMenuItem<String>(
child: ListTile( value: 'image',
leading: const CircleAvatar( child: ListTile(
backgroundColor: Colors.blue, leading: const CircleAvatar(
foregroundColor: Colors.white, backgroundColor: Colors.blue,
child: Icon(Icons.image_outlined), foregroundColor: Colors.white,
), child: Icon(Icons.image_outlined),
title: Text(L10n.of(context)!.sendImage),
contentPadding: const EdgeInsets.all(0),
), ),
title: Text(L10n.of(context)!.sendImage),
contentPadding: const EdgeInsets.all(0),
), ),
),
//#Pangea //#Pangea
// if (PlatformInfos.isMobile) // if (PlatformInfos.isMobile)
if (PlatformInfos.isMobile && if (PlatformInfos.isMobile &&
controller.pangeaController.permissionsController controller.pangeaController.permissionsController
.canSharePhoto(controller.roomId)) .canSharePhoto(controller.roomId))
//Pangea# //Pangea#
PopupMenuItem<String>( PopupMenuItem<String>(
value: 'camera', value: 'camera',
child: ListTile( child: ListTile(
leading: const CircleAvatar( leading: const CircleAvatar(
backgroundColor: Colors.purple, backgroundColor: Colors.purple,
foregroundColor: Colors.white, foregroundColor: Colors.white,
child: Icon(Icons.camera_alt_outlined), child: Icon(Icons.camera_alt_outlined),
),
title: Text(L10n.of(context)!.openCamera),
contentPadding: const EdgeInsets.all(0),
), ),
title: Text(L10n.of(context)!.openCamera),
contentPadding: const EdgeInsets.all(0),
), ),
//#Pangea ),
// if (PlatformInfos.isMobile) //#Pangea
if (PlatformInfos.isMobile && // if (PlatformInfos.isMobile)
controller.pangeaController.permissionsController if (PlatformInfos.isMobile &&
.canShareVideo(controller.roomId)) controller.pangeaController.permissionsController
//Pangea# .canShareVideo(controller.roomId))
PopupMenuItem<String>( //Pangea#
value: 'camera-video', PopupMenuItem<String>(
child: ListTile( value: 'camera-video',
leading: const CircleAvatar( child: ListTile(
backgroundColor: Colors.red, leading: const CircleAvatar(
foregroundColor: Colors.white, backgroundColor: Colors.red,
child: Icon(Icons.videocam_outlined), foregroundColor: Colors.white,
), child: Icon(Icons.videocam_outlined),
title: Text(L10n.of(context)!.openVideoCamera),
contentPadding: const EdgeInsets.all(0),
), ),
title: Text(L10n.of(context)!.openVideoCamera),
contentPadding: const EdgeInsets.all(0),
), ),
if (controller.room ),
.getImagePacks(ImagePackUsage.sticker) if (controller.room
.isNotEmpty) .getImagePacks(ImagePackUsage.sticker)
PopupMenuItem<String>( .isNotEmpty)
value: 'sticker', PopupMenuItem<String>(
child: ListTile( value: 'sticker',
leading: const CircleAvatar( child: ListTile(
backgroundColor: Colors.orange, leading: const CircleAvatar(
foregroundColor: Colors.white, backgroundColor: Colors.orange,
child: Icon(Icons.emoji_emotions_outlined), foregroundColor: Colors.white,
), child: Icon(Icons.emoji_emotions_outlined),
title: Text(L10n.of(context)!.sendSticker),
contentPadding: const EdgeInsets.all(0),
), ),
title: Text(L10n.of(context)!.sendSticker),
contentPadding: const EdgeInsets.all(0),
), ),
//#Pangea ),
// if (PlatformInfos.isMobile) //#Pangea
if (PlatformInfos.isMobile && // if (PlatformInfos.isMobile)
controller.pangeaController.permissionsController if (PlatformInfos.isMobile &&
.canShareLocation(controller.roomId)) controller.pangeaController.permissionsController
//Pangea# .canShareLocation(controller.roomId))
PopupMenuItem<String>( //Pangea#
value: 'location', PopupMenuItem<String>(
child: ListTile( value: 'location',
leading: const CircleAvatar( child: ListTile(
backgroundColor: Colors.brown, leading: const CircleAvatar(
foregroundColor: Colors.white, backgroundColor: Colors.brown,
child: Icon(Icons.gps_fixed_outlined), foregroundColor: Colors.white,
), child: Icon(Icons.gps_fixed_outlined),
title: Text(L10n.of(context)!.shareLocation),
contentPadding: const EdgeInsets.all(0),
), ),
title: Text(L10n.of(context)!.shareLocation),
contentPadding: const EdgeInsets.all(0),
), ),
], ),
), ],
), ),
), ),
// #Pangea
// ),
// Pangea#
Container( Container(
height: 56, height: 56,
alignment: Alignment.center, alignment: Alignment.center,
child: KeyBoardShortcuts( child:
keysToPress: { // #Pangea
LogicalKeyboardKey.altLeft, // KeyBoardShortcuts(
LogicalKeyboardKey.keyE, // keysToPress: {
}, // LogicalKeyboardKey.altLeft,
onKeysPressed: controller.emojiPickerAction, // LogicalKeyboardKey.keyE,
helpLabel: L10n.of(context)!.emojis, // },
child: IconButton( // onKeysPressed: controller.emojiPickerAction,
tooltip: L10n.of(context)!.emojis, // helpLabel: L10n.of(context)!.emojis,
icon: PageTransitionSwitcher( // child:
transitionBuilder: ( // Pangea#
Widget child, IconButton(
Animation<double> primaryAnimation, tooltip: L10n.of(context)!.emojis,
Animation<double> secondaryAnimation, icon: PageTransitionSwitcher(
) { transitionBuilder: (
return SharedAxisTransition( Widget child,
animation: primaryAnimation, Animation<double> primaryAnimation,
secondaryAnimation: secondaryAnimation, Animation<double> secondaryAnimation,
transitionType: SharedAxisTransitionType.scaled, ) {
fillColor: Colors.transparent, return SharedAxisTransition(
child: child, animation: primaryAnimation,
); secondaryAnimation: secondaryAnimation,
}, transitionType: SharedAxisTransitionType.scaled,
child: Icon( fillColor: Colors.transparent,
controller.showEmojiPicker child: child,
? Icons.keyboard );
: Icons.emoji_emotions_outlined, },
key: ValueKey(controller.showEmojiPicker), child: Icon(
), controller.showEmojiPicker
? Icons.keyboard
: Icons.emoji_emotions_outlined,
key: ValueKey(controller.showEmojiPicker),
), ),
onPressed: controller.emojiPickerAction,
), ),
onPressed: controller.emojiPickerAction,
), ),
// #Pangea
// ),
// Pangea#
), ),
// #Pangea // #Pangea
// if (Matrix.of(context).isMultiAccount && // if (Matrix.of(context).isMultiAccount &&

@ -12,7 +12,6 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart'; import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:go_router/go_router.dart'; import 'package:go_router/go_router.dart';
import 'package:keyboard_shortcuts/keyboard_shortcuts.dart';
import 'package:matrix/matrix.dart'; import 'package:matrix/matrix.dart';
import '../../utils/fluffy_share.dart'; import '../../utils/fluffy_share.dart';
@ -279,38 +278,40 @@ class ClientChooserButton extends StatelessWidget {
builder: (context, snapshot) => Stack( builder: (context, snapshot) => Stack(
alignment: Alignment.center, alignment: Alignment.center,
children: [ children: [
...List.generate( // #Pangea
clientCount, // ...List.generate(
(index) => KeyBoardShortcuts( // clientCount,
keysToPress: _buildKeyboardShortcut(index + 1), // (index) => KeyBoardShortcuts(
helpLabel: L10n.of(context)!.switchToAccount(index + 1), // keysToPress: _buildKeyboardShortcut(index + 1),
onKeysPressed: () => _handleKeyboardShortcut( // helpLabel: L10n.of(context)!.switchToAccount(index + 1),
matrix, // onKeysPressed: () => _handleKeyboardShortcut(
index, // matrix,
context, // index,
), // context,
child: const SizedBox.shrink(), // ),
), // child: const SizedBox.shrink(),
), // ),
KeyBoardShortcuts( // ),
keysToPress: { // KeyBoardShortcuts(
LogicalKeyboardKey.controlLeft, // keysToPress: {
LogicalKeyboardKey.tab, // LogicalKeyboardKey.controlLeft,
}, // LogicalKeyboardKey.tab,
helpLabel: L10n.of(context)!.nextAccount, // },
onKeysPressed: () => _nextAccount(matrix, context), // helpLabel: L10n.of(context)!.nextAccount,
child: const SizedBox.shrink(), // onKeysPressed: () => _nextAccount(matrix, context),
), // child: const SizedBox.shrink(),
KeyBoardShortcuts( // ),
keysToPress: { // KeyBoardShortcuts(
LogicalKeyboardKey.controlLeft, // keysToPress: {
LogicalKeyboardKey.shiftLeft, // LogicalKeyboardKey.controlLeft,
LogicalKeyboardKey.tab, // LogicalKeyboardKey.shiftLeft,
}, // LogicalKeyboardKey.tab,
helpLabel: L10n.of(context)!.previousAccount, // },
onKeysPressed: () => _previousAccount(matrix, context), // helpLabel: L10n.of(context)!.previousAccount,
child: const SizedBox.shrink(), // onKeysPressed: () => _previousAccount(matrix, context),
), // child: const SizedBox.shrink(),
// ),
// Pangea#
PopupMenuButton<Object>( PopupMenuButton<Object>(
onSelected: (o) => _clientSelected(o, context), onSelected: (o) => _clientSelected(o, context),
itemBuilder: _bundleMenuItems, itemBuilder: _bundleMenuItems,

@ -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/models/class_model.dart';
import 'package:fluffychat/pangea/utils/download_chat.dart'; import 'package:fluffychat/pangea/utils/download_chat.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart'; import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:future_loading_dialog/future_loading_dialog.dart'; import 'package:future_loading_dialog/future_loading_dialog.dart';
import 'package:go_router/go_router.dart'; import 'package:go_router/go_router.dart';
import 'package:keyboard_shortcuts/keyboard_shortcuts.dart';
import 'package:matrix/matrix.dart'; import 'package:matrix/matrix.dart';
import 'matrix.dart'; import 'matrix.dart';
@ -152,15 +150,17 @@ class ChatSettingsPopupMenuState extends State<ChatSettingsPopupMenu> {
return Stack( return Stack(
alignment: Alignment.center, alignment: Alignment.center,
children: [ children: [
KeyBoardShortcuts( // #Pangea
keysToPress: { // KeyBoardShortcuts(
LogicalKeyboardKey.controlLeft, // keysToPress: {
LogicalKeyboardKey.keyI, // LogicalKeyboardKey.controlLeft,
}, // LogicalKeyboardKey.keyI,
helpLabel: L10n.of(context)!.chatDetails, // },
onKeysPressed: _showChatDetails, // helpLabel: L10n.of(context)!.chatDetails,
child: const SizedBox.shrink(), // onKeysPressed: _showChatDetails,
), // child: const SizedBox.shrink(),
// ),
// Pangea#
PopupMenuButton( PopupMenuButton(
onSelected: (String choice) async { onSelected: (String choice) async {
switch (choice) { switch (choice) {

Loading…
Cancel
Save