From ee0cdf567b8719561bfbcde9d692880dc07df180 Mon Sep 17 00:00:00 2001 From: Deven Joshi Date: Wed, 6 Jan 2021 18:33:31 +0530 Subject: [PATCH] feat: Changed sending indicator icons to svg icons --- lib/src/channel_list_view.dart | 2 ++ lib/src/channel_preview.dart | 3 +-- lib/src/sending_indicator.dart | 6 ++---- lib/src/stream_chat_theme.dart | 34 +++++++++++++++++++--------------- lib/src/stream_svg_icon.dart | 12 ++++++++++++ 5 files changed, 36 insertions(+), 21 deletions(-) diff --git a/lib/src/channel_list_view.dart b/lib/src/channel_list_view.dart index 6c4e967e..4ffe4511 100644 --- a/lib/src/channel_list_view.dart +++ b/lib/src/channel_list_view.dart @@ -157,6 +157,7 @@ class ChannelListView extends StatefulWidget { class _ChannelListViewState extends State with WidgetsBindingObserver { final ScrollController _scrollController = ScrollController(); + final SlidableController _slideController = SlidableController(); @override Widget build(BuildContext context) { @@ -562,6 +563,7 @@ class _ChannelListViewState extends State final backgroundColor = StreamChatTheme.of(context).colorTheme.whiteSmoke; child = Slidable( + controller: _slideController, enabled: widget.swipeToAction, actionPane: SlidableBehindActionPane(), actionExtentRatio: 0.12, diff --git a/lib/src/channel_preview.dart b/lib/src/channel_preview.dart index d7c1a418..c1536653 100644 --- a/lib/src/channel_preview.dart +++ b/lib/src/channel_preview.dart @@ -104,8 +104,7 @@ class ChannelPreview extends StatelessWidget { message: channel.state.lastMessage, size: StreamChatTheme.of(context) .channelPreviewTheme - .lastMessageAt - .fontSize, + .indicatorIconSize, isMessageRead: channel.state.read ?.where((element) => element.user.id != diff --git a/lib/src/sending_indicator.dart b/lib/src/sending_indicator.dart index e3a9df06..83e02bb3 100644 --- a/lib/src/sending_indicator.dart +++ b/lib/src/sending_indicator.dart @@ -17,15 +17,13 @@ class SendingIndicator extends StatelessWidget { @override Widget build(BuildContext context) { if (isMessageRead) { - return Icon( - Icons.done_all_rounded, + return StreamSvgIcon.checkAll( size: size, color: StreamChatTheme.of(context).colorTheme.accentBlue, ); } if (message.status == MessageSendingStatus.SENT || message.status == null) { - return Icon( - Icons.done, + return StreamSvgIcon.check( size: size, color: IconTheme.of(context).color.withOpacity(0.5), ); diff --git a/lib/src/stream_chat_theme.dart b/lib/src/stream_chat_theme.dart index 246459c6..3639d229 100644 --- a/lib/src/stream_chat_theme.dart +++ b/lib/src/stream_chat_theme.dart @@ -227,22 +227,22 @@ class StreamChatThemeData { ), ), channelPreviewTheme: ChannelPreviewTheme( - unreadCounterColor: colorTheme.accentRed, - avatarTheme: AvatarTheme( - borderRadius: BorderRadius.circular(20), - constraints: BoxConstraints.tightFor( - height: 40, - width: 40, + unreadCounterColor: colorTheme.accentRed, + avatarTheme: AvatarTheme( + borderRadius: BorderRadius.circular(20), + constraints: BoxConstraints.tightFor( + height: 40, + width: 40, + ), ), - ), - title: textTheme.bodyBold, - subtitle: textTheme.footnote.copyWith( - color: Color(0xff7A7A7A), - ), - lastMessageAt: textTheme.footnote.copyWith( - color: colorTheme.black.withOpacity(.5), - ), - ), + title: textTheme.bodyBold, + subtitle: textTheme.footnote.copyWith( + color: Color(0xff7A7A7A), + ), + lastMessageAt: textTheme.footnote.copyWith( + color: colorTheme.black.withOpacity(.5), + ), + indicatorIconSize: 16.0), channelTheme: ChannelTheme( messageInputButtonIconTheme: theme.iconTheme.copyWith( color: accentColor, @@ -698,6 +698,7 @@ class ChannelPreviewTheme { final TextStyle lastMessageAt; final AvatarTheme avatarTheme; final Color unreadCounterColor; + final double indicatorIconSize; const ChannelPreviewTheme({ this.title, @@ -705,6 +706,7 @@ class ChannelPreviewTheme { this.lastMessageAt, this.avatarTheme, this.unreadCounterColor, + this.indicatorIconSize, }); ChannelPreviewTheme copyWith({ @@ -713,6 +715,7 @@ class ChannelPreviewTheme { TextStyle lastMessageAt, AvatarTheme avatarTheme, Color unreadCounterColor, + double indicatorIconSize, }) => ChannelPreviewTheme( title: title ?? this.title, @@ -720,6 +723,7 @@ class ChannelPreviewTheme { lastMessageAt: lastMessageAt ?? this.lastMessageAt, avatarTheme: avatarTheme ?? this.avatarTheme, unreadCounterColor: unreadCounterColor ?? this.unreadCounterColor, + indicatorIconSize: indicatorIconSize ?? this.indicatorIconSize, ); } diff --git a/lib/src/stream_svg_icon.dart b/lib/src/stream_svg_icon.dart index e7ef46c3..9c91d9bd 100644 --- a/lib/src/stream_svg_icon.dart +++ b/lib/src/stream_svg_icon.dart @@ -194,6 +194,18 @@ class StreamSvgIcon extends StatelessWidget { ); } + factory StreamSvgIcon.checkAll({ + double size, + Color color, + }) { + return StreamSvgIcon( + assetName: 'Icon_check_all.svg', + color: color, + width: size, + height: size, + ); + } + factory StreamSvgIcon.penWrite({ double size, Color color,