From 6e01e6a36024e2133e5ba91fad631068fdef1e55 Mon Sep 17 00:00:00 2001 From: Abhishek Date: Sat, 9 Apr 2022 15:34:12 +0530 Subject: [PATCH] color design fixes --- .../knowledge_panel_title_card.dart | 17 +++++++---------- .../lib/generic_lib/design_constants.dart | 1 + 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/packages/smooth_app/lib/cards/product_cards/knowledge_panels/knowledge_panel_title_card.dart b/packages/smooth_app/lib/cards/product_cards/knowledge_panels/knowledge_panel_title_card.dart index 8ea533c6e5f..fedc9c72814 100644 --- a/packages/smooth_app/lib/cards/product_cards/knowledge_panels/knowledge_panel_title_card.dart +++ b/packages/smooth_app/lib/cards/product_cards/knowledge_panels/knowledge_panel_title_card.dart @@ -17,7 +17,6 @@ class KnowledgePanelTitleCard extends StatelessWidget { @override Widget build(BuildContext context) { final ThemeData themeData = Theme.of(context); - final ColorScheme colorScheme = themeData.colorScheme; Color? colorFromEvaluation; if (evaluation != null && (knowledgePanelTitleElement.iconColorFromEvaluation ?? false)) { @@ -27,10 +26,8 @@ class KnowledgePanelTitleCard extends StatelessWidget { colorFromEvaluation = _getColorFromEvaluation(evaluation!); } } - if (evaluation != null && - _getColorFromEvaluation(evaluation!) == null && - themeData.brightness == Brightness.dark) { - colorFromEvaluation = colorScheme.onBackground; + if (evaluation != null && themeData.brightness == Brightness.dark) { + colorFromEvaluation = _getColorFromEvaluationDarkMode(evaluation!); } List iconWidget; if (knowledgePanelTitleElement.iconUrl != null) { @@ -87,7 +84,7 @@ class KnowledgePanelTitleCard extends StatelessWidget { ); } - Color? _getColorFromEvaluation(Evaluation evaluation) { + Color _getColorFromEvaluation(Evaluation evaluation) { switch (evaluation) { case Evaluation.BAD: return RED_COLOR; @@ -98,22 +95,22 @@ class KnowledgePanelTitleCard extends StatelessWidget { case Evaluation.GOOD: return LIGHT_GREEN_COLOR; case Evaluation.UNKNOWN: - return null; + return PRIMARY_GREY_COLOR; } } - Color? _getColorFromEvaluationDarkMode(Evaluation evaluation) { + Color _getColorFromEvaluationDarkMode(Evaluation evaluation) { switch (evaluation) { case Evaluation.BAD: return RED_COLOR; case Evaluation.NEUTRAL: - return GREY_COLOR; + return LIGHT_GREY_COLOR; case Evaluation.AVERAGE: return LIGHT_ORANGE_COLOR; case Evaluation.GOOD: return LIGHT_GREEN_COLOR; case Evaluation.UNKNOWN: - return null; + return LIGHT_GREY_COLOR; } } } diff --git a/packages/smooth_app/lib/generic_lib/design_constants.dart b/packages/smooth_app/lib/generic_lib/design_constants.dart index db09eccaab5..67c5a3d14ba 100644 --- a/packages/smooth_app/lib/generic_lib/design_constants.dart +++ b/packages/smooth_app/lib/generic_lib/design_constants.dart @@ -32,6 +32,7 @@ const Color WHITE_COLOR = Color(0xFFFFFFFF); const Color DARK_GREEN_COLOR = Color(0xFF219653); const Color LIGHT_GREEN_COLOR = Color(0xFF60AC0E); const Color LIGHT_YELLOW_COLOR = Color(0xFFF2C94C); +const Color LIGHT_GREY_COLOR = Color(0xFFBFBFBF); const Color DARK_YELLOW_COLOR = Color(0xFFC88F01); const Color LIGHT_ORANGE_COLOR = Color(0xFFF2994A); const Color DARK_ORANGE_COLOR = Color(0xFFE07312);