From 7e8bb14c697809be04f889b51fd885f8acb21e76 Mon Sep 17 00:00:00 2001 From: Krille Date: Tue, 25 Feb 2025 14:56:59 +0100 Subject: [PATCH] chore: Follow up paddings --- lib/pages/chat/chat_input_row.dart | 182 +++++++++++++-------------- lib/pages/chat/send_file_dialog.dart | 5 +- 2 files changed, 92 insertions(+), 95 deletions(-) diff --git a/lib/pages/chat/chat_input_row.dart b/lib/pages/chat/chat_input_row.dart index c3da73990..686dcfb2b 100644 --- a/lib/pages/chat/chat_input_row.dart +++ b/lib/pages/chat/chat_input_row.dart @@ -109,109 +109,105 @@ class ChatInputRow extends StatelessWidget { ] : [ const SizedBox(width: 4), - AnimatedSize( + AnimatedContainer( duration: FluffyThemes.animationDuration, curve: FluffyThemes.animationCurve, - child: controller.sendController.text.isNotEmpty - ? null - : Center( - child: 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), - ), - ), - 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), - ), - ), - ], + width: controller.sendController.text.isNotEmpty ? 0 : height, + height: height, + alignment: Alignment.center, + decoration: const BoxDecoration(), + child: 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), + ), + ), + 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), + ), + ), + ], + ), ), if (PlatformInfos.isMobile) - AnimatedSize( + AnimatedContainer( duration: FluffyThemes.animationDuration, curve: FluffyThemes.animationCurve, - child: controller.sendController.text.isNotEmpty - ? null - : Center( - child: 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), - ), - ), - ], + width: controller.sendController.text.isNotEmpty ? 0 : height, + height: height, + alignment: Alignment.center, + decoration: const BoxDecoration(), + child: Center( + child: 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, diff --git a/lib/pages/chat/send_file_dialog.dart b/lib/pages/chat/send_file_dialog.dart index 3c04438e6..dea055467 100644 --- a/lib/pages/chat/send_file_dialog.dart +++ b/lib/pages/chat/send_file_dialog.dart @@ -255,8 +255,9 @@ class SendFileDialogState extends State { return Image.memory( bytes, height: 256, - width: - widget.files.length == 1 ? 256 : null, + width: widget.files.length == 1 + ? 256 - 24 + : null, fit: BoxFit.contain, errorBuilder: (context, e, s) { Logs()