Skip to content

Commit

Permalink
fix: Transportation Component Icon and title color is not compatible (#…
Browse files Browse the repository at this point in the history
…1494)

* chore(develop): release 1.0.0

* fix: Transportation Component Icon and title color is not compatible with background color

* removed extra variable

* chore(develop): release 1.1.0

* remoed additional variable

* removed additional files

* added CHANGELOG.md file

* added set for dark mode

* color design fixes

* removed unused code

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
bhattabhi013 and github-actions[bot] authored Apr 9, 2022
1 parent 7dc2185 commit c5cf03b
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,12 @@ class KnowledgePanelTitleCard extends StatelessWidget {
Widget build(BuildContext context) {
final ThemeData themeData = Theme.of(context);
Color? colorFromEvaluation;
if (evaluation != null &&
(knowledgePanelTitleElement.iconColorFromEvaluation ?? false)) {
colorFromEvaluation = _getColorFromEvaluation(evaluation!);
}
if (evaluation != null &&
_getColorFromEvaluation(evaluation!) == null &&
themeData.brightness == Brightness.dark) {
colorFromEvaluation = Colors.white;
if (knowledgePanelTitleElement.iconColorFromEvaluation ?? false) {
if (themeData.brightness == Brightness.dark) {
colorFromEvaluation = _getColorFromEvaluationDarkMode(evaluation);
} else {
colorFromEvaluation = _getColorFromEvaluation(evaluation);
}
}
List<Widget> iconWidget;
if (knowledgePanelTitleElement.iconUrl != null) {
Expand Down Expand Up @@ -82,18 +80,33 @@ class KnowledgePanelTitleCard extends StatelessWidget {
);
}

Color? _getColorFromEvaluation(Evaluation evaluation) {
Color _getColorFromEvaluation(Evaluation? evaluation) {
switch (evaluation) {
case Evaluation.BAD:
return RED_COLOR;
case Evaluation.AVERAGE:
return LIGHT_ORANGE_COLOR;
case Evaluation.GOOD:
return LIGHT_GREEN_COLOR;
case null:
case Evaluation.NEUTRAL:
return GREY_COLOR;
case Evaluation.UNKNOWN:
return PRIMARY_GREY_COLOR;
}
}

Color _getColorFromEvaluationDarkMode(Evaluation? evaluation) {
switch (evaluation) {
case Evaluation.BAD:
return RED_COLOR;
case Evaluation.AVERAGE:
return LIGHT_ORANGE_COLOR;
case Evaluation.GOOD:
return LIGHT_GREEN_COLOR;
case null:
case Evaluation.NEUTRAL:
case Evaluation.UNKNOWN:
return null;
return LIGHT_GREY_COLOR;
}
}
}
1 change: 1 addition & 0 deletions packages/smooth_app/lib/generic_lib/design_constants.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit c5cf03b

Please sign in to comment.