Skip to content
Snippets Groups Projects
Commit cb1a8cfe authored by Daniel Furaev's avatar Daniel Furaev
Browse files

some little stuff

parent b416e6fb
No related branches found
No related tags found
No related merge requests found
......@@ -29,7 +29,7 @@ class _HomePageState extends State<HomePage> {
backgroundColor: color,
color: Colors.white,
activeColor: Colors.white,
tabBackgroundColor: Colors.grey,
tabBackgroundColor: ligten(color),
gap: 8,
padding: EdgeInsets.all(16),
tabs: [
......@@ -57,4 +57,23 @@ class _HomePageState extends State<HomePage> {
),
);
}
Color darken(Color color, [double amount = .1]) {
assert(amount >= 0 && amount <= 1);
final hsl = HSLColor.fromColor(color);
final hslDark = hsl.withLightness((hsl.lightness - amount).clamp(0.0, 1.0));
return hslDark.toColor();
}
Color ligten(Color color, [double amount = .1]) {
assert(amount >= 0 && amount <= 1);
final hsl = HSLColor.fromColor(color);
final hslLight =
hsl.withLightness((hsl.lightness + amount).clamp(0.0, 1.0));
return hslLight.toColor();
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment