From d7563944969c2302f33517ffa2b5bc9e78d8cb9e Mon Sep 17 00:00:00 2001 From: thelukewalton Date: Mon, 14 Apr 2025 11:38:09 +0100 Subject: [PATCH 1/4] fix: Add background color prop to ZdsComment --- example/lib/pages/components/comment.dart | 1 + lib/src/components/molecules/comment.dart | 25 +++++++++++++++++------ 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/example/lib/pages/components/comment.dart b/example/lib/pages/components/comment.dart index 99769461..80ef71e5 100644 --- a/example/lib/pages/components/comment.dart +++ b/example/lib/pages/components/comment.dart @@ -16,6 +16,7 @@ class _CommentDemoState extends State { child: Column( children: [ ZdsComment( + backgroundColor: Colors.amber, avatar: ZetaAvatar.initials( initials: 'JP', size: ZetaAvatarSize.xxxs, diff --git a/lib/src/components/molecules/comment.dart b/lib/src/components/molecules/comment.dart index 982e876c..5cf95df7 100644 --- a/lib/src/components/molecules/comment.dart +++ b/lib/src/components/molecules/comment.dart @@ -24,6 +24,7 @@ class ZdsComment extends StatelessWidget { this.menuItems, this.menuPosition = ZdsPopupMenuPosition.bottomRight, this.onMenuItemSelected, + this.backgroundColor, }) : assert( onReply != null && replySemanticLabel != null || onReply == null && replySemanticLabel == null, 'replySemanticLabel must be not null if onReply is defined', @@ -86,13 +87,20 @@ class ZdsComment extends StatelessWidget { /// Menu items must be given a value for the callback to trigger. final ValueChanged? onMenuItemSelected; + /// The background color of the comment. + /// + /// Defaults to [ZetaColors.surfacePrimary]. + final Color? backgroundColor; + @override Widget build(BuildContext context) { final colors = Zeta.of(context).colors; final spacing = Zeta.of(context).spacing; + final backgroundColor = this.backgroundColor ?? colors.surfacePrimary; + return ColoredBox( - color: colors.surfacePrimary, + color: backgroundColor, child: Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -121,7 +129,6 @@ class ZdsComment extends StatelessWidget { icon: ZetaIcons.reply, semanticLabel: replySemanticLabel, foregroundColor: colors.primary, - backgroundColor: colors.surfacePrimarySubtle, onPressed: (_) => onReply!(), ), if (onDelete != null && deleteSemanticLabel != null) @@ -200,6 +207,7 @@ class ZdsComment extends StatelessWidget { attachment: attachment!, downloadCallback: downloadCallback, customThumbnail: attachmentThumbnail, + backgroundColor: backgroundColor, ), ), ], @@ -213,7 +221,7 @@ class ZdsComment extends StatelessWidget { onSelected: onMenuItemSelected, builder: (context, open) { return Material( - color: colors.surfacePrimary, + color: backgroundColor, child: InkWell( onTap: open, child: child, @@ -222,7 +230,7 @@ class ZdsComment extends StatelessWidget { }, ); } - return ColoredBox(color: colors.surfacePrimary, child: child); + return ColoredBox(color: backgroundColor, child: child); }, ), ); @@ -249,7 +257,8 @@ class ZdsComment extends StatelessWidget { ..add(StringProperty('deleteSemanticLabel', deleteSemanticLabel)) ..add(StringProperty('replySemanticLabel', replySemanticLabel)) ..add(EnumProperty('menuPosition', menuPosition)) - ..add(ObjectFlagProperty?>.has('onMenuItemSelected', onMenuItemSelected)); + ..add(ObjectFlagProperty?>.has('onMenuItemSelected', onMenuItemSelected)) + ..add(ColorProperty('backgroundColor', backgroundColor)); } } @@ -258,11 +267,13 @@ class _AttachmentRow extends StatelessWidget { required this.attachment, this.customThumbnail, this.downloadCallback, + required this.backgroundColor, }); final ZdsChatAttachment attachment; final VoidCallback? downloadCallback; final Widget? customThumbnail; + final Color backgroundColor; @override Widget build(BuildContext context) { @@ -271,6 +282,7 @@ class _AttachmentRow extends StatelessWidget { final radius = Zeta.of(context).radius; return Material( + color: backgroundColor, child: InkWell( borderRadius: radius.minimal, onTap: downloadCallback, @@ -324,6 +336,7 @@ class _AttachmentRow extends StatelessWidget { super.debugFillProperties(properties); properties ..add(DiagnosticsProperty('attachment', attachment)) - ..add(ObjectFlagProperty.has('downloadCallback', downloadCallback)); + ..add(ObjectFlagProperty.has('downloadCallback', downloadCallback)) + ..add(ColorProperty('backgroundColor', backgroundColor)); } } From e005fe69cdd8e8dd2cd6b1ec61e2e6183c12ccc2 Mon Sep 17 00:00:00 2001 From: thelukewalton Date: Mon, 14 Apr 2025 12:53:28 +0100 Subject: [PATCH 2/4] fix: Comment popup background color; --- example/lib/pages/components/comment.dart | 1 + lib/src/components/molecules/comment.dart | 44 ++++++++++++++--------- 2 files changed, 29 insertions(+), 16 deletions(-) diff --git a/example/lib/pages/components/comment.dart b/example/lib/pages/components/comment.dart index 80ef71e5..54bcc553 100644 --- a/example/lib/pages/components/comment.dart +++ b/example/lib/pages/components/comment.dart @@ -17,6 +17,7 @@ class _CommentDemoState extends State { children: [ ZdsComment( backgroundColor: Colors.amber, + popupMenuBackgroundColor: Colors.greenAccent[100], avatar: ZetaAvatar.initials( initials: 'JP', size: ZetaAvatarSize.xxxs, diff --git a/lib/src/components/molecules/comment.dart b/lib/src/components/molecules/comment.dart index 5cf95df7..96aa963a 100644 --- a/lib/src/components/molecules/comment.dart +++ b/lib/src/components/molecules/comment.dart @@ -25,6 +25,7 @@ class ZdsComment extends StatelessWidget { this.menuPosition = ZdsPopupMenuPosition.bottomRight, this.onMenuItemSelected, this.backgroundColor, + this.popupMenuBackgroundColor, }) : assert( onReply != null && replySemanticLabel != null || onReply == null && replySemanticLabel == null, 'replySemanticLabel must be not null if onReply is defined', @@ -77,7 +78,7 @@ class ZdsComment extends StatelessWidget { final Widget? attachmentThumbnail; /// The menu items to display in the popup menu. - /// If defined, the pouup menu will be shown when the user taps on the comment. + /// If defined, the popup menu will be shown when the user taps on the comment. final List>? menuItems; /// The popup menu position to display in the popup menu items. @@ -92,6 +93,11 @@ class ZdsComment extends StatelessWidget { /// Defaults to [ZetaColors.surfacePrimary]. final Color? backgroundColor; + /// The background color of the popup menu. + /// + /// Defaults to [ZetaColors.surfacePrimary]. + final Color? popupMenuBackgroundColor; + @override Widget build(BuildContext context) { final colors = Zeta.of(context).colors; @@ -214,20 +220,25 @@ class ZdsComment extends StatelessWidget { ), ); if (menuItems != null) { - return ZdsPopupMenu( - verticalOffset: spacing.small, - menuPosition: menuPosition, - items: menuItems ?? [], - onSelected: onMenuItemSelected, - builder: (context, open) { - return Material( - color: backgroundColor, - child: InkWell( - onTap: open, - child: child, - ), - ); - }, + return Theme( + data: Theme.of(context).copyWith( + popupMenuTheme: PopupMenuThemeData(color: popupMenuBackgroundColor), + ), + child: ZdsPopupMenu( + verticalOffset: spacing.small, + menuPosition: menuPosition, + items: menuItems ?? [], + onSelected: onMenuItemSelected, + builder: (context, open) { + return Material( + color: backgroundColor, + child: InkWell( + onTap: open, + child: child, + ), + ); + }, + ), ); } return ColoredBox(color: backgroundColor, child: child); @@ -258,7 +269,8 @@ class ZdsComment extends StatelessWidget { ..add(StringProperty('replySemanticLabel', replySemanticLabel)) ..add(EnumProperty('menuPosition', menuPosition)) ..add(ObjectFlagProperty?>.has('onMenuItemSelected', onMenuItemSelected)) - ..add(ColorProperty('backgroundColor', backgroundColor)); + ..add(ColorProperty('backgroundColor', backgroundColor)) + ..add(ColorProperty('popupMenuBackgroundColor', popupMenuBackgroundColor)); } } From 5c153e6f547a530ca1c1f020accfd5024b20d82b Mon Sep 17 00:00:00 2001 From: thelukewalton Date: Mon, 14 Apr 2025 13:39:51 +0100 Subject: [PATCH 3/4] deps: Fix verson of camerawesome as newer versions dont support flutter 3.24 --- pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pubspec.yaml b/pubspec.yaml index 681dcc23..8926066f 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -20,7 +20,7 @@ environment: dependencies: any_link_preview: ^3.0.2 cached_network_image: ^3.4.1 - camerawesome: ^2.1.0 + camerawesome: 2.1.0 # TODO: Update this once repo is on 3.27.x chewie: ^1.8.5 collection: ^1.18.0 crop_image: ^1.0.15 From fabc16d2273bf70b8207738bae184f4d7e439907 Mon Sep 17 00:00:00 2001 From: thelukewalton Date: Mon, 14 Apr 2025 13:40:18 +0100 Subject: [PATCH 4/4] fix: Attachments sheet iOS scroll height --- lib/src/components/organisms/chat/message_input.dart | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/src/components/organisms/chat/message_input.dart b/lib/src/components/organisms/chat/message_input.dart index 61e08590..cc564163 100644 --- a/lib/src/components/organisms/chat/message_input.dart +++ b/lib/src/components/organisms/chat/message_input.dart @@ -433,8 +433,9 @@ class ZdsMessageInputState extends State with SingleTickerProvi const itemHeightHorizontalIndividual = 56; final itemHeightHorizontalTotal = itemHeightHorizontalIndividual * moreItemsLength; final dividerHeight = _moreConfig.options.length - 1; - - final maxSheetHeight = handleSize + + final viewInsets = MediaQuery.of(context).padding.bottom; + final maxSheetHeight = viewInsets + + handleSize + titleHeaderHeight + (widget.moreOptionItemStyle == ZdsFilePickerOptionItemStyle.vertical ? itemHeightHorizontalTotal + dividerHeight @@ -445,7 +446,7 @@ class ZdsMessageInputState extends State with SingleTickerProvi enforceSheet: true, backgroundColor: zetaColors.surfacePrimary, context: context, - maxHeight: maxSheetHeight.toDouble(), + maxHeight: maxSheetHeight, builder: (_) { return Scaffold( body: Material(