From ecd11fbf2991985df5fc8f14c6c6f77f264b1ad7 Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Sun, 25 Apr 2021 16:35:50 +0200 Subject: [PATCH] Adapt conversations color for #Forez --- lib/forez/main_forez_dev.dart | 1 + lib/models/config.dart | 2 ++ lib/ui/screens/conversation_screen.dart | 8 ++++++-- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/forez/main_forez_dev.dart b/lib/forez/main_forez_dev.dart index 36b3dfe..63378de 100644 --- a/lib/forez/main_forez_dev.dart +++ b/lib/forez/main_forez_dev.dart @@ -35,6 +35,7 @@ void main() { appName: "#Forez", appQuickDescription: tr("Events organisation in Forez plain"), unreadConversationColor: Colors.green.shade900, + defaultConversationColor: Colors.green.shade900, toursEntriesBuilder: buildTour, additionalLoading: () => ForezGroupHelper.refreshInfo(), mainRouteBuilder: (c, k) => ForezRoute(key: k), diff --git a/lib/models/config.dart b/lib/models/config.dart index 2310e1e..c2a6cba 100644 --- a/lib/models/config.dart +++ b/lib/models/config.dart @@ -24,6 +24,7 @@ class Config { final String appName; final String appQuickDescription; final Color unreadConversationColor; + final Color defaultConversationColor; // Entries for the welcome tour final TourEntriesBuilder toursEntriesBuilder; @@ -44,6 +45,7 @@ class Config { this.primaryColorDark, this.appName = "Comunic", this.appQuickDescription, + this.defaultConversationColor, this.unreadConversationColor, this.toursEntriesBuilder, this.additionalLoading, diff --git a/lib/ui/screens/conversation_screen.dart b/lib/ui/screens/conversation_screen.dart index 4c0052d..693adf5 100644 --- a/lib/ui/screens/conversation_screen.dart +++ b/lib/ui/screens/conversation_screen.dart @@ -7,6 +7,7 @@ import 'package:comunic/helpers/users_helper.dart'; import 'package:comunic/lists/conversation_messages_list.dart'; import 'package:comunic/lists/users_list.dart'; import 'package:comunic/models/api_request.dart'; +import 'package:comunic/models/config.dart'; import 'package:comunic/models/conversation.dart'; import 'package:comunic/models/conversation_message.dart'; import 'package:comunic/models/new_conversation_message.dart'; @@ -92,6 +93,7 @@ class _ConversationScreenState extends SafeState { // Colors definition Color get _senderColor => _conversation.color ?? + config().defaultConversationColor ?? /*(darkTheme() ? Color(0xff2b343b) :*/ Colors.blue.shade700; //); Color get _receiverColor => @@ -100,11 +102,13 @@ class _ConversationScreenState extends SafeState { Color get _greyColor => Color(0xff8f8f8f); Color get _gradientColorStart => - _conversation.color ?? + (_conversation.color ?? config().defaultConversationColor) + ?.withOpacity(0.7) ?? (darkTheme() ? Color(0xff00b6f3) : Colors.blue.shade300); Color get _gradientColorEnd => - _conversation.color?.withOpacity(0.7) ?? + _conversation.color ?? + config().defaultConversationColor ?? (darkTheme() ? Color(0xff0184dc) : Colors.blueAccent.shade700); Color get _separatorColor =>