add WebDAV

add Auto check updates

Optimize more details
This commit is contained in:
chen08209
2024-05-20 15:15:09 +08:00
parent c4b470ffaf
commit 91d30c0f0e
65 changed files with 2866 additions and 1565 deletions

View File

@@ -1,10 +1,10 @@
import 'package:collection/collection.dart';
import 'package:fl_clash/common/common.dart';
import 'package:fl_clash/enum/enum.dart';
import 'package:flutter/material.dart';
import 'ffi.dart';
import 'log.dart';
import 'navigation.dart';
import 'package.dart';
import 'profile.dart';
import 'proxy.dart';
import 'system_color_scheme.dart';
@@ -20,7 +20,6 @@ class AppState with ChangeNotifier {
VersionInfo? _versionInfo;
List<Traffic> _traffics;
List<Log> _logs;
List<Package> _packages;
String _currentLabel;
SystemColorSchemes _systemColorSchemes;
num _sortNum;
@@ -29,9 +28,11 @@ class AppState with ChangeNotifier {
SelectedMap _selectedMap;
bool _isCompatible;
List<Group> _groups;
double _viewWidth;
AppState({
required Mode mode,
double? viewWidth,
required bool isCompatible,
required SelectedMap selectedMap,
}) : _navigationItems = [],
@@ -39,8 +40,8 @@ class AppState with ChangeNotifier {
_currentLabel = "dashboard",
_traffics = [],
_logs = [],
_viewWidth = viewWidth ?? 0,
_selectedMap = selectedMap,
_packages = [],
_sortNum = 0,
_mode = mode,
_delayMap = {},
@@ -66,6 +67,20 @@ class AppState with ChangeNotifier {
}
}
List<NavigationItem> get currentNavigationItems {
NavigationItemMode navigationItemMode;
if (_viewWidth <= maxMobileWidth) {
navigationItemMode = NavigationItemMode.mobile;
} else {
navigationItemMode = NavigationItemMode.desktop;
}
return navigationItems
.where(
(element) => element.modes.contains(navigationItemMode),
)
.toList();
}
bool get isInit => _isInit;
set isInit(bool value) {
@@ -164,14 +179,6 @@ class AppState with ChangeNotifier {
}
}
List<Package> get packages => _packages;
set packages(List<Package> value) {
if (_packages != value) {
_packages = value;
notifyListeners();
}
}
List<Group> get groups => _groups;
@@ -200,19 +207,6 @@ class AppState with ChangeNotifier {
}
}
// String? get currentProxyName {
// if (mode == Mode.direct) return UsedProxy.DIRECT.name;
// if (_currentProxyName != null) return _currentProxyName!;
// return currentGroup?.now;
// }
//
// set currentProxyName(String? value) {
// if (_currentProxyName != value) {
// _currentProxyName = value;
// notifyListeners();
// }
// }
bool get isCompatible {
return _isCompatible;
}
@@ -250,6 +244,21 @@ class AppState with ChangeNotifier {
}
}
double get viewWidth => _viewWidth;
set viewWidth(double value) {
if (_viewWidth != value) {
_viewWidth = value;
notifyListeners();
}
}
ViewMode get viewMode {
if (_viewWidth <= maxMobileWidth) return ViewMode.mobile;
if (_viewWidth <= maxLaptopWidth) return ViewMode.laptop;
return ViewMode.desktop;
}
DelayMap get delayMap {
return _delayMap;
}

View File

@@ -11,15 +11,13 @@ part 'generated/clash_config.g.dart';
part 'generated/clash_config.freezed.dart';
@freezed
class Tun with _$Tun {
const factory Tun({
@Default(false) bool enable,
@Default(appName) String device,
@Default(TunStack.gvisor) TunStack stack,
@JsonKey(name: "dns-hijack") @Default(["any:53"])
List<String> dnsHijack,
@JsonKey(name: "dns-hijack") @Default(["any:53"]) List<String> dnsHijack,
}) = _Tun;
factory Tun.fromJson(Map<String, Object?> json) => _$TunFromJson(json);
@@ -198,6 +196,19 @@ class ClashConfig extends ChangeNotifier {
}
}
update([ClashConfig? clashConfig]) {
if (clashConfig != null) {
_mixedPort = clashConfig._mixedPort;
_allowLan = clashConfig._allowLan;
_mode = clashConfig._mode;
_logLevel = clashConfig._logLevel;
_tun = clashConfig._tun;
_dns = clashConfig._dns;
_rules = clashConfig._rules;
}
notifyListeners();
}
Map<String, dynamic> toJson() {
return _$ClashConfigToJson(this);
}
@@ -216,4 +227,9 @@ class ClashConfig extends ChangeNotifier {
allowLan: allowLan,
);
}
}
@override
String toString() {
return 'ClashConfig{_mixedPort: $_mixedPort, _allowLan: $_allowLan, _mode: $_mode, _logLevel: $_logLevel, _tun: $_tun, _dns: $_dns, _rules: $_rules}';
}
}

View File

@@ -11,14 +11,10 @@ class Result<T> {
this.data,
});
Result.success({
this.data,
}) : type = ResultType.success,
Result.success([this.data]) : type = ResultType.success,
message = null;
Result.error({
this.message,
}) : type = ResultType.error,
Result.error([this.message]) : type = ResultType.error,
data = null;
@override

View File

