apply colors and ui fixes

This commit is contained in:
Salvatore Giordano
2020-12-30 16:22:14 +01:00
parent d794a40b4b
commit cb518db1a2
32 changed files with 225 additions and 238 deletions
+61 -61
View File
@@ -1,63 +1,63 @@
include: package:pedantic/analysis_options.yaml #include: package:pedantic/analysis_options.yaml
#
analyzer: #analyzer:
enable-experiment: # enable-experiment:
- extension-methods # - extension-methods
exclude: # exclude:
- lib/**/*.g.dart # - lib/**/*.g.dart
- example/** # - example/**
#
linter: #linter:
rules: # rules:
# these rules are documented on and in the same order as # # these rules are documented on and in the same order as
# the Dart Lint rules page to make maintenance easier # # the Dart Lint rules page to make maintenance easier
# https://github.com/dart-lang/linter/blob/master/example/all.yaml # # https://github.com/dart-lang/linter/blob/master/example/all.yaml
# - always_declare_return_types # # - always_declare_return_types
# - always_specify_types # # - always_specify_types
# - annotate_overrides # # - annotate_overrides
# - avoid_as # # - avoid_as
- avoid_empty_else # - avoid_empty_else
- avoid_init_to_null # - avoid_init_to_null
- avoid_return_types_on_setters # - avoid_return_types_on_setters
- avoid_web_libraries_in_flutter # - avoid_web_libraries_in_flutter
- await_only_futures # - await_only_futures
- camel_case_types # - camel_case_types
- cancel_subscriptions # - cancel_subscriptions
- close_sinks # - close_sinks
# - comment_references # we do not presume as to what people want to reference in their dartdocs # # - comment_references # we do not presume as to what people want to reference in their dartdocs
# - constant_identifier_names # https://github.com/dart-lang/linter/issues/204 # # - constant_identifier_names # https://github.com/dart-lang/linter/issues/204
- control_flow_in_finally # - control_flow_in_finally
- empty_constructor_bodies # - empty_constructor_bodies
- empty_statements # - empty_statements
- hash_and_equals # - hash_and_equals
- implementation_imports # - implementation_imports
# - invariant_booleans # # - invariant_booleans
# - iterable_contains_unrelated_type # # - iterable_contains_unrelated_type
- library_names # - library_names
# - library_prefixes # # - library_prefixes
# - list_remove_unrelated_type # # - list_remove_unrelated_type
# - literal_only_boolean_expressions # # - literal_only_boolean_expressions
- non_constant_identifier_names # - non_constant_identifier_names
# - one_member_abstracts # # - one_member_abstracts
# - only_throw_errors # # - only_throw_errors
# - overridden_fields # # - overridden_fields
# - package_api_docs ## - package_api_docs
- package_names # - package_names
- package_prefixed_library_names # - package_prefixed_library_names
- prefer_is_not_empty # - prefer_is_not_empty
# - prefer_mixin # https://github.com/dart-lang/language/issues/32 # # - prefer_mixin # https://github.com/dart-lang/language/issues/32
- public_member_api_docs # - public_member_api_docs
- slash_for_doc_comments # - slash_for_doc_comments
# - sort_constructors_first # # - sort_constructors_first
# - sort_unnamed_constructors_first # # - sort_unnamed_constructors_first
# - super_goes_last # no longer needed w/ Dart 2 # # - super_goes_last # no longer needed w/ Dart 2
- test_types_in_equals # - test_types_in_equals
- throw_in_finally # - throw_in_finally
# - type_annotate_public_apis # subset of always_specify_types # # - type_annotate_public_apis # subset of always_specify_types
- type_init_formals # - type_init_formals
# - unawaited_futures # # - unawaited_futures
- unnecessary_brace_in_string_interps # - unnecessary_brace_in_string_interps
- unnecessary_getters_setters # - unnecessary_getters_setters
- unnecessary_statements # - unnecessary_statements
- unrelated_type_equality_checks - unrelated_type_equality_checks
- valid_regexps - valid_regexps
+8 -7
View File
@@ -3,12 +3,12 @@ import 'dart:io';
import 'package:example/stream_version.dart'; import 'package:example/stream_version.dart';
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
import 'package:stream_chat_flutter/stream_chat_flutter.dart'; import 'package:stream_chat_flutter/stream_chat_flutter.dart';
import 'choose_user_page.dart';
import 'main.dart'; import 'main.dart';
import 'notifications_service.dart'; import 'notifications_service.dart';
import 'choose_user_page.dart';
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
class AdvancedOptionsPage extends StatefulWidget { class AdvancedOptionsPage extends StatefulWidget {
@override @override
@@ -36,7 +36,7 @@ class _AdvancedOptionsPageState extends State<AdvancedOptionsPage> {
return Scaffold( return Scaffold(
resizeToAvoidBottomPadding: false, resizeToAvoidBottomPadding: false,
appBar: AppBar( appBar: AppBar(
backgroundColor: StreamChatTheme.of(context).primaryColor, backgroundColor: StreamChatTheme.of(context).colorTheme.white,
elevation: 1, elevation: 1,
centerTitle: true, centerTitle: true,
brightness: Theme.of(context).brightness, brightness: Theme.of(context).brightness,
@@ -97,7 +97,7 @@ class _AdvancedOptionsPageState extends State<AdvancedOptionsPage> {
fontSize: 14, fontSize: 14,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
color: _apiKeyError != null color: _apiKeyError != null
? Color(0xffff3742) ? StreamChatTheme.of(context).colorTheme.accentRed
: StreamChatTheme.of(context) : StreamChatTheme.of(context)
.colorTheme .colorTheme
.black .black
@@ -145,7 +145,7 @@ class _AdvancedOptionsPageState extends State<AdvancedOptionsPage> {
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontSize: 14, fontSize: 14,
color: _userIdError != null color: _userIdError != null
? Color(0xffff3742) ? StreamChatTheme.of(context).colorTheme.accentRed
: StreamChatTheme.of(context) : StreamChatTheme.of(context)
.colorTheme .colorTheme
.black .black
@@ -193,7 +193,7 @@ class _AdvancedOptionsPageState extends State<AdvancedOptionsPage> {
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontSize: 14, fontSize: 14,
color: _userTokenError != null color: _userTokenError != null
? Color(0xffff3742) ? StreamChatTheme.of(context).colorTheme.accentRed
: StreamChatTheme.of(context) : StreamChatTheme.of(context)
.colorTheme .colorTheme
.black .black
@@ -238,7 +238,8 @@ class _AdvancedOptionsPageState extends State<AdvancedOptionsPage> {
child: Align( child: Align(
alignment: Alignment.bottomCenter, alignment: Alignment.bottomCenter,
child: FlatButton( child: FlatButton(
color: StreamChatTheme.of(context).accentColor, color:
StreamChatTheme.of(context).colorTheme.accentBlue,
minWidth: double.infinity, minWidth: double.infinity,
height: 48, height: 48,
child: Text( child: Text(
+1 -3
View File
@@ -1,5 +1,3 @@
import 'package:example/advanced_options_page.dart';
import 'package:example/main.dart';
import 'package:example/stream_version.dart'; import 'package:example/stream_version.dart';
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@@ -194,7 +192,7 @@ class ChooseUserPage extends StatelessWidget {
color: StreamChatTheme.of(context).colorTheme.black, color: StreamChatTheme.of(context).colorTheme.black,
), ),
backgroundColor: backgroundColor:
StreamChatTheme.of(context).secondaryColor, StreamChatTheme.of(context).colorTheme.accentBlue,
), ),
title: Text( title: Text(
'Advanced Options', 'Advanced Options',
@@ -84,7 +84,6 @@ class ChannelListPage extends StatelessWidget {
channel: channel, channel: channel,
), ),
title: ChannelName( title: ChannelName(
channel: channel,
textStyle: textStyle:
StreamChatTheme.of(context).channelPreviewTheme.title.copyWith( StreamChatTheme.of(context).channelPreviewTheme.title.copyWith(
color: StreamChatTheme.of(context) color: StreamChatTheme.of(context)
@@ -127,7 +127,6 @@ class ChannelPage extends StatelessWidget {
showTimestamp: !details.isNextUser, showTimestamp: !details.isNextUser,
showUsername: !details.isNextUser, showUsername: !details.isNextUser,
showReactions: false, showReactions: false,
showReplyIndicator: false,
); );
} }
} }
+18 -19
View File
@@ -1,8 +1,7 @@
import 'dart:async';
import 'dart:io'; import 'dart:io';
import 'package:example/choose_user_page.dart'; import 'package:example/choose_user_page.dart';
import 'package:example/new_chat_screen.dart';
import 'package:example/new_group_chat_screen.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@@ -13,7 +12,6 @@ import 'notifications_service.dart';
import 'routes/app_routes.dart'; import 'routes/app_routes.dart';
import 'routes/routes.dart'; import 'routes/routes.dart';
import 'search_text_field.dart'; import 'search_text_field.dart';
import 'dart:async';
void main() async { void main() async {
WidgetsFlutterBinding.ensureInitialized(); WidgetsFlutterBinding.ensureInitialized();
@@ -51,21 +49,20 @@ class MyApp extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return StreamChat( return MaterialApp(
streamChatThemeData: StreamChatThemeData.getDefaultTheme( builder: (context, child) {
ThemeData.dark(), return StreamChat(
), client: client,
client: client, child: child,
child: MaterialApp( );
debugShowCheckedModeBanner: false, },
theme: ThemeData.light(), debugShowCheckedModeBanner: false,
darkTheme: ThemeData.dark(), theme: ThemeData.light(),
//TODO change to system once dark theme is implemented darkTheme: ThemeData.dark(),
themeMode: ThemeMode.dark, themeMode: ThemeMode.dark,
onGenerateRoute: AppRoutes.generateRoute, onGenerateRoute: AppRoutes.generateRoute,
initialRoute: initialRoute:
client.state.user == null ? Routes.CHOOSE_USER : Routes.HOME, client.state.user == null ? Routes.CHOOSE_USER : Routes.HOME,
),
); );
} }
} }
@@ -120,6 +117,7 @@ class _HomePageState extends State<HomePage> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
final user = StreamChat.of(context).user; final user = StreamChat.of(context).user;
return Scaffold( return Scaffold(
backgroundColor: StreamChatTheme.of(context).colorTheme.whiteSnow,
appBar: ChannelListHeader( appBar: ChannelListHeader(
onNewChatButtonTap: () { onNewChatButtonTap: () {
Navigator.pushNamed(context, Routes.NEW_CHAT); Navigator.pushNamed(context, Routes.NEW_CHAT);
@@ -128,6 +126,7 @@ class _HomePageState extends State<HomePage> {
drawer: _buildDrawer(context, user), drawer: _buildDrawer(context, user),
drawerEdgeDragWidth: 50, drawerEdgeDragWidth: 50,
bottomNavigationBar: BottomNavigationBar( bottomNavigationBar: BottomNavigationBar(
backgroundColor: StreamChatTheme.of(context).colorTheme.white,
currentIndex: _currentIndex, currentIndex: _currentIndex,
items: _navBarItems, items: _navBarItems,
selectedLabelStyle: StreamChatTheme.of(context).textTheme.footnoteBold, selectedLabelStyle: StreamChatTheme.of(context).textTheme.footnoteBold,
@@ -429,7 +428,7 @@ class ChannelPage extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
backgroundColor: StreamChatTheme.of(context).backgroundColor, backgroundColor: StreamChatTheme.of(context).colorTheme.whiteSnow,
appBar: ChannelHeader( appBar: ChannelHeader(
showTypingIndicator: false, showTypingIndicator: false,
), ),
-3
View File
@@ -5,7 +5,6 @@ import 'package:stream_chat_flutter/stream_chat_flutter.dart';
import 'chips_input_text_field.dart'; import 'chips_input_text_field.dart';
import 'main.dart'; import 'main.dart';
import 'new_group_chat_screen.dart';
import 'routes/routes.dart'; import 'routes/routes.dart';
class NewChatScreen extends StatefulWidget { class NewChatScreen extends StatefulWidget {
@@ -37,8 +36,6 @@ class _NewChatScreenState extends State<NewChatScreen> {
bool _showUserList = true; bool _showUserList = true;
bool _channelExisted = false;
void _userNameListener() { void _userNameListener() {
if (_debounce?.isActive ?? false) _debounce.cancel(); if (_debounce?.isActive ?? false) _debounce.cancel();
_debounce = Timer(const Duration(milliseconds: 350), () { _debounce = Timer(const Duration(milliseconds: 350), () {
+1 -1
View File
@@ -24,7 +24,7 @@ class SearchTextField extends StatelessWidget {
decoration: BoxDecoration( decoration: BoxDecoration(
color: StreamChatTheme.of(context).colorTheme.white, color: StreamChatTheme.of(context).colorTheme.white,
border: Border.all( border: Border.all(
color: Colors.grey.shade300, color: StreamChatTheme.of(context).colorTheme.white,
), ),
borderRadius: BorderRadius.circular(24), borderRadius: BorderRadius.circular(24),
), ),
+1 -1
View File
@@ -1,6 +1,6 @@
name: example name: example
description: A new Flutter project. description: A new Flutter project.
version: 1.0.95+98 version: 1.0.97+100
environment: environment:
sdk: ">=2.2.2 <3.0.0" sdk: ">=2.2.2 <3.0.0"
+1 -1
View File
@@ -32,7 +32,7 @@ class AttachmentTitle extends StatelessWidget {
attachment.title, attachment.title,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: messageTheme.messageText.copyWith( style: messageTheme.messageText.copyWith(
color: StreamChatTheme.of(context).accentColor, color: StreamChatTheme.of(context).colorTheme.accentBlue,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
), ),
+1 -3
View File
@@ -37,9 +37,7 @@ class StreamBackButton extends StatelessWidget {
}, },
child: StreamSvgIcon.left( child: StreamSvgIcon.left(
size: 24, size: 24,
color: Theme.of(context).brightness == Brightness.dark color: StreamChatTheme.of(context).colorTheme.black,
? StreamChatTheme.of(context).colorTheme.white
: StreamChatTheme.of(context).colorTheme.black,
), ),
), ),
), ),
+3 -3
View File
@@ -106,13 +106,13 @@ class ChannelBottomSheet extends StatelessWidget {
?.role)) ?.role))
ListTile( ListTile(
leading: StreamSvgIcon.delete( leading: StreamSvgIcon.delete(
color: Color(0xFFFF3742), color: StreamChatTheme.of(context).colorTheme.accentRed,
size: 24, size: 24,
), ),
title: Text( title: Text(
'Delete chat', 'Delete chat',
style: TextStyle( style: TextStyle(
color: Color(0xFFFF3742), color: StreamChatTheme.of(context).colorTheme.accentRed,
), ),
), ),
onTap: () async { onTap: () async {
@@ -124,7 +124,7 @@ class ChannelBottomSheet extends StatelessWidget {
'Are you sure you want to delete this conversation?', 'Are you sure you want to delete this conversation?',
cancelText: 'CANCEL', cancelText: 'CANCEL',
icon: StreamSvgIcon.delete( icon: StreamSvgIcon.delete(
color: Colors.red, color: StreamChatTheme.of(context).colorTheme.accentRed,
), ),
); );
var channel = StreamChannel.of(context).channel; var channel = StreamChannel.of(context).channel;
+1 -1
View File
@@ -133,7 +133,7 @@ class ChannelImage extends StatelessWidget {
.avatarTheme .avatarTheme
.constraints, .constraints,
decoration: BoxDecoration( decoration: BoxDecoration(
color: StreamChatTheme.of(context).accentColor, color: StreamChatTheme.of(context).colorTheme.accentBlue,
), ),
child: Stack( child: Stack(
alignment: Alignment.center, alignment: Alignment.center,
+9 -10
View File
@@ -253,7 +253,8 @@ class _ChannelListViewState extends State<ChannelListView>
.bodyBold .bodyBold
.copyWith( .copyWith(
color: StreamChatTheme.of(context) color: StreamChatTheme.of(context)
.accentColor, .colorTheme
.accentBlue,
), ),
), ),
), ),
@@ -501,9 +502,7 @@ class _ChannelListViewState extends State<ChannelListView>
); );
} else { } else {
final backgroundColor = final backgroundColor =
Theme.of(context).brightness == Brightness.light StreamChatTheme.of(context).colorTheme.whiteSmoke;
? Color(0xffEBEBEB)
: Color(0xff141414);
child = Slidable( child = Slidable(
enabled: widget.swipeToAction, enabled: widget.swipeToAction,
actionPane: SlidableBehindActionPane(), actionPane: SlidableBehindActionPane(),
@@ -543,7 +542,7 @@ class _ChannelListViewState extends State<ChannelListView>
IconSlideAction( IconSlideAction(
color: backgroundColor, color: backgroundColor,
iconWidget: StreamSvgIcon.delete( iconWidget: StreamSvgIcon.delete(
color: Color(0xFFFF3742), color: StreamChatTheme.of(context).colorTheme.accentRed,
), ),
onTap: () async { onTap: () async {
final res = await showConfirmationDialog( final res = await showConfirmationDialog(
@@ -554,7 +553,9 @@ class _ChannelListViewState extends State<ChannelListView>
'Are you sure you want to delete this conversation?', 'Are you sure you want to delete this conversation?',
cancelText: 'CANCEL', cancelText: 'CANCEL',
icon: StreamSvgIcon.delete( icon: StreamSvgIcon.delete(
color: Color(0xFFFF3742), color: StreamChatTheme.of(context)
.colorTheme
.accentRed,
), ),
); );
if (res == true) { if (res == true) {
@@ -564,7 +565,7 @@ class _ChannelListViewState extends State<ChannelListView>
), ),
], ],
child: Container( child: Container(
color: StreamChatTheme.of(context).backgroundColor, color: StreamChatTheme.of(context).colorTheme.whiteSnow,
child: ChannelPreview( child: ChannelPreview(
onLongPress: widget.onChannelLongPress, onLongPress: widget.onChannelLongPress,
channel: channel, channel: channel,
@@ -621,9 +622,7 @@ class _ChannelListViewState extends State<ChannelListView>
Widget _separatorBuilder(context, i) { Widget _separatorBuilder(context, i) {
return Container( return Container(
height: 1, height: 1,
color: Theme.of(context).brightness == Brightness.dark color: StreamChatTheme.of(context).colorTheme.black.withOpacity(0.08),
? StreamChatTheme.of(context).colorTheme.white.withOpacity(0.1)
: StreamChatTheme.of(context).colorTheme.black.withOpacity(0.1),
); );
} }
+1 -1
View File
@@ -130,7 +130,7 @@ class ChannelPreview extends StatelessWidget {
.isAfter(channel .isAfter(channel
.state.lastMessage.createdAt)) .state.lastMessage.createdAt))
.length == .length ==
(channel.memberCount ?? 0), ((channel.memberCount ?? 0) - 1),
), ),
); );
} }
+12 -11
View File
@@ -1,4 +1,3 @@
import 'package:emojis/emojis.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:jiffy/jiffy.dart'; import 'package:jiffy/jiffy.dart';
@@ -21,7 +20,7 @@ class _ChatInfoScreenState extends State<ChatInfoScreen> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
final channel = StreamChannel.of(context).channel; final channel = StreamChannel.of(context).channel;
return Scaffold( return Scaffold(
backgroundColor: Color(0xFFe6e6e6), backgroundColor: StreamChatTheme.of(context).colorTheme.whiteSnow,
body: ListView( body: ListView(
children: [ children: [
_buildUserHeader(), _buildUserHeader(),
@@ -47,7 +46,7 @@ class _ChatInfoScreenState extends State<ChatInfoScreen> {
Widget _buildUserHeader() { Widget _buildUserHeader() {
return Material( return Material(
color: StreamChatTheme.of(context).colorTheme.white, color: StreamChatTheme.of(context).colorTheme.whiteSnow,
child: SafeArea( child: SafeArea(
child: Stack( child: Stack(
children: [ children: [
@@ -96,7 +95,9 @@ class _ChatInfoScreenState extends State<ChatInfoScreen> {
top: 21, top: 21,
left: 16, left: 16,
child: InkWell( child: InkWell(
child: StreamSvgIcon.left(), child: StreamSvgIcon.left(
color: StreamChatTheme.of(context).colorTheme.black,
),
onTap: () { onTap: () {
Navigator.of(context).pop(); Navigator.of(context).pop();
}, },
@@ -218,7 +219,7 @@ class _ChatInfoScreenState extends State<ChatInfoScreen> {
Widget _buildDeleteListTile() { Widget _buildDeleteListTile() {
return _OptionListTile( return _OptionListTile(
title: 'Delete', title: 'Delete conversation',
leading: StreamSvgIcon.delete( leading: StreamSvgIcon.delete(
color: Colors.red, color: Colors.red,
size: 24.0, size: 24.0,
@@ -290,7 +291,7 @@ class _ChatInfoScreenState extends State<ChatInfoScreen> {
), ),
child: Material( child: Material(
shape: CircleBorder(), shape: CircleBorder(),
color: Color(0xff20E070), color: StreamChatTheme.of(context).colorTheme.accentGreen,
), ),
), ),
color: StreamChatTheme.of(context).colorTheme.white, color: StreamChatTheme.of(context).colorTheme.white,
@@ -321,11 +322,11 @@ class _OptionListTile extends StatelessWidget {
return Column( return Column(
children: [ children: [
Container( Container(
color: Color(0xffe6e6e6), color: StreamChatTheme.of(context).colorTheme.white,
height: 2.0, height: 2.0,
), ),
Material( Material(
color: StreamChatTheme.of(context).colorTheme.white, color: StreamChatTheme.of(context).colorTheme.whiteSnow,
child: Container( child: Container(
height: 56.0, height: 56.0,
child: InkWell( child: InkWell(
@@ -409,7 +410,7 @@ class __SharedGroupsScreenState extends State<_SharedGroupsScreen> {
), ),
), ),
), ),
backgroundColor: StreamChatTheme.of(context).primaryColor, backgroundColor: StreamChatTheme.of(context).colorTheme.white,
), ),
body: FutureBuilder<List<Channel>>( body: FutureBuilder<List<Channel>>(
future: chat.client.queryChannels( future: chat.client.queryChannels(
@@ -559,7 +560,7 @@ class _MediaDisplayScreen extends StatelessWidget {
), ),
), ),
), ),
backgroundColor: StreamChatTheme.of(context).primaryColor, backgroundColor: StreamChatTheme.of(context).colorTheme.white,
), ),
); );
} }
@@ -595,7 +596,7 @@ class _FileDisplayScreen extends StatelessWidget {
), ),
), ),
), ),
backgroundColor: StreamChatTheme.of(context).primaryColor, backgroundColor: StreamChatTheme.of(context).colorTheme.white,
), ),
); );
} }
+1 -4
View File
@@ -40,10 +40,7 @@ class DateDivider extends StatelessWidget {
child: Container( child: Container(
padding: const EdgeInsets.symmetric(horizontal: 8), padding: const EdgeInsets.symmetric(horizontal: 8),
decoration: BoxDecoration( decoration: BoxDecoration(
color: (Theme.of(context).brightness == Brightness.light color: StreamChatTheme.of(context).colorTheme.black.withOpacity(0.5),
? StreamChatTheme.of(context).colorTheme.black
: StreamChatTheme.of(context).colorTheme.white)
.withOpacity(0.5),
borderRadius: BorderRadius.circular( borderRadius: BorderRadius.circular(
8, 8,
), ),
+3 -2
View File
@@ -9,6 +9,7 @@ import 'package:stream_chat_flutter/src/stream_svg_icon.dart';
import 'package:stream_chat_flutter/src/utils.dart'; import 'package:stream_chat_flutter/src/utils.dart';
import 'package:video_compress/video_compress.dart'; import 'package:video_compress/video_compress.dart';
import 'package:video_player/video_player.dart'; import 'package:video_player/video_player.dart';
import 'media_utils.dart'; import 'media_utils.dart';
enum FileAttachmentType { local, online } enum FileAttachmentType { local, online }
@@ -61,7 +62,6 @@ class _FileAttachmentState extends State<FileAttachment> {
child: Container( child: Container(
width: widget.size?.width ?? 100, width: widget.size?.width ?? 100,
height: 56.0, height: 56.0,
margin: widget.trailing != null ? EdgeInsets.only(top: 4.0) : null,
decoration: BoxDecoration( decoration: BoxDecoration(
color: StreamChatTheme.of(context).colorTheme.white, color: StreamChatTheme.of(context).colorTheme.white,
borderRadius: borderRadius:
@@ -177,7 +177,8 @@ class _FileAttachmentState extends State<FileAttachment> {
width: 20.0, width: 20.0,
height: 20.0, height: 20.0,
child: CircularProgressIndicator( child: CircularProgressIndicator(
backgroundColor: StreamChatTheme.of(context).accentColor, backgroundColor:
StreamChatTheme.of(context).colorTheme.accentBlue,
), ),
), ),
); );
+3 -1
View File
@@ -260,7 +260,9 @@ class GiphyAttachment extends StatelessWidget {
child: Text( child: Text(
'Send', 'Send',
style: TextStyle( style: TextStyle(
color: StreamChatTheme.of(context).accentColor, color: StreamChatTheme.of(context)
.colorTheme
.accentBlue,
fontWeight: FontWeight.bold), fontWeight: FontWeight.bold),
), ),
), ),
+1 -1
View File
@@ -31,7 +31,7 @@ class GroupImage extends StatelessWidget {
.avatarTheme .avatarTheme
.constraints, .constraints,
decoration: BoxDecoration( decoration: BoxDecoration(
color: StreamChatTheme.of(context).accentColor, color: StreamChatTheme.of(context).colorTheme.accentBlue,
), ),
child: Flex( child: Flex(
direction: Axis.vertical, direction: Axis.vertical,
+9 -4
View File
@@ -1,13 +1,14 @@
import 'dart:typed_data'; import 'dart:typed_data';
import 'dart:ui'; import 'dart:ui';
import 'package:dio/dio.dart';
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:dio/dio.dart';
import 'package:image_gallery_saver/image_gallery_saver.dart'; import 'package:image_gallery_saver/image_gallery_saver.dart';
import '../stream_chat_flutter.dart';
import 'package:path_provider/path_provider.dart'; import 'package:path_provider/path_provider.dart';
import '../stream_chat_flutter.dart';
class ImageActionsModal extends StatelessWidget { class ImageActionsModal extends StatelessWidget {
final Message message; final Message message;
final String userName; final String userName;
@@ -165,7 +166,9 @@ class ImageActionsModal extends StatelessWidget {
'Delete', 'Delete',
StreamSvgIcon.delete( StreamSvgIcon.delete(
size: 24.0, size: 24.0,
color: Color(0xffFF3742), color: StreamChatTheme.of(context)
.colorTheme
.accentRed,
), ),
() { () {
Navigator.pop(context); Navigator.pop(context);
@@ -175,7 +178,9 @@ class ImageActionsModal extends StatelessWidget {
StreamChannel.of(context).channel.cid, StreamChannel.of(context).channel.cid,
); );
}, },
color: Color(0xffFF3742), color: StreamChatTheme.of(context)
.colorTheme
.accentRed,
), ),
], ],
).toList(), ).toList(),
+5 -2
View File
@@ -378,7 +378,8 @@ class _ImageFooterState extends State<ImageFooter> {
'Save to Photos', 'Save to Photos',
style: TextStyle( style: TextStyle(
color: StreamChatTheme.of(context) color: StreamChatTheme.of(context)
.accentColor, .colorTheme
.accentBlue,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
), ),
@@ -595,7 +596,9 @@ class _ImageFooterState extends State<ImageFooter> {
child: Transform.rotate( child: Transform.rotate(
angle: -pi / 2, angle: -pi / 2,
child: StreamSvgIcon.Icon_send_message( child: StreamSvgIcon.Icon_send_message(
color: StreamChatTheme.of(context).accentColor, color: StreamChatTheme.of(context)
.colorTheme
.accentBlue,
), ),
), ),
), ),
+11 -2
View File
@@ -1,10 +1,11 @@
import 'dart:ui' as ui;
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart'; import 'package:flutter_svg/flutter_svg.dart';
import 'package:photo_manager/photo_manager.dart'; import 'package:photo_manager/photo_manager.dart';
import 'package:stream_chat_flutter/src/lazy_load_scroll_view.dart'; import 'package:stream_chat_flutter/src/lazy_load_scroll_view.dart';
import 'package:stream_chat_flutter/src/stream_svg_icon.dart'; import 'package:stream_chat_flutter/src/stream_svg_icon.dart';
import 'dart:ui' as ui;
import '../stream_chat_flutter.dart'; import '../stream_chat_flutter.dart';
@@ -148,7 +149,15 @@ class _MediaListViewState extends State<MediaListView> {
void _getMedia() async { void _getMedia() async {
final assetList = await PhotoManager.getAssetPathList( final assetList = await PhotoManager.getAssetPathList(
hasAll: true, hasAll: true,
).then((value) => value.singleWhere((element) => element.isAll)); ).then((value) {
if (value?.isNotEmpty == true) {
return value.singleWhere((element) => element.isAll);
}
});
if (assetList == null) {
return;
}
final media = await assetList.getAssetListPaged(_currentPage, 50); final media = await assetList.getAssetListPaged(_currentPage, 50);
+4 -4
View File
@@ -69,10 +69,7 @@ class MessageActionsModal extends StatelessWidget {
sigmaY: 10.8731, sigmaY: 10.8731,
), ),
child: Container( child: Container(
color: StreamChatTheme.of(context) color: Colors.black.withOpacity(.2),
.colorTheme
.black
.withOpacity(0.1),
), ),
), ),
), ),
@@ -146,6 +143,9 @@ class MessageActionsModal extends StatelessWidget {
horizontal: 48.0, horizontal: 48.0,
), ),
child: Material( child: Material(
color: StreamChatTheme.of(context)
.colorTheme
.whiteSnow,
clipBehavior: Clip.hardEdge, clipBehavior: Clip.hardEdge,
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(16), borderRadius: BorderRadius.circular(16),
+35 -37
View File
@@ -275,7 +275,7 @@ class MessageInputState extends State<MessageInput> {
child: Material( child: Material(
borderRadius: BorderRadius.circular(3), borderRadius: BorderRadius.circular(3),
color: _sendAsDm color: _sendAsDm
? StreamChatTheme.of(context).accentColor ? StreamChatTheme.of(context).colorTheme.accentBlue
: StreamChatTheme.of(context).colorTheme.white, : StreamChatTheme.of(context).colorTheme.white,
child: InkWell( child: InkWell(
onTap: () { onTap: () {
@@ -337,7 +337,7 @@ class MessageInputState extends State<MessageInput> {
child: Padding( child: Padding(
padding: const EdgeInsets.all(8.0) + EdgeInsets.only(bottom: 3.0), padding: const EdgeInsets.all(8.0) + EdgeInsets.only(bottom: 3.0),
child: StreamSvgIcon.emptyCircleLeft( child: StreamSvgIcon.emptyCircleLeft(
color: StreamChatTheme.of(context).accentColor, color: StreamChatTheme.of(context).colorTheme.accentBlue,
), ),
), ),
), ),
@@ -364,7 +364,7 @@ class MessageInputState extends State<MessageInput> {
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(24.0), borderRadius: BorderRadius.circular(24.0),
border: Border.all( border: Border.all(
color: Colors.grey, color: StreamChatTheme.of(context).colorTheme.white,
), ),
), ),
padding: _attachments.isEmpty ? null : EdgeInsets.all(6.0), padding: _attachments.isEmpty ? null : EdgeInsets.all(6.0),
@@ -411,8 +411,9 @@ class MessageInputState extends State<MessageInput> {
padding: padding:
const EdgeInsets.symmetric(horizontal: 8.0), const EdgeInsets.symmetric(horizontal: 8.0),
child: Chip( child: Chip(
backgroundColor: backgroundColor: StreamChatTheme.of(context)
StreamChatTheme.of(context).accentColor, .colorTheme
.accentBlue,
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
labelPadding: labelPadding:
EdgeInsets.symmetric(horizontal: 9.0), EdgeInsets.symmetric(horizontal: 9.0),
@@ -612,12 +613,12 @@ class MessageInputState extends State<MessageInput> {
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8.0), borderRadius: BorderRadius.circular(8.0),
), ),
color: StreamChatTheme.of(context).primaryColor, color: StreamChatTheme.of(context).colorTheme.white,
clipBehavior: Clip.antiAlias, clipBehavior: Clip.antiAlias,
child: Container( child: Container(
constraints: BoxConstraints.loose(Size.fromHeight(400)), constraints: BoxConstraints.loose(Size.fromHeight(400)),
decoration: BoxDecoration( decoration: BoxDecoration(
color: StreamChatTheme.of(context).primaryColor, color: StreamChatTheme.of(context).colorTheme.white,
borderRadius: BorderRadius.circular(8.0)), borderRadius: BorderRadius.circular(8.0)),
child: ListView( child: ListView(
padding: const EdgeInsets.all(0), padding: const EdgeInsets.all(0),
@@ -635,7 +636,8 @@ class MessageInputState extends State<MessageInput> {
), ),
child: StreamSvgIcon.lightning( child: StreamSvgIcon.lightning(
color: StreamChatTheme.of(context) color: StreamChatTheme.of(context)
.accentColor, .colorTheme
.accentBlue,
), ),
), ),
Text( Text(
@@ -671,17 +673,6 @@ class MessageInputState extends State<MessageInput> {
], ],
), ),
), ),
trailing: CircleAvatar(
backgroundColor:
StreamChatTheme.of(context).accentColor,
child: StreamSvgIcon.lightning(
color: StreamChatTheme.of(context)
.colorTheme
.white,
size: 12.5,
),
maxRadius: 12,
),
//subtitle: Text(c.description), //subtitle: Text(c.description),
onTap: () { onTap: () {
_setCommand(c); _setCommand(c);
@@ -708,9 +699,9 @@ class MessageInputState extends State<MessageInput> {
switch (index) { switch (index) {
case 0: case 0:
return _attachments.isEmpty return _attachments.isEmpty
? StreamChatTheme.of(context).accentColor ? StreamChatTheme.of(context).colorTheme.accentBlue
: (!_attachmentContainsFile : (!_attachmentContainsFile
? StreamChatTheme.of(context).accentColor ? StreamChatTheme.of(context).colorTheme.accentBlue
: StreamChatTheme.of(context) : StreamChatTheme.of(context)
.colorTheme .colorTheme
.black .black
@@ -718,7 +709,7 @@ class MessageInputState extends State<MessageInput> {
break; break;
case 1: case 1:
return _attachmentContainsFile return _attachmentContainsFile
? StreamChatTheme.of(context).accentColor ? StreamChatTheme.of(context).colorTheme.accentBlue
: (_attachments.isEmpty : (_attachments.isEmpty
? StreamChatTheme.of(context) ? StreamChatTheme.of(context)
.colorTheme .colorTheme
@@ -881,7 +872,8 @@ class MessageInputState extends State<MessageInput> {
child: Text( child: Text(
'Add more files', 'Add more files',
style: TextStyle( style: TextStyle(
color: StreamChatTheme.of(context).accentColor, color:
StreamChatTheme.of(context).colorTheme.accentBlue,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
), ),
@@ -919,7 +911,8 @@ class MessageInputState extends State<MessageInput> {
'svgs/icon_picture_empty_state.svg', 'svgs/icon_picture_empty_state.svg',
package: 'stream_chat_flutter', package: 'stream_chat_flutter',
height: 140, height: 140,
color: StreamChatTheme.of(context).accentColor, color:
StreamChatTheme.of(context).colorTheme.accentBlue,
), ),
Center( Center(
child: Text( child: Text(
@@ -928,7 +921,9 @@ class MessageInputState extends State<MessageInput> {
.textTheme .textTheme
.bodyBold .bodyBold
.copyWith( .copyWith(
color: StreamChatTheme.of(context).accentColor, color: StreamChatTheme.of(context)
.colorTheme
.accentBlue,
), ),
), ),
), ),
@@ -1106,7 +1101,7 @@ class MessageInputState extends State<MessageInput> {
child: Card( child: Card(
margin: EdgeInsets.all(8.0), margin: EdgeInsets.all(8.0),
elevation: 2.0, elevation: 2.0,
color: StreamChatTheme.of(context).primaryColor, color: StreamChatTheme.of(context).colorTheme.white,
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8.0), borderRadius: BorderRadius.circular(8.0),
), ),
@@ -1114,7 +1109,7 @@ class MessageInputState extends State<MessageInput> {
child: Container( child: Container(
constraints: BoxConstraints.loose(Size.fromHeight(400)), constraints: BoxConstraints.loose(Size.fromHeight(400)),
decoration: BoxDecoration( decoration: BoxDecoration(
color: StreamChatTheme.of(context).primaryColor, color: StreamChatTheme.of(context).colorTheme.white,
), ),
child: FutureBuilder<List<Member>>( child: FutureBuilder<List<Member>>(
future: queryMembers ?? Future.value(members), future: queryMembers ?? Future.value(members),
@@ -1142,7 +1137,8 @@ class MessageInputState extends State<MessageInput> {
subtitle: Text('@${m.userId}'), subtitle: Text('@${m.userId}'),
trailing: StreamSvgIcon.mentions( trailing: StreamSvgIcon.mentions(
color: StreamChatTheme.of(context) color: StreamChatTheme.of(context)
.accentColor, .colorTheme
.accentBlue,
), ),
onTap: () { onTap: () {
_mentionedUsers.add(m.user); _mentionedUsers.add(m.user);
@@ -1207,7 +1203,7 @@ class MessageInputState extends State<MessageInput> {
child: Card( child: Card(
margin: EdgeInsets.all(8.0), margin: EdgeInsets.all(8.0),
elevation: 2.0, elevation: 2.0,
color: StreamChatTheme.of(context).primaryColor, color: StreamChatTheme.of(context).colorTheme.white,
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8.0), borderRadius: BorderRadius.circular(8.0),
), ),
@@ -1222,7 +1218,7 @@ class MessageInputState extends State<MessageInput> {
offset: Offset(0, -4), offset: Offset(0, -4),
), ),
], ],
color: StreamChatTheme.of(context).primaryColor, color: StreamChatTheme.of(context).colorTheme.white,
), ),
child: ListView.builder( child: ListView.builder(
padding: const EdgeInsets.all(0), padding: const EdgeInsets.all(0),
@@ -1238,7 +1234,9 @@ class MessageInputState extends State<MessageInput> {
padding: padding:
const EdgeInsets.symmetric(horizontal: 8.0), const EdgeInsets.symmetric(horizontal: 8.0),
child: StreamSvgIcon.smile( child: StreamSvgIcon.smile(
color: StreamChatTheme.of(context).accentColor, color: StreamChatTheme.of(context)
.colorTheme
.accentBlue,
), ),
), ),
Flexible( Flexible(
@@ -1528,8 +1526,8 @@ class MessageInputState extends State<MessageInput> {
const EdgeInsets.only(left: 4.0, right: 8.0, top: 8.0, bottom: 8.0), const EdgeInsets.only(left: 4.0, right: 8.0, top: 8.0, bottom: 8.0),
child: StreamSvgIcon.lightning( child: StreamSvgIcon.lightning(
color: _commandsOverlay != null color: _commandsOverlay != null
? StreamChatTheme.of(context).accentColor ? StreamChatTheme.of(context).colorTheme.accentBlue
: Color(0xFF000000).withAlpha(128), : StreamChatTheme.of(context).colorTheme.grey,
), ),
), ),
onTap: () async { onTap: () async {
@@ -1566,8 +1564,8 @@ class MessageInputState extends State<MessageInput> {
EdgeInsets.only(left: 8.0, right: padding, top: 8.0, bottom: 8.0), EdgeInsets.only(left: 8.0, right: padding, top: 8.0, bottom: 8.0),
child: StreamSvgIcon.attach( child: StreamSvgIcon.attach(
color: _openFilePickerSection color: _openFilePickerSection
? StreamChatTheme.of(context).accentColor ? StreamChatTheme.of(context).colorTheme.accentBlue
: Color(0xFF000000).withAlpha(128), : StreamChatTheme.of(context).colorTheme.grey,
), ),
), ),
onTap: () async { onTap: () async {
@@ -1896,7 +1894,7 @@ class MessageInputState extends State<MessageInput> {
}, },
child: StreamSvgIcon( child: StreamSvgIcon(
assetName: _getIdleSendIcon(), assetName: _getIdleSendIcon(),
color: Colors.grey, color: StreamChatTheme.of(context).colorTheme.greyGainsboro,
height: 24.0, height: 24.0,
width: 24.0, width: 24.0,
), ),
@@ -1914,7 +1912,7 @@ class MessageInputState extends State<MessageInput> {
}, },
child: StreamSvgIcon( child: StreamSvgIcon(
assetName: _getSendIcon(), assetName: _getSendIcon(),
color: StreamChatTheme.of(context).accentColor, color: StreamChatTheme.of(context).colorTheme.accentBlue,
height: 24.0, height: 24.0,
width: 24.0, width: 24.0,
), ),
+2 -4
View File
@@ -60,10 +60,7 @@ class MessageReactionsModal extends StatelessWidget {
sigmaY: 10.8731, sigmaY: 10.8731,
), ),
child: Container( child: Container(
color: StreamChatTheme.of(context) color: Colors.black.withOpacity(0.2),
.colorTheme
.black
.withOpacity(0.1),
), ),
), ),
), ),
@@ -140,6 +137,7 @@ class MessageReactionsModal extends StatelessWidget {
horizontal: 8.0, horizontal: 8.0,
), ),
child: Card( child: Card(
color: StreamChatTheme.of(context).colorTheme.white,
clipBehavior: Clip.hardEdge, clipBehavior: Clip.hardEdge,
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(16), borderRadius: BorderRadius.circular(16),
+2 -2
View File
@@ -107,7 +107,7 @@ class ReactionBubble extends StatelessWidget {
height: 16, height: 16,
color: (!highlightOwnReactions || color: (!highlightOwnReactions ||
reaction.user.id == StreamChat.of(context).user.id) reaction.user.id == StreamChat.of(context).user.id)
? StreamChatTheme.of(context).accentColor ? StreamChatTheme.of(context).colorTheme.accentBlue
: StreamChatTheme.of(context) : StreamChatTheme.of(context)
.colorTheme .colorTheme
.black .black
@@ -118,7 +118,7 @@ class ReactionBubble extends StatelessWidget {
size: 16, size: 16,
color: (!highlightOwnReactions || color: (!highlightOwnReactions ||
reaction.user.id == StreamChat.of(context).user.id) reaction.user.id == StreamChat.of(context).user.id)
? StreamChatTheme.of(context).accentColor ? StreamChatTheme.of(context).colorTheme.accentBlue
: StreamChatTheme.of(context) : StreamChatTheme.of(context)
.colorTheme .colorTheme
.black .black
+3 -1
View File
@@ -89,7 +89,9 @@ class _ReactionPickerState extends State<ReactionPicker>
height: animations[index].value * 24.0, height: animations[index].value * 24.0,
width: animations[index].value * 24.0, width: animations[index].value * 24.0,
color: ownReactionIndex != -1 color: ownReactionIndex != -1
? StreamChatTheme.of(context).accentColor ? StreamChatTheme.of(context)
.colorTheme
.accentBlue
: Theme.of(context) : Theme.of(context)
.iconTheme .iconTheme
.color .color
+1 -1
View File
@@ -18,7 +18,7 @@ class SendingIndicator extends StatelessWidget {
return Icon( return Icon(
Icons.done_all, Icons.done_all,
size: 8, size: 8,
color: StreamChatTheme.of(context).accentColor, color: StreamChatTheme.of(context).colorTheme.accentBlue,
); );
} }
if (message.status == MessageSendingStatus.SENT || message.status == null) { if (message.status == MessageSendingStatus.SENT || message.status == null) {
+2 -6
View File
@@ -76,8 +76,8 @@ class StreamChatState extends State<StreamChat> with WidgetsBindingObserver {
return Theme( return Theme(
data: materialTheme.copyWith( data: materialTheme.copyWith(
primaryIconTheme: streamTheme.primaryIconTheme, primaryIconTheme: streamTheme.primaryIconTheme,
accentColor: streamTheme.accentColor, accentColor: streamTheme.colorTheme.accentBlue,
scaffoldBackgroundColor: streamTheme.backgroundColor, scaffoldBackgroundColor: streamTheme.colorTheme.white,
), ),
child: widget.child, child: widget.child,
); );
@@ -92,11 +92,9 @@ class StreamChatState extends State<StreamChat> with WidgetsBindingObserver {
) { ) {
final defaultTheme = StreamChatThemeData.getDefaultTheme(Theme.of(context)); final defaultTheme = StreamChatThemeData.getDefaultTheme(Theme.of(context));
final theme = defaultTheme.copyWith( final theme = defaultTheme.copyWith(
primaryColor: themeData?.primaryColor,
defaultChannelImage: themeData?.defaultChannelImage, defaultChannelImage: themeData?.defaultChannelImage,
primaryIconTheme: themeData?.primaryIconTheme, primaryIconTheme: themeData?.primaryIconTheme,
defaultUserImage: themeData?.defaultUserImage, defaultUserImage: themeData?.defaultUserImage,
backgroundColor: themeData?.backgroundColor,
channelTheme: defaultTheme.channelTheme.copyWith( channelTheme: defaultTheme.channelTheme.copyWith(
channelHeaderTheme: channelHeaderTheme:
defaultTheme.channelTheme.channelHeaderTheme.copyWith( defaultTheme.channelTheme.channelHeaderTheme.copyWith(
@@ -151,8 +149,6 @@ class StreamChatState extends State<StreamChat> with WidgetsBindingObserver {
reactionsBackgroundColor: reactionsBackgroundColor:
themeData?.otherMessageTheme?.reactionsBackgroundColor, themeData?.otherMessageTheme?.reactionsBackgroundColor,
), ),
accentColor: themeData?.accentColor,
secondaryColor: themeData?.secondaryColor,
channelPreviewTheme: defaultTheme.channelPreviewTheme.copyWith( channelPreviewTheme: defaultTheme.channelPreviewTheme.copyWith(
avatarTheme: defaultTheme.channelPreviewTheme.avatarTheme.copyWith( avatarTheme: defaultTheme.channelPreviewTheme.avatarTheme.copyWith(
constraints: themeData?.channelPreviewTheme?.avatarTheme?.constraints, constraints: themeData?.channelPreviewTheme?.avatarTheme?.constraints,
+23 -38
View File
@@ -48,18 +48,6 @@ class StreamChatThemeData {
/// The text themes used in the widgets /// The text themes used in the widgets
final ColorTheme colorTheme; final ColorTheme colorTheme;
/// Primary color of the chat widgets
final Color primaryColor;
/// Secondary color of the chat widgets
final Color secondaryColor;
/// Accent color of the chat widgets
final Color accentColor;
/// Background color of the chat widgets
final Color backgroundColor;
/// Theme of the [ChannelPreview] /// Theme of the [ChannelPreview]
final ChannelPreviewTheme channelPreviewTheme; final ChannelPreviewTheme channelPreviewTheme;
@@ -88,10 +76,6 @@ class StreamChatThemeData {
StreamChatThemeData({ StreamChatThemeData({
this.textTheme, this.textTheme,
this.colorTheme, this.colorTheme,
this.primaryColor,
this.secondaryColor,
this.accentColor,
this.backgroundColor,
this.channelPreviewTheme, this.channelPreviewTheme,
this.channelTheme, this.channelTheme,
this.otherMessageTheme, this.otherMessageTheme,
@@ -107,11 +91,7 @@ class StreamChatThemeData {
final defaultTheme = getDefaultTheme(theme); final defaultTheme = getDefaultTheme(theme);
return defaultTheme.copyWith( return defaultTheme.copyWith(
accentColor: theme.accentColor,
primaryIconTheme: theme.primaryIconTheme, primaryIconTheme: theme.primaryIconTheme,
primaryColor: theme.colorScheme.primary,
secondaryColor: theme.colorScheme.secondary,
backgroundColor: theme.scaffoldBackgroundColor,
channelTheme: defaultTheme.channelTheme.copyWith( channelTheme: defaultTheme.channelTheme.copyWith(
inputGradient: LinearGradient(colors: [ inputGradient: LinearGradient(colors: [
theme.accentColor.withOpacity(.5), theme.accentColor.withOpacity(.5),
@@ -141,10 +121,6 @@ class StreamChatThemeData {
StreamChatThemeData copyWith({ StreamChatThemeData copyWith({
TextTheme textTheme, TextTheme textTheme,
ColorTheme colorTheme, ColorTheme colorTheme,
Color primaryColor,
Color secondaryColor,
Color accentColor,
Color backgroundColor,
ChannelPreviewTheme channelPreviewTheme, ChannelPreviewTheme channelPreviewTheme,
ChannelTheme channelTheme, ChannelTheme channelTheme,
MessageTheme ownMessageTheme, MessageTheme ownMessageTheme,
@@ -175,13 +151,9 @@ class StreamChatThemeData {
white: colorTheme?.white, white: colorTheme?.white,
blueAlice: colorTheme?.blueAlice, blueAlice: colorTheme?.blueAlice,
), ),
primaryColor: primaryColor ?? this.primaryColor,
secondaryColor: secondaryColor ?? this.secondaryColor,
primaryIconTheme: primaryIconTheme ?? this.primaryIconTheme, primaryIconTheme: primaryIconTheme ?? this.primaryIconTheme,
accentColor: accentColor ?? this.accentColor,
defaultChannelImage: defaultChannelImage ?? this.defaultChannelImage, defaultChannelImage: defaultChannelImage ?? this.defaultChannelImage,
defaultUserImage: defaultUserImage ?? this.defaultUserImage, defaultUserImage: defaultUserImage ?? this.defaultUserImage,
backgroundColor: backgroundColor ?? this.backgroundColor,
channelPreviewTheme: this.channelPreviewTheme?.copyWith( channelPreviewTheme: this.channelPreviewTheme?.copyWith(
title: channelPreviewTheme.title, title: channelPreviewTheme.title,
subtitle: channelPreviewTheme.subtitle, subtitle: channelPreviewTheme.subtitle,
@@ -252,12 +224,8 @@ class StreamChatThemeData {
return StreamChatThemeData( return StreamChatThemeData(
textTheme: textTheme, textTheme: textTheme,
colorTheme: colorTheme, colorTheme: colorTheme,
secondaryColor: Color(0xffEAEAEA),
accentColor: accentColor,
primaryColor: colorTheme.white,
primaryIconTheme: IconThemeData(color: colorTheme.black.withOpacity(.5)), primaryIconTheme: IconThemeData(color: colorTheme.black.withOpacity(.5)),
defaultChannelImage: (context, channel) => SizedBox(), defaultChannelImage: (context, channel) => SizedBox(),
backgroundColor: colorTheme.whiteSnow,
defaultUserImage: (context, user) => Center( defaultUserImage: (context, user) => Center(
child: CachedNetworkImage( child: CachedNetworkImage(
filterQuality: FilterQuality.high, filterQuality: FilterQuality.high,
@@ -266,7 +234,7 @@ class StreamChatThemeData {
), ),
), ),
channelPreviewTheme: ChannelPreviewTheme( channelPreviewTheme: ChannelPreviewTheme(
unreadCounterColor: Color(0xffff3742), unreadCounterColor: colorTheme.accentRed,
avatarTheme: AvatarTheme( avatarTheme: AvatarTheme(
borderRadius: BorderRadius.circular(20), borderRadius: BorderRadius.circular(20),
constraints: BoxConstraints.tightFor( constraints: BoxConstraints.tightFor(
@@ -324,10 +292,10 @@ class StreamChatThemeData {
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
fontSize: 12, fontSize: 12,
), ),
messageBackgroundColor: isDark ? Color(0xff191919) : Color(0xffEAEAEA), messageBackgroundColor: colorTheme.greyGainsboro,
reactionsBackgroundColor: colorTheme.white, reactionsBackgroundColor: colorTheme.white,
reactionsBorderColor: isDark ? Color(0xff191919) : Color(0xffEAEAEA), reactionsBorderColor: colorTheme.greyWhisper,
replyThreadColor: isDark ? Color(0xff191919) : Color(0xffEAEAEA), replyThreadColor: colorTheme.greyWhisper,
avatarTheme: AvatarTheme( avatarTheme: AvatarTheme(
borderRadius: BorderRadius.circular(20), borderRadius: BorderRadius.circular(20),
constraints: BoxConstraints.tightFor( constraints: BoxConstraints.tightFor(
@@ -340,8 +308,7 @@ class StreamChatThemeData {
), ),
), ),
otherMessageTheme: MessageTheme( otherMessageTheme: MessageTheme(
reactionsBackgroundColor: reactionsBackgroundColor: colorTheme.greyGainsboro,
isDark ? Color(0xff191919) : Color(0xffEAEAEA),
reactionsBorderColor: colorTheme.white, reactionsBorderColor: colorTheme.white,
messageText: TextStyle( messageText: TextStyle(
fontSize: 14.5, fontSize: 14.5,
@@ -535,6 +502,9 @@ class ColorTheme {
final Color whiteSnow; final Color whiteSnow;
final Color white; final Color white;
final Color blueAlice; final Color blueAlice;
final Color accentBlue;
final Color accentRed;
final Color accentGreen;
ColorTheme.light({ ColorTheme.light({
this.black = const Color(0xff000000), this.black = const Color(0xff000000),
@@ -545,6 +515,9 @@ class ColorTheme {
this.whiteSnow = const Color(0xfffcfcfc), this.whiteSnow = const Color(0xfffcfcfc),
this.white = const Color(0xffffffff), this.white = const Color(0xffffffff),
this.blueAlice = const Color(0xffe9f2ff), this.blueAlice = const Color(0xffe9f2ff),
this.accentBlue = const Color(0xff005FFF),
this.accentRed = const Color(0xffFF3742),
this.accentGreen = const Color(0xff20E070),
}); });
ColorTheme.dark({ ColorTheme.dark({
@@ -556,6 +529,9 @@ class ColorTheme {
this.whiteSnow = const Color(0xff070A0D), this.whiteSnow = const Color(0xff070A0D),
this.white = const Color(0xff101418), this.white = const Color(0xff101418),
this.blueAlice = const Color(0xff00193D), this.blueAlice = const Color(0xff00193D),
this.accentBlue = const Color(0xff005FFF),
this.accentRed = const Color(0xffFF3742),
this.accentGreen = const Color(0xff20E070),
}); });
ColorTheme copyWith({ ColorTheme copyWith({
@@ -568,6 +544,9 @@ class ColorTheme {
Color whiteSnow, Color whiteSnow,
Color white, Color white,
Color blueAlice, Color blueAlice,
Color accentBlue,
Color accentRed,
Color accentGreen,
}) { }) {
return type == ColorThemeType.light return type == ColorThemeType.light
? ColorTheme.light( ? ColorTheme.light(
@@ -579,6 +558,9 @@ class ColorTheme {
whiteSnow: whiteSnow ?? this.whiteSnow, whiteSnow: whiteSnow ?? this.whiteSnow,
white: white ?? this.white, white: white ?? this.white,
blueAlice: blueAlice ?? this.blueAlice, blueAlice: blueAlice ?? this.blueAlice,
accentBlue: accentBlue ?? this.accentBlue,
accentRed: accentRed ?? this.accentRed,
accentGreen: accentGreen ?? this.accentGreen,
) )
: ColorTheme.dark( : ColorTheme.dark(
black: black ?? this.black, black: black ?? this.black,
@@ -589,6 +571,9 @@ class ColorTheme {
whiteSnow: whiteSnow ?? this.whiteSnow, whiteSnow: whiteSnow ?? this.whiteSnow,
white: white ?? this.white, white: white ?? this.white,
blueAlice: blueAlice ?? this.blueAlice, blueAlice: blueAlice ?? this.blueAlice,
accentBlue: accentBlue ?? this.accentBlue,
accentRed: accentRed ?? this.accentRed,
accentGreen: accentGreen ?? this.accentGreen,
); );
} }
} }
+2 -2
View File
@@ -47,7 +47,7 @@ class UserAvatar extends StatelessWidget {
constraints: constraints ?? constraints: constraints ??
streamChatTheme.ownMessageTheme.avatarTheme.constraints, streamChatTheme.ownMessageTheme.avatarTheme.constraints,
decoration: BoxDecoration( decoration: BoxDecoration(
color: streamChatTheme.accentColor, color: streamChatTheme.colorTheme.accentBlue,
), ),
child: hasImage child: hasImage
? CachedNetworkImage( ? CachedNetworkImage(
@@ -96,7 +96,7 @@ class UserAvatar extends StatelessWidget {
), ),
child: Material( child: Material(
shape: CircleBorder(), shape: CircleBorder(),
color: Color(0xff20E070), color: streamChatTheme.colorTheme.accentGreen,
), ),
), ),
color: StreamChatTheme.of(context).colorTheme.white, color: StreamChatTheme.of(context).colorTheme.white,