Fix tray action issues Fix get profile redirect client ua issues Fix proxy card delay view issues Add Russian, Japanese adaptation Fix some issues
62 lines
1.3 KiB
Dart
62 lines
1.3 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
extension ColorExtension on Color {
|
|
Color get toLight {
|
|
return withOpacity(0.8);
|
|
}
|
|
|
|
Color get toLighter {
|
|
return withOpacity(0.6);
|
|
}
|
|
|
|
Color get toSoft {
|
|
return withOpacity(0.15);
|
|
}
|
|
|
|
Color get toLittle {
|
|
return withOpacity(0.03);
|
|
}
|
|
|
|
Color darken([double amount = .1]) {
|
|
assert(amount >= 0 && amount <= 1);
|
|
final hsl = HSLColor.fromColor(this);
|
|
final hslDark = hsl.withLightness((hsl.lightness - amount).clamp(0.0, 1.0));
|
|
return hslDark.toColor();
|
|
}
|
|
|
|
Color blendDarken(
|
|
BuildContext context, {
|
|
double factor = 0.1,
|
|
}) {
|
|
final brightness = Theme.of(context).brightness;
|
|
return Color.lerp(
|
|
this,
|
|
brightness == Brightness.dark ? Colors.white : Colors.black,
|
|
factor,
|
|
)!;
|
|
}
|
|
|
|
Color blendLighten(
|
|
BuildContext context, {
|
|
double factor = 0.1,
|
|
}) {
|
|
final brightness = Theme.of(context).brightness;
|
|
return Color.lerp(
|
|
this,
|
|
brightness == Brightness.dark ? Colors.black : Colors.white,
|
|
factor,
|
|
)!;
|
|
}
|
|
}
|
|
|
|
extension ColorSchemeExtension on ColorScheme {
|
|
ColorScheme toPureBlack(bool isPrueBlack) => isPrueBlack
|
|
? copyWith(
|
|
surface: Colors.black,
|
|
surfaceContainer: surfaceContainer.darken(
|
|
0.05,
|
|
),
|
|
)
|
|
: this;
|
|
}
|