diff --git a/assets/l10n/intl_en.arb b/assets/l10n/intl_en.arb index ebd4246f2..77be7b987 100644 --- a/assets/l10n/intl_en.arb +++ b/assets/l10n/intl_en.arb @@ -3201,5 +3201,7 @@ "allDevices": "All devices", "crossVerifiedDevicesIfEnabled": "Cross verified devices if enabled", "crossVerifiedDevices": "Cross verified devices", - "verifiedDevicesOnly": "Verified devices only" + "verifiedDevicesOnly": "Verified devices only", + "takeAPhoto": "Take a photo", + "recordAVideo": "Record a video" } diff --git a/lib/pages/chat/chat.dart b/lib/pages/chat/chat.dart index d595e7a0f..9187a2dbe 100644 --- a/lib/pages/chat/chat.dart +++ b/lib/pages/chat/chat.dart @@ -548,10 +548,9 @@ class ChatController extends State } void sendImageAction() async { - final files = await selectFiles( - context, - allowMultiple: true, - type: FileSelectorType.images, + final files = await ImagePicker().pickMultipleMedia( + imageQuality: null, + requestFullMetadata: false, ); if (files.isEmpty) return; diff --git a/lib/pages/chat/chat_input_row.dart b/lib/pages/chat/chat_input_row.dart index 500afdee0..eccb4fed6 100644 --- a/lib/pages/chat/chat_input_row.dart +++ b/lib/pages/chat/chat_input_row.dart @@ -109,91 +109,112 @@ class ChatInputRow extends StatelessWidget { ] : [ const SizedBox(width: 4), - AnimatedContainer( + AnimatedSize( duration: FluffyThemes.animationDuration, curve: FluffyThemes.animationCurve, - height: height, - width: controller.sendController.text.isEmpty ? height : 0, - alignment: Alignment.center, - clipBehavior: Clip.hardEdge, - decoration: const BoxDecoration(), - child: PopupMenuButton( - icon: const Icon(Icons.add_outlined), - onSelected: controller.onAddPopupMenuButtonSelected, - itemBuilder: (BuildContext context) => - >[ - 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), - ), - ), - 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), - ), - ), - if (PlatformInfos.isMobile) - PopupMenuItem( - value: 'camera', - child: ListTile( - leading: const CircleAvatar( - backgroundColor: Colors.purple, - foregroundColor: Colors.white, - child: Icon(Icons.camera_alt_outlined), + child: controller.sendController.text.isNotEmpty + ? null + : PopupMenuButton( + icon: const Icon(Icons.add_circle_outline), + iconColor: theme.colorScheme.onPrimaryContainer, + onSelected: controller.onAddPopupMenuButtonSelected, + itemBuilder: (BuildContext context) => + >[ + if (PlatformInfos.isMobile) + PopupMenuItem( + value: 'location', + child: ListTile( + leading: CircleAvatar( + backgroundColor: + theme.colorScheme.onPrimaryContainer, + foregroundColor: + theme.colorScheme.primaryContainer, + child: const Icon(Icons.gps_fixed_outlined), + ), + title: Text(L10n.of(context).shareLocation), + contentPadding: const EdgeInsets.all(0), + ), + ), + PopupMenuItem( + value: 'image', + child: ListTile( + leading: CircleAvatar( + backgroundColor: + theme.colorScheme.onPrimaryContainer, + foregroundColor: + theme.colorScheme.primaryContainer, + child: const Icon(Icons.photo_album_outlined), + ), + title: Text(L10n.of(context).openGallery), + contentPadding: const EdgeInsets.all(0), + ), ), - title: Text(L10n.of(context).openCamera), - contentPadding: const EdgeInsets.all(0), - ), - ), - if (PlatformInfos.isMobile) - PopupMenuItem( - value: 'camera-video', - child: ListTile( - leading: const CircleAvatar( - backgroundColor: Colors.red, - foregroundColor: Colors.white, - child: Icon(Icons.videocam_outlined), + PopupMenuItem( + value: 'file', + child: ListTile( + leading: CircleAvatar( + backgroundColor: + theme.colorScheme.onPrimaryContainer, + foregroundColor: + theme.colorScheme.primaryContainer, + child: const Icon(Icons.attachment_outlined), + ), + title: Text(L10n.of(context).sendFile), + contentPadding: const EdgeInsets.all(0), + ), ), - title: Text(L10n.of(context).openVideoCamera), - contentPadding: const EdgeInsets.all(0), - ), + ], ), - if (PlatformInfos.isMobile) - 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), + ), + if (PlatformInfos.isMobile) + AnimatedSize( + duration: FluffyThemes.animationDuration, + curve: FluffyThemes.animationCurve, + child: controller.sendController.text.isNotEmpty + ? null + : PopupMenuButton( + icon: const Icon(Icons.camera_alt_outlined), + onSelected: controller.onAddPopupMenuButtonSelected, + iconColor: theme.colorScheme.onPrimaryContainer, + itemBuilder: (context) => [ + PopupMenuItem( + value: 'camera-video', + child: ListTile( + leading: CircleAvatar( + backgroundColor: + theme.colorScheme.onPrimaryContainer, + foregroundColor: + theme.colorScheme.primaryContainer, + child: const Icon(Icons.videocam_outlined), + ), + title: Text(L10n.of(context).recordAVideo), + contentPadding: const EdgeInsets.all(0), + ), + ), + PopupMenuItem( + value: 'camera', + child: ListTile( + leading: CircleAvatar( + backgroundColor: + theme.colorScheme.onPrimaryContainer, + foregroundColor: + theme.colorScheme.primaryContainer, + child: const Icon(Icons.camera_alt_outlined), + ), + title: Text(L10n.of(context).takeAPhoto), + contentPadding: const EdgeInsets.all(0), + ), + ), + ], ), - ), - ], ), - ), Container( height: height, width: height, alignment: Alignment.center, child: IconButton( tooltip: L10n.of(context).emojis, + color: theme.colorScheme.onPrimaryContainer, icon: PageTransitionSwitcher( transitionBuilder: ( Widget child,