Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dbf1724cca | ||
|
|
909aa4038e | ||
|
|
2d0a7d8d46 | ||
|
|
ca96cd1d82 | ||
|
|
91ab1e5dac |
@@ -98,7 +98,7 @@ func changeProxy(s *C.char) bool {
|
|||||||
log.Infoln("Unmarshal ChangeProxyParams %v", err)
|
log.Infoln("Unmarshal ChangeProxyParams %v", err)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
proxies := tunnel.Proxies()
|
proxies := tunnel.ProxiesWithProviders()
|
||||||
proxy := proxies[*params.GroupName]
|
proxy := proxies[*params.GroupName]
|
||||||
if proxy == nil {
|
if proxy == nil {
|
||||||
return false
|
return false
|
||||||
@@ -148,7 +148,7 @@ func asyncTestDelay(s *C.char) {
|
|||||||
ctx, cancel := context.WithTimeout(context.Background(), time.Millisecond*time.Duration(params.Timeout))
|
ctx, cancel := context.WithTimeout(context.Background(), time.Millisecond*time.Duration(params.Timeout))
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
proxies := tunnel.Proxies()
|
proxies := tunnel.ProxiesWithProviders()
|
||||||
proxy := proxies[params.ProxyName]
|
proxy := proxies[params.ProxyName]
|
||||||
|
|
||||||
delayData := &Delay{
|
delayData := &Delay{
|
||||||
|
|||||||
@@ -74,17 +74,19 @@ class ClashCore {
|
|||||||
final proxiesRawString = proxiesRaw.cast<Utf8>().toDartString();
|
final proxiesRawString = proxiesRaw.cast<Utf8>().toDartString();
|
||||||
return Isolate.run<List<Group>>(() {
|
return Isolate.run<List<Group>>(() {
|
||||||
final proxies = json.decode(proxiesRawString);
|
final proxies = json.decode(proxiesRawString);
|
||||||
final groupsRaw = (proxies[UsedProxy.GLOBAL.name]["all"] as List)
|
final groupNames = [
|
||||||
.where((e) {
|
UsedProxy.GLOBAL.name,
|
||||||
final proxy = proxies[e];
|
...(proxies[UsedProxy.GLOBAL.name]["all"] as List).where((e) {
|
||||||
final excludeName = !UsedProxyExtension.valueList
|
final proxy = proxies[e];
|
||||||
.where((element) => element != UsedProxy.GLOBAL.name)
|
return GroupTypeExtension.valueList.contains(proxy['type']);
|
||||||
.contains(proxy['name']);
|
})
|
||||||
final validType = GroupTypeExtension.valueList.contains(proxy['type']);
|
];
|
||||||
return excludeName && validType;
|
final groupsRaw = groupNames.map((groupName) {
|
||||||
}).map((groupName) {
|
|
||||||
final group = proxies[groupName];
|
final group = proxies[groupName];
|
||||||
group["all"] = ((group["all"] ?? []) as List)
|
group["all"] = ((group["all"] ?? []) as List)
|
||||||
|
.where(
|
||||||
|
(name) => !groupNames.contains(groupNames),
|
||||||
|
)
|
||||||
.map(
|
.map(
|
||||||
(name) => proxies[name],
|
(name) => proxies[name],
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -194,7 +194,7 @@ class _ProxiesTabViewState extends State<ProxiesTabView>
|
|||||||
_controller.dispose();
|
_controller.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
get group => widget.group;
|
Group get group => widget.group;
|
||||||
|
|
||||||
get measure => context.appController.measure;
|
get measure => context.appController.measure;
|
||||||
|
|
||||||
@@ -374,17 +374,26 @@ class _ProxiesTabViewState extends State<ProxiesTabView>
|
|||||||
return ObjectKey(item);
|
return ObjectKey(item);
|
||||||
},
|
},
|
||||||
builder: (_, proxy) {
|
builder: (_, proxy) {
|
||||||
return Selector3<AppState, Config, ClashConfig, String?>(
|
return Selector3<AppState, Config, ClashConfig,
|
||||||
|
ProxiesCardSelectorState>(
|
||||||
selector: (_, appState, config, clashConfig) =>
|
selector: (_, appState, config, clashConfig) =>
|
||||||
appState.getCurrentProxyName(
|
ProxiesCardSelectorState(
|
||||||
config.currentProxyName,
|
currentGroupName: appState.getCurrentGroupName(
|
||||||
clashConfig.mode,
|
config.currentGroupName,
|
||||||
|
clashConfig.mode,
|
||||||
|
),
|
||||||
|
currentProxyName: appState.getCurrentProxyName(
|
||||||
|
config.currentProxyName,
|
||||||
|
clashConfig.mode,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
builder: (_, value, __) {
|
builder: (_, state, __) {
|
||||||
final currentProxyName =
|
final isSelected = group.type == GroupType.Selector
|
||||||
group.type == GroupType.Selector ? value : group.now;
|
? group.name == state.currentGroupName &&
|
||||||
|
proxy.name == state.currentProxyName
|
||||||
|
: group.now == state.currentProxyName;
|
||||||
return _card(
|
return _card(
|
||||||
isSelected: proxy.name == currentProxyName,
|
isSelected: isSelected,
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
if (group.type == GroupType.Selector) {
|
if (group.type == GroupType.Selector) {
|
||||||
final config = context.read<Config>();
|
final config = context.read<Config>();
|
||||||
|
|||||||
@@ -1887,3 +1887,148 @@ abstract class _ProxiesSelectorState implements ProxiesSelectorState {
|
|||||||
_$$ProxiesSelectorStateImplCopyWith<_$ProxiesSelectorStateImpl>
|
_$$ProxiesSelectorStateImplCopyWith<_$ProxiesSelectorStateImpl>
|
||||||
get copyWith => throw _privateConstructorUsedError;
|
get copyWith => throw _privateConstructorUsedError;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
mixin _$ProxiesCardSelectorState {
|
||||||
|
String? get currentGroupName => throw _privateConstructorUsedError;
|
||||||
|
String? get currentProxyName => throw _privateConstructorUsedError;
|
||||||
|
|
||||||
|
@JsonKey(ignore: true)
|
||||||
|
$ProxiesCardSelectorStateCopyWith<ProxiesCardSelectorState> get copyWith =>
|
||||||
|
throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class $ProxiesCardSelectorStateCopyWith<$Res> {
|
||||||
|
factory $ProxiesCardSelectorStateCopyWith(ProxiesCardSelectorState value,
|
||||||
|
$Res Function(ProxiesCardSelectorState) then) =
|
||||||
|
_$ProxiesCardSelectorStateCopyWithImpl<$Res, ProxiesCardSelectorState>;
|
||||||
|
@useResult
|
||||||
|
$Res call({String? currentGroupName, String? currentProxyName});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class _$ProxiesCardSelectorStateCopyWithImpl<$Res,
|
||||||
|
$Val extends ProxiesCardSelectorState>
|
||||||
|
implements $ProxiesCardSelectorStateCopyWith<$Res> {
|
||||||
|
_$ProxiesCardSelectorStateCopyWithImpl(this._value, this._then);
|
||||||
|
|
||||||
|
// ignore: unused_field
|
||||||
|
final $Val _value;
|
||||||
|
// ignore: unused_field
|
||||||
|
final $Res Function($Val) _then;
|
||||||
|
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
@override
|
||||||
|
$Res call({
|
||||||
|
Object? currentGroupName = freezed,
|
||||||
|
Object? currentProxyName = freezed,
|
||||||
|
}) {
|
||||||
|
return _then(_value.copyWith(
|
||||||
|
currentGroupName: freezed == currentGroupName
|
||||||
|
? _value.currentGroupName
|
||||||
|
: currentGroupName // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String?,
|
||||||
|
currentProxyName: freezed == currentProxyName
|
||||||
|
? _value.currentProxyName
|
||||||
|
: currentProxyName // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String?,
|
||||||
|
) as $Val);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class _$$ProxiesCardSelectorStateImplCopyWith<$Res>
|
||||||
|
implements $ProxiesCardSelectorStateCopyWith<$Res> {
|
||||||
|
factory _$$ProxiesCardSelectorStateImplCopyWith(
|
||||||
|
_$ProxiesCardSelectorStateImpl value,
|
||||||
|
$Res Function(_$ProxiesCardSelectorStateImpl) then) =
|
||||||
|
__$$ProxiesCardSelectorStateImplCopyWithImpl<$Res>;
|
||||||
|
@override
|
||||||
|
@useResult
|
||||||
|
$Res call({String? currentGroupName, String? currentProxyName});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class __$$ProxiesCardSelectorStateImplCopyWithImpl<$Res>
|
||||||
|
extends _$ProxiesCardSelectorStateCopyWithImpl<$Res,
|
||||||
|
_$ProxiesCardSelectorStateImpl>
|
||||||
|
implements _$$ProxiesCardSelectorStateImplCopyWith<$Res> {
|
||||||
|
__$$ProxiesCardSelectorStateImplCopyWithImpl(
|
||||||
|
_$ProxiesCardSelectorStateImpl _value,
|
||||||
|
$Res Function(_$ProxiesCardSelectorStateImpl) _then)
|
||||||
|
: super(_value, _then);
|
||||||
|
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
@override
|
||||||
|
$Res call({
|
||||||
|
Object? currentGroupName = freezed,
|
||||||
|
Object? currentProxyName = freezed,
|
||||||
|
}) {
|
||||||
|
return _then(_$ProxiesCardSelectorStateImpl(
|
||||||
|
currentGroupName: freezed == currentGroupName
|
||||||
|
? _value.currentGroupName
|
||||||
|
: currentGroupName // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String?,
|
||||||
|
currentProxyName: freezed == currentProxyName
|
||||||
|
? _value.currentProxyName
|
||||||
|
: currentProxyName // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String?,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
|
||||||
|
class _$ProxiesCardSelectorStateImpl implements _ProxiesCardSelectorState {
|
||||||
|
const _$ProxiesCardSelectorStateImpl(
|
||||||
|
{required this.currentGroupName, required this.currentProxyName});
|
||||||
|
|
||||||
|
@override
|
||||||
|
final String? currentGroupName;
|
||||||
|
@override
|
||||||
|
final String? currentProxyName;
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'ProxiesCardSelectorState(currentGroupName: $currentGroupName, currentProxyName: $currentProxyName)';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) ||
|
||||||
|
(other.runtimeType == runtimeType &&
|
||||||
|
other is _$ProxiesCardSelectorStateImpl &&
|
||||||
|
(identical(other.currentGroupName, currentGroupName) ||
|
||||||
|
other.currentGroupName == currentGroupName) &&
|
||||||
|
(identical(other.currentProxyName, currentProxyName) ||
|
||||||
|
other.currentProxyName == currentProxyName));
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode =>
|
||||||
|
Object.hash(runtimeType, currentGroupName, currentProxyName);
|
||||||
|
|
||||||
|
@JsonKey(ignore: true)
|
||||||
|
@override
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
_$$ProxiesCardSelectorStateImplCopyWith<_$ProxiesCardSelectorStateImpl>
|
||||||
|
get copyWith => __$$ProxiesCardSelectorStateImplCopyWithImpl<
|
||||||
|
_$ProxiesCardSelectorStateImpl>(this, _$identity);
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class _ProxiesCardSelectorState implements ProxiesCardSelectorState {
|
||||||
|
const factory _ProxiesCardSelectorState(
|
||||||
|
{required final String? currentGroupName,
|
||||||
|
required final String? currentProxyName}) =
|
||||||
|
_$ProxiesCardSelectorStateImpl;
|
||||||
|
|
||||||
|
@override
|
||||||
|
String? get currentGroupName;
|
||||||
|
@override
|
||||||
|
String? get currentProxyName;
|
||||||
|
@override
|
||||||
|
@JsonKey(ignore: true)
|
||||||
|
_$$ProxiesCardSelectorStateImplCopyWith<_$ProxiesCardSelectorStateImpl>
|
||||||
|
get copyWith => throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
|
|||||||
@@ -111,3 +111,10 @@ class ProxiesSelectorState with _$ProxiesSelectorState{
|
|||||||
}) = _ProxiesSelectorState;
|
}) = _ProxiesSelectorState;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
class ProxiesCardSelectorState with _$ProxiesCardSelectorState{
|
||||||
|
const factory ProxiesCardSelectorState({
|
||||||
|
required String? currentGroupName,
|
||||||
|
required String? currentProxyName,
|
||||||
|
}) = _ProxiesCardSelectorState;
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
name: fl_clash
|
name: fl_clash
|
||||||
description: A multi-platform proxy client based on ClashMeta, simple and easy to use, open-source and ad-free.
|
description: A multi-platform proxy client based on ClashMeta, simple and easy to use, open-source and ad-free.
|
||||||
publish_to: 'none'
|
publish_to: 'none'
|
||||||
version: 0.7.3
|
version: 0.7.6
|
||||||
environment:
|
environment:
|
||||||
sdk: '>=3.1.0 <4.0.0'
|
sdk: '>=3.1.0 <4.0.0'
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user