Remake dashboard
Optimize theme Optimize more details Update flutter version
This commit is contained in:
@@ -306,6 +306,7 @@ class AppFlowingState with ChangeNotifier {
|
||||
List<Log> _logs;
|
||||
List<Traffic> _traffics;
|
||||
Traffic _totalTraffic;
|
||||
String? _localIp;
|
||||
|
||||
AppFlowingState()
|
||||
: _logs = [],
|
||||
@@ -350,7 +351,7 @@ class AppFlowingState with ChangeNotifier {
|
||||
|
||||
addTraffic(Traffic traffic) {
|
||||
_traffics = List.from(_traffics)..add(traffic);
|
||||
const maxLength = 60;
|
||||
const maxLength = 30;
|
||||
_traffics = _traffics.safeSublist(_traffics.length - maxLength);
|
||||
notifyListeners();
|
||||
}
|
||||
@@ -363,4 +364,13 @@ class AppFlowingState with ChangeNotifier {
|
||||
notifyListeners();
|
||||
}
|
||||
}
|
||||
|
||||
String? get localIp => _localIp;
|
||||
|
||||
set localIp(String? value) {
|
||||
if (_localIp != value) {
|
||||
_localIp = value;
|
||||
notifyListeners();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -180,7 +180,7 @@ class Traffic {
|
||||
TrafficValue up;
|
||||
TrafficValue down;
|
||||
|
||||
Traffic({num? up, num? down})
|
||||
Traffic({int? up, int? down})
|
||||
: id = DateTime.now().millisecondsSinceEpoch,
|
||||
up = TrafficValue(value: up),
|
||||
down = TrafficValue(value: down);
|
||||
@@ -225,11 +225,11 @@ class TrafficValueShow {
|
||||
|
||||
@immutable
|
||||
class TrafficValue {
|
||||
final num _value;
|
||||
final int _value;
|
||||
|
||||
const TrafficValue({num? value}) : _value = value ?? 0;
|
||||
const TrafficValue({int? value}) : _value = value ?? 0;
|
||||
|
||||
num get value => _value;
|
||||
int get value => _value;
|
||||
|
||||
String get show => "$showValue $showUnit";
|
||||
|
||||
@@ -343,7 +343,7 @@ class SystemColorSchemes {
|
||||
);
|
||||
}
|
||||
return lightColorScheme != null
|
||||
? ColorScheme.fromSeed(seedColor: darkColorScheme!.primary)
|
||||
? ColorScheme.fromSeed(seedColor: lightColorScheme!.primary)
|
||||
: ColorScheme.fromSeed(seedColor: defaultPrimaryColor);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// ignore_for_file: invalid_annotation_target
|
||||
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:fl_clash/common/common.dart';
|
||||
@@ -8,16 +10,42 @@ import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
import 'models.dart';
|
||||
|
||||
part 'generated/config.freezed.dart';
|
||||
|
||||
part 'generated/config.g.dart';
|
||||
|
||||
final defaultAppSetting = const AppSetting().copyWith(
|
||||
isAnimateToPage: system.isDesktop ? false : true,
|
||||
);
|
||||
|
||||
const List<DashboardWidget> defaultDashboardWidgets = [
|
||||
DashboardWidget.networkSpeed,
|
||||
DashboardWidget.systemProxyButton,
|
||||
DashboardWidget.tunButton,
|
||||
DashboardWidget.outboundMode,
|
||||
DashboardWidget.networkDetection,
|
||||
DashboardWidget.trafficUsage,
|
||||
DashboardWidget.intranetIp,
|
||||
];
|
||||
|
||||
List<DashboardWidget> dashboardWidgetsRealFormJson(
|
||||
List<dynamic>? dashboardWidgets) {
|
||||
try {
|
||||
return dashboardWidgets
|
||||
?.map((e) => $enumDecode(_$DashboardWidgetEnumMap, e))
|
||||
.toList() ??
|
||||
defaultDashboardWidgets;
|
||||
} catch (_) {
|
||||
return defaultDashboardWidgets;
|
||||
}
|
||||
}
|
||||
|
||||
@freezed
|
||||
class AppSetting with _$AppSetting {
|
||||
const factory AppSetting({
|
||||
String? locale,
|
||||
@JsonKey(fromJson: dashboardWidgetsRealFormJson)
|
||||
@Default(defaultDashboardWidgets)
|
||||
List<DashboardWidget> dashboardWidgets,
|
||||
@Default(false) bool onlyProxy,
|
||||
@Default(false) bool autoLaunch,
|
||||
@Default(false) bool silentLaunch,
|
||||
|
||||
@@ -21,6 +21,9 @@ AppSetting _$AppSettingFromJson(Map<String, dynamic> json) {
|
||||
/// @nodoc
|
||||
mixin _$AppSetting {
|
||||
String? get locale => throw _privateConstructorUsedError;
|
||||
@JsonKey(fromJson: dashboardWidgetsRealFormJson)
|
||||
List<DashboardWidget> get dashboardWidgets =>
|
||||
throw _privateConstructorUsedError;
|
||||
bool get onlyProxy => throw _privateConstructorUsedError;
|
||||
bool get autoLaunch => throw _privateConstructorUsedError;
|
||||
bool get silentLaunch => throw _privateConstructorUsedError;
|
||||
@@ -53,6 +56,8 @@ abstract class $AppSettingCopyWith<$Res> {
|
||||
@useResult
|
||||
$Res call(
|
||||
{String? locale,
|
||||
@JsonKey(fromJson: dashboardWidgetsRealFormJson)
|
||||
List<DashboardWidget> dashboardWidgets,
|
||||
bool onlyProxy,
|
||||
bool autoLaunch,
|
||||
bool silentLaunch,
|
||||
@@ -84,6 +89,7 @@ class _$AppSettingCopyWithImpl<$Res, $Val extends AppSetting>
|
||||
@override
|
||||
$Res call({
|
||||
Object? locale = freezed,
|
||||
Object? dashboardWidgets = null,
|
||||
Object? onlyProxy = null,
|
||||
Object? autoLaunch = null,
|
||||
Object? silentLaunch = null,
|
||||
@@ -103,6 +109,10 @@ class _$AppSettingCopyWithImpl<$Res, $Val extends AppSetting>
|
||||
? _value.locale
|
||||
: locale // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
dashboardWidgets: null == dashboardWidgets
|
||||
? _value.dashboardWidgets
|
||||
: dashboardWidgets // ignore: cast_nullable_to_non_nullable
|
||||
as List<DashboardWidget>,
|
||||
onlyProxy: null == onlyProxy
|
||||
? _value.onlyProxy
|
||||
: onlyProxy // ignore: cast_nullable_to_non_nullable
|
||||
@@ -169,6 +179,8 @@ abstract class _$$AppSettingImplCopyWith<$Res>
|
||||
@useResult
|
||||
$Res call(
|
||||
{String? locale,
|
||||
@JsonKey(fromJson: dashboardWidgetsRealFormJson)
|
||||
List<DashboardWidget> dashboardWidgets,
|
||||
bool onlyProxy,
|
||||
bool autoLaunch,
|
||||
bool silentLaunch,
|
||||
@@ -198,6 +210,7 @@ class __$$AppSettingImplCopyWithImpl<$Res>
|
||||
@override
|
||||
$Res call({
|
||||
Object? locale = freezed,
|
||||
Object? dashboardWidgets = null,
|
||||
Object? onlyProxy = null,
|
||||
Object? autoLaunch = null,
|
||||
Object? silentLaunch = null,
|
||||
@@ -217,6 +230,10 @@ class __$$AppSettingImplCopyWithImpl<$Res>
|
||||
? _value.locale
|
||||
: locale // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
dashboardWidgets: null == dashboardWidgets
|
||||
? _value._dashboardWidgets
|
||||
: dashboardWidgets // ignore: cast_nullable_to_non_nullable
|
||||
as List<DashboardWidget>,
|
||||
onlyProxy: null == onlyProxy
|
||||
? _value.onlyProxy
|
||||
: onlyProxy // ignore: cast_nullable_to_non_nullable
|
||||
@@ -278,6 +295,8 @@ class __$$AppSettingImplCopyWithImpl<$Res>
|
||||
class _$AppSettingImpl implements _AppSetting {
|
||||
const _$AppSettingImpl(
|
||||
{this.locale,
|
||||
@JsonKey(fromJson: dashboardWidgetsRealFormJson)
|
||||
final List<DashboardWidget> dashboardWidgets = defaultDashboardWidgets,
|
||||
this.onlyProxy = false,
|
||||
this.autoLaunch = false,
|
||||
this.silentLaunch = false,
|
||||
@@ -290,13 +309,24 @@ class _$AppSettingImpl implements _AppSetting {
|
||||
this.showLabel = false,
|
||||
this.disclaimerAccepted = false,
|
||||
this.minimizeOnExit = true,
|
||||
this.hidden = false});
|
||||
this.hidden = false})
|
||||
: _dashboardWidgets = dashboardWidgets;
|
||||
|
||||
factory _$AppSettingImpl.fromJson(Map<String, dynamic> json) =>
|
||||
_$$AppSettingImplFromJson(json);
|
||||
|
||||
@override
|
||||
final String? locale;
|
||||
final List<DashboardWidget> _dashboardWidgets;
|
||||
@override
|
||||
@JsonKey(fromJson: dashboardWidgetsRealFormJson)
|
||||
List<DashboardWidget> get dashboardWidgets {
|
||||
if (_dashboardWidgets is EqualUnmodifiableListView)
|
||||
return _dashboardWidgets;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableListView(_dashboardWidgets);
|
||||
}
|
||||
|
||||
@override
|
||||
@JsonKey()
|
||||
final bool onlyProxy;
|
||||
@@ -339,7 +369,7 @@ class _$AppSettingImpl implements _AppSetting {
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'AppSetting(locale: $locale, onlyProxy: $onlyProxy, autoLaunch: $autoLaunch, silentLaunch: $silentLaunch, autoRun: $autoRun, openLogs: $openLogs, closeConnections: $closeConnections, testUrl: $testUrl, isAnimateToPage: $isAnimateToPage, autoCheckUpdate: $autoCheckUpdate, showLabel: $showLabel, disclaimerAccepted: $disclaimerAccepted, minimizeOnExit: $minimizeOnExit, hidden: $hidden)';
|
||||
return 'AppSetting(locale: $locale, dashboardWidgets: $dashboardWidgets, onlyProxy: $onlyProxy, autoLaunch: $autoLaunch, silentLaunch: $silentLaunch, autoRun: $autoRun, openLogs: $openLogs, closeConnections: $closeConnections, testUrl: $testUrl, isAnimateToPage: $isAnimateToPage, autoCheckUpdate: $autoCheckUpdate, showLabel: $showLabel, disclaimerAccepted: $disclaimerAccepted, minimizeOnExit: $minimizeOnExit, hidden: $hidden)';
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -348,6 +378,8 @@ class _$AppSettingImpl implements _AppSetting {
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$AppSettingImpl &&
|
||||
(identical(other.locale, locale) || other.locale == locale) &&
|
||||
const DeepCollectionEquality()
|
||||
.equals(other._dashboardWidgets, _dashboardWidgets) &&
|
||||
(identical(other.onlyProxy, onlyProxy) ||
|
||||
other.onlyProxy == onlyProxy) &&
|
||||
(identical(other.autoLaunch, autoLaunch) ||
|
||||
@@ -378,6 +410,7 @@ class _$AppSettingImpl implements _AppSetting {
|
||||
int get hashCode => Object.hash(
|
||||
runtimeType,
|
||||
locale,
|
||||
const DeepCollectionEquality().hash(_dashboardWidgets),
|
||||
onlyProxy,
|
||||
autoLaunch,
|
||||
silentLaunch,
|
||||
@@ -411,6 +444,8 @@ class _$AppSettingImpl implements _AppSetting {
|
||||
abstract class _AppSetting implements AppSetting {
|
||||
const factory _AppSetting(
|
||||
{final String? locale,
|
||||
@JsonKey(fromJson: dashboardWidgetsRealFormJson)
|
||||
final List<DashboardWidget> dashboardWidgets,
|
||||
final bool onlyProxy,
|
||||
final bool autoLaunch,
|
||||
final bool silentLaunch,
|
||||
@@ -431,6 +466,9 @@ abstract class _AppSetting implements AppSetting {
|
||||
@override
|
||||
String? get locale;
|
||||
@override
|
||||
@JsonKey(fromJson: dashboardWidgetsRealFormJson)
|
||||
List<DashboardWidget> get dashboardWidgets;
|
||||
@override
|
||||
bool get onlyProxy;
|
||||
@override
|
||||
bool get autoLaunch;
|
||||
|
||||
@@ -54,6 +54,9 @@ Map<String, dynamic> _$ConfigToJson(Config instance) => <String, dynamic>{
|
||||
_$AppSettingImpl _$$AppSettingImplFromJson(Map<String, dynamic> json) =>
|
||||
_$AppSettingImpl(
|
||||
locale: json['locale'] as String?,
|
||||
dashboardWidgets: json['dashboardWidgets'] == null
|
||||
? defaultDashboardWidgets
|
||||
: dashboardWidgetsRealFormJson(json['dashboardWidgets'] as List?),
|
||||
onlyProxy: json['onlyProxy'] as bool? ?? false,
|
||||
autoLaunch: json['autoLaunch'] as bool? ?? false,
|
||||
silentLaunch: json['silentLaunch'] as bool? ?? false,
|
||||
@@ -72,6 +75,9 @@ _$AppSettingImpl _$$AppSettingImplFromJson(Map<String, dynamic> json) =>
|
||||
Map<String, dynamic> _$$AppSettingImplToJson(_$AppSettingImpl instance) =>
|
||||
<String, dynamic>{
|
||||
'locale': instance.locale,
|
||||
'dashboardWidgets': instance.dashboardWidgets
|
||||
.map((e) => _$DashboardWidgetEnumMap[e]!)
|
||||
.toList(),
|
||||
'onlyProxy': instance.onlyProxy,
|
||||
'autoLaunch': instance.autoLaunch,
|
||||
'silentLaunch': instance.silentLaunch,
|
||||
@@ -87,6 +93,17 @@ Map<String, dynamic> _$$AppSettingImplToJson(_$AppSettingImpl instance) =>
|
||||
'hidden': instance.hidden,
|
||||
};
|
||||
|
||||
const _$DashboardWidgetEnumMap = {
|
||||
DashboardWidget.networkSpeed: 'networkSpeed',
|
||||
DashboardWidget.outboundMode: 'outboundMode',
|
||||
DashboardWidget.trafficUsage: 'trafficUsage',
|
||||
DashboardWidget.networkDetection: 'networkDetection',
|
||||
DashboardWidget.tunButton: 'tunButton',
|
||||
DashboardWidget.systemProxyButton: 'systemProxyButton',
|
||||
DashboardWidget.intranetIp: 'intranetIp',
|
||||
DashboardWidget.memoryInfo: 'memoryInfo',
|
||||
};
|
||||
|
||||
_$AccessControlImpl _$$AccessControlImplFromJson(Map<String, dynamic> json) =>
|
||||
_$AccessControlImpl(
|
||||
mode: $enumDecodeNullable(_$AccessControlModeEnumMap, json['mode']) ??
|
||||
|
||||
@@ -329,4 +329,6 @@ const _$ActionMethodEnumMap = {
|
||||
ActionMethod.stopLog: 'stopLog',
|
||||
ActionMethod.startListener: 'startListener',
|
||||
ActionMethod.stopListener: 'stopListener',
|
||||
ActionMethod.getCountryCode: 'getCountryCode',
|
||||
ActionMethod.getMemory: 'getMemory',
|
||||
};
|
||||
|
||||
@@ -3209,137 +3209,6 @@ abstract class _ProxiesActionsState implements ProxiesActionsState {
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$AutoLaunchState {
|
||||
bool get isAutoLaunch => throw _privateConstructorUsedError;
|
||||
|
||||
/// Create a copy of AutoLaunchState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
$AutoLaunchStateCopyWith<AutoLaunchState> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $AutoLaunchStateCopyWith<$Res> {
|
||||
factory $AutoLaunchStateCopyWith(
|
||||
AutoLaunchState value, $Res Function(AutoLaunchState) then) =
|
||||
_$AutoLaunchStateCopyWithImpl<$Res, AutoLaunchState>;
|
||||
@useResult
|
||||
$Res call({bool isAutoLaunch});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$AutoLaunchStateCopyWithImpl<$Res, $Val extends AutoLaunchState>
|
||||
implements $AutoLaunchStateCopyWith<$Res> {
|
||||
_$AutoLaunchStateCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of AutoLaunchState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? isAutoLaunch = null,
|
||||
}) {
|
||||
return _then(_value.copyWith(
|
||||
isAutoLaunch: null == isAutoLaunch
|
||||
? _value.isAutoLaunch
|
||||
: isAutoLaunch // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
) as $Val);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$AutoLaunchStateImplCopyWith<$Res>
|
||||
implements $AutoLaunchStateCopyWith<$Res> {
|
||||
factory _$$AutoLaunchStateImplCopyWith(_$AutoLaunchStateImpl value,
|
||||
$Res Function(_$AutoLaunchStateImpl) then) =
|
||||
__$$AutoLaunchStateImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call({bool isAutoLaunch});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$AutoLaunchStateImplCopyWithImpl<$Res>
|
||||
extends _$AutoLaunchStateCopyWithImpl<$Res, _$AutoLaunchStateImpl>
|
||||
implements _$$AutoLaunchStateImplCopyWith<$Res> {
|
||||
__$$AutoLaunchStateImplCopyWithImpl(
|
||||
_$AutoLaunchStateImpl _value, $Res Function(_$AutoLaunchStateImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of AutoLaunchState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? isAutoLaunch = null,
|
||||
}) {
|
||||
return _then(_$AutoLaunchStateImpl(
|
||||
isAutoLaunch: null == isAutoLaunch
|
||||
? _value.isAutoLaunch
|
||||
: isAutoLaunch // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$AutoLaunchStateImpl implements _AutoLaunchState {
|
||||
const _$AutoLaunchStateImpl({required this.isAutoLaunch});
|
||||
|
||||
@override
|
||||
final bool isAutoLaunch;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'AutoLaunchState(isAutoLaunch: $isAutoLaunch)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$AutoLaunchStateImpl &&
|
||||
(identical(other.isAutoLaunch, isAutoLaunch) ||
|
||||
other.isAutoLaunch == isAutoLaunch));
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType, isAutoLaunch);
|
||||
|
||||
/// Create a copy of AutoLaunchState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$AutoLaunchStateImplCopyWith<_$AutoLaunchStateImpl> get copyWith =>
|
||||
__$$AutoLaunchStateImplCopyWithImpl<_$AutoLaunchStateImpl>(
|
||||
this, _$identity);
|
||||
}
|
||||
|
||||
abstract class _AutoLaunchState implements AutoLaunchState {
|
||||
const factory _AutoLaunchState({required final bool isAutoLaunch}) =
|
||||
_$AutoLaunchStateImpl;
|
||||
|
||||
@override
|
||||
bool get isAutoLaunch;
|
||||
|
||||
/// Create a copy of AutoLaunchState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$AutoLaunchStateImplCopyWith<_$AutoLaunchStateImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$ProxyState {
|
||||
bool get isStart => throw _privateConstructorUsedError;
|
||||
@@ -4235,6 +4104,167 @@ abstract class _ClashConfigState implements ClashConfigState {
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$DashboardState {
|
||||
List<DashboardWidget> get dashboardWidgets =>
|
||||
throw _privateConstructorUsedError;
|
||||
double get viewWidth => throw _privateConstructorUsedError;
|
||||
|
||||
/// Create a copy of DashboardState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
$DashboardStateCopyWith<DashboardState> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $DashboardStateCopyWith<$Res> {
|
||||
factory $DashboardStateCopyWith(
|
||||
DashboardState value, $Res Function(DashboardState) then) =
|
||||
_$DashboardStateCopyWithImpl<$Res, DashboardState>;
|
||||
@useResult
|
||||
$Res call({List<DashboardWidget> dashboardWidgets, double viewWidth});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$DashboardStateCopyWithImpl<$Res, $Val extends DashboardState>
|
||||
implements $DashboardStateCopyWith<$Res> {
|
||||
_$DashboardStateCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of DashboardState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? dashboardWidgets = null,
|
||||
Object? viewWidth = null,
|
||||
}) {
|
||||
return _then(_value.copyWith(
|
||||
dashboardWidgets: null == dashboardWidgets
|
||||
? _value.dashboardWidgets
|
||||
: dashboardWidgets // ignore: cast_nullable_to_non_nullable
|
||||
as List<DashboardWidget>,
|
||||
viewWidth: null == viewWidth
|
||||
? _value.viewWidth
|
||||
: viewWidth // ignore: cast_nullable_to_non_nullable
|
||||
as double,
|
||||
) as $Val);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$DashboardStateImplCopyWith<$Res>
|
||||
implements $DashboardStateCopyWith<$Res> {
|
||||
factory _$$DashboardStateImplCopyWith(_$DashboardStateImpl value,
|
||||
$Res Function(_$DashboardStateImpl) then) =
|
||||
__$$DashboardStateImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call({List<DashboardWidget> dashboardWidgets, double viewWidth});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$DashboardStateImplCopyWithImpl<$Res>
|
||||
extends _$DashboardStateCopyWithImpl<$Res, _$DashboardStateImpl>
|
||||
implements _$$DashboardStateImplCopyWith<$Res> {
|
||||
__$$DashboardStateImplCopyWithImpl(
|
||||
_$DashboardStateImpl _value, $Res Function(_$DashboardStateImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of DashboardState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? dashboardWidgets = null,
|
||||
Object? viewWidth = null,
|
||||
}) {
|
||||
return _then(_$DashboardStateImpl(
|
||||
dashboardWidgets: null == dashboardWidgets
|
||||
? _value._dashboardWidgets
|
||||
: dashboardWidgets // ignore: cast_nullable_to_non_nullable
|
||||
as List<DashboardWidget>,
|
||||
viewWidth: null == viewWidth
|
||||
? _value.viewWidth
|
||||
: viewWidth // ignore: cast_nullable_to_non_nullable
|
||||
as double,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$DashboardStateImpl implements _DashboardState {
|
||||
const _$DashboardStateImpl(
|
||||
{required final List<DashboardWidget> dashboardWidgets,
|
||||
required this.viewWidth})
|
||||
: _dashboardWidgets = dashboardWidgets;
|
||||
|
||||
final List<DashboardWidget> _dashboardWidgets;
|
||||
@override
|
||||
List<DashboardWidget> get dashboardWidgets {
|
||||
if (_dashboardWidgets is EqualUnmodifiableListView)
|
||||
return _dashboardWidgets;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableListView(_dashboardWidgets);
|
||||
}
|
||||
|
||||
@override
|
||||
final double viewWidth;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'DashboardState(dashboardWidgets: $dashboardWidgets, viewWidth: $viewWidth)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$DashboardStateImpl &&
|
||||
const DeepCollectionEquality()
|
||||
.equals(other._dashboardWidgets, _dashboardWidgets) &&
|
||||
(identical(other.viewWidth, viewWidth) ||
|
||||
other.viewWidth == viewWidth));
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,
|
||||
const DeepCollectionEquality().hash(_dashboardWidgets), viewWidth);
|
||||
|
||||
/// Create a copy of DashboardState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$DashboardStateImplCopyWith<_$DashboardStateImpl> get copyWith =>
|
||||
__$$DashboardStateImplCopyWithImpl<_$DashboardStateImpl>(
|
||||
this, _$identity);
|
||||
}
|
||||
|
||||
abstract class _DashboardState implements DashboardState {
|
||||
const factory _DashboardState(
|
||||
{required final List<DashboardWidget> dashboardWidgets,
|
||||
required final double viewWidth}) = _$DashboardStateImpl;
|
||||
|
||||
@override
|
||||
List<DashboardWidget> get dashboardWidgets;
|
||||
@override
|
||||
double get viewWidth;
|
||||
|
||||
/// Create a copy of DashboardState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$DashboardStateImplCopyWith<_$DashboardStateImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$VPNState {
|
||||
AccessControl? get accessControl => throw _privateConstructorUsedError;
|
||||
|
||||
312
lib/models/generated/widget.freezed.dart
Normal file
312
lib/models/generated/widget.freezed.dart
Normal file
@@ -0,0 +1,312 @@
|
||||
// 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 '../widget.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');
|
||||
|
||||
/// @nodoc
|
||||
mixin _$ActivateState {
|
||||
bool get active => throw _privateConstructorUsedError;
|
||||
|
||||
/// Create a copy of ActivateState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
$ActivateStateCopyWith<ActivateState> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $ActivateStateCopyWith<$Res> {
|
||||
factory $ActivateStateCopyWith(
|
||||
ActivateState value, $Res Function(ActivateState) then) =
|
||||
_$ActivateStateCopyWithImpl<$Res, ActivateState>;
|
||||
@useResult
|
||||
$Res call({bool active});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$ActivateStateCopyWithImpl<$Res, $Val extends ActivateState>
|
||||
implements $ActivateStateCopyWith<$Res> {
|
||||
_$ActivateStateCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of ActivateState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? active = null,
|
||||
}) {
|
||||
return _then(_value.copyWith(
|
||||
active: null == active
|
||||
? _value.active
|
||||
: active // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
) as $Val);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$ActivateStateImplCopyWith<$Res>
|
||||
implements $ActivateStateCopyWith<$Res> {
|
||||
factory _$$ActivateStateImplCopyWith(
|
||||
_$ActivateStateImpl value, $Res Function(_$ActivateStateImpl) then) =
|
||||
__$$ActivateStateImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call({bool active});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$ActivateStateImplCopyWithImpl<$Res>
|
||||
extends _$ActivateStateCopyWithImpl<$Res, _$ActivateStateImpl>
|
||||
implements _$$ActivateStateImplCopyWith<$Res> {
|
||||
__$$ActivateStateImplCopyWithImpl(
|
||||
_$ActivateStateImpl _value, $Res Function(_$ActivateStateImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of ActivateState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? active = null,
|
||||
}) {
|
||||
return _then(_$ActivateStateImpl(
|
||||
active: null == active
|
||||
? _value.active
|
||||
: active // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$ActivateStateImpl implements _ActivateState {
|
||||
const _$ActivateStateImpl({required this.active});
|
||||
|
||||
@override
|
||||
final bool active;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'ActivateState(active: $active)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$ActivateStateImpl &&
|
||||
(identical(other.active, active) || other.active == active));
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType, active);
|
||||
|
||||
/// Create a copy of ActivateState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$ActivateStateImplCopyWith<_$ActivateStateImpl> get copyWith =>
|
||||
__$$ActivateStateImplCopyWithImpl<_$ActivateStateImpl>(this, _$identity);
|
||||
}
|
||||
|
||||
abstract class _ActivateState implements ActivateState {
|
||||
const factory _ActivateState({required final bool active}) =
|
||||
_$ActivateStateImpl;
|
||||
|
||||
@override
|
||||
bool get active;
|
||||
|
||||
/// Create a copy of ActivateState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$ActivateStateImplCopyWith<_$ActivateStateImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$CommonMessage {
|
||||
String get id => throw _privateConstructorUsedError;
|
||||
String get text => throw _privateConstructorUsedError;
|
||||
Duration get duration => throw _privateConstructorUsedError;
|
||||
|
||||
/// Create a copy of CommonMessage
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
$CommonMessageCopyWith<CommonMessage> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $CommonMessageCopyWith<$Res> {
|
||||
factory $CommonMessageCopyWith(
|
||||
CommonMessage value, $Res Function(CommonMessage) then) =
|
||||
_$CommonMessageCopyWithImpl<$Res, CommonMessage>;
|
||||
@useResult
|
||||
$Res call({String id, String text, Duration duration});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$CommonMessageCopyWithImpl<$Res, $Val extends CommonMessage>
|
||||
implements $CommonMessageCopyWith<$Res> {
|
||||
_$CommonMessageCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of CommonMessage
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? id = null,
|
||||
Object? text = null,
|
||||
Object? duration = null,
|
||||
}) {
|
||||
return _then(_value.copyWith(
|
||||
id: null == id
|
||||
? _value.id
|
||||
: id // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
text: null == text
|
||||
? _value.text
|
||||
: text // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
duration: null == duration
|
||||
? _value.duration
|
||||
: duration // ignore: cast_nullable_to_non_nullable
|
||||
as Duration,
|
||||
) as $Val);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$CommonMessageImplCopyWith<$Res>
|
||||
implements $CommonMessageCopyWith<$Res> {
|
||||
factory _$$CommonMessageImplCopyWith(
|
||||
_$CommonMessageImpl value, $Res Function(_$CommonMessageImpl) then) =
|
||||
__$$CommonMessageImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call({String id, String text, Duration duration});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$CommonMessageImplCopyWithImpl<$Res>
|
||||
extends _$CommonMessageCopyWithImpl<$Res, _$CommonMessageImpl>
|
||||
implements _$$CommonMessageImplCopyWith<$Res> {
|
||||
__$$CommonMessageImplCopyWithImpl(
|
||||
_$CommonMessageImpl _value, $Res Function(_$CommonMessageImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of CommonMessage
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? id = null,
|
||||
Object? text = null,
|
||||
Object? duration = null,
|
||||
}) {
|
||||
return _then(_$CommonMessageImpl(
|
||||
id: null == id
|
||||
? _value.id
|
||||
: id // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
text: null == text
|
||||
? _value.text
|
||||
: text // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
duration: null == duration
|
||||
? _value.duration
|
||||
: duration // ignore: cast_nullable_to_non_nullable
|
||||
as Duration,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$CommonMessageImpl implements _CommonMessage {
|
||||
const _$CommonMessageImpl(
|
||||
{required this.id,
|
||||
required this.text,
|
||||
this.duration = const Duration(seconds: 3)});
|
||||
|
||||
@override
|
||||
final String id;
|
||||
@override
|
||||
final String text;
|
||||
@override
|
||||
@JsonKey()
|
||||
final Duration duration;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'CommonMessage(id: $id, text: $text, duration: $duration)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$CommonMessageImpl &&
|
||||
(identical(other.id, id) || other.id == id) &&
|
||||
(identical(other.text, text) || other.text == text) &&
|
||||
(identical(other.duration, duration) ||
|
||||
other.duration == duration));
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType, id, text, duration);
|
||||
|
||||
/// Create a copy of CommonMessage
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$CommonMessageImplCopyWith<_$CommonMessageImpl> get copyWith =>
|
||||
__$$CommonMessageImplCopyWithImpl<_$CommonMessageImpl>(this, _$identity);
|
||||
}
|
||||
|
||||
abstract class _CommonMessage implements CommonMessage {
|
||||
const factory _CommonMessage(
|
||||
{required final String id,
|
||||
required final String text,
|
||||
final Duration duration}) = _$CommonMessageImpl;
|
||||
|
||||
@override
|
||||
String get id;
|
||||
@override
|
||||
String get text;
|
||||
@override
|
||||
Duration get duration;
|
||||
|
||||
/// Create a copy of CommonMessage
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$CommonMessageImplCopyWith<_$CommonMessageImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
@@ -5,3 +5,4 @@ export 'config.dart';
|
||||
export 'core.dart';
|
||||
export 'profile.dart';
|
||||
export 'selector.dart';
|
||||
export 'widget.dart';
|
||||
|
||||
@@ -195,13 +195,6 @@ class ProxiesActionsState with _$ProxiesActionsState {
|
||||
}) = _ProxiesActionsState;
|
||||
}
|
||||
|
||||
@freezed
|
||||
class AutoLaunchState with _$AutoLaunchState {
|
||||
const factory AutoLaunchState({
|
||||
required bool isAutoLaunch,
|
||||
}) = _AutoLaunchState;
|
||||
}
|
||||
|
||||
@freezed
|
||||
class ProxyState with _$ProxyState {
|
||||
const factory ProxyState({
|
||||
@@ -244,6 +237,14 @@ class ClashConfigState with _$ClashConfigState {
|
||||
}) = _ClashConfigState;
|
||||
}
|
||||
|
||||
@freezed
|
||||
class DashboardState with _$DashboardState {
|
||||
const factory DashboardState({
|
||||
required List<DashboardWidget> dashboardWidgets,
|
||||
required double viewWidth,
|
||||
}) = _DashboardState;
|
||||
}
|
||||
|
||||
@freezed
|
||||
class VPNState with _$VPNState {
|
||||
const factory VPNState({
|
||||
|
||||
19
lib/models/widget.dart
Normal file
19
lib/models/widget.dart
Normal file
@@ -0,0 +1,19 @@
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
part 'generated/widget.freezed.dart';
|
||||
|
||||
@freezed
|
||||
class ActivateState with _$ActivateState {
|
||||
const factory ActivateState({
|
||||
required bool active,
|
||||
}) = _ActivateState;
|
||||
}
|
||||
|
||||
@freezed
|
||||
class CommonMessage with _$CommonMessage {
|
||||
const factory CommonMessage({
|
||||
required String id,
|
||||
required String text,
|
||||
@Default(Duration(seconds: 3)) Duration duration,
|
||||
}) = _CommonMessage;
|
||||
}
|
||||
Reference in New Issue
Block a user