aaf934c2d1
Rework the application layer end to end: core IPC client, providers, models, database, managers, and shared utilities, with riverpod 3.4.2 and freezed 4.0.1. Keep a rejected profile selected, push the empty config to Core when a profile fails to build, and fall back to the default activity icon for package icons. Add opt-in proxy authentication that injects credentials into the generated profile and the runtime config, force-clears profile-provided skip-auth-prefixes so loopback stays covered, sends the credentials with the app's own proxied requests, and withholds the Android VPN system proxy while credentials are set. HelperCoreLease treats an unreachable Helper as confirmation once the OS reports the Core pid gone, and the lifecycle reconcile retries a parked stop, so the Core comes back after the Helper service dies. Launch arguments seed LinkManager so a clash:// link raises a silently started window, the access control app list is fetched on every page entry, the desktop header matches a standard title bar height, and the tray icons ship as resolution-aware assets scoped per platform. The version moves to 0.8.97+2026090101. Rule.parse mirrors mihomo's ParseRulePayload: the type is case-insensitive, MATCH rules keep no content field, a two-field rule is payload without a target except for comma-payload types whose lone field is the target, params are matched whole, and the wildcard and REMATCH-NAME types the core accepts get their own actions instead of collapsing into DOMAIN. Window routes show, hide and toggle through one serialized queue and defers the macOS accessory activation switch until a second after the last regular switch, so hotkey bursts no longer leave stray Dock icons. The hotkey manager registers through rust_api instead of hotkey_manager, the window header restyles the caption buttons after the native Windows title bar, and the proxies tab keeps its tab controller alive while the empty state animates in. Bootstrap reads the Android dynamic palette from the plugin channel without the deprecated CorePalette, dynamic_color moves to its material_ui release, navigator_resizable 3.1.0 fixes an assertion when popping mid-transition, reorderable_grid goes, and the SDK floor rises to 3.10. Changelog: Rework the app layer and window handling, and add proxy authentication
121 lines
2.8 KiB
Dart
121 lines
2.8 KiB
Dart
import 'dart:math';
|
|
|
|
import 'package:material_ui/material_ui.dart';
|
|
|
|
extension ColorExtension on Color {
|
|
Color get opacity80 {
|
|
return withValues(alpha: 0.8);
|
|
}
|
|
|
|
Color get opacity60 {
|
|
return withValues(alpha: 0.6);
|
|
}
|
|
|
|
Color get opacity50 {
|
|
return withValues(alpha: 0.5);
|
|
}
|
|
|
|
Color get opacity38 {
|
|
return withValues(alpha: 0.38);
|
|
}
|
|
|
|
Color get opacity30 {
|
|
return withValues(alpha: 0.3);
|
|
}
|
|
|
|
Color get opacity12 {
|
|
return withValues(alpha: 0.12);
|
|
}
|
|
|
|
Color get opacity15 {
|
|
return withValues(alpha: 0.15);
|
|
}
|
|
|
|
Color get opacity10 {
|
|
return withValues(alpha: 0.1);
|
|
}
|
|
|
|
Color get opacity3 {
|
|
return withValues(alpha: 0.03);
|
|
}
|
|
|
|
Color get opacity0 {
|
|
return withValues(alpha: 0);
|
|
}
|
|
|
|
int get value32bit {
|
|
return _floatToInt8(a) << 24 |
|
|
_floatToInt8(r) << 16 |
|
|
_floatToInt8(g) << 8 |
|
|
_floatToInt8(b) << 0;
|
|
}
|
|
|
|
int get alpha8bit => (0xff000000 & value32bit) >> 24;
|
|
|
|
int get red8bit => (0x00ff0000 & value32bit) >> 16;
|
|
|
|
int get green8bit => (0x0000ff00 & value32bit) >> 8;
|
|
|
|
int get blue8bit => (0x000000ff & value32bit) >> 0;
|
|
|
|
int _floatToInt8(double x) {
|
|
return (x * 255.0).round() & 0xff;
|
|
}
|
|
|
|
Color lighten([double amount = 10]) {
|
|
if (amount <= 0) return this;
|
|
if (amount > 100) return Colors.white;
|
|
final HSLColor hsl = this == const Color(0xFF000000)
|
|
? HSLColor.fromColor(this).withSaturation(0)
|
|
: HSLColor.fromColor(this);
|
|
return hsl
|
|
.withLightness(min(1, max(0, hsl.lightness + amount / 100)))
|
|
.toColor();
|
|
}
|
|
|
|
String get hex {
|
|
final value = toARGB32();
|
|
final red = (value >> 16) & 0xFF;
|
|
final green = (value >> 8) & 0xFF;
|
|
final blue = value & 0xFF;
|
|
return '#${red.toRadixString(16).padLeft(2, '0')}'
|
|
'${green.toRadixString(16).padLeft(2, '0')}'
|
|
'${blue.toRadixString(16).padLeft(2, '0')}'
|
|
.toUpperCase();
|
|
}
|
|
|
|
Color darken([final int amount = 10]) {
|
|
if (amount <= 0) return this;
|
|
if (amount > 100) return Colors.black;
|
|
final HSLColor hsl = HSLColor.fromColor(this);
|
|
return hsl
|
|
.withLightness(min(1, max(0, hsl.lightness - amount / 100)))
|
|
.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,
|
|
)!;
|
|
}
|
|
}
|
|
|
|
extension ColorSchemeExtension on ColorScheme {
|
|
ColorScheme toPureBlack(bool isPrueBlack) => isPrueBlack
|
|
? copyWith(
|
|
surface: Colors.black,
|
|
surfaceContainer: surfaceContainer.darken(5),
|
|
)
|
|
: this;
|
|
}
|
|
|
|
Color? getDelayColor(int? delay) {
|
|
if (delay == null) return null;
|
|
if (delay < 0) return Colors.red;
|
|
if (delay < 600) return Colors.green;
|
|
return const Color(0xFFC57F0A);
|
|
}
|