@@ -56,6 +56,23 @@ class AccessControl {
factory AccessControl.fromJson(Map<String, dynamic> json) {
return _$AccessControlFromJson(json);
}
@override
bool operator ==(Object other) =>
identical(this, other) ||
other is AccessControl &&
runtimeType == other.runtimeType &&
mode == other.mode &&
acceptList == other.acceptList &&
rejectList == other.rejectList &&
isFilterSystemApp == other.isFilterSystemApp;
@override
int get hashCode =>
mode.hashCode ^
acceptList.hashCode ^
rejectList.hashCode ^
isFilterSystemApp.hashCode;
}
@JsonSerializable()
@@ -75,6 +92,8 @@ class Config extends ChangeNotifier {
bool _isAccessControl;
AccessControl _accessControl;
bool _isAnimateToPage;
bool _autoCheckUpdate;
DAV? _dav;
Config()
: _profiles = [],
@@ -84,10 +103,11 @@ class Config extends ChangeNotifier {
_themeMode = ThemeMode.system,
_openLog = false,
_isCompatible = false,
_primaryColor = appConstant.defaultPrimaryColor.value,
_primaryColor = defaultPrimaryColor.value,
_proxiesSortType = ProxiesSortType.none,
_isMinimizeOnExit = true,
_isAccessControl = false,
_autoCheckUpdate = true,
_accessControl = AccessControl(),
_isAnimateToPage = true;
@@ -108,17 +128,18 @@ class Config extends ChangeNotifier {
}
String? _getLabel(String? label, String id) {
final realLabel = label ?? id;
final hasDup = _profiles.indexWhere(
(element) => element.label == label && element.id != id) !=
(element) => element.label == realLabel && element.id != id) !=
-1;
if (hasDup) {
return _getLabel(other.getOverwriteLabel(label!), id);
return _getLabel(other.getOverwriteLabel(realLabel), id);
} else {
return label;
}
}
setProfile(Profile profile) {
_setProfile(Profile profile) {
final List<Profile> profilesTemp = List.from(_profiles);
final index =
profilesTemp.indexWhere((element) => element.id == profile.id);
@@ -131,6 +152,10 @@ class Config extends ChangeNotifier {
profilesTemp[index] = updateProfile;
}
_profiles = profilesTemp;
}
setProfile(Profile profile) {
_setProfile(profile);
notifyListeners();
}
@@ -161,7 +186,6 @@ class Config extends ChangeNotifier {
}
}
SelectedMap get currentSelectedMap {
return currentProfile?.selectedMap ?? {};
}
@@ -280,9 +304,18 @@ class Config extends ChangeNotifier {
AccessControl get accessControl => _accessControl;
set accessControl(AccessControl? value) {
set accessControl(AccessControl value) {
if (_accessControl != value) {
_accessControl = value ?? AccessControl();
_accessControl = value;
notifyListeners();
}
}
DAV? get dav => _dav;
set dav(DAV? value) {
if (_dav != value) {
_dav = value;
notifyListeners();
}
}
@@ -312,7 +345,46 @@ class Config extends ChangeNotifier {
}
}
update() {
@JsonKey(defaultValue: true)
bool get autoCheckUpdate {
return _autoCheckUpdate;
}
set autoCheckUpdate(bool value) {
if (_autoCheckUpdate != value) {
_autoCheckUpdate = value;
notifyListeners();
}
}
update([Config? config, RecoveryOption recoveryOptions = RecoveryOption.all]) {
if (config != null) {
_profiles = config._profiles;
for (final profile in config._profiles) {
_setProfile(profile);
}
final onlyProfiles = recoveryOptions == RecoveryOption.onlyProfiles;
if(_currentProfileId == null && onlyProfiles && profiles.isNotEmpty){
_currentProfileId = _profiles.first.id;
}
if(onlyProfiles) return;
_currentProfileId = config._currentProfileId;
_isCompatible = config._isCompatible;
_autoLaunch = config._autoLaunch;
_silentLaunch = config._silentLaunch;
_autoRun = config._autoRun;
_openLog = config._openLog;
_themeMode = config._themeMode;
_locale = config._locale;
_primaryColor = config._primaryColor;
_proxiesSortType = config._proxiesSortType;
_isMinimizeOnExit = config._isMinimizeOnExit;
_isAccessControl = config._isAccessControl;
_accessControl = config._accessControl;
_isAnimateToPage = config._isAnimateToPage;
_autoCheckUpdate = config._autoCheckUpdate;
_dav = config._dav;
}
notifyListeners();
}
@@ -323,4 +395,9 @@ class Config extends ChangeNotifier {
factory Config.fromJson(Map<String, dynamic> json) {
return _$ConfigFromJson(json);
}
@override
String toString() {
return 'Config{_profiles: $_profiles, _isCompatible: $_isCompatible, _currentProfileId: $_currentProfileId, _autoLaunch: $_autoLaunch, _silentLaunch: $_silentLaunch, _autoRun: $_autoRun, _openLog: $_openLog, _themeMode: $_themeMode, _locale: $_locale, _primaryColor: $_primaryColor, _proxiesSortType: $_proxiesSortType, _isMinimizeOnExit: $_isMinimizeOnExit, _isAccessControl: $_isAccessControl, _accessControl: $_accessControl, _isAnimateToPage: $_isAnimateToPage, _dav: $_dav}';
}
}

17
lib/models/dav.dart Normal file
View File

@@ -0,0 +1,17 @@
import 'package:freezed_annotation/freezed_annotation.dart';
part 'generated/dav.g.dart';
part 'generated/dav.freezed.dart';
@freezed
class DAV with _$DAV{
const factory DAV({
required String uri,
required String user,
required String password,
}) = _DAV;
factory DAV.fromJson(Map<String, Object?> json) =>
_$DAVFromJson(json);
}

View File

@@ -55,8 +55,12 @@ Config _$ConfigFromJson(Map<String, dynamic> json) => Config()
..isAccessControl = json['isAccessControl'] as bool? ?? false
..accessControl =
AccessControl.fromJson(json['accessControl'] as Map<String, dynamic>)
..dav = json['dav'] == null
? null
: DAV.fromJson(json['dav'] as Map<String, dynamic>)
..isAnimateToPage = json['isAnimateToPage'] as bool? ?? true
..isCompatible = json['isCompatible'] as bool? ?? false;
..isCompatible = json['isCompatible'] as bool? ?? false
..autoCheckUpdate = json['autoCheckUpdate'] as bool? ?? true;
Map<String, dynamic> _$ConfigToJson(Config instance) => <String, dynamic>{
'profiles': instance.profiles,
@@ -72,8 +76,10 @@ Map<String, dynamic> _$ConfigToJson(Config instance) => <String, dynamic>{
'isMinimizeOnExit': instance.isMinimizeOnExit,
'isAccessControl': instance.isAccessControl,
'accessControl': instance.accessControl,
'dav': instance.dav,
'isAnimateToPage': instance.isAnimateToPage,
'isCompatible': instance.isCompatible,
'autoCheckUpdate': instance.autoCheckUpdate,
};
const _$ThemeModeEnumMap = {

View File

@@ -0,0 +1,180 @@
// coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: type=lint
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
part of '../dav.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
DAV _$DAVFromJson(Map<String, dynamic> json) {
return _DAV.fromJson(json);
}
/// @nodoc
mixin _$DAV {
String get uri => throw _privateConstructorUsedError;
String get user => throw _privateConstructorUsedError;
String get password => throw _privateConstructorUsedError;
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
@JsonKey(ignore: true)
$DAVCopyWith<DAV> get copyWith => throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $DAVCopyWith<$Res> {
factory $DAVCopyWith(DAV value, $Res Function(DAV) then) =
_$DAVCopyWithImpl<$Res, DAV>;
@useResult
$Res call({String uri, String user, String password});
}
/// @nodoc
class _$DAVCopyWithImpl<$Res, $Val extends DAV> implements $DAVCopyWith<$Res> {
_$DAVCopyWithImpl(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? uri = null,
Object? user = null,
Object? password = null,
}) {
return _then(_value.copyWith(
uri: null == uri
? _value.uri
: uri // ignore: cast_nullable_to_non_nullable
as String,
user: null == user
? _value.user
: user // ignore: cast_nullable_to_non_nullable
as String,
password: null == password
? _value.password
: password // ignore: cast_nullable_to_non_nullable
as String,
) as $Val);
}
}
/// @nodoc
abstract class _$$DAVImplCopyWith<$Res> implements $DAVCopyWith<$Res> {
factory _$$DAVImplCopyWith(_$DAVImpl value, $Res Function(_$DAVImpl) then) =
__$$DAVImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({String uri, String user, String password});
}
/// @nodoc
class __$$DAVImplCopyWithImpl<$Res> extends _$DAVCopyWithImpl<$Res, _$DAVImpl>
implements _$$DAVImplCopyWith<$Res> {
__$$DAVImplCopyWithImpl(_$DAVImpl _value, $Res Function(_$DAVImpl) _then)
: super(_value, _then);
@pragma('vm:prefer-inline')
@override
$Res call({
Object? uri = null,
Object? user = null,
Object? password = null,
}) {
return _then(_$DAVImpl(
uri: null == uri
? _value.uri
: uri // ignore: cast_nullable_to_non_nullable
as String,
user: null == user
? _value.user
: user // ignore: cast_nullable_to_non_nullable
as String,
password: null == password
? _value.password
: password // ignore: cast_nullable_to_non_nullable
as String,
));
}
}
/// @nodoc
@JsonSerializable()
class _$DAVImpl implements _DAV {
const _$DAVImpl(
{required this.uri, required this.user, required this.password});
factory _$DAVImpl.fromJson(Map<String, dynamic> json) =>
_$$DAVImplFromJson(json);
@override
final String uri;
@override
final String user;
@override
final String password;
@override
String toString() {
return 'DAV(uri: $uri, user: $user, password: $password)';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$DAVImpl &&
(identical(other.uri, uri) || other.uri == uri) &&
(identical(other.user, user) || other.user == user) &&
(identical(other.password, password) ||
other.password == password));
}
@JsonKey(ignore: true)
@override
int get hashCode => Object.hash(runtimeType, uri, user, password);
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$DAVImplCopyWith<_$DAVImpl> get copyWith =>
__$$DAVImplCopyWithImpl<_$DAVImpl>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$$DAVImplToJson(
this,
);
}
}
abstract class _DAV implements DAV {
const factory _DAV(
{required final String uri,
required final String user,
required final String password}) = _$DAVImpl;
factory _DAV.fromJson(Map<String, dynamic> json) = _$DAVImpl.fromJson;
@override
String get uri;
@override
String get user;
@override
String get password;
@override
@JsonKey(ignore: true)
_$$DAVImplCopyWith<_$DAVImpl> get copyWith =>
throw _privateConstructorUsedError;
}

View File

@@ -0,0 +1,19 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of '../dav.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
_$DAVImpl _$$DAVImplFromJson(Map<String, dynamic> json) => _$DAVImpl(
uri: json['uri'] as String,
user: json['user'] as String,
password: json['password'] as String,
);
Map<String, dynamic> _$$DAVImplToJson(_$DAVImpl instance) => <String, dynamic>{
'uri': instance.uri,
'user': instance.user,
'password': instance.password,
};

View File

@@ -497,6 +497,7 @@ abstract class _NetworkDetectionSelectorState
mixin _$ProfilesSelectorState {
List<Profile> get profiles => throw _privateConstructorUsedError;
String? get currentProfileId => throw _privateConstructorUsedError;
ViewMode get viewMode => throw _privateConstructorUsedError;
@JsonKey(ignore: true)
$ProfilesSelectorStateCopyWith<ProfilesSelectorState> get copyWith =>
@@ -509,7 +510,8 @@ abstract class $ProfilesSelectorStateCopyWith<$Res> {
$Res Function(ProfilesSelectorState) then) =
_$ProfilesSelectorStateCopyWithImpl<$Res, ProfilesSelectorState>;
@useResult
$Res call({List<Profile> profiles, String? currentProfileId});
$Res call(
{List<Profile> profiles, String? currentProfileId, ViewMode viewMode});
}
/// @nodoc
@@ -528,6 +530,7 @@ class _$ProfilesSelectorStateCopyWithImpl<$Res,
$Res call({
Object? profiles = null,
Object? currentProfileId = freezed,
Object? viewMode = null,
}) {
return _then(_value.copyWith(
profiles: null == profiles
@@ -538,6 +541,10 @@ class _$ProfilesSelectorStateCopyWithImpl<$Res,
? _value.currentProfileId
: currentProfileId // ignore: cast_nullable_to_non_nullable
as String?,
viewMode: null == viewMode
? _value.viewMode
: viewMode // ignore: cast_nullable_to_non_nullable
as ViewMode,
) as $Val);
}
}
@@ -551,7 +558,8 @@ abstract class _$$ProfilesSelectorStateImplCopyWith<$Res>
__$$ProfilesSelectorStateImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({List<Profile> profiles, String? currentProfileId});
$Res call(
{List<Profile> profiles, String? currentProfileId, ViewMode viewMode});
}
/// @nodoc
@@ -568,6 +576,7 @@ class __$$ProfilesSelectorStateImplCopyWithImpl<$Res>
$Res call({
Object? profiles = null,
Object? currentProfileId = freezed,
Object? viewMode = null,
}) {
return _then(_$ProfilesSelectorStateImpl(
profiles: null == profiles
@@ -578,6 +587,10 @@ class __$$ProfilesSelectorStateImplCopyWithImpl<$Res>
? _value.currentProfileId
: currentProfileId // ignore: cast_nullable_to_non_nullable
as String?,
viewMode: null == viewMode
? _value.viewMode
: viewMode // ignore: cast_nullable_to_non_nullable
as ViewMode,
));
}
}
@@ -586,7 +599,9 @@ class __$$ProfilesSelectorStateImplCopyWithImpl<$Res>
class _$ProfilesSelectorStateImpl implements _ProfilesSelectorState {
const _$ProfilesSelectorStateImpl(
{required final List<Profile> profiles, required this.currentProfileId})
{required final List<Profile> profiles,
required this.currentProfileId,
required this.viewMode})
: _profiles = profiles;
final List<Profile> _profiles;
@@ -599,10 +614,12 @@ class _$ProfilesSelectorStateImpl implements _ProfilesSelectorState {
@override
final String? currentProfileId;
@override
final ViewMode viewMode;
@override
String toString() {
return 'ProfilesSelectorState(profiles: $profiles, currentProfileId: $currentProfileId)';
return 'ProfilesSelectorState(profiles: $profiles, currentProfileId: $currentProfileId, viewMode: $viewMode)';
}
@override
@@ -612,12 +629,17 @@ class _$ProfilesSelectorStateImpl implements _ProfilesSelectorState {
other is _$ProfilesSelectorStateImpl &&
const DeepCollectionEquality().equals(other._profiles, _profiles) &&
(identical(other.currentProfileId, currentProfileId) ||
other.currentProfileId == currentProfileId));
other.currentProfileId == currentProfileId) &&
(identical(other.viewMode, viewMode) ||
other.viewMode == viewMode));
}
@override
int get hashCode => Object.hash(runtimeType,
const DeepCollectionEquality().hash(_profiles), currentProfileId);
int get hashCode => Object.hash(
runtimeType,
const DeepCollectionEquality().hash(_profiles),
currentProfileId,
viewMode);
@JsonKey(ignore: true)
@override
@@ -630,13 +652,16 @@ class _$ProfilesSelectorStateImpl implements _ProfilesSelectorState {
abstract class _ProfilesSelectorState implements ProfilesSelectorState {
const factory _ProfilesSelectorState(
{required final List<Profile> profiles,
required final String? currentProfileId}) = _$ProfilesSelectorStateImpl;
required final String? currentProfileId,
required final ViewMode viewMode}) = _$ProfilesSelectorStateImpl;
@override
List<Profile> get profiles;
@override
String? get currentProfileId;
@override
ViewMode get viewMode;
@override
@JsonKey(ignore: true)
_$$ProfilesSelectorStateImplCopyWith<_$ProfilesSelectorStateImpl>
get copyWith => throw _privateConstructorUsedError;
@@ -951,159 +976,6 @@ abstract class _ApplicationSelectorState implements ApplicationSelectorState {
get copyWith => throw _privateConstructorUsedError;
}
/// @nodoc
mixin _$HomeLayoutSelectorState {
List<NavigationItem> get navigationItems =>
throw _privateConstructorUsedError;
int get currentIndex => throw _privateConstructorUsedError;
@JsonKey(ignore: true)
$HomeLayoutSelectorStateCopyWith<HomeLayoutSelectorState> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $HomeLayoutSelectorStateCopyWith<$Res> {
factory $HomeLayoutSelectorStateCopyWith(HomeLayoutSelectorState value,
$Res Function(HomeLayoutSelectorState) then) =
_$HomeLayoutSelectorStateCopyWithImpl<$Res, HomeLayoutSelectorState>;
@useResult
$Res call({List<NavigationItem> navigationItems, int currentIndex});
}
/// @nodoc
class _$HomeLayoutSelectorStateCopyWithImpl<$Res,
$Val extends HomeLayoutSelectorState>
implements $HomeLayoutSelectorStateCopyWith<$Res> {
_$HomeLayoutSelectorStateCopyWithImpl(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? navigationItems = null,
Object? currentIndex = null,
}) {
return _then(_value.copyWith(
navigationItems: null == navigationItems
? _value.navigationItems
: navigationItems // ignore: cast_nullable_to_non_nullable
as List<NavigationItem>,
currentIndex: null == currentIndex
? _value.currentIndex
: currentIndex // ignore: cast_nullable_to_non_nullable
as int,
) as $Val);
}
}
/// @nodoc
abstract class _$$HomeLayoutSelectorStateImplCopyWith<$Res>
implements $HomeLayoutSelectorStateCopyWith<$Res> {
factory _$$HomeLayoutSelectorStateImplCopyWith(
_$HomeLayoutSelectorStateImpl value,
$Res Function(_$HomeLayoutSelectorStateImpl) then) =
__$$HomeLayoutSelectorStateImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({List<NavigationItem> navigationItems, int currentIndex});
}
/// @nodoc
class __$$HomeLayoutSelectorStateImplCopyWithImpl<$Res>
extends _$HomeLayoutSelectorStateCopyWithImpl<$Res,
_$HomeLayoutSelectorStateImpl>
implements _$$HomeLayoutSelectorStateImplCopyWith<$Res> {
__$$HomeLayoutSelectorStateImplCopyWithImpl(
_$HomeLayoutSelectorStateImpl _value,
$Res Function(_$HomeLayoutSelectorStateImpl) _then)
: super(_value, _then);
@pragma('vm:prefer-inline')
@override
$Res call({
Object? navigationItems = null,
Object? currentIndex = null,
}) {
return _then(_$HomeLayoutSelectorStateImpl(
navigationItems: null == navigationItems
? _value._navigationItems
: navigationItems // ignore: cast_nullable_to_non_nullable
as List<NavigationItem>,
currentIndex: null == currentIndex
? _value.currentIndex
: currentIndex // ignore: cast_nullable_to_non_nullable
as int,
));
}
}
/// @nodoc
class _$HomeLayoutSelectorStateImpl implements _HomeLayoutSelectorState {
const _$HomeLayoutSelectorStateImpl(
{required final List<NavigationItem> navigationItems,
required this.currentIndex})
: _navigationItems = navigationItems;
final List<NavigationItem> _navigationItems;
@override
List<NavigationItem> get navigationItems {
if (_navigationItems is EqualUnmodifiableListView) return _navigationItems;
// ignore: implicit_dynamic_type
return EqualUnmodifiableListView(_navigationItems);
}
@override
final int currentIndex;
@override
String toString() {
return 'HomeLayoutSelectorState(navigationItems: $navigationItems, currentIndex: $currentIndex)';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$HomeLayoutSelectorStateImpl &&
const DeepCollectionEquality()
.equals(other._navigationItems, _navigationItems) &&
(identical(other.currentIndex, currentIndex) ||
other.currentIndex == currentIndex));
}
@override
int get hashCode => Object.hash(runtimeType,
const DeepCollectionEquality().hash(_navigationItems), currentIndex);
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$HomeLayoutSelectorStateImplCopyWith<_$HomeLayoutSelectorStateImpl>
get copyWith => __$$HomeLayoutSelectorStateImplCopyWithImpl<
_$HomeLayoutSelectorStateImpl>(this, _$identity);
}
abstract class _HomeLayoutSelectorState implements HomeLayoutSelectorState {
const factory _HomeLayoutSelectorState(
{required final List<NavigationItem> navigationItems,
required final int currentIndex}) = _$HomeLayoutSelectorStateImpl;
@override
List<NavigationItem> get navigationItems;
@override
int get currentIndex;
@override
@JsonKey(ignore: true)
_$$HomeLayoutSelectorStateImplCopyWith<_$HomeLayoutSelectorStateImpl>
get copyWith => throw _privateConstructorUsedError;
}
/// @nodoc
mixin _$TrayContainerSelectorState {
Mode get mode => throw _privateConstructorUsedError;
@@ -1429,31 +1301,35 @@ abstract class _UpdateNavigationsSelector implements UpdateNavigationsSelector {
}
/// @nodoc
mixin _$HomeCommonScaffoldSelectorState {
mixin _$HomeSelectorState {
String get currentLabel => throw _privateConstructorUsedError;
List<NavigationItem> get navigationItems =>
throw _privateConstructorUsedError;
ViewMode get viewMode => throw _privateConstructorUsedError;
String? get locale => throw _privateConstructorUsedError;
@JsonKey(ignore: true)
$HomeCommonScaffoldSelectorStateCopyWith<HomeCommonScaffoldSelectorState>
get copyWith => throw _privateConstructorUsedError;
$HomeSelectorStateCopyWith<HomeSelectorState> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $HomeCommonScaffoldSelectorStateCopyWith<$Res> {
factory $HomeCommonScaffoldSelectorStateCopyWith(
HomeCommonScaffoldSelectorState value,
$Res Function(HomeCommonScaffoldSelectorState) then) =
_$HomeCommonScaffoldSelectorStateCopyWithImpl<$Res,
HomeCommonScaffoldSelectorState>;
abstract class $HomeSelectorStateCopyWith<$Res> {
factory $HomeSelectorStateCopyWith(
HomeSelectorState value, $Res Function(HomeSelectorState) then) =
_$HomeSelectorStateCopyWithImpl<$Res, HomeSelectorState>;
@useResult
$Res call({String currentLabel, String? locale});
$Res call(
{String currentLabel,
List<NavigationItem> navigationItems,
ViewMode viewMode,
String? locale});
}
/// @nodoc
class _$HomeCommonScaffoldSelectorStateCopyWithImpl<$Res,
$Val extends HomeCommonScaffoldSelectorState>
implements $HomeCommonScaffoldSelectorStateCopyWith<$Res> {
_$HomeCommonScaffoldSelectorStateCopyWithImpl(this._value, this._then);
class _$HomeSelectorStateCopyWithImpl<$Res, $Val extends HomeSelectorState>
implements $HomeSelectorStateCopyWith<$Res> {
_$HomeSelectorStateCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
@@ -1464,6 +1340,8 @@ class _$HomeCommonScaffoldSelectorStateCopyWithImpl<$Res,
@override
$Res call({
Object? currentLabel = null,
Object? navigationItems = null,
Object? viewMode = null,
Object? locale = freezed,
}) {
return _then(_value.copyWith(
@@ -1471,6 +1349,14 @@ class _$HomeCommonScaffoldSelectorStateCopyWithImpl<$Res,
? _value.currentLabel
: currentLabel // ignore: cast_nullable_to_non_nullable
as String,
navigationItems: null == navigationItems
? _value.navigationItems
: navigationItems // ignore: cast_nullable_to_non_nullable
as List<NavigationItem>,
viewMode: null == viewMode
? _value.viewMode
: viewMode // ignore: cast_nullable_to_non_nullable
as ViewMode,
locale: freezed == locale
? _value.locale
: locale // ignore: cast_nullable_to_non_nullable
@@ -1480,38 +1366,49 @@ class _$HomeCommonScaffoldSelectorStateCopyWithImpl<$Res,
}
/// @nodoc
abstract class _$$HomeCommonScaffoldSelectorStateImplCopyWith<$Res>
implements $HomeCommonScaffoldSelectorStateCopyWith<$Res> {
factory _$$HomeCommonScaffoldSelectorStateImplCopyWith(
_$HomeCommonScaffoldSelectorStateImpl value,
$Res Function(_$HomeCommonScaffoldSelectorStateImpl) then) =
__$$HomeCommonScaffoldSelectorStateImplCopyWithImpl<$Res>;
abstract class _$$HomeSelectorStateImplCopyWith<$Res>
implements $HomeSelectorStateCopyWith<$Res> {
factory _$$HomeSelectorStateImplCopyWith(_$HomeSelectorStateImpl value,
$Res Function(_$HomeSelectorStateImpl) then) =
__$$HomeSelectorStateImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({String currentLabel, String? locale});
$Res call(
{String currentLabel,
List<NavigationItem> navigationItems,
ViewMode viewMode,
String? locale});
}
/// @nodoc
class __$$HomeCommonScaffoldSelectorStateImplCopyWithImpl<$Res>
extends _$HomeCommonScaffoldSelectorStateCopyWithImpl<$Res,
_$HomeCommonScaffoldSelectorStateImpl>
implements _$$HomeCommonScaffoldSelectorStateImplCopyWith<$Res> {
__$$HomeCommonScaffoldSelectorStateImplCopyWithImpl(
_$HomeCommonScaffoldSelectorStateImpl _value,
$Res Function(_$HomeCommonScaffoldSelectorStateImpl) _then)
class __$$HomeSelectorStateImplCopyWithImpl<$Res>
extends _$HomeSelectorStateCopyWithImpl<$Res, _$HomeSelectorStateImpl>
implements _$$HomeSelectorStateImplCopyWith<$Res> {
__$$HomeSelectorStateImplCopyWithImpl(_$HomeSelectorStateImpl _value,
$Res Function(_$HomeSelectorStateImpl) _then)
: super(_value, _then);
@pragma('vm:prefer-inline')
@override
$Res call({
Object? currentLabel = null,
Object? navigationItems = null,
Object? viewMode = null,
Object? locale = freezed,
}) {
return _then(_$HomeCommonScaffoldSelectorStateImpl(
return _then(_$HomeSelectorStateImpl(
currentLabel: null == currentLabel
? _value.currentLabel
: currentLabel // ignore: cast_nullable_to_non_nullable
as String,
navigationItems: null == navigationItems
? _value._navigationItems
: navigationItems // ignore: cast_nullable_to_non_nullable
as List<NavigationItem>,
viewMode: null == viewMode
? _value.viewMode
: viewMode // ignore: cast_nullable_to_non_nullable
as ViewMode,
locale: freezed == locale
? _value.locale
: locale // ignore: cast_nullable_to_non_nullable
@@ -1522,86 +1419,105 @@ class __$$HomeCommonScaffoldSelectorStateImplCopyWithImpl<$Res>
/// @nodoc
class _$HomeCommonScaffoldSelectorStateImpl
implements _HomeCommonScaffoldSelectorState {
const _$HomeCommonScaffoldSelectorStateImpl(
{required this.currentLabel, required this.locale});
class _$HomeSelectorStateImpl implements _HomeSelectorState {
const _$HomeSelectorStateImpl(
{required this.currentLabel,
required final List<NavigationItem> navigationItems,
required this.viewMode,
required this.locale})
: _navigationItems = navigationItems;
@override
final String currentLabel;
final List<NavigationItem> _navigationItems;
@override
List<NavigationItem> get navigationItems {
if (_navigationItems is EqualUnmodifiableListView) return _navigationItems;
// ignore: implicit_dynamic_type
return EqualUnmodifiableListView(_navigationItems);
}
@override
final ViewMode viewMode;
@override
final String? locale;
@override
String toString() {
return 'HomeCommonScaffoldSelectorState(currentLabel: $currentLabel, locale: $locale)';
return 'HomeSelectorState(currentLabel: $currentLabel, navigationItems: $navigationItems, viewMode: $viewMode, locale: $locale)';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$HomeCommonScaffoldSelectorStateImpl &&
other is _$HomeSelectorStateImpl &&
(identical(other.currentLabel, currentLabel) ||
other.currentLabel == currentLabel) &&
const DeepCollectionEquality()
.equals(other._navigationItems, _navigationItems) &&
(identical(other.viewMode, viewMode) ||
other.viewMode == viewMode) &&
(identical(other.locale, locale) || other.locale == locale));
}
@override
int get hashCode => Object.hash(runtimeType, currentLabel, locale);
int get hashCode => Object.hash(runtimeType, currentLabel,
const DeepCollectionEquality().hash(_navigationItems), viewMode, locale);
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$HomeCommonScaffoldSelectorStateImplCopyWith<
_$HomeCommonScaffoldSelectorStateImpl>
get copyWith => __$$HomeCommonScaffoldSelectorStateImplCopyWithImpl<
_$HomeCommonScaffoldSelectorStateImpl>(this, _$identity);
_$$HomeSelectorStateImplCopyWith<_$HomeSelectorStateImpl> get copyWith =>
__$$HomeSelectorStateImplCopyWithImpl<_$HomeSelectorStateImpl>(
this, _$identity);
}
abstract class _HomeCommonScaffoldSelectorState
implements HomeCommonScaffoldSelectorState {
const factory _HomeCommonScaffoldSelectorState(
abstract class _HomeSelectorState implements HomeSelectorState {
const factory _HomeSelectorState(
{required final String currentLabel,
required final String? locale}) = _$HomeCommonScaffoldSelectorStateImpl;
required final List<NavigationItem> navigationItems,
required final ViewMode viewMode,
required final String? locale}) = _$HomeSelectorStateImpl;
@override
String get currentLabel;
@override
List<NavigationItem> get navigationItems;
@override
ViewMode get viewMode;
@override
String? get locale;
@override
@JsonKey(ignore: true)
_$$HomeCommonScaffoldSelectorStateImplCopyWith<
_$HomeCommonScaffoldSelectorStateImpl>
get copyWith => throw _privateConstructorUsedError;
_$$HomeSelectorStateImplCopyWith<_$HomeSelectorStateImpl> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
mixin _$HomeNavigationSelectorState {
int get currentIndex => throw _privateConstructorUsedError;
String? get locale => throw _privateConstructorUsedError;
mixin _$HomeBodySelectorState {
List<NavigationItem> get navigationItems =>
throw _privateConstructorUsedError;
@JsonKey(ignore: true)
$HomeNavigationSelectorStateCopyWith<HomeNavigationSelectorState>
get copyWith => throw _privateConstructorUsedError;
$HomeBodySelectorStateCopyWith<HomeBodySelectorState> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $HomeNavigationSelectorStateCopyWith<$Res> {
factory $HomeNavigationSelectorStateCopyWith(
HomeNavigationSelectorState value,
$Res Function(HomeNavigationSelectorState) then) =
_$HomeNavigationSelectorStateCopyWithImpl<$Res,
HomeNavigationSelectorState>;
abstract class $HomeBodySelectorStateCopyWith<$Res> {
factory $HomeBodySelectorStateCopyWith(HomeBodySelectorState value,
$Res Function(HomeBodySelectorState) then) =
_$HomeBodySelectorStateCopyWithImpl<$Res, HomeBodySelectorState>;
@useResult
$Res call({int currentIndex, String? locale});
$Res call({List<NavigationItem> navigationItems});
}
/// @nodoc
class _$HomeNavigationSelectorStateCopyWithImpl<$Res,
$Val extends HomeNavigationSelectorState>
implements $HomeNavigationSelectorStateCopyWith<$Res> {
_$HomeNavigationSelectorStateCopyWithImpl(this._value, this._then);
class _$HomeBodySelectorStateCopyWithImpl<$Res,
$Val extends HomeBodySelectorState>
implements $HomeBodySelectorStateCopyWith<$Res> {
_$HomeBodySelectorStateCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
@@ -1611,114 +1527,103 @@ class _$HomeNavigationSelectorStateCopyWithImpl<$Res,
@pragma('vm:prefer-inline')
@override
$Res call({
Object? currentIndex = null,
Object? locale = freezed,
Object? navigationItems = null,
}) {
return _then(_value.copyWith(
currentIndex: null == currentIndex
? _value.currentIndex
: currentIndex // ignore: cast_nullable_to_non_nullable
as int,
locale: freezed == locale
? _value.locale
: locale // ignore: cast_nullable_to_non_nullable
as String?,
navigationItems: null == navigationItems
? _value.navigationItems
: navigationItems // ignore: cast_nullable_to_non_nullable
as List<NavigationItem>,
) as $Val);
}
}
/// @nodoc
abstract class _$$HomeNavigationSelectorStateImplCopyWith<$Res>
implements $HomeNavigationSelectorStateCopyWith<$Res> {
factory _$$HomeNavigationSelectorStateImplCopyWith(
_$HomeNavigationSelectorStateImpl value,
$Res Function(_$HomeNavigationSelectorStateImpl) then) =
__$$HomeNavigationSelectorStateImplCopyWithImpl<$Res>;
abstract class _$$HomeBodySelectorStateImplCopyWith<$Res>
implements $HomeBodySelectorStateCopyWith<$Res> {
factory _$$HomeBodySelectorStateImplCopyWith(
_$HomeBodySelectorStateImpl value,
$Res Function(_$HomeBodySelectorStateImpl) then) =
__$$HomeBodySelectorStateImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({int currentIndex, String? locale});
$Res call({List<NavigationItem> navigationItems});
}
/// @nodoc
class __$$HomeNavigationSelectorStateImplCopyWithImpl<$Res>
extends _$HomeNavigationSelectorStateCopyWithImpl<$Res,
_$HomeNavigationSelectorStateImpl>
implements _$$HomeNavigationSelectorStateImplCopyWith<$Res> {
__$$HomeNavigationSelectorStateImplCopyWithImpl(
_$HomeNavigationSelectorStateImpl _value,
$Res Function(_$HomeNavigationSelectorStateImpl) _then)
class __$$HomeBodySelectorStateImplCopyWithImpl<$Res>
extends _$HomeBodySelectorStateCopyWithImpl<$Res,
_$HomeBodySelectorStateImpl>
implements _$$HomeBodySelectorStateImplCopyWith<$Res> {
__$$HomeBodySelectorStateImplCopyWithImpl(_$HomeBodySelectorStateImpl _value,
$Res Function(_$HomeBodySelectorStateImpl) _then)
: super(_value, _then);
@pragma('vm:prefer-inline')
@override
$Res call({
Object? currentIndex = null,
Object? locale = freezed,
Object? navigationItems = null,
}) {
return _then(_$HomeNavigationSelectorStateImpl(
currentIndex: null == currentIndex
? _value.currentIndex
: currentIndex // ignore: cast_nullable_to_non_nullable
as int,
locale: freezed == locale
? _value.locale
: locale // ignore: cast_nullable_to_non_nullable
as String?,
return _then(_$HomeBodySelectorStateImpl(
navigationItems: null == navigationItems
? _value._navigationItems
: navigationItems // ignore: cast_nullable_to_non_nullable
as List<NavigationItem>,
));
}
}
/// @nodoc
class _$HomeNavigationSelectorStateImpl
implements _HomeNavigationSelectorState {
const _$HomeNavigationSelectorStateImpl(
{required this.currentIndex, required this.locale});
class _$HomeBodySelectorStateImpl implements _HomeBodySelectorState {
const _$HomeBodySelectorStateImpl(
{required final List<NavigationItem> navigationItems})
: _navigationItems = navigationItems;
final List<NavigationItem> _navigationItems;
@override
final int currentIndex;
@override
final String? locale;
List<NavigationItem> get navigationItems {
if (_navigationItems is EqualUnmodifiableListView) return _navigationItems;
// ignore: implicit_dynamic_type
return EqualUnmodifiableListView(_navigationItems);
}
@override
String toString() {
return 'HomeNavigationSelectorState(currentIndex: $currentIndex, locale: $locale)';
return 'HomeBodySelectorState(navigationItems: $navigationItems)';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$HomeNavigationSelectorStateImpl &&
(identical(other.currentIndex, currentIndex) ||
other.currentIndex == currentIndex) &&
(identical(other.locale, locale) || other.locale == locale));
other is _$HomeBodySelectorStateImpl &&
const DeepCollectionEquality()
.equals(other._navigationItems, _navigationItems));
}
@override
int get hashCode => Object.hash(runtimeType, currentIndex, locale);
int get hashCode => Object.hash(
runtimeType, const DeepCollectionEquality().hash(_navigationItems));
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$HomeNavigationSelectorStateImplCopyWith<_$HomeNavigationSelectorStateImpl>
get copyWith => __$$HomeNavigationSelectorStateImplCopyWithImpl<
_$HomeNavigationSelectorStateImpl>(this, _$identity);
_$$HomeBodySelectorStateImplCopyWith<_$HomeBodySelectorStateImpl>
get copyWith => __$$HomeBodySelectorStateImplCopyWithImpl<
_$HomeBodySelectorStateImpl>(this, _$identity);
}
abstract class _HomeNavigationSelectorState
implements HomeNavigationSelectorState {
const factory _HomeNavigationSelectorState(
{required final int currentIndex,
required final String? locale}) = _$HomeNavigationSelectorStateImpl;
abstract class _HomeBodySelectorState implements HomeBodySelectorState {
const factory _HomeBodySelectorState(
{required final List<NavigationItem> navigationItems}) =
_$HomeBodySelectorStateImpl;
@override
int get currentIndex;
@override
String? get locale;
List<NavigationItem> get navigationItems;
@override
@JsonKey(ignore: true)
_$$HomeNavigationSelectorStateImplCopyWith<_$HomeNavigationSelectorStateImpl>
_$$HomeBodySelectorStateImplCopyWith<_$HomeBodySelectorStateImpl>
get copyWith => throw _privateConstructorUsedError;
}
@@ -1980,6 +1885,7 @@ mixin _$ProxiesTabViewSelectorState {
ProxiesSortType get proxiesSortType => throw _privateConstructorUsedError;
num get sortNum => throw _privateConstructorUsedError;
Group get group => throw _privateConstructorUsedError;
ViewMode get viewMode => throw _privateConstructorUsedError;
@JsonKey(ignore: true)
$ProxiesTabViewSelectorStateCopyWith<ProxiesTabViewSelectorState>
@@ -1994,7 +1900,11 @@ abstract class $ProxiesTabViewSelectorStateCopyWith<$Res> {
_$ProxiesTabViewSelectorStateCopyWithImpl<$Res,
ProxiesTabViewSelectorState>;
@useResult
$Res call({ProxiesSortType proxiesSortType, num sortNum, Group group});
$Res call(
{ProxiesSortType proxiesSortType,
num sortNum,
Group group,
ViewMode viewMode});
$GroupCopyWith<$Res> get group;
}
@@ -2016,6 +1926,7 @@ class _$ProxiesTabViewSelectorStateCopyWithImpl<$Res,
Object? proxiesSortType = null,
Object? sortNum = null,
Object? group = null,
Object? viewMode = null,
}) {
return _then(_value.copyWith(
proxiesSortType: null == proxiesSortType
@@ -2030,6 +1941,10 @@ class _$ProxiesTabViewSelectorStateCopyWithImpl<$Res,
? _value.group
: group // ignore: cast_nullable_to_non_nullable
as Group,
viewMode: null == viewMode
? _value.viewMode
: viewMode // ignore: cast_nullable_to_non_nullable
as ViewMode,
) as $Val);
}
@@ -2051,7 +1966,11 @@ abstract class _$$ProxiesTabViewSelectorStateImplCopyWith<$Res>
__$$ProxiesTabViewSelectorStateImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({ProxiesSortType proxiesSortType, num sortNum, Group group});
$Res call(
{ProxiesSortType proxiesSortType,
num sortNum,
Group group,
ViewMode viewMode});
@override
$GroupCopyWith<$Res> get group;
@@ -2073,6 +1992,7 @@ class __$$ProxiesTabViewSelectorStateImplCopyWithImpl<$Res>
Object? proxiesSortType = null,
Object? sortNum = null,
Object? group = null,
Object? viewMode = null,
}) {
return _then(_$ProxiesTabViewSelectorStateImpl(
proxiesSortType: null == proxiesSortType
@@ -2087,6 +2007,10 @@ class __$$ProxiesTabViewSelectorStateImplCopyWithImpl<$Res>
? _value.group
: group // ignore: cast_nullable_to_non_nullable
as Group,
viewMode: null == viewMode
? _value.viewMode
: viewMode // ignore: cast_nullable_to_non_nullable
as ViewMode,
));
}
}
@@ -2098,7 +2022,8 @@ class _$ProxiesTabViewSelectorStateImpl
const _$ProxiesTabViewSelectorStateImpl(
{required this.proxiesSortType,
required this.sortNum,
required this.group});
required this.group,
required this.viewMode});
@override
final ProxiesSortType proxiesSortType;
@@ -2106,10 +2031,12 @@ class _$ProxiesTabViewSelectorStateImpl
final num sortNum;
@override
final Group group;
@override
final ViewMode viewMode;
@override
String toString() {
return 'ProxiesTabViewSelectorState(proxiesSortType: $proxiesSortType, sortNum: $sortNum, group: $group)';
return 'ProxiesTabViewSelectorState(proxiesSortType: $proxiesSortType, sortNum: $sortNum, group: $group, viewMode: $viewMode)';
}
@override
@@ -2120,11 +2047,14 @@ class _$ProxiesTabViewSelectorStateImpl
(identical(other.proxiesSortType, proxiesSortType) ||
other.proxiesSortType == proxiesSortType) &&
(identical(other.sortNum, sortNum) || other.sortNum == sortNum) &&
(identical(other.group, group) || other.group == group));
(identical(other.group, group) || other.group == group) &&
(identical(other.viewMode, viewMode) ||
other.viewMode == viewMode));
}
@override
int get hashCode => Object.hash(runtimeType, proxiesSortType, sortNum, group);
int get hashCode =>
Object.hash(runtimeType, proxiesSortType, sortNum, group, viewMode);
@JsonKey(ignore: true)
@override
@@ -2139,7 +2069,8 @@ abstract class _ProxiesTabViewSelectorState
const factory _ProxiesTabViewSelectorState(
{required final ProxiesSortType proxiesSortType,
required final num sortNum,
required final Group group}) = _$ProxiesTabViewSelectorStateImpl;
required final Group group,
required final ViewMode viewMode}) = _$ProxiesTabViewSelectorStateImpl;
@override
ProxiesSortType get proxiesSortType;
@@ -2148,7 +2079,143 @@ abstract class _ProxiesTabViewSelectorState
@override
Group get group;
@override
ViewMode get viewMode;
@override
@JsonKey(ignore: true)
_$$ProxiesTabViewSelectorStateImplCopyWith<_$ProxiesTabViewSelectorStateImpl>
get copyWith => throw _privateConstructorUsedError;
}
/// @nodoc
mixin _$MoreToolsSelectorState {
List<NavigationItem> get navigationItems =>
throw _privateConstructorUsedError;
@JsonKey(ignore: true)
$MoreToolsSelectorStateCopyWith<MoreToolsSelectorState> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $MoreToolsSelectorStateCopyWith<$Res> {
factory $MoreToolsSelectorStateCopyWith(MoreToolsSelectorState value,
$Res Function(MoreToolsSelectorState) then) =
_$MoreToolsSelectorStateCopyWithImpl<$Res, MoreToolsSelectorState>;
@useResult
$Res call({List<NavigationItem> navigationItems});
}
/// @nodoc
class _$MoreToolsSelectorStateCopyWithImpl<$Res,
$Val extends MoreToolsSelectorState>
implements $MoreToolsSelectorStateCopyWith<$Res> {
_$MoreToolsSelectorStateCopyWithImpl(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? navigationItems = null,
}) {
return _then(_value.copyWith(
navigationItems: null == navigationItems
? _value.navigationItems
: navigationItems // ignore: cast_nullable_to_non_nullable
as List<NavigationItem>,
) as $Val);
}
}
/// @nodoc
abstract class _$$MoreToolsSelectorStateImplCopyWith<$Res>
implements $MoreToolsSelectorStateCopyWith<$Res> {
factory _$$MoreToolsSelectorStateImplCopyWith(
_$MoreToolsSelectorStateImpl value,
$Res Function(_$MoreToolsSelectorStateImpl) then) =
__$$MoreToolsSelectorStateImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({List<NavigationItem> navigationItems});
}
/// @nodoc
class __$$MoreToolsSelectorStateImplCopyWithImpl<$Res>
extends _$MoreToolsSelectorStateCopyWithImpl<$Res,
_$MoreToolsSelectorStateImpl>
implements _$$MoreToolsSelectorStateImplCopyWith<$Res> {
__$$MoreToolsSelectorStateImplCopyWithImpl(
_$MoreToolsSelectorStateImpl _value,
$Res Function(_$MoreToolsSelectorStateImpl) _then)
: super(_value, _then);
@pragma('vm:prefer-inline')
@override
$Res call({
Object? navigationItems = null,
}) {
return _then(_$MoreToolsSelectorStateImpl(
navigationItems: null == navigationItems
? _value._navigationItems
: navigationItems // ignore: cast_nullable_to_non_nullable
as List<NavigationItem>,
));
}
}
/// @nodoc
class _$MoreToolsSelectorStateImpl implements _MoreToolsSelectorState {
const _$MoreToolsSelectorStateImpl(
{required final List<NavigationItem> navigationItems})
: _navigationItems = navigationItems;
final List<NavigationItem> _navigationItems;
@override
List<NavigationItem> get navigationItems {
if (_navigationItems is EqualUnmodifiableListView) return _navigationItems;
// ignore: implicit_dynamic_type
return EqualUnmodifiableListView(_navigationItems);
}
@override
String toString() {
return 'MoreToolsSelectorState(navigationItems: $navigationItems)';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$MoreToolsSelectorStateImpl &&
const DeepCollectionEquality()
.equals(other._navigationItems, _navigationItems));
}
@override
int get hashCode => Object.hash(
runtimeType, const DeepCollectionEquality().hash(_navigationItems));
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$MoreToolsSelectorStateImplCopyWith<_$MoreToolsSelectorStateImpl>
get copyWith => __$$MoreToolsSelectorStateImplCopyWithImpl<
_$MoreToolsSelectorStateImpl>(this, _$identity);
}
abstract class _MoreToolsSelectorState implements MoreToolsSelectorState {
const factory _MoreToolsSelectorState(
{required final List<NavigationItem> navigationItems}) =
_$MoreToolsSelectorStateImpl;
@override
List<NavigationItem> get navigationItems;
@override
@JsonKey(ignore: true)
_$$MoreToolsSelectorStateImplCopyWith<_$MoreToolsSelectorStateImpl>
get copyWith => throw _privateConstructorUsedError;
}

View File

@@ -12,4 +12,5 @@ export 'package.dart';
export 'common.dart';
export 'ffi.dart';
export 'selector.dart';
export 'navigation.dart';
export 'navigation.dart';
export 'dav.dart';

View File

@@ -84,42 +84,40 @@ class Profile {
this.autoUpdate = true,
}) : id = id ?? DateTime.now().millisecondsSinceEpoch.toString(),
autoUpdateDuration =
autoUpdateDuration ?? appConstant.defaultUpdateDuration,
autoUpdateDuration ?? defaultUpdateDuration,
selectedMap = selectedMap ?? {};
ProfileType get type => url == null ? ProfileType.file : ProfileType.url;
Future<Result<bool>> checkAndUpdate() async {
final isExists = await check();
if(!isExists){
if(url != null){
return await update();
}
return Result.error();
}
return Result.success();
}
Future<Result<bool>> update() async {
if (url == null) {
return Result.error(
message: appLocalizations.unableToUpdateCurrentProfileDesc,
appLocalizations.unableToUpdateCurrentProfileDesc,
);
}
final responseResult = await Request.getFileResponseForUrl(url!);
final response = responseResult.data;
if (responseResult.type != ResultType.success || response == null) {
return Result.error(message: responseResult.message);
return Result.error(responseResult.message);
}
final disposition = response.headers['content-disposition'];
if (disposition != null && label == null) {
final parseValue = HeaderValue.parse(disposition);
parseValue.parameters.forEach(
(key, value) {
if (key.startsWith("filename")) {
if (key == "filename*") {
label = Uri.decodeComponent((value ?? "").split("'").last);
} else {
label = value ?? id;
}
}
},
);
}
label ??= other.getFileNameForDisposition(disposition) ?? id;
final userinfo = response.headers['subscription-userinfo'];
userInfo = UserInfo.formHString(userinfo);
final saveResult = await saveFile(response.bodyBytes);
if (saveResult.type == ResultType.error) {
return Result.error(message: saveResult.message);
return Result.error(saveResult.message);
}
lastUpdateDate = DateTime.now();
return Result.success();
@@ -133,7 +131,7 @@ class Profile {
Future<Result<void>> saveFile(Uint8List bytes) async {
final isValidate = clashCore.validateConfig(utf8.decode(bytes));
if (!isValidate) {
return Result.error(message: appLocalizations.profileParseErrorDesc);
return Result.error(appLocalizations.profileParseErrorDesc);
}
final path = await appPath.getProfilePath(id);
final file = File(path!);

View File

@@ -40,6 +40,7 @@ class ProfilesSelectorState with _$ProfilesSelectorState {
const factory ProfilesSelectorState({
required List<Profile> profiles,
required String? currentProfileId,
required ViewMode viewMode,
}) = _ProfilesSelectorState;
}
@@ -60,14 +61,6 @@ class ApplicationSelectorState with _$ApplicationSelectorState {
}) = _ApplicationSelectorState;
}
@freezed
class HomeLayoutSelectorState with _$HomeLayoutSelectorState{
const factory HomeLayoutSelectorState({
required List<NavigationItem> navigationItems,
required int currentIndex,
})=_HomeLayoutSelectorState;
}
@freezed
class TrayContainerSelectorState with _$TrayContainerSelectorState{
const factory TrayContainerSelectorState({
@@ -86,20 +79,22 @@ class UpdateNavigationsSelector with _$UpdateNavigationsSelector{
}) = _UpdateNavigationsSelector;
}
@freezed
class HomeCommonScaffoldSelectorState with _$HomeCommonScaffoldSelectorState {
const factory HomeCommonScaffoldSelectorState({
class HomeSelectorState with _$HomeSelectorState {
const factory HomeSelectorState({
required String currentLabel,
required List<NavigationItem> navigationItems,
required ViewMode viewMode,
required String? locale,
}) = _HomeCommonScaffoldSelectorState;
}) = _HomeSelectorState;
}
@freezed
class HomeNavigationSelectorState with _$HomeNavigationSelectorState{
const factory HomeNavigationSelectorState({
required int currentIndex,
required String? locale,
}) = _HomeNavigationSelectorState;
class HomeBodySelectorState with _$HomeBodySelectorState {
const factory HomeBodySelectorState({
required List<NavigationItem> navigationItems,
}) = _HomeBodySelectorState;
}
@freezed
@@ -122,5 +117,13 @@ class ProxiesTabViewSelectorState with _$ProxiesTabViewSelectorState{
required ProxiesSortType proxiesSortType,
required num sortNum,
required Group group,
required ViewMode viewMode,
}) = _ProxiesTabViewSelectorState;
}
@freezed
class MoreToolsSelectorState with _$MoreToolsSelectorState {
const factory MoreToolsSelectorState({
required List<NavigationItem> navigationItems,
}) = _MoreToolsSelectorState;
}

View File

@@ -6,10 +6,10 @@ class SystemColorSchemes {
ColorScheme? lightColorScheme,
ColorScheme? darkColorScheme,
}) : lightColorScheme = lightColorScheme ??
ColorScheme.fromSeed(seedColor: appConstant.defaultPrimaryColor),
ColorScheme.fromSeed(seedColor: defaultPrimaryColor),
darkColorScheme = darkColorScheme ??
ColorScheme.fromSeed(
seedColor: appConstant.defaultPrimaryColor,
seedColor: defaultPrimaryColor,
brightness: Brightness.dark,
);
ColorScheme lightColorScheme;