@ -1,10 +1,8 @@
import ' package:flutter/material.dart ' ;
import ' package:flutter/material.dart ' ;
import ' package:flutter/services.dart ' ;
import ' package:animations/animations.dart ' ;
import ' package:animations/animations.dart ' ;
import ' package:flutter_gen/gen_l10n/l10n.dart ' ;
import ' package:flutter_gen/gen_l10n/l10n.dart ' ;
import ' package:matrix/matrix.dart ' ;
import ' package:matrix/matrix.dart ' ;
import ' package:new_keyboard_shortcuts/keyboard_shortcuts.dart ' ;
import ' package:fluffychat/config/app_config.dart ' ;
import ' package:fluffychat/config/app_config.dart ' ;
import ' package:fluffychat/utils/platform_infos.dart ' ;
import ' package:fluffychat/utils/platform_infos.dart ' ;
@ -96,130 +94,113 @@ class ChatInputRow extends StatelessWidget {
]
]
: < Widget > [
: < Widget > [
const SizedBox ( width: 4 ) ,
const SizedBox ( width: 4 ) ,
KeyBoardShortcuts (
AnimatedContainer (
keysToPress: {
duration: FluffyThemes . animationDuration ,
LogicalKeyboardKey . altLeft ,
curve: FluffyThemes . animationCurve ,
LogicalKeyboardKey . keyA ,
height: height ,
} ,
width: controller . sendController . text . isEmpty ? height : 0 ,
onKeysPressed: ( ) = >
alignment: Alignment . center ,
controller . onAddPopupMenuButtonSelected ( ' file ' ) ,
clipBehavior: Clip . hardEdge ,
helpLabel: L10n . of ( context ) . sendFile ,
decoration: const BoxDecoration ( ) ,
child: AnimatedContainer (
child: PopupMenuButton < String > (
duration: FluffyThemes . animationDuration ,
icon: const Icon ( Icons . add_outlined ) ,
curve: FluffyThemes . animationCurve ,
onSelected: controller . onAddPopupMenuButtonSelected ,
height: height ,
itemBuilder: ( BuildContext context ) = >
width: controller . sendController . text . isEmpty ? height : 0 ,
< PopupMenuEntry < String > > [
alignment: Alignment . center ,
PopupMenuItem < String > (
clipBehavior: Clip . hardEdge ,
value: ' file ' ,
decoration: const BoxDecoration ( ) ,
child: ListTile (
child: PopupMenuButton < String > (
leading: const CircleAvatar (
icon: const Icon ( Icons . add_outlined ) ,
backgroundColor: Colors . green ,
onSelected: controller . onAddPopupMenuButtonSelected ,
foregroundColor: Colors . white ,
itemBuilder: ( BuildContext context ) = >
child: Icon ( Icons . attachment_outlined ) ,
< PopupMenuEntry < String > > [
) ,
title: Text ( L10n . of ( context ) . sendFile ) ,
contentPadding: const EdgeInsets . all ( 0 ) ,
) ,
) ,
PopupMenuItem < String > (
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 ) ,
) ,
) ,
if ( PlatformInfos . isMobile )
PopupMenuItem < String > (
PopupMenuItem < String > (
value: ' file ' ,
value: ' camera ' ,
child: ListTile (
child: ListTile (
leading: const CircleAvatar (
leading: const CircleAvatar (
backgroundColor: Colors . green ,
backgroundColor: Colors . purple ,
foregroundColor: Colors . white ,
foregroundColor: Colors . white ,
child: Icon ( Icons . attachment_outlined ) ,
child: Icon ( Icons . camera_al t_outlined) ,
) ,
) ,
title: Text ( L10n . of ( context ) . sendFile ) ,
title: Text ( L10n . of ( context ) . openCamera ) ,
contentPadding: const EdgeInsets . all ( 0 ) ,
contentPadding: const EdgeInsets . all ( 0 ) ,
) ,
) ,
) ,
) ,
if ( PlatformInfos . isMobile )
PopupMenuItem < String > (
PopupMenuItem < String > (
value: ' image ' ,
value: ' camera-video ' ,
child: ListTile (
child: ListTile (
leading: const CircleAvatar (
leading: const CircleAvatar (
backgroundColor: Colors . blue ,
backgroundColor: Colors . red ,
foregroundColor: Colors . white ,
foregroundColor: Colors . white ,
child: Icon ( Icons . image _outlined) ,
child: Icon ( Icons . videocam _outlined) ,
) ,
) ,
title: Text ( L10n . of ( context ) . sendImage ) ,
title: Text ( L10n . of ( context ) . openVideoCamera ) ,
contentPadding: const EdgeInsets . all ( 0 ) ,
contentPadding: const EdgeInsets . all ( 0 ) ,
) ,
) ,
) ,
) ,
if ( PlatformInfos . isMobile )
if ( PlatformInfos . isMobile )
PopupMenuItem < String > (
PopupMenuItem < String > (
value: ' camera ' ,
value: ' location ' ,
child: ListTile (
child: ListTile (
leading: const CircleAvatar (
leading: const CircleAvatar (
backgroundColor: Colors . purple ,
backgroundColor: Colors . brown ,
foregroundColor: Colors . white ,
foregroundColor: Colors . white ,
child: Icon ( Icons . camera_alt_outlined ) ,
child: Icon ( Icons . gps_fixed_outlined ) ,
) ,
title: Text ( L10n . of ( context ) . openCamera ) ,
contentPadding: const EdgeInsets . all ( 0 ) ,
) ,
) ,
if ( PlatformInfos . isMobile )
PopupMenuItem < String > (
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 ( PlatformInfos . isMobile )
PopupMenuItem < String > (
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 ) ,
) ,
) ,
title: Text ( L10n . of ( context ) . shareLocation ) ,
contentPadding: const EdgeInsets . all ( 0 ) ,
) ,
) ,
] ,
) ,
) ,
] ,
) ,
) ,
) ,
) ,
Container (
Container (
height: height ,
height: height ,
width: height ,
width: height ,
alignment: Alignment . center ,
alignment: Alignment . center ,
child: KeyBoardShortcuts (
child: IconButton (
keysToPress: {
tooltip: L10n . of ( context ) . emojis ,
LogicalKeyboardKey . altLeft ,
icon: PageTransitionSwitcher (
LogicalKeyboardKey . keyE ,
transitionBuilder: (
} ,
Widget child ,
onKeysPressed: controller . emojiPickerAction ,
Animation < double > primaryAnimation ,
helpLabel: L10n . of ( context ) . emojis ,
Animation < double > secondaryAnimation ,
child: IconButton (
) {
tooltip: L10n . of ( context ) . emojis ,
return SharedAxisTransition (
icon: PageTransitionSwitcher (
animation: primaryAnimation ,
transitionBuilder: (
secondaryAnimation: secondaryAnimation ,
Widget child ,
transitionType: SharedAxisTransitionType . scaled ,
Animation < double > primaryAnimation ,
fillColor: Colors . transparent ,
Animation < double > secondaryAnimation ,
child: child ,
) {
) ;
return SharedAxisTransition (
} ,
animation: primaryAnimation ,
child: Icon (
secondaryAnimation: secondaryAnimation ,
controller . showEmojiPicker
transitionType: SharedAxisTransitionType . scaled ,
? Icons . keyboard
fillColor: Colors . transparent ,
: Icons . add_reaction_outlined ,
child: child ,
key: ValueKey ( controller . showEmojiPicker ) ,
) ;
} ,
child: Icon (
controller . showEmojiPicker
? Icons . keyboard
: Icons . add_reaction_outlined ,
key: ValueKey ( controller . showEmojiPicker ) ,
) ,
) ,
) ,
onPressed: controller . emojiPickerAction ,
) ,
) ,
onPressed: controller . emojiPickerAction ,
) ,
) ,
) ,
) ,
if ( Matrix . of ( context ) . isMultiAccount & &
if ( Matrix . of ( context ) . isMultiAccount & &