From f011bf32fc46b917c06e9ef51280d754147e1aec Mon Sep 17 00:00:00 2001 From: Salvatore Giordano Date: Thu, 31 Dec 2020 10:24:25 +0100 Subject: [PATCH] apply theme to rest of the sdk --- example/lib/group_chat_details_screen.dart | 4 +++- example/lib/main.dart | 7 +++++-- example/lib/new_group_chat_screen.dart | 3 ++- example/pubspec.yaml | 2 +- lib/src/channel_image.dart | 11 +++++++---- lib/src/channel_info.dart | 2 +- lib/src/channel_list_header.dart | 4 ++-- lib/src/channel_list_view.dart | 5 ++++- lib/src/file_attachment.dart | 3 ++- lib/src/group_image.dart | 5 +++-- lib/src/message_list_view.dart | 5 ++++- lib/src/message_search_list_view.dart | 5 ++++- lib/src/message_widget.dart | 2 +- lib/src/url_attachment.dart | 4 +++- lib/src/user_avatar.dart | 5 +++-- lib/src/user_list_view.dart | 5 ++++- lib/src/utils.dart | 3 ++- 17 files changed, 51 insertions(+), 24 deletions(-) diff --git a/example/lib/group_chat_details_screen.dart b/example/lib/group_chat_details_screen.dart index 19674332..03b4877b 100644 --- a/example/lib/group_chat_details_screen.dart +++ b/example/lib/group_chat_details_screen.dart @@ -121,7 +121,9 @@ class _GroupChatDetailsScreenState extends State { padding: const EdgeInsets.all(0), icon: StreamSvgIcon.check( size: 24, - color: _isGroupNameEmpty ? Colors.grey : Color(0xFF006CFF), + color: _isGroupNameEmpty + ? Colors.grey + : StreamChatTheme.of(context).colorTheme.accentBlue, ), onPressed: _isGroupNameEmpty ? null diff --git a/example/lib/main.dart b/example/lib/main.dart index 0de1fbe1..8d436614 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -25,7 +25,7 @@ void main() async { logLevel: Level.INFO, showLocalNotification: (!kIsWeb && Platform.isAndroid) ? showLocalNotification : null, - persistenceEnabled: true, + persistenceEnabled: false, ); if (userId != null) { @@ -456,7 +456,10 @@ class ChannelPage extends StatelessWidget { right: 0, child: Container( alignment: Alignment.centerLeft, - color: Color(0xffFCFCFC).withOpacity(.9), + color: StreamChatTheme.of(context) + .colorTheme + .whiteSnow + .withOpacity(.9), child: TypingIndicator( alignment: Alignment.centerLeft, padding: const EdgeInsets.symmetric( diff --git a/example/lib/new_group_chat_screen.dart b/example/lib/new_group_chat_screen.dart index a81f2f51..505db69c 100644 --- a/example/lib/new_group_chat_screen.dart +++ b/example/lib/new_group_chat_screen.dart @@ -76,7 +76,8 @@ class _NewGroupChatScreenState extends State { if (_selectedUsers.isNotEmpty) IconButton( icon: StreamSvgIcon.arrow_right( - color: Color(0xFF006CFF), + color: + StreamChatTheme.of(context).colorTheme.accentBlue, ), onPressed: () async { final updatedList = await Navigator.pushNamed( diff --git a/example/pubspec.yaml b/example/pubspec.yaml index 0fca32a4..944be796 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -1,6 +1,6 @@ name: example description: A new Flutter project. -version: 1.0.101+104 +version: 1.0.102+105 environment: sdk: ">=2.2.2 <3.0.0" diff --git a/lib/src/channel_image.dart b/lib/src/channel_image.dart index efd8700e..2f5862f3 100644 --- a/lib/src/channel_image.dart +++ b/lib/src/channel_image.dart @@ -53,7 +53,7 @@ class ChannelImage extends StatelessWidget { this.showOnlineStatus = true, this.borderRadius, this.selected = false, - this.selectionColor = const Color(0xFF006CFF), + this.selectionColor, this.selectionThickness = 4, }) : super(key: key); @@ -105,7 +105,8 @@ class ChannelImage extends StatelessWidget { .constraints, onTap: onTap != null ? (_) => onTap() : null, selected: selected, - selectionColor: selectionColor, + selectionColor: selectionColor ?? + StreamChatTheme.of(context).colorTheme.accentBlue, selectionThickness: selectionThickness, ); }); @@ -127,7 +128,8 @@ class ChannelImage extends StatelessWidget { .constraints, onTap: onTap, selected: selected, - selectionColor: selectionColor, + selectionColor: selectionColor ?? + StreamChatTheme.of(context).colorTheme.accentBlue, selectionThickness: selectionThickness, ); } @@ -197,7 +199,8 @@ class ChannelImage extends StatelessWidget { .ownMessageTheme .avatarTheme .constraints, - color: selectionColor, + color: selectionColor ?? + StreamChatTheme.of(context).colorTheme.accentBlue, child: Padding( padding: EdgeInsets.all(selectionThickness), child: child, diff --git a/lib/src/channel_info.dart b/lib/src/channel_info.dart index eda58f43..b1ab568d 100644 --- a/lib/src/channel_info.dart +++ b/lib/src/channel_info.dart @@ -134,7 +134,7 @@ class ChannelInfo extends StatelessWidget { child: Text( 'Try Again', style: textStyle.copyWith( - color: Color(0xFF006CFF), + color: StreamChatTheme.of(context).colorTheme.accentBlue, ), ), ), diff --git a/lib/src/channel_list_header.dart b/lib/src/channel_list_header.dart index 09156d4c..34f3cc76 100644 --- a/lib/src/channel_list_header.dart +++ b/lib/src/channel_list_header.dart @@ -99,7 +99,7 @@ class ChannelListHeader extends StatelessWidget implements PreferredSizeWidget { var color; switch (status) { case ConnectionStatus.connected: - color = Color(0xFF006CFF); + color = StreamChatTheme.of(context).colorTheme.accentBlue; break; case ConnectionStatus.connecting: color = Colors.grey; @@ -205,7 +205,7 @@ class ChannelListHeader extends StatelessWidget implements PreferredSizeWidget { .copyWith( fontSize: 16, fontWeight: FontWeight.bold, - color: Color(0xFF006CFF), + color: StreamChatTheme.of(context).colorTheme.accentBlue, ), ), ), diff --git a/lib/src/channel_list_view.dart b/lib/src/channel_list_view.dart index e33f7e1f..777fae57 100644 --- a/lib/src/channel_list_view.dart +++ b/lib/src/channel_list_view.dart @@ -684,7 +684,10 @@ class _ChannelListViewState extends State builder: (context, snapshot) { if (snapshot.hasError) { return Container( - color: Color(0xffd0021B).withAlpha(26), + color: StreamChatTheme.of(context) + .colorTheme + .accentRed + .withOpacity(.2), child: Padding( padding: const EdgeInsets.symmetric(vertical: 16.0), child: Center( diff --git a/lib/src/file_attachment.dart b/lib/src/file_attachment.dart index 273cddf2..92139530 100644 --- a/lib/src/file_attachment.dart +++ b/lib/src/file_attachment.dart @@ -67,7 +67,8 @@ class _FileAttachmentState extends State { borderRadius: widget.trailing != null ? BorderRadius.circular(16.0) : null, border: widget.trailing != null - ? Border.fromBorderSide(BorderSide(color: Color(0xFFE6E6E6))) + ? Border.fromBorderSide(BorderSide( + color: StreamChatTheme.of(context).colorTheme.greyWhisper)) : null, ), child: Row( diff --git a/lib/src/group_image.dart b/lib/src/group_image.dart index fc45aa59..4cfd655a 100644 --- a/lib/src/group_image.dart +++ b/lib/src/group_image.dart @@ -11,7 +11,7 @@ class GroupImage extends StatelessWidget { this.onTap, this.borderRadius, this.selected = false, - this.selectionColor = const Color(0xFF006CFF), + this.selectionColor, this.selectionThickness = 4, }) : super(key: key); @@ -110,7 +110,8 @@ class GroupImage extends StatelessWidget { streamChatTheme.ownMessageTheme.avatarTheme.borderRadius) + BorderRadius.circular(selectionThickness), child: Container( - color: selectionColor, + color: selectionColor ?? + StreamChatTheme.of(context).colorTheme.accentBlue, height: 64.0, width: 64.0, child: Padding( diff --git a/lib/src/message_list_view.dart b/lib/src/message_list_view.dart index 3c6484dc..a85beb0a 100644 --- a/lib/src/message_list_view.dart +++ b/lib/src/message_list_view.dart @@ -592,7 +592,10 @@ class _MessageListViewState extends State { builder: (context, snapshot) { if (snapshot.hasError) { return Container( - color: Color(0xffd0021B).withAlpha(26), + color: StreamChatTheme.of(context) + .colorTheme + .accentRed + .withOpacity(.2), child: Center( child: Text('Error loading messages'), ), diff --git a/lib/src/message_search_list_view.dart b/lib/src/message_search_list_view.dart index 989234b3..d59ae4a0 100644 --- a/lib/src/message_search_list_view.dart +++ b/lib/src/message_search_list_view.dart @@ -152,7 +152,10 @@ class _MessageSearchListViewState extends State { builder: (context, snapshot) { if (snapshot.hasError) { return Container( - color: Color(0xffd0021B).withAlpha(26), + color: StreamChatTheme.of(context) + .colorTheme + .accentRed + .withOpacity(.2), child: Padding( padding: const EdgeInsets.symmetric(vertical: 16.0), child: Center( diff --git a/lib/src/message_widget.dart b/lib/src/message_widget.dart index 7b185f97..acc8f03d 100644 --- a/lib/src/message_widget.dart +++ b/lib/src/message_widget.dart @@ -919,7 +919,7 @@ class _MessageWidgetState extends State { if ((widget.message.status == MessageSendingStatus.FAILED || widget.message.status == MessageSendingStatus.FAILED_UPDATE || widget.message.status == MessageSendingStatus.FAILED_DELETE)) { - return Color(0xffd0021B).withOpacity(.1); + return StreamChatTheme.of(context).colorTheme.accentRed.withOpacity(.1); } if (widget.message.attachments diff --git a/lib/src/url_attachment.dart b/lib/src/url_attachment.dart index c655880d..1909fc33 100644 --- a/lib/src/url_attachment.dart +++ b/lib/src/url_attachment.dart @@ -55,7 +55,9 @@ class UrlAttachment extends StatelessWidget { .textTheme .bodyBold .copyWith( - color: Color(0xFF006CFF), + color: StreamChatTheme.of(context) + .colorTheme + .accentBlue, ), ), ), diff --git a/lib/src/user_avatar.dart b/lib/src/user_avatar.dart index fb9a832a..688eff77 100644 --- a/lib/src/user_avatar.dart +++ b/lib/src/user_avatar.dart @@ -16,7 +16,7 @@ class UserAvatar extends StatelessWidget { this.borderRadius, this.onlineIndicatorAlignment = Alignment.topRight, this.selected = false, - this.selectionColor = const Color(0xFF006CFF), + this.selectionColor, this.selectionThickness = 4, }) : super(key: key); @@ -70,7 +70,8 @@ class UserAvatar extends StatelessWidget { child: Container( constraints: constraints ?? streamChatTheme.ownMessageTheme.avatarTheme.constraints, - color: selectionColor, + color: selectionColor ?? + StreamChatTheme.of(context).colorTheme.accentBlue, child: Padding( padding: EdgeInsets.all(selectionThickness), child: avatar, diff --git a/lib/src/user_list_view.dart b/lib/src/user_list_view.dart index 1108c24d..35692841 100644 --- a/lib/src/user_list_view.dart +++ b/lib/src/user_list_view.dart @@ -453,7 +453,10 @@ class _UserListViewState extends State builder: (context, snapshot) { if (snapshot.hasError) { return Container( - color: Color(0xffd0021B).withAlpha(26), + color: StreamChatTheme.of(context) + .colorTheme + .accentRed + .withOpacity(.2), child: Padding( padding: const EdgeInsets.symmetric(vertical: 16.0), child: Center( diff --git a/lib/src/utils.dart b/lib/src/utils.dart index f1f1b68a..32681d6e 100644 --- a/lib/src/utils.dart +++ b/lib/src/utils.dart @@ -55,7 +55,8 @@ Future showConfirmationDialog( height: 36.0, ), Container( - color: Color(0xffe6e6e6), + color: + StreamChatTheme.of(context).colorTheme.black.withOpacity(.08), height: 1.0, ), Row(