diff --git a/example/ios/Flutter/.last_build_id b/example/ios/Flutter/.last_build_id index e72273c3..a2e31d3e 100644 --- a/example/ios/Flutter/.last_build_id +++ b/example/ios/Flutter/.last_build_id @@ -1 +1 @@ -13a41b8138c4868054e44b5158f3bdd6 \ No newline at end of file +209b1a40522bc1cb0ea3596a28cded5e \ No newline at end of file diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock index f266b656..af57742c 100644 --- a/example/ios/Podfile.lock +++ b/example/ios/Podfile.lock @@ -296,4 +296,4 @@ SPEC CHECKSUMS: PODFILE CHECKSUM: eb001256612a59f8f9e4d083ad8b9671e69dd184 -COCOAPODS: 1.10.0 +COCOAPODS: 1.8.3 diff --git a/example/lib/advanced_options_page.dart b/example/lib/advanced_options_page.dart index 6c922e3d..803c3e72 100644 --- a/example/lib/advanced_options_page.dart +++ b/example/lib/advanced_options_page.dart @@ -45,11 +45,11 @@ class _AdvancedOptionsPageState extends State { style: StreamChatTheme.of(context) .textTheme .headlineBold - .copyWith(color: Colors.black), + .copyWith(color: StreamChatTheme.of(context).colorTheme.black), ), leading: IconButton( icon: StreamSvgIcon.left( - color: Colors.black, + color: StreamChatTheme.of(context).colorTheme.black, ), onPressed: () { Navigator.pop(context); @@ -89,7 +89,7 @@ class _AdvancedOptionsPageState extends State { }, style: TextStyle( fontSize: 14, - color: Colors.black, + color: StreamChatTheme.of(context).colorTheme.black, ), decoration: InputDecoration( errorStyle: TextStyle(fontSize: 0), @@ -98,7 +98,10 @@ class _AdvancedOptionsPageState extends State { fontWeight: FontWeight.bold, color: _apiKeyError != null ? Color(0xffff3742) - : Colors.black.withOpacity(.5), + : StreamChatTheme.of(context) + .colorTheme + .black + .withOpacity(.5), ), border: UnderlineInputBorder( borderRadius: BorderRadius.circular(8), @@ -133,7 +136,7 @@ class _AdvancedOptionsPageState extends State { }, style: TextStyle( fontSize: 14, - color: Colors.black, + color: StreamChatTheme.of(context).colorTheme.black, ), textInputAction: TextInputAction.next, decoration: InputDecoration( @@ -143,7 +146,10 @@ class _AdvancedOptionsPageState extends State { fontSize: 14, color: _userIdError != null ? Color(0xffff3742) - : Colors.black.withOpacity(.5), + : StreamChatTheme.of(context) + .colorTheme + .black + .withOpacity(.5), ), border: UnderlineInputBorder( borderRadius: BorderRadius.circular(8), @@ -178,7 +184,7 @@ class _AdvancedOptionsPageState extends State { }, style: TextStyle( fontSize: 14, - color: Colors.black, + color: StreamChatTheme.of(context).colorTheme.black, ), textInputAction: TextInputAction.next, decoration: InputDecoration( @@ -188,7 +194,10 @@ class _AdvancedOptionsPageState extends State { fontSize: 14, color: _userTokenError != null ? Color(0xffff3742) - : Colors.black.withOpacity(.5), + : StreamChatTheme.of(context) + .colorTheme + .black + .withOpacity(.5), ), border: UnderlineInputBorder( borderRadius: BorderRadius.circular(8), @@ -210,7 +219,10 @@ class _AdvancedOptionsPageState extends State { labelStyle: TextStyle( fontSize: 14, fontWeight: FontWeight.bold, - color: Colors.black.withOpacity(.5), + color: StreamChatTheme.of(context) + .colorTheme + .black + .withOpacity(.5), ), border: UnderlineInputBorder( borderRadius: BorderRadius.circular(8), @@ -232,7 +244,7 @@ class _AdvancedOptionsPageState extends State { child: Text( 'Login', style: TextStyle( - color: Colors.white, + color: StreamChatTheme.of(context).colorTheme.white, fontSize: 16, ), ), @@ -257,7 +269,9 @@ class _AdvancedOptionsPageState extends State { child: Container( decoration: BoxDecoration( borderRadius: BorderRadius.circular(16), - color: Colors.white, + color: StreamChatTheme.of(context) + .colorTheme + .white, ), height: 100, width: 100, diff --git a/example/lib/chips_input_text_field.dart b/example/lib/chips_input_text_field.dart index efa3b10e..7291ef03 100644 --- a/example/lib/chips_input_text_field.dart +++ b/example/lib/chips_input_text_field.dart @@ -66,7 +66,7 @@ class ChipInputTextFieldState extends State> { onTap: _pauseItemAddition ? resumeItemAddition : null, child: Material( elevation: 1, - color: Colors.white, + color: StreamChatTheme.of(context).colorTheme.white, child: Container( child: Padding( padding: const EdgeInsets.fromLTRB(16, 16, 16, 16), @@ -81,7 +81,11 @@ class ChipInputTextFieldState extends State> { style: StreamChatTheme.of(context) .textTheme .footnote - .copyWith(color: Colors.black.withOpacity(.5)), + .copyWith( + color: StreamChatTheme.of(context) + .colorTheme + .black + .withOpacity(.5)), ), ), SizedBox(width: 12), @@ -115,7 +119,10 @@ class ChipInputTextFieldState extends State> { .textTheme .body .copyWith( - color: Colors.black.withOpacity(.5)), + color: StreamChatTheme.of(context) + .colorTheme + .black + .withOpacity(.5)), ), ), ], @@ -127,11 +134,17 @@ class ChipInputTextFieldState extends State> { child: IconButton( icon: _chips.isEmpty ? StreamSvgIcon.user( - color: Colors.black.withOpacity(0.5), + color: StreamChatTheme.of(context) + .colorTheme + .black + .withOpacity(0.5), size: 24, ) : StreamSvgIcon.userAdd( - color: Colors.black.withOpacity(0.5), + color: StreamChatTheme.of(context) + .colorTheme + .black + .withOpacity(0.5), size: 24, ), onPressed: resumeItemAddition, diff --git a/example/lib/choose_user_page.dart b/example/lib/choose_user_page.dart index 205f2581..18212253 100644 --- a/example/lib/choose_user_page.dart +++ b/example/lib/choose_user_page.dart @@ -113,7 +113,9 @@ class ChooseUserPage extends StatelessWidget { child: Container( decoration: BoxDecoration( borderRadius: BorderRadius.circular(16), - color: Colors.white, + color: StreamChatTheme.of(context) + .colorTheme + .white, ), height: 100, width: 100, @@ -189,7 +191,7 @@ class ChooseUserPage extends StatelessWidget { }, leading: CircleAvatar( child: StreamSvgIcon.settings( - color: Colors.black, + color: StreamChatTheme.of(context).colorTheme.black, ), backgroundColor: StreamChatTheme.of(context).secondaryColor, diff --git a/example/lib/custom_theme.dart b/example/lib/custom_theme.dart index 21db1c6c..90635993 100644 --- a/example/lib/custom_theme.dart +++ b/example/lib/custom_theme.dart @@ -50,9 +50,10 @@ class MyApp extends StatelessWidget { client: client, streamChatThemeData: StreamChatThemeData.fromTheme(theme).copyWith( ownMessageTheme: MessageTheme( - messageBackgroundColor: Colors.black, + messageBackgroundColor: + StreamChatTheme.of(context).colorTheme.black, messageText: TextStyle( - color: Colors.white, + color: StreamChatTheme.of(context).colorTheme.white, ), avatarTheme: AvatarTheme( borderRadius: BorderRadius.circular(8), diff --git a/example/lib/customize_channel_preview.dart b/example/lib/customize_channel_preview.dart index 3809f780..d06cdba7 100644 --- a/example/lib/customize_channel_preview.dart +++ b/example/lib/customize_channel_preview.dart @@ -87,7 +87,10 @@ class ChannelListPage extends StatelessWidget { channel: channel, textStyle: StreamChatTheme.of(context).channelPreviewTheme.title.copyWith( - color: Colors.black.withOpacity(opacity), + color: StreamChatTheme.of(context) + .colorTheme + .black + .withOpacity(opacity), ), ), subtitle: Text(subtitle), diff --git a/example/lib/group_chat_details_screen.dart b/example/lib/group_chat_details_screen.dart index c6d4331d..0c49c523 100644 --- a/example/lib/group_chat_details_screen.dart +++ b/example/lib/group_chat_details_screen.dart @@ -62,12 +62,12 @@ class _GroupChatDetailsScreenState extends State { backgroundColor: Color.fromRGBO(252, 252, 252, 1), appBar: AppBar( elevation: 1, - backgroundColor: Colors.white, + backgroundColor: StreamChatTheme.of(context).colorTheme.white, leading: const StreamBackButton(), title: Text( 'Name of Group Chat', style: TextStyle( - color: Colors.black, + color: StreamChatTheme.of(context).colorTheme.black, fontSize: 16, ), ), @@ -82,7 +82,10 @@ class _GroupChatDetailsScreenState extends State { 'NAME', style: TextStyle( fontSize: 12, - color: Colors.black.withOpacity(0.5), + color: StreamChatTheme.of(context) + .colorTheme + .black + .withOpacity(0.5), ), ), SizedBox(width: 16), @@ -99,7 +102,11 @@ class _GroupChatDetailsScreenState extends State { contentPadding: const EdgeInsets.all(0), hintText: 'Choose a group chat name', hintStyle: TextStyle( - fontSize: 14, color: Colors.black.withOpacity(.5)), + fontSize: 14, + color: StreamChatTheme.of(context) + .colorTheme + .black + .withOpacity(.5)), ), ), ), @@ -167,16 +174,28 @@ class _GroupChatDetailsScreenState extends State { separatorBuilder: (_, __) => Container( height: 1, color: Theme.of(context).brightness == Brightness.dark - ? Colors.white.withOpacity(0.1) - : Colors.black.withOpacity(0.1), + ? StreamChatTheme.of(context) + .colorTheme + .white + .withOpacity(0.1) + : StreamChatTheme.of(context) + .colorTheme + .black + .withOpacity(0.1), ), itemBuilder: (_, index) { if (index == _selectedUsers.length) { return Container( height: 1, color: Theme.of(context).brightness == Brightness.dark - ? Colors.white.withOpacity(0.1) - : Colors.black.withOpacity(0.1), + ? StreamChatTheme.of(context) + .colorTheme + .white + .withOpacity(0.1) + : StreamChatTheme.of(context) + .colorTheme + .black + .withOpacity(0.1), ); } final user = _selectedUsers[index]; @@ -200,7 +219,7 @@ class _GroupChatDetailsScreenState extends State { trailing: IconButton( icon: Icon( Icons.clear_rounded, - color: Colors.black, + color: StreamChatTheme.of(context).colorTheme.black, ), padding: const EdgeInsets.all(0), splashRadius: 24, diff --git a/example/lib/main.dart b/example/lib/main.dart index a79a6fb4..6f4562b6 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -55,10 +55,10 @@ class MyApp extends StatelessWidget { client: client, child: MaterialApp( debugShowCheckedModeBanner: false, - theme: ThemeData.light(), + theme: ThemeData.dark(), darkTheme: ThemeData.dark(), //TODO change to system once dark theme is implemented - themeMode: ThemeMode.light, + themeMode: ThemeMode.dark, onGenerateRoute: AppRoutes.generateRoute, initialRoute: client.state.user == null ? Routes.CHOOSE_USER : Routes.HOME, @@ -84,7 +84,9 @@ class _HomePageState extends State { overflow: Overflow.visible, children: [ StreamSvgIcon.message( - color: _isSelected(0) ? Colors.black : Colors.grey, + color: _isSelected(0) + ? StreamChatTheme.of(context).colorTheme.black + : Colors.grey, ), Positioned( top: -3, @@ -100,7 +102,9 @@ class _HomePageState extends State { overflow: Overflow.visible, children: [ StreamSvgIcon.mentions( - color: _isSelected(1) ? Colors.black : Colors.grey, + color: _isSelected(1) + ? StreamChatTheme.of(context).colorTheme.black + : Colors.grey, ), ], ), @@ -127,7 +131,7 @@ class _HomePageState extends State { unselectedLabelStyle: StreamChatTheme.of(context).textTheme.footnoteBold, type: BottomNavigationBarType.fixed, - selectedItemColor: Colors.black, + selectedItemColor: StreamChatTheme.of(context).colorTheme.black, unselectedItemColor: Colors.grey, onTap: (index) { setState(() => _currentIndex = index); @@ -179,7 +183,10 @@ class _HomePageState extends State { ), ListTile( leading: StreamSvgIcon.penWrite( - color: Colors.black.withOpacity(.5), + color: StreamChatTheme.of(context) + .colorTheme + .black + .withOpacity(.5), ), onTap: () { Navigator.popAndPushNamed( @@ -196,7 +203,10 @@ class _HomePageState extends State { ), ListTile( leading: StreamSvgIcon.contacts( - color: Colors.black.withOpacity(.5), + color: StreamChatTheme.of(context) + .colorTheme + .black + .withOpacity(.5), ), onTap: () { Navigator.popAndPushNamed( @@ -231,7 +241,10 @@ class _HomePageState extends State { ); }, leading: StreamSvgIcon.user( - color: Colors.black.withOpacity(.5), + color: StreamChatTheme.of(context) + .colorTheme + .black + .withOpacity(.5), ), title: Text( 'Sign out', diff --git a/example/lib/new_chat_screen.dart b/example/lib/new_chat_screen.dart index b89bdee1..0d8b9821 100644 --- a/example/lib/new_chat_screen.dart +++ b/example/lib/new_chat_screen.dart @@ -125,14 +125,14 @@ class _NewChatScreenState extends State { backgroundColor: Color.fromRGBO(252, 252, 252, 1), appBar: AppBar( elevation: 0, - backgroundColor: Colors.white, + backgroundColor: StreamChatTheme.of(context).colorTheme.white, leading: const StreamBackButton(), title: Text( 'New Chat', style: StreamChatTheme.of(context) .textTheme .headlineBold - .copyWith(color: Colors.black), + .copyWith(color: StreamChatTheme.of(context).colorTheme.black), ), centerTitle: true, ), @@ -157,7 +157,10 @@ class _NewChatScreenState extends State { children: [ Container( decoration: BoxDecoration( - color: Colors.black.withOpacity(0.05), + color: StreamChatTheme.of(context) + .colorTheme + .black + .withOpacity(0.05), borderRadius: BorderRadius.circular(12), ), padding: const EdgeInsets.only(left: 24), @@ -165,7 +168,10 @@ class _NewChatScreenState extends State { padding: const EdgeInsets.fromLTRB(8, 4, 12, 4), child: Text( user.name, - style: TextStyle(color: Colors.black), + style: TextStyle( + color: StreamChatTheme.of(context) + .colorTheme + .black), ), ), ), @@ -182,7 +188,7 @@ class _NewChatScreenState extends State { ), Positioned( child: StreamSvgIcon.close( - color: Colors.white, + color: StreamChatTheme.of(context).colorTheme.white, ), ), ], @@ -235,8 +241,14 @@ class _NewChatScreenState extends State { begin: Alignment.centerLeft, end: Alignment.centerRight, colors: [ - Colors.black.withOpacity(0.02), - Colors.white.withOpacity(0.05), + StreamChatTheme.of(context) + .colorTheme + .black + .withOpacity(0.02), + StreamChatTheme.of(context) + .colorTheme + .white + .withOpacity(0.05), ], stops: [0, 1], ), @@ -253,7 +265,11 @@ class _NewChatScreenState extends State { style: StreamChatTheme.of(context) .textTheme .footnote - .copyWith(color: Colors.black.withOpacity(.5))), + .copyWith( + color: StreamChatTheme.of(context) + .colorTheme + .black + .withOpacity(.5))), ), ), Expanded( @@ -318,7 +334,10 @@ class _NewChatScreenState extends State { .textTheme .footnote .copyWith( - color: Colors.black + color: StreamChatTheme.of( + context) + .colorTheme + .black .withOpacity(.5)), ), ], @@ -344,7 +363,10 @@ class _NewChatScreenState extends State { 'No chats here yet...', style: TextStyle( fontSize: 12, - color: Colors.black.withOpacity(.5), + color: StreamChatTheme.of(context) + .colorTheme + .black + .withOpacity(.5), ), ), ); diff --git a/example/lib/new_group_chat_screen.dart b/example/lib/new_group_chat_screen.dart index ba477a73..a00dbc07 100644 --- a/example/lib/new_group_chat_screen.dart +++ b/example/lib/new_group_chat_screen.dart @@ -62,12 +62,12 @@ class _NewGroupChatScreenState extends State { pinned: true, forceElevated: true, elevation: 1, - backgroundColor: Colors.white, + backgroundColor: StreamChatTheme.of(context).colorTheme.white, leading: const StreamBackButton(), title: Text( 'Add Group Members', style: TextStyle( - color: Colors.black, + color: StreamChatTheme.of(context).colorTheme.black, fontSize: 16, ), ), @@ -137,7 +137,9 @@ class _NewGroupChatScreenState extends State { }, child: Container( decoration: BoxDecoration( - color: Colors.white, + color: StreamChatTheme.of(context) + .colorTheme + .white, shape: BoxShape.circle, border: Border.all( color: Colors.grey.shade100, @@ -146,7 +148,9 @@ class _NewGroupChatScreenState extends State { child: Padding( padding: const EdgeInsets.all(0.0), child: StreamSvgIcon.close( - color: Colors.black, + color: StreamChatTheme.of(context) + .colorTheme + .black, size: 24, ), ), @@ -180,8 +184,14 @@ class _NewGroupChatScreenState extends State { begin: Alignment.centerLeft, end: Alignment.centerRight, colors: [ - Colors.black.withOpacity(0.02), - Colors.white.withOpacity(0.05), + StreamChatTheme.of(context) + .colorTheme + .black + .withOpacity(0.02), + StreamChatTheme.of(context) + .colorTheme + .white + .withOpacity(0.05), ], stops: [0, 1], ), @@ -196,7 +206,10 @@ class _NewGroupChatScreenState extends State { ? 'Matches for \"$_userNameQuery\"' : 'On the platform', style: TextStyle( - color: Colors.black.withOpacity(0.5), + color: StreamChatTheme.of(context) + .colorTheme + .black + .withOpacity(0.5), ), ), ), @@ -267,7 +280,10 @@ class _NewGroupChatScreenState extends State { .textTheme .footnote .copyWith( - color: Colors.black.withOpacity(.5)), + color: StreamChatTheme.of(context) + .colorTheme + .black + .withOpacity(.5)), ), ], ), @@ -299,7 +315,7 @@ class _HeaderDelegate extends SliverPersistentHeaderDelegate { Widget build( BuildContext context, double shrinkOffset, bool overlapsContent) { return Container( - color: Colors.white, + color: StreamChatTheme.of(context).colorTheme.white, child: child, ); } diff --git a/example/lib/search_text_field.dart b/example/lib/search_text_field.dart index 00859b59..1054446f 100644 --- a/example/lib/search_text_field.dart +++ b/example/lib/search_text_field.dart @@ -22,7 +22,7 @@ class SearchTextField extends StatelessWidget { return Container( height: 36, decoration: BoxDecoration( - color: Colors.white, + color: StreamChatTheme.of(context).colorTheme.white, border: Border.all( color: Colors.grey.shade300, ), @@ -48,15 +48,16 @@ class SearchTextField extends StatelessWidget { right: 8, ), child: StreamSvgIcon.search( - color: Colors.black, + color: StreamChatTheme.of(context).colorTheme.black, size: 24, ), ), hintText: hintText, - hintStyle: StreamChatTheme.of(context) - .textTheme - .body - .copyWith(color: Colors.black.withOpacity(.5)), + hintStyle: StreamChatTheme.of(context).textTheme.body.copyWith( + color: StreamChatTheme.of(context) + .colorTheme + .black + .withOpacity(.5)), contentPadding: const EdgeInsets.all(0), border: OutlineInputBorder( borderSide: BorderSide.none, diff --git a/example/lib/stream_version.dart b/example/lib/stream_version.dart index 113e36c0..a3d52ab6 100644 --- a/example/lib/stream_version.dart +++ b/example/lib/stream_version.dart @@ -1,6 +1,7 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:yaml/yaml.dart'; +import 'package:stream_chat_flutter/stream_chat_flutter.dart'; class StreamVersion extends StatelessWidget { const StreamVersion({ @@ -28,7 +29,8 @@ class StreamVersion extends StatelessWidget { 'Stream SDK v ${streamChatDep}', style: TextStyle( fontSize: 14.5, - color: Colors.black.withOpacity(.13), + color: + StreamChatTheme.of(context).colorTheme.black.withOpacity(.13), ), ); }, diff --git a/lib/src/attachment_error.dart b/lib/src/attachment_error.dart index e08867b8..0b51e59c 100644 --- a/lib/src/attachment_error.dart +++ b/lib/src/attachment_error.dart @@ -3,6 +3,8 @@ import 'dart:io'; import 'package:flutter/material.dart'; import 'package:stream_chat/stream_chat.dart'; +import '../stream_chat_flutter.dart'; + class AttachmentError extends StatelessWidget { final Attachment attachment; final Size size; @@ -28,7 +30,7 @@ class AttachmentError extends StatelessWidget { child: Center( child: Icon( Icons.error_outline, - color: Colors.white, + color: StreamChatTheme.of(context).colorTheme.white, ), ), ), diff --git a/lib/src/back_button.dart b/lib/src/back_button.dart index 10b177d2..d4d7c53c 100644 --- a/lib/src/back_button.dart +++ b/lib/src/back_button.dart @@ -2,6 +2,8 @@ import 'package:flutter/material.dart'; import 'package:stream_chat_flutter/src/stream_svg_icon.dart'; import 'package:stream_chat_flutter/src/unread_indicator.dart'; +import '../stream_chat_flutter.dart'; + class StreamBackButton extends StatelessWidget { const StreamBackButton({ Key key, @@ -36,8 +38,8 @@ class StreamBackButton extends StatelessWidget { child: StreamSvgIcon.left( size: 24, color: Theme.of(context).brightness == Brightness.dark - ? Colors.white - : Colors.black, + ? StreamChatTheme.of(context).colorTheme.white + : StreamChatTheme.of(context).colorTheme.black, ), ), ), diff --git a/lib/src/channel_image.dart b/lib/src/channel_image.dart index c3d76202..b577a442 100644 --- a/lib/src/channel_image.dart +++ b/lib/src/channel_image.dart @@ -149,7 +149,9 @@ class ChannelImage extends StatelessWidget { ? snapshot.data['name'][0] : '', style: TextStyle( - color: Colors.white, + color: StreamChatTheme.of(context) + .colorTheme + .white, fontWeight: FontWeight.bold, ), ), diff --git a/lib/src/channel_list_header.dart b/lib/src/channel_list_header.dart index 41b283f5..09156d4c 100644 --- a/lib/src/channel_list_header.dart +++ b/lib/src/channel_list_header.dart @@ -145,7 +145,7 @@ class ChannelListHeader extends StatelessWidget implements PreferredSizeWidget { Widget _buildConnectedTitleState(BuildContext context) => Text( 'Stream Chat', style: StreamChatTheme.of(context).textTheme.headlineBold.copyWith( - color: Colors.black, + color: StreamChatTheme.of(context).colorTheme.black, ), ); diff --git a/lib/src/channel_list_view.dart b/lib/src/channel_list_view.dart index c04f80ed..701158e1 100644 --- a/lib/src/channel_list_view.dart +++ b/lib/src/channel_list_view.dart @@ -319,7 +319,7 @@ class _ChannelListViewState extends State child: ListTile( leading: Container( decoration: BoxDecoration( - color: Colors.white, + color: StreamChatTheme.of(context).colorTheme.white, shape: BoxShape.circle, ), constraints: BoxConstraints.tightFor( @@ -331,7 +331,7 @@ class _ChannelListViewState extends State alignment: Alignment.centerLeft, child: Container( decoration: BoxDecoration( - color: Colors.white, + color: StreamChatTheme.of(context).colorTheme.white, borderRadius: BorderRadius.circular(11), ), constraints: BoxConstraints.tightFor( @@ -346,7 +346,7 @@ class _ChannelListViewState extends State alignment: Alignment.centerLeft, child: Container( decoration: BoxDecoration( - color: Colors.white, + color: StreamChatTheme.of(context).colorTheme.white, borderRadius: BorderRadius.circular(11), ), constraints: BoxConstraints.tightFor( @@ -358,7 +358,7 @@ class _ChannelListViewState extends State Container( margin: const EdgeInsets.only(left: 16), decoration: BoxDecoration( - color: Colors.white, + color: StreamChatTheme.of(context).colorTheme.white, borderRadius: BorderRadius.circular(11), ), constraints: BoxConstraints.tightFor( @@ -622,8 +622,8 @@ class _ChannelListViewState extends State return Container( height: 1, color: Theme.of(context).brightness == Brightness.dark - ? Colors.white.withOpacity(0.1) - : Colors.black.withOpacity(0.1), + ? StreamChatTheme.of(context).colorTheme.white.withOpacity(0.1) + : StreamChatTheme.of(context).colorTheme.black.withOpacity(0.1), ); } diff --git a/lib/src/channel_unread_indicator.dart b/lib/src/channel_unread_indicator.dart index 8080b1e9..10a2aa48 100644 --- a/lib/src/channel_unread_indicator.dart +++ b/lib/src/channel_unread_indicator.dart @@ -36,7 +36,7 @@ class ChannelUnreadIndicator extends StatelessWidget { '${snapshot.data}', style: TextStyle( fontSize: 11, - color: Colors.white, + color: StreamChatTheme.of(context).colorTheme.white, ), ), ), diff --git a/lib/src/chat_info_screen.dart b/lib/src/chat_info_screen.dart index 8d291f38..132f3ea3 100644 --- a/lib/src/chat_info_screen.dart +++ b/lib/src/chat_info_screen.dart @@ -47,7 +47,7 @@ class _ChatInfoScreenState extends State { Widget _buildUserHeader() { return Material( - color: Colors.white, + color: StreamChatTheme.of(context).colorTheme.white, child: SafeArea( child: Stack( children: [ @@ -81,7 +81,11 @@ class _ChatInfoScreenState extends State { child: Text( widget.user.name, style: TextStyle( - color: Colors.black.withOpacity(0.5), fontSize: 16.0), + color: StreamChatTheme.of(context) + .colorTheme + .black + .withOpacity(0.5), + fontSize: 16.0), ), ), onTap: () {}, @@ -113,7 +117,7 @@ class _ChatInfoScreenState extends State { // title: 'Notifications', // leading: StreamSvgIcon.Icon_notification( // size: 24.0, - // color: Colors.black.withOpacity(0.5), + // color: StreamChatTheme.of(context).colorTheme.black.withOpacity(0.5), // ), // trailing: CupertinoSwitch( // value: true, @@ -128,7 +132,10 @@ class _ChatInfoScreenState extends State { title: 'Mute user', leading: StreamSvgIcon.mute( size: 23.0, - color: Colors.black.withOpacity(0.5), + color: StreamChatTheme.of(context) + .colorTheme + .black + .withOpacity(0.5), ), trailing: snapshot.data == null ? CircularProgressIndicator() @@ -149,7 +156,7 @@ class _ChatInfoScreenState extends State { // title: 'Block User', // leading: StreamSvgIcon.Icon_user_delete( // size: 24.0, - // color: Colors.black.withOpacity(0.5), + // color: StreamChatTheme.of(context).colorTheme.black.withOpacity(0.5), // ), // trailing: CupertinoSwitch( // value: widget.user.banned, @@ -167,7 +174,8 @@ class _ChatInfoScreenState extends State { title: 'Photos & Videos', leading: StreamSvgIcon.pictures( size: 32.0, - color: Colors.black.withOpacity(0.5), + color: + StreamChatTheme.of(context).colorTheme.black.withOpacity(0.5), ), trailing: StreamSvgIcon.right(), onTap: () { @@ -179,7 +187,8 @@ class _ChatInfoScreenState extends State { title: 'Files', leading: StreamSvgIcon.files( size: 32.0, - color: Colors.black.withOpacity(0.5), + color: + StreamChatTheme.of(context).colorTheme.black.withOpacity(0.5), ), trailing: StreamSvgIcon.right(), onTap: () { @@ -191,7 +200,8 @@ class _ChatInfoScreenState extends State { title: 'Shared groups', leading: StreamSvgIcon.Icon_group( size: 24.0, - color: Colors.black.withOpacity(0.5), + color: + StreamChatTheme.of(context).colorTheme.black.withOpacity(0.5), ), trailing: StreamSvgIcon.right(), onTap: () { @@ -248,12 +258,20 @@ class _ChatInfoScreenState extends State { if (otherMember.online) { alternativeWidget = Text( 'Online', - style: TextStyle(color: Colors.black.withOpacity(0.5)), + style: TextStyle( + color: StreamChatTheme.of(context) + .colorTheme + .black + .withOpacity(0.5)), ); } else { alternativeWidget = Text( 'Last seen ${Jiffy(otherMember.lastActive).fromNow()}', - style: TextStyle(color: Colors.black.withOpacity(0.5)), + style: TextStyle( + color: StreamChatTheme.of(context) + .colorTheme + .black + .withOpacity(0.5)), ); } } @@ -275,7 +293,7 @@ class _ChatInfoScreenState extends State { color: Color(0xff20E070), ), ), - color: Colors.white, + color: StreamChatTheme.of(context).colorTheme.white, ), alternativeWidget, ], @@ -307,7 +325,7 @@ class _OptionListTile extends StatelessWidget { height: 2.0, ), Material( - color: Colors.white, + color: StreamChatTheme.of(context).colorTheme.white, child: Container( height: 56.0, child: InkWell( @@ -365,14 +383,16 @@ class __SharedGroupsScreenState extends State<_SharedGroupsScreen> { var chat = StreamChat.of(context); return Scaffold( - backgroundColor: Colors.white, + backgroundColor: StreamChatTheme.of(context).colorTheme.white, appBar: AppBar( brightness: Theme.of(context).brightness, elevation: 1, centerTitle: true, title: Text( 'Shared Groups', - style: TextStyle(color: Colors.black, fontSize: 16.0), + style: TextStyle( + color: StreamChatTheme.of(context).colorTheme.black, + fontSize: 16.0), ), leading: Center( child: InkWell( @@ -381,7 +401,7 @@ class __SharedGroupsScreenState extends State<_SharedGroupsScreen> { }, child: Container( child: StreamSvgIcon.left( - color: Colors.black, + color: StreamChatTheme.of(context).colorTheme.black, size: 24.0, ), width: 24.0, @@ -488,7 +508,11 @@ class __SharedGroupsScreenState extends State<_SharedGroupsScreen> { padding: const EdgeInsets.all(8.0), child: Text( '${channel.memberCount} members', - style: TextStyle(color: Colors.black.withOpacity(0.5)), + style: TextStyle( + color: StreamChatTheme.of(context) + .colorTheme + .black + .withOpacity(0.5)), ), ) ], @@ -509,14 +533,16 @@ class _MediaDisplayScreen extends StatelessWidget { @override Widget build(BuildContext context) { return Scaffold( - backgroundColor: Colors.white, + backgroundColor: StreamChatTheme.of(context).colorTheme.white, appBar: AppBar( brightness: Theme.of(context).brightness, elevation: 1, centerTitle: true, title: Text( 'Photos & Videos', - style: TextStyle(color: Colors.black, fontSize: 16.0), + style: TextStyle( + color: StreamChatTheme.of(context).colorTheme.black, + fontSize: 16.0), ), leading: Center( child: InkWell( @@ -525,7 +551,7 @@ class _MediaDisplayScreen extends StatelessWidget { }, child: Container( child: StreamSvgIcon.left( - color: Colors.black, + color: StreamChatTheme.of(context).colorTheme.black, size: 24.0, ), width: 24.0, @@ -543,14 +569,16 @@ class _FileDisplayScreen extends StatelessWidget { @override Widget build(BuildContext context) { return Scaffold( - backgroundColor: Colors.white, + backgroundColor: StreamChatTheme.of(context).colorTheme.white, appBar: AppBar( brightness: Theme.of(context).brightness, elevation: 1, centerTitle: true, title: Text( 'Files', - style: TextStyle(color: Colors.black, fontSize: 16.0), + style: TextStyle( + color: StreamChatTheme.of(context).colorTheme.black, + fontSize: 16.0), ), leading: Center( child: InkWell( @@ -559,7 +587,7 @@ class _FileDisplayScreen extends StatelessWidget { }, child: Container( child: StreamSvgIcon.left( - color: Colors.black, + color: StreamChatTheme.of(context).colorTheme.black, size: 24.0, ), width: 24.0, diff --git a/lib/src/date_divider.dart b/lib/src/date_divider.dart index 3b8c36c1..9b1ba435 100644 --- a/lib/src/date_divider.dart +++ b/lib/src/date_divider.dart @@ -41,8 +41,8 @@ class DateDivider extends StatelessWidget { padding: const EdgeInsets.symmetric(horizontal: 8), decoration: BoxDecoration( color: (Theme.of(context).brightness == Brightness.light - ? Colors.black - : Colors.white) + ? StreamChatTheme.of(context).colorTheme.black + : StreamChatTheme.of(context).colorTheme.white) .withOpacity(0.5), borderRadius: BorderRadius.circular( 8, @@ -51,7 +51,7 @@ class DateDivider extends StatelessWidget { child: Text( dayInfo, style: StreamChatTheme.of(context).textTheme.footnoteBold.copyWith( - color: Colors.white, + color: StreamChatTheme.of(context).colorTheme.white, fontWeight: FontWeight.bold, ), ), diff --git a/lib/src/deleted_message.dart b/lib/src/deleted_message.dart index 9181d985..5921df43 100644 --- a/lib/src/deleted_message.dart +++ b/lib/src/deleted_message.dart @@ -41,8 +41,14 @@ class DeletedMessage extends StatelessWidget { side: borderSide ?? BorderSide( color: Theme.of(context).brightness == Brightness.dark - ? Colors.white.withAlpha(24) - : Colors.black.withAlpha(24), + ? StreamChatTheme.of(context) + .colorTheme + .white + .withAlpha(24) + : StreamChatTheme.of(context) + .colorTheme + .black + .withAlpha(24), ), ), child: Padding( @@ -58,8 +64,8 @@ class DeletedMessage extends StatelessWidget { style: messageTheme.messageText.copyWith( fontStyle: FontStyle.italic, color: (Theme.of(context).brightness == Brightness.dark - ? Colors.white - : Colors.black) + ? StreamChatTheme.of(context).colorTheme.white + : StreamChatTheme.of(context).colorTheme.black) .withOpacity(.5), ), ), diff --git a/lib/src/file_attachment.dart b/lib/src/file_attachment.dart index c5e6c92f..597add86 100644 --- a/lib/src/file_attachment.dart +++ b/lib/src/file_attachment.dart @@ -63,7 +63,7 @@ class _FileAttachmentState extends State { height: 56.0, margin: widget.trailing != null ? EdgeInsets.only(top: 4.0) : null, decoration: BoxDecoration( - color: Colors.white, + color: StreamChatTheme.of(context).colorTheme.white, borderRadius: widget.trailing != null ? BorderRadius.circular(16.0) : null, border: widget.trailing != null @@ -97,10 +97,11 @@ class _FileAttachmentState extends State { ), Text( '${_getSizeText(widget.attachment.extraData['file_size'])}', - style: StreamChatTheme.of(context) - .textTheme - .body - .copyWith(color: Colors.black.withOpacity(0.5)), + style: StreamChatTheme.of(context).textTheme.body.copyWith( + color: StreamChatTheme.of(context) + .colorTheme + .black + .withOpacity(0.5)), ), ], ), @@ -110,7 +111,7 @@ class _FileAttachmentState extends State { widget.trailing ?? IconButton( icon: StreamSvgIcon.cloud_download( - color: Colors.black, + color: StreamChatTheme.of(context).colorTheme.black, ), onPressed: () { launchURL(context, widget.attachment.assetUrl); @@ -138,13 +139,13 @@ class _FileAttachmentState extends State { // subtitle: Text( // '${attachment.extraData['file_size'] ?? 'N/A'} bytes', // style: TextStyle( - // color: Colors.black.withOpacity(0.5), + // color: StreamChatTheme.of(context).colorTheme.black.withOpacity(0.5), // ), // ), // trailing: trailing ?? // IconButton( // icon: StreamSvgIcon.cloud_download( - // color: Colors.black, + // color: StreamChatTheme.of(context).colorTheme.black, // ), // onPressed: () { // launchURL(context, attachment.assetUrl); diff --git a/lib/src/full_screen_media.dart b/lib/src/full_screen_media.dart index 7e3f3d7d..e6ecb64f 100644 --- a/lib/src/full_screen_media.dart +++ b/lib/src/full_screen_media.dart @@ -100,7 +100,9 @@ class _FullScreenMediaState extends State .channelTheme .channelHeaderTheme .color, - end: Colors.black) + end: StreamChatTheme.of(context) + .colorTheme + .black) .lerp(_controller.value), ), onTapUp: (a, b, c) { diff --git a/lib/src/giphy_attachment.dart b/lib/src/giphy_attachment.dart index 74dfeeb4..1f3bf9e6 100644 --- a/lib/src/giphy_attachment.dart +++ b/lib/src/giphy_attachment.dart @@ -112,7 +112,10 @@ class GiphyAttachment extends StatelessWidget { bottom: 16, left: 16, child: Material( - color: Colors.black.withOpacity(.5), + color: StreamChatTheme.of(context) + .colorTheme + .black + .withOpacity(.5), shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(12), ), @@ -124,13 +127,16 @@ class GiphyAttachment extends StatelessWidget { child: Row( children: [ StreamSvgIcon.lightning( - color: Colors.white, + color: + StreamChatTheme.of(context).colorTheme.white, size: 16, ), Text( 'GIPHY', style: TextStyle( - color: Colors.white, + color: StreamChatTheme.of(context) + .colorTheme + .white, fontWeight: FontWeight.bold, fontSize: 11, ), @@ -202,7 +208,10 @@ class GiphyAttachment extends StatelessWidget { height: 4.0, ), Container( - color: Colors.black.withOpacity(0.2), + color: StreamChatTheme.of(context) + .colorTheme + .black + .withOpacity(0.2), width: double.infinity, height: 0.5, ), @@ -224,14 +233,20 @@ class GiphyAttachment extends StatelessWidget { .textTheme .bodyBold .copyWith( - color: Colors.black.withOpacity(0.5), + color: StreamChatTheme.of(context) + .colorTheme + .black + .withOpacity(0.5), ), ), ), ), Container( width: 0.5, - color: Colors.black.withOpacity(0.2), + color: StreamChatTheme.of(context) + .colorTheme + .black + .withOpacity(0.2), height: 50.0, ), Expanded( @@ -266,7 +281,10 @@ class GiphyAttachment extends StatelessWidget { mainAxisSize: MainAxisSize.min, children: [ StreamSvgIcon.eye( - color: Colors.black.withOpacity(0.5), + color: StreamChatTheme.of(context) + .colorTheme + .black + .withOpacity(0.5), size: 16.0, ), SizedBox( @@ -277,7 +295,11 @@ class GiphyAttachment extends StatelessWidget { style: StreamChatTheme.of(context) .textTheme .footnote - .copyWith(color: Colors.black.withOpacity(0.5)), + .copyWith( + color: StreamChatTheme.of(context) + .colorTheme + .black + .withOpacity(0.5)), ), ], ), @@ -334,7 +356,10 @@ class GiphyAttachment extends StatelessWidget { bottom: 8, left: 8, child: Material( - color: Colors.black.withOpacity(.5), + color: StreamChatTheme.of(context) + .colorTheme + .black + .withOpacity(.5), shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(12), ), @@ -346,13 +371,13 @@ class GiphyAttachment extends StatelessWidget { child: Row( children: [ StreamSvgIcon.lightning( - color: Colors.white, + color: StreamChatTheme.of(context).colorTheme.white, size: 16, ), Text( 'GIPHY', style: TextStyle( - color: Colors.white, + color: StreamChatTheme.of(context).colorTheme.white, fontWeight: FontWeight.bold, fontSize: 11, ), diff --git a/lib/src/image_actions_modal.dart b/lib/src/image_actions_modal.dart index 2b2aa05e..45a60d60 100644 --- a/lib/src/image_actions_modal.dart +++ b/lib/src/image_actions_modal.dart @@ -34,7 +34,7 @@ class ImageActionsModal extends StatelessWidget { begin: Alignment.topCenter, end: Alignment.bottomCenter, colors: [ - Colors.black.withOpacity(0.8), + StreamChatTheme.of(context).colorTheme.black.withOpacity(0.8), Colors.transparent, ], stops: [0.0, 0.4], @@ -69,7 +69,9 @@ class ImageActionsModal extends StatelessWidget { style: StreamChatTheme.of(context) .textTheme .headlineBold - .copyWith(color: Colors.white), + .copyWith( + color: + StreamChatTheme.of(context).colorTheme.white), ), ), Text( @@ -77,14 +79,18 @@ class ImageActionsModal extends StatelessWidget { style: StreamChatTheme.of(context) .channelPreviewTheme .subtitle - .copyWith(color: Colors.white.withOpacity(0.5)), + .copyWith( + color: StreamChatTheme.of(context) + .colorTheme + .white + .withOpacity(0.5)), ), ], ), IconButton( icon: StreamSvgIcon.close( size: 24.0, - color: Colors.white, + color: StreamChatTheme.of(context).colorTheme.white, ), onPressed: () { Navigator.pop(context); @@ -114,7 +120,10 @@ class ImageActionsModal extends StatelessWidget { 'Reply', StreamSvgIcon.Icon_curve_line_left_up( size: 24.0, - color: Colors.black.withOpacity(0.5), + color: StreamChatTheme.of(context) + .colorTheme + .black + .withOpacity(0.5), ), () {}), _buildButton( @@ -122,7 +131,8 @@ class ImageActionsModal extends StatelessWidget { 'Show in Chat', StreamSvgIcon.eye( size: 24.0, - color: Colors.black, + color: + StreamChatTheme.of(context).colorTheme.black, ), () { Navigator.pop(context); Navigator.pop(context); @@ -132,7 +142,10 @@ class ImageActionsModal extends StatelessWidget { 'Save ${urls[currentIndex].type == 'video' ? 'Video' : 'Image'}', StreamSvgIcon.Icon_save( size: 24.0, - color: Colors.black.withOpacity(0.5), + color: StreamChatTheme.of(context) + .colorTheme + .black + .withOpacity(0.5), ), () async { var url = urls[currentIndex].imageUrl ?? urls[currentIndex].assetUrl ?? @@ -181,7 +194,7 @@ class ImageActionsModal extends StatelessWidget { {Color color}) { var titleStyle = TextStyle( fontSize: 14.5, - color: Colors.black, + color: StreamChatTheme.of(context).colorTheme.black, ); return Material( diff --git a/lib/src/image_footer.dart b/lib/src/image_footer.dart index f16be87d..762bd737 100644 --- a/lib/src/image_footer.dart +++ b/lib/src/image_footer.dart @@ -114,7 +114,7 @@ class _ImageFooterState extends State { IconButton( icon: StreamSvgIcon.icon_SHARE( size: 24.0, - color: Colors.black, + color: StreamChatTheme.of(context).colorTheme.black, ), onPressed: () { _buildShareModal(context); @@ -138,7 +138,7 @@ class _ImageFooterState extends State { ), IconButton( icon: StreamSvgIcon.Icon_grid( - color: Colors.black, + color: StreamChatTheme.of(context).colorTheme.black, ), onPressed: () { _buildPhotosModal(context); @@ -166,7 +166,7 @@ class _ImageFooterState extends State { children: [ Container( decoration: BoxDecoration( - color: Colors.white, + color: StreamChatTheme.of(context).colorTheme.white, borderRadius: BorderRadius.only( topRight: Radius.circular(16.0), topLeft: Radius.circular(16.0), @@ -187,7 +187,7 @@ class _ImageFooterState extends State { alignment: Alignment.centerRight, child: IconButton( icon: StreamSvgIcon.close( - color: Colors.black, + color: StreamChatTheme.of(context).colorTheme.black, ), onPressed: () { Navigator.pop(context); @@ -198,7 +198,7 @@ class _ImageFooterState extends State { ), ), Container( - color: Colors.white, + color: StreamChatTheme.of(context).colorTheme.white, child: GridView.builder( shrinkWrap: true, physics: NeverScrollableScrollPhysics(), @@ -346,7 +346,7 @@ class _ImageFooterState extends State { Align( alignment: Alignment.bottomCenter, child: Container( - color: Colors.white, + color: StreamChatTheme.of(context).colorTheme.white, height: 48.0, child: Material( child: InkWell( @@ -415,7 +415,7 @@ class _ImageFooterState extends State { Expanded( child: TextField( controller: _searchController, - cursorColor: Colors.black, + cursorColor: StreamChatTheme.of(context).colorTheme.black, autofocus: true, decoration: InputDecoration( isDense: true, @@ -425,19 +425,25 @@ class _ImageFooterState extends State { padding: const EdgeInsets.symmetric( vertical: 2.0, horizontal: 6.0), child: StreamSvgIcon.search( - color: Colors.black, + color: StreamChatTheme.of(context).colorTheme.black, ), ), hintText: 'Search', border: OutlineInputBorder( borderRadius: BorderRadius.circular(32.0), - borderSide: - BorderSide(color: Colors.black.withOpacity(0.08)), + borderSide: BorderSide( + color: StreamChatTheme.of(context) + .colorTheme + .black + .withOpacity(0.08)), ), focusedBorder: OutlineInputBorder( borderRadius: BorderRadius.circular(32.0), - borderSide: - BorderSide(color: Colors.black.withOpacity(0.08)), + borderSide: BorderSide( + color: StreamChatTheme.of(context) + .colorTheme + .black + .withOpacity(0.08)), ), contentPadding: EdgeInsets.zero, ), @@ -448,7 +454,10 @@ class _ImageFooterState extends State { ), IconButton( icon: StreamSvgIcon.close_small( - color: Colors.black.withOpacity(0.5), + color: StreamChatTheme.of(context) + .colorTheme + .black + .withOpacity(0.5), ), onPressed: () { modalSetState(() { @@ -469,7 +478,7 @@ class _ImageFooterState extends State { padding: const EdgeInsets.symmetric(horizontal: 6.0), child: IconButton( icon: StreamSvgIcon.search( - color: Colors.black, + color: StreamChatTheme.of(context).colorTheme.black, ), iconSize: 24.0, onPressed: () { @@ -490,7 +499,7 @@ class _ImageFooterState extends State { padding: const EdgeInsets.symmetric(horizontal: 6.0), child: IconButton( icon: StreamSvgIcon.share_arrow( - color: Colors.black, + color: StreamChatTheme.of(context).colorTheme.black, ), onPressed: () async { var url = @@ -517,7 +526,7 @@ class _ImageFooterState extends State { return Align( alignment: Alignment.bottomCenter, child: Container( - color: Colors.white, + color: StreamChatTheme.of(context).colorTheme.white, height: 56.0, child: _loading ? Center( @@ -547,13 +556,19 @@ class _ImageFooterState extends State { border: OutlineInputBorder( borderRadius: BorderRadius.circular(32.0), borderSide: BorderSide( - color: Colors.black.withOpacity(0.16), + color: StreamChatTheme.of(context) + .colorTheme + .black + .withOpacity(0.16), ), ), focusedBorder: OutlineInputBorder( borderRadius: BorderRadius.circular(32.0), borderSide: BorderSide( - color: Colors.black.withOpacity(0.16), + color: StreamChatTheme.of(context) + .colorTheme + .black + .withOpacity(0.16), )), contentPadding: EdgeInsets.symmetric(vertical: 12.0), ), diff --git a/lib/src/image_group.dart b/lib/src/image_group.dart index 44c15623..7bce22f9 100644 --- a/lib/src/image_group.dart +++ b/lib/src/image_group.dart @@ -83,7 +83,9 @@ class ImageGroup extends StatelessWidget { child: Text( '${images.length - 4} +', style: TextStyle( - color: Colors.white, + color: StreamChatTheme.of(context) + .colorTheme + .white, fontSize: 28, ), ), diff --git a/lib/src/image_header.dart b/lib/src/image_header.dart index aae73057..a9f1173f 100644 --- a/lib/src/image_header.dart +++ b/lib/src/image_header.dart @@ -50,7 +50,7 @@ class ImageHeader extends StatelessWidget implements PreferredSizeWidget { leading: showBackButton ? IconButton( icon: StreamSvgIcon.close( - color: Colors.black, + color: StreamChatTheme.of(context).colorTheme.black, size: 24.0, ), onPressed: onBackPressed, @@ -61,7 +61,7 @@ class ImageHeader extends StatelessWidget implements PreferredSizeWidget { actions: [ IconButton( icon: StreamSvgIcon.Icon_menu_point_v( - color: Colors.black, + color: StreamChatTheme.of(context).colorTheme.black, ), onPressed: () { _showMessageActionModalBottomSheet(context); diff --git a/lib/src/media_list_view.dart b/lib/src/media_list_view.dart index 5f52e9b5..d2b7ba69 100644 --- a/lib/src/media_list_view.dart +++ b/lib/src/media_list_view.dart @@ -6,6 +6,8 @@ import 'package:stream_chat_flutter/src/lazy_load_scroll_view.dart'; import 'package:stream_chat_flutter/src/stream_svg_icon.dart'; import 'dart:ui' as ui; +import '../stream_chat_flutter.dart'; + extension on Duration { String format() { final s = '$this'.split('.')[0].padLeft(8, '0'); @@ -80,7 +82,10 @@ class _MediaListViewState extends State { ? 1.0 : 0.0, child: Container( - color: Colors.black.withOpacity(0.5), + color: StreamChatTheme.of(context) + .colorTheme + .black + .withOpacity(0.5), alignment: Alignment.topRight, padding: const EdgeInsets.only( top: 8, @@ -88,10 +93,12 @@ class _MediaListViewState extends State { ), child: CircleAvatar( radius: 12, - backgroundColor: Colors.white, + backgroundColor: + StreamChatTheme.of(context).colorTheme.white, child: StreamSvgIcon.check( size: 24, - color: Colors.black, + color: + StreamChatTheme.of(context).colorTheme.black, ), ), ), @@ -113,7 +120,7 @@ class _MediaListViewState extends State { child: Text( media.videoDuration.format(), style: TextStyle( - color: Colors.white, + color: StreamChatTheme.of(context).colorTheme.white, ), ), ), diff --git a/lib/src/message_actions_modal.dart b/lib/src/message_actions_modal.dart index 8013a8b3..17b9a79e 100644 --- a/lib/src/message_actions_modal.dart +++ b/lib/src/message_actions_modal.dart @@ -69,7 +69,10 @@ class MessageActionsModal extends StatelessWidget { sigmaY: 10.8731, ), child: Container( - color: Colors.black.withOpacity(0.1), + color: StreamChatTheme.of(context) + .colorTheme + .black + .withOpacity(0.1), ), ), ), diff --git a/lib/src/message_input.dart b/lib/src/message_input.dart index 79189d1d..73f98754 100644 --- a/lib/src/message_input.dart +++ b/lib/src/message_input.dart @@ -263,7 +263,10 @@ class MessageInputState extends State { border: _sendAsDm ? null : Border.all( - color: Colors.black.withOpacity(.5), + color: StreamChatTheme.of(context) + .colorTheme + .black + .withOpacity(.5), width: 2, ), borderRadius: BorderRadius.circular(3), @@ -273,7 +276,7 @@ class MessageInputState extends State { borderRadius: BorderRadius.circular(3), color: _sendAsDm ? StreamChatTheme.of(context).accentColor - : Colors.white, + : StreamChatTheme.of(context).colorTheme.white, child: InkWell( onTap: () { setState(() { @@ -288,7 +291,7 @@ class MessageInputState extends State { : CrossFadeState.showSecond, firstChild: StreamSvgIcon.check( size: 16.0, - color: Colors.white, + color: StreamChatTheme.of(context).colorTheme.white, ), secondChild: SizedBox( height: 16, @@ -418,7 +421,9 @@ class MessageInputState extends State { mainAxisAlignment: MainAxisAlignment.center, children: [ StreamSvgIcon.lightning( - color: Colors.white, + color: StreamChatTheme.of(context) + .colorTheme + .white, size: 16.0, ), Text( @@ -426,7 +431,10 @@ class MessageInputState extends State { style: StreamChatTheme.of(context) .textTheme .footnote - .copyWith(color: Colors.white), + .copyWith( + color: StreamChatTheme.of(context) + .colorTheme + .white), ), ], ), @@ -633,7 +641,10 @@ class MessageInputState extends State { Text( 'Instant Commands', style: TextStyle( - color: Colors.black.withOpacity(.5), + color: StreamChatTheme.of(context) + .colorTheme + .black + .withOpacity(.5), ), ) ], @@ -664,7 +675,9 @@ class MessageInputState extends State { backgroundColor: StreamChatTheme.of(context).accentColor, child: StreamSvgIcon.lightning( - color: Colors.white, + color: StreamChatTheme.of(context) + .colorTheme + .white, size: 12.5, ), maxRadius: 12, @@ -698,24 +711,33 @@ class MessageInputState extends State { ? StreamChatTheme.of(context).accentColor : (!_attachmentContainsFile ? StreamChatTheme.of(context).accentColor - : Colors.black.withOpacity(0.2)); + : StreamChatTheme.of(context) + .colorTheme + .black + .withOpacity(0.2)); break; case 1: return _attachmentContainsFile ? StreamChatTheme.of(context).accentColor : (_attachments.isEmpty - ? Colors.black.withOpacity(0.5) - : Colors.black.withOpacity(0.2)); + ? StreamChatTheme.of(context) + .colorTheme + .black + .withOpacity(0.5) + : StreamChatTheme.of(context) + .colorTheme + .black + .withOpacity(0.2)); break; case 2: return _attachmentContainsFile && _attachments.isNotEmpty - ? Colors.black.withOpacity(0.2) - : Colors.black.withOpacity(0.5); + ? StreamChatTheme.of(context).colorTheme.black.withOpacity(0.2) + : StreamChatTheme.of(context).colorTheme.black.withOpacity(0.5); break; case 3: return _attachmentContainsFile && _attachments.isNotEmpty - ? Colors.black.withOpacity(0.2) - : Colors.black.withOpacity(0.5); + ? StreamChatTheme.of(context).colorTheme.black.withOpacity(0.2) + : StreamChatTheme.of(context).colorTheme.black.withOpacity(0.5); break; } } @@ -791,7 +813,7 @@ class MessageInputState extends State { }, child: Container( decoration: BoxDecoration( - color: Colors.white, + color: StreamChatTheme.of(context).colorTheme.white, borderRadius: BorderRadius.only( topLeft: Radius.circular(16.0), topRight: Radius.circular(16.0), @@ -820,7 +842,7 @@ class MessageInputState extends State { Expanded( child: Container( decoration: BoxDecoration( - color: Colors.white, + color: StreamChatTheme.of(context).colorTheme.white, borderRadius: BorderRadius.circular(8.0), ), child: _buildPickerSection(), @@ -1023,7 +1045,7 @@ class MessageInputState extends State { CircleAvatar _buildGiphyIcon() { if (kIsWeb) { return CircleAvatar( - backgroundColor: Colors.black, + backgroundColor: StreamChatTheme.of(context).colorTheme.black, child: Image.asset( 'images/giphy_icon.png', package: 'stream_chat_flutter', @@ -1223,7 +1245,10 @@ class MessageInputState extends State { child: Text( 'Emoji matching "$query"', style: TextStyle( - color: Colors.black.withOpacity(.5), + color: StreamChatTheme.of(context) + .colorTheme + .black + .withOpacity(.5), ), ), ) @@ -1317,10 +1342,15 @@ class MessageInputState extends State { child: InkWell( child: CircleAvatar( backgroundColor: - Colors.black.withOpacity(0.2), + StreamChatTheme.of(context) + .colorTheme + .black + .withOpacity(0.2), maxRadius: 12.0, child: StreamSvgIcon.close( - color: Colors.white, + color: StreamChatTheme.of(context) + .colorTheme + .white, ), ), onTap: () { @@ -1405,11 +1435,11 @@ class MessageInputState extends State { _attachments.remove(attachment); }); }, - fillColor: Colors.black.withOpacity(.5), + fillColor: StreamChatTheme.of(context).colorTheme.black.withOpacity(.5), child: Center( child: StreamSvgIcon.close( size: 24, - color: Colors.white, + color: StreamChatTheme.of(context).colorTheme.white, ), ), ), diff --git a/lib/src/message_list_view.dart b/lib/src/message_list_view.dart index 7452fd6d..fd31b996 100644 --- a/lib/src/message_list_view.dart +++ b/lib/src/message_list_view.dart @@ -254,7 +254,11 @@ class _MessageListViewState extends State { style: StreamChatTheme.of(context) .textTheme .footnote - .copyWith(color: Colors.black.withOpacity(.5)), + .copyWith( + color: StreamChatTheme.of(context) + .colorTheme + .black + .withOpacity(.5)), ), ); } @@ -524,9 +528,9 @@ class _MessageListViewState extends State { clipBehavior: Clip.none, children: [ FloatingActionButton( - backgroundColor: Colors.white, + backgroundColor: StreamChatTheme.of(context).colorTheme.white, child: StreamSvgIcon.down( - color: Colors.black, + color: StreamChatTheme.of(context).colorTheme.black, ), onPressed: () { if (unreadCount > 0) { diff --git a/lib/src/message_reactions_modal.dart b/lib/src/message_reactions_modal.dart index e5043e62..a6a7e54c 100644 --- a/lib/src/message_reactions_modal.dart +++ b/lib/src/message_reactions_modal.dart @@ -60,7 +60,10 @@ class MessageReactionsModal extends StatelessWidget { sigmaY: 10.8731, ), child: Container( - color: Colors.black.withOpacity(0.1), + color: StreamChatTheme.of(context) + .colorTheme + .black + .withOpacity(0.1), ), ), ), diff --git a/lib/src/message_search_list_view.dart b/lib/src/message_search_list_view.dart index 087ae839..989234b3 100644 --- a/lib/src/message_search_list_view.dart +++ b/lib/src/message_search_list_view.dart @@ -4,6 +4,7 @@ import 'package:flutter/material.dart'; import 'package:stream_chat/stream_chat.dart'; import 'package:stream_chat_flutter/src/message_search_item.dart'; +import '../stream_chat_flutter.dart'; import 'lazy_load_scroll_view.dart'; import 'message_search_bloc.dart'; @@ -127,8 +128,8 @@ class _MessageSearchListViewState extends State { return Container( height: 1, color: Theme.of(context).brightness == Brightness.dark - ? Colors.white.withOpacity(0.1) - : Colors.black.withOpacity(0.1), + ? StreamChatTheme.of(context).colorTheme.white.withOpacity(0.1) + : StreamChatTheme.of(context).colorTheme.black.withOpacity(0.1), ); } @@ -313,8 +314,14 @@ class _MessageSearchListViewState extends State { begin: Alignment.centerLeft, end: Alignment.centerRight, colors: [ - Colors.black.withOpacity(0.02), - Colors.white.withOpacity(0.05), + StreamChatTheme.of(context) + .colorTheme + .black + .withOpacity(0.02), + StreamChatTheme.of(context) + .colorTheme + .white + .withOpacity(0.05), ], stops: [0, 1], ), @@ -327,7 +334,10 @@ class _MessageSearchListViewState extends State { child: Text( '${items.length} results', style: TextStyle( - color: Colors.black.withOpacity(0.5), + color: StreamChatTheme.of(context) + .colorTheme + .black + .withOpacity(0.5), ), ), ), diff --git a/lib/src/message_widget.dart b/lib/src/message_widget.dart index f3e5b108..7b185f97 100644 --- a/lib/src/message_widget.dart +++ b/lib/src/message_widget.dart @@ -327,10 +327,16 @@ class _MessageWidgetState extends State { .brightness == Brightness .dark - ? Colors.white + ? StreamChatTheme.of( + context) + .colorTheme + .white .withAlpha( 24) - : Colors.black + : StreamChatTheme.of( + context) + .colorTheme + .black .withAlpha( 24), ), @@ -414,16 +420,18 @@ class _MessageWidgetState extends State { mainAxisSize: MainAxisSize.min, children: [ StreamSvgIcon.eye( - color: Colors.black.withOpacity(0.5), + color: + StreamChatTheme.of(context).colorTheme.black.withOpacity(0.5), size: 16.0, ), SizedBox(width: 8.0), Text( 'Only visible to you', - style: StreamChatTheme.of(context) - .textTheme - .footnote - .copyWith(color: Colors.black.withOpacity(0.5)), + style: StreamChatTheme.of(context).textTheme.footnote.copyWith( + color: StreamChatTheme.of(context) + .colorTheme + .black + .withOpacity(0.5)), ), ], ), @@ -551,7 +559,7 @@ class _MessageWidgetState extends State { bottom: 0, top: 0, child: Material( - color: Colors.white, + color: StreamChatTheme.of(context).colorTheme.white, clipBehavior: Clip.antiAlias, shape: CircleBorder(), child: Padding( @@ -664,8 +672,8 @@ class _MessageWidgetState extends State { widget.borderSide ?? BorderSide( color: Theme.of(context).brightness == Brightness.dark - ? Colors.white.withAlpha(24) - : Colors.black.withAlpha(24), + ? StreamChatTheme.of(context).colorTheme.white.withAlpha(24) + : StreamChatTheme.of(context).colorTheme.black.withAlpha(24), ), borderRadius: widget.attachmentBorderRadiusGeometry ?? widget.borderRadiusGeometry ?? @@ -820,8 +828,8 @@ class _MessageWidgetState extends State { 'MESSAGE FAILED · CLICK TO TRY AGAIN', style: widget.messageTheme.messageText.copyWith( color: Theme.of(context).brightness == Brightness.dark - ? Colors.white.withOpacity(.5) - : Colors.black.withOpacity(.5), + ? StreamChatTheme.of(context).colorTheme.white.withOpacity(.5) + : StreamChatTheme.of(context).colorTheme.black.withOpacity(.5), fontSize: 11, ), ); @@ -831,8 +839,8 @@ class _MessageWidgetState extends State { 'MESSAGE UPDATE FAILED · CLICK TO TRY AGAIN', style: widget.messageTheme.messageText.copyWith( color: Theme.of(context).brightness == Brightness.dark - ? Colors.white.withOpacity(.5) - : Colors.black.withOpacity(.5), + ? StreamChatTheme.of(context).colorTheme.white.withOpacity(.5) + : StreamChatTheme.of(context).colorTheme.black.withOpacity(.5), fontSize: 11, ), ); @@ -842,8 +850,8 @@ class _MessageWidgetState extends State { 'MESSAGE DELETE FAILED · CLICK TO TRY AGAIN', style: widget.messageTheme.messageText.copyWith( color: Theme.of(context).brightness == Brightness.dark - ? Colors.white.withOpacity(.5) - : Colors.black.withOpacity(.5), + ? StreamChatTheme.of(context).colorTheme.white.withOpacity(.5) + : StreamChatTheme.of(context).colorTheme.black.withOpacity(.5), fontSize: 11, ), ); diff --git a/lib/src/reaction_bubble.dart b/lib/src/reaction_bubble.dart index 87dc7a92..f7c9c142 100644 --- a/lib/src/reaction_bubble.dart +++ b/lib/src/reaction_bubble.dart @@ -108,7 +108,10 @@ class ReactionBubble extends StatelessWidget { color: (!highlightOwnReactions || reaction.user.id == StreamChat.of(context).user.id) ? StreamChatTheme.of(context).accentColor - : Colors.black.withOpacity(.5), + : StreamChatTheme.of(context) + .colorTheme + .black + .withOpacity(.5), ) : Icon( Icons.help_outline_rounded, @@ -116,7 +119,10 @@ class ReactionBubble extends StatelessWidget { color: (!highlightOwnReactions || reaction.user.id == StreamChat.of(context).user.id) ? StreamChatTheme.of(context).accentColor - : Colors.black.withOpacity(.5), + : StreamChatTheme.of(context) + .colorTheme + .black + .withOpacity(.5), ), ); } diff --git a/lib/src/stream_chat_theme.dart b/lib/src/stream_chat_theme.dart index d4237270..573e646b 100644 --- a/lib/src/stream_chat_theme.dart +++ b/lib/src/stream_chat_theme.dart @@ -254,7 +254,7 @@ class StreamChatThemeData { colorTheme: colorTheme, secondaryColor: Color(0xffEAEAEA), accentColor: accentColor, - primaryColor: isDark ? Colors.black : Colors.white, + primaryColor: isDark ? colorTheme.black : colorTheme.white, primaryIconTheme: IconThemeData( color: isDark ? Colors.white : Colors.black.withOpacity(.5)), defaultChannelImage: (context, channel) => SizedBox(), diff --git a/lib/src/unread_indicator.dart b/lib/src/unread_indicator.dart index c9f42fad..42e6c78d 100644 --- a/lib/src/unread_indicator.dart +++ b/lib/src/unread_indicator.dart @@ -34,7 +34,7 @@ class UnreadIndicator extends StatelessWidget { '${snapshot.data}', style: TextStyle( fontSize: 11, - color: Colors.white, + color: StreamChatTheme.of(context).colorTheme.white, ), ), ), diff --git a/lib/src/user_avatar.dart b/lib/src/user_avatar.dart index 756252cc..c0b2a712 100644 --- a/lib/src/user_avatar.dart +++ b/lib/src/user_avatar.dart @@ -99,7 +99,7 @@ class UserAvatar extends StatelessWidget { color: Color(0xff20E070), ), ), - color: Colors.white, + color: StreamChatTheme.of(context).colorTheme.white, ), ), ), diff --git a/lib/src/user_item.dart b/lib/src/user_item.dart index 0c6c196d..49a6d5e3 100644 --- a/lib/src/user_item.dart +++ b/lib/src/user_item.dart @@ -76,7 +76,7 @@ class UserItem extends StatelessWidget { ? CircleAvatar( child: StreamSvgIcon.check( size: 20, - color: Colors.white, + color: StreamChatTheme.of(context).colorTheme.white, ), radius: 10, ) @@ -94,10 +94,8 @@ class UserItem extends StatelessWidget { user.online == true ? 'Online' : 'Last online ${Jiffy(user.lastActive).fromNow()}', - style: StreamChatTheme.of(context) - .textTheme - .footnote - .copyWith(color: Colors.black.withOpacity(.5)), + style: StreamChatTheme.of(context).textTheme.footnote.copyWith( + color: StreamChatTheme.of(context).colorTheme.black.withOpacity(.5)), ); } } diff --git a/lib/src/user_list_view.dart b/lib/src/user_list_view.dart index cc3c1125..1108c24d 100644 --- a/lib/src/user_list_view.dart +++ b/lib/src/user_list_view.dart @@ -356,7 +356,8 @@ class _UserListViewState extends State headerItem: (header) { return Container( key: ValueKey('HEADER-$header'), - color: Colors.black.withOpacity(0.05), + color: + StreamChatTheme.of(context).colorTheme.black.withOpacity(0.05), child: Padding( padding: const EdgeInsets.symmetric(horizontal: 8.0, vertical: 6), child: Text( @@ -364,7 +365,10 @@ class _UserListViewState extends State style: TextStyle( fontWeight: FontWeight.bold, fontSize: 14.5, - color: Colors.black.withOpacity(0.3)), + color: StreamChatTheme.of(context) + .colorTheme + .black + .withOpacity(0.3)), ), ), ); @@ -472,8 +476,8 @@ class _UserListViewState extends State return Container( height: 1, color: Theme.of(context).brightness == Brightness.dark - ? Colors.white.withOpacity(0.1) - : Colors.black.withOpacity(0.1), + ? StreamChatTheme.of(context).colorTheme.white.withOpacity(0.1) + : StreamChatTheme.of(context).colorTheme.black.withOpacity(0.1), ); } diff --git a/lib/src/utils.dart b/lib/src/utils.dart index 60eca678..f1f1b68a 100644 --- a/lib/src/utils.dart +++ b/lib/src/utils.dart @@ -25,7 +25,7 @@ Future showConfirmationDialog( String cancelText, }) { return showModalBottomSheet( - backgroundColor: Colors.white, + backgroundColor: StreamChatTheme.of(context).colorTheme.white, context: context, shape: RoundedRectangleBorder( borderRadius: BorderRadius.only( @@ -65,7 +65,10 @@ Future showConfirmationDialog( child: Text( cancelText, style: TextStyle( - color: Colors.black.withOpacity(0.5), + color: StreamChatTheme.of(context) + .colorTheme + .black + .withOpacity(0.5), fontWeight: FontWeight.w400), ), onPressed: () {