Refactor dark mode color blending to extension method

Moved dark mode color blending logic to a Color extension (toDark) in the design system. Updated usages in ui_utils.dart and related tests to use the new extension. Removed the old getDarkModeColor function for cleaner and more idiomatic code organization.
This commit is contained in:
Ankit Mahato
2025-08-05 21:17:39 +05:30
parent d1fe07ac8d
commit be16016d95
5 changed files with 24 additions and 30 deletions

View File

@ -21,7 +21,7 @@ Color getResponseStatusCodeColor(int? statusCode,
}
}
if (brightness == Brightness.dark) {
col = getDarkModeColor(col);
col = col.toDark;
}
return col;
}
@ -38,7 +38,7 @@ Color getAPIColor(
APIType.graphql => kColorGQL,
};
if (brightness == Brightness.dark) {
col = getDarkModeColor(col);
col = col.toDark;
}
return col;
}
@ -57,13 +57,6 @@ Color getHTTPMethodColor(HTTPVerb? method) {
return col;
}
Color getDarkModeColor(Color col) {
return Color.alphaBlend(
col.withValues(alpha: kOpacityDarkModeBlend),
kColorWhite,
);
}
double? getJsonPreviewerMaxRootNodeWidth(double w) {
if (w < 300) {
return 150;