From 607a51daad46143d794136ae88257865f312abaa Mon Sep 17 00:00:00 2001 From: Deven Joshi Date: Thu, 31 Dec 2020 18:01:55 +0530 Subject: [PATCH] feat: added themes --- lib/src/channel_bottom_sheet.dart | 33 ++++++++++++------------------- lib/src/option_list_tile.dart | 21 ++++++++++++-------- 2 files changed, 26 insertions(+), 28 deletions(-) diff --git a/lib/src/channel_bottom_sheet.dart b/lib/src/channel_bottom_sheet.dart index 2d7b726c..130738d8 100644 --- a/lib/src/channel_bottom_sheet.dart +++ b/lib/src/channel_bottom_sheet.dart @@ -25,6 +25,7 @@ class _ChannelBottomSheetState extends State { var isOwner = userAsMember.role == 'owner'; return Material( + color: StreamChatTheme.of(context).colorTheme.white, clipBehavior: Clip.antiAlias, shape: RoundedRectangleBorder( borderRadius: BorderRadius.only( @@ -41,11 +42,7 @@ class _ChannelBottomSheetState extends State { Padding( padding: const EdgeInsets.symmetric(horizontal: 16.0), child: ChannelName( - textStyle: TextStyle( - fontSize: 16.0, - color: Color(0xff000000), - fontWeight: FontWeight.bold, - ), + textStyle: StreamChatTheme.of(context).textTheme.headlineBold, ), ), SizedBox( @@ -80,10 +77,7 @@ class _ChannelBottomSheetState extends State { .firstWhere((e) => e.user.id != userAsMember.user.id) .user .name, - style: TextStyle( - fontSize: 12.0, - fontWeight: FontWeight.w600, - ), + style: StreamChatTheme.of(context).textTheme.footnoteBold, maxLines: 1, overflow: TextOverflow.ellipsis, ), @@ -115,10 +109,9 @@ class _ChannelBottomSheetState extends State { ), Text( members[index].user.name, - style: TextStyle( - fontSize: 12.0, - fontWeight: FontWeight.w600, - ), + style: StreamChatTheme.of(context) + .textTheme + .footnoteBold, maxLines: 1, overflow: TextOverflow.ellipsis, ), @@ -133,7 +126,7 @@ class _ChannelBottomSheetState extends State { ), OptionListTile( leading: StreamSvgIcon.user( - color: Color(0xff7a7a7a), + color: StreamChatTheme.of(context).colorTheme.grey, ), title: 'View Info', onTap: widget.onViewInfoTap, @@ -141,7 +134,7 @@ class _ChannelBottomSheetState extends State { if (!channel.isDistinct) OptionListTile( leading: StreamSvgIcon.userRemove( - color: Color(0xff7a7a7a), + color: StreamChatTheme.of(context).colorTheme.grey, ), title: 'Leave Group', onTap: () async { @@ -151,17 +144,17 @@ class _ChannelBottomSheetState extends State { if (isOwner) OptionListTile( leading: StreamSvgIcon.delete( - color: Colors.red, + color: StreamChatTheme.of(context).colorTheme.accentRed, ), title: 'Delete Conversation', - titleColor: Colors.red, + titleColor: StreamChatTheme.of(context).colorTheme.accentRed, onTap: () async { _showDeleteDialog(); }, ), OptionListTile( leading: StreamSvgIcon.close_small( - color: Color(0xff7a7a7a), + color: StreamChatTheme.of(context).colorTheme.grey, ), title: 'Cancel', onTap: () { @@ -181,7 +174,7 @@ class _ChannelBottomSheetState extends State { question: 'Are you sure you want to delete this conversation?', cancelText: 'CANCEL', icon: StreamSvgIcon.delete( - color: Colors.red, + color: StreamChatTheme.of(context).colorTheme.accentRed, ), ); var channel = StreamChannel.of(context).channel; @@ -199,7 +192,7 @@ class _ChannelBottomSheetState extends State { question: 'Are you sure you want to leave this conversation?', cancelText: 'CANCEL', icon: StreamSvgIcon.userRemove( - color: Colors.red, + color: StreamChatTheme.of(context).colorTheme.accentRed, ), ); var channel = StreamChannel.of(context).channel; diff --git a/lib/src/option_list_tile.dart b/lib/src/option_list_tile.dart index 040b1a00..d551d33e 100644 --- a/lib/src/option_list_tile.dart +++ b/lib/src/option_list_tile.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:stream_chat_flutter/src/stream_chat_theme.dart'; import 'package:stream_chat_flutter/src/stream_svg_icon.dart'; class OptionListTile extends StatelessWidget { @@ -21,13 +22,13 @@ class OptionListTile extends StatelessWidget { return Column( children: [ Container( - color: Color(0xffe6e6e6), - height: 2.0, + color: StreamChatTheme.of(context).colorTheme.greyGainsboro, + height: 1.0, ), Material( - color: Colors.white, + color: StreamChatTheme.of(context).colorTheme.white, child: Container( - height: 56.0, + height: 63.0, child: InkWell( onTap: onTap, child: Row( @@ -44,10 +45,14 @@ class OptionListTile extends StatelessWidget { flex: 4, child: Text( title, - style: TextStyle( - fontWeight: FontWeight.bold, - color: titleColor, - ), + style: titleColor == null + ? StreamChatTheme.of(context).textTheme.bodyBold + : StreamChatTheme.of(context) + .textTheme + .bodyBold + .copyWith( + color: titleColor, + ), ), ), Expanded(