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
166 lines
4.1 KiB
Dart
166 lines
4.1 KiB
Dart
import 'dart:math';
|
|
import 'dart:ui';
|
|
|
|
import 'package:fl_clash/common/common.dart';
|
|
import 'package:fl_clash/widgets/scroll.dart';
|
|
import 'package:material_ui/material_ui.dart';
|
|
|
|
class BaseScrollBehavior extends MaterialScrollBehavior {
|
|
const BaseScrollBehavior({this.scrollbarPadding = EdgeInsets.zero});
|
|
|
|
final EdgeInsets scrollbarPadding;
|
|
|
|
@override
|
|
Set<PointerDeviceKind> get dragDevices => {
|
|
PointerDeviceKind.touch,
|
|
PointerDeviceKind.stylus,
|
|
PointerDeviceKind.invertedStylus,
|
|
PointerDeviceKind.trackpad,
|
|
if (system.isDesktop) PointerDeviceKind.mouse,
|
|
PointerDeviceKind.unknown,
|
|
};
|
|
|
|
bool showScrollbar(BuildContext context) {
|
|
switch (getPlatform(context)) {
|
|
case TargetPlatform.linux:
|
|
case TargetPlatform.macOS:
|
|
case TargetPlatform.windows:
|
|
return true;
|
|
case TargetPlatform.android:
|
|
case TargetPlatform.fuchsia:
|
|
case TargetPlatform.iOS:
|
|
return false;
|
|
}
|
|
}
|
|
|
|
@override
|
|
Widget buildScrollbar(
|
|
BuildContext context,
|
|
Widget child,
|
|
ScrollableDetails details,
|
|
) {
|
|
if (axisDirectionToAxis(details.direction) == Axis.horizontal ||
|
|
!showScrollbar(context)) {
|
|
return child;
|
|
}
|
|
return CommonScrollBar(
|
|
controller: details.controller,
|
|
padding: scrollbarPadding,
|
|
child: child,
|
|
);
|
|
}
|
|
|
|
@override
|
|
bool shouldNotify(covariant BaseScrollBehavior oldDelegate) {
|
|
return oldDelegate.scrollbarPadding != scrollbarPadding;
|
|
}
|
|
}
|
|
|
|
class HiddenBarScrollBehavior extends BaseScrollBehavior {
|
|
const HiddenBarScrollBehavior();
|
|
|
|
@override
|
|
bool showScrollbar(BuildContext context) => false;
|
|
}
|
|
|
|
class ShowBarScrollBehavior extends BaseScrollBehavior {
|
|
const ShowBarScrollBehavior({super.scrollbarPadding});
|
|
|
|
@override
|
|
bool showScrollbar(BuildContext context) => true;
|
|
}
|
|
|
|
class NextClampingScrollPhysics extends ClampingScrollPhysics {
|
|
const NextClampingScrollPhysics({super.parent});
|
|
|
|
@override
|
|
NextClampingScrollPhysics applyTo(ScrollPhysics? ancestor) {
|
|
return NextClampingScrollPhysics(parent: buildParent(ancestor));
|
|
}
|
|
|
|
@override
|
|
Simulation? createBallisticSimulation(
|
|
ScrollMetrics position,
|
|
double velocity,
|
|
) {
|
|
final Tolerance tolerance = toleranceFor(position);
|
|
if (position.outOfRange) {
|
|
double? end;
|
|
if (position.pixels > position.maxScrollExtent) {
|
|
end = position.maxScrollExtent;
|
|
}
|
|
if (position.pixels < position.minScrollExtent) {
|
|
end = position.minScrollExtent;
|
|
}
|
|
assert(end != null);
|
|
return ScrollSpringSimulation(
|
|
spring,
|
|
end!,
|
|
end,
|
|
min(0.0, velocity),
|
|
tolerance: tolerance,
|
|
);
|
|
}
|
|
if (velocity.abs() < tolerance.velocity) {
|
|
return null;
|
|
}
|
|
if (velocity > 0.0 && position.pixels >= position.maxScrollExtent) {
|
|
return null;
|
|
}
|
|
if (velocity < 0.0 && position.pixels <= position.minScrollExtent) {
|
|
return null;
|
|
}
|
|
return ClampingScrollSimulation(
|
|
position: position.pixels,
|
|
velocity: velocity,
|
|
tolerance: tolerance,
|
|
);
|
|
}
|
|
}
|
|
|
|
class ReverseScrollController extends ScrollController {
|
|
ReverseScrollController({
|
|
super.initialScrollOffset,
|
|
super.keepScrollOffset,
|
|
super.debugLabel,
|
|
});
|
|
|
|
@override
|
|
ScrollPosition createScrollPosition(
|
|
ScrollPhysics physics,
|
|
ScrollContext context,
|
|
ScrollPosition? oldPosition,
|
|
) {
|
|
return ReverseScrollPosition(
|
|
physics: physics,
|
|
context: context,
|
|
initialPixels: initialScrollOffset,
|
|
keepScrollOffset: keepScrollOffset,
|
|
oldPosition: oldPosition,
|
|
debugLabel: debugLabel,
|
|
);
|
|
}
|
|
}
|
|
|
|
class ReverseScrollPosition extends ScrollPositionWithSingleContext {
|
|
ReverseScrollPosition({
|
|
required super.physics,
|
|
required super.context,
|
|
super.initialPixels = 0.0,
|
|
super.keepScrollOffset,
|
|
super.oldPosition,
|
|
super.debugLabel,
|
|
});
|
|
|
|
bool _isInit = false;
|
|
|
|
@override
|
|
bool applyContentDimensions(double minScrollExtent, double maxScrollExtent) {
|
|
if (!_isInit) {
|
|
correctPixels(maxScrollExtent);
|
|
_isInit = true;
|
|
}
|
|
return super.applyContentDimensions(minScrollExtent, maxScrollExtent);
|
|
}
|
|
}
|