diff --git a/lib/models/settings_model.dart b/lib/models/settings_model.dart index 1a227cd0..74bc2ff9 100644 --- a/lib/models/settings_model.dart +++ b/lib/models/settings_model.dart @@ -6,7 +6,6 @@ import 'package:apidash/consts.dart'; class SettingsModel { const SettingsModel({ this.isDark = false, - this.isSSLDisabled =false, this.alwaysShowCollectionPaneScrollbar = true, this.size, this.offset, @@ -17,10 +16,10 @@ class SettingsModel { this.activeEnvironmentId, this.historyRetentionPeriod = HistoryRetentionPeriod.oneWeek, this.workspaceFolderPath, + this.isSSLDisabled = false, }); final bool isDark; - final bool isSSLDisabled; final bool alwaysShowCollectionPaneScrollbar; final Size? size; final Offset? offset; @@ -31,10 +30,10 @@ class SettingsModel { final String? activeEnvironmentId; final HistoryRetentionPeriod historyRetentionPeriod; final String? workspaceFolderPath; + final bool isSSLDisabled; SettingsModel copyWith({ bool? isDark, - bool? isSSLDisabled, bool? alwaysShowCollectionPaneScrollbar, Size? size, Offset? offset, @@ -45,10 +44,10 @@ class SettingsModel { String? activeEnvironmentId, HistoryRetentionPeriod? historyRetentionPeriod, String? workspaceFolderPath, + bool? isSSLDisabled, }) { return SettingsModel( isDark: isDark ?? this.isDark, - isSSLDisabled: isSSLDisabled ?? this.isSSLDisabled, alwaysShowCollectionPaneScrollbar: alwaysShowCollectionPaneScrollbar ?? this.alwaysShowCollectionPaneScrollbar, size: size ?? this.size, @@ -61,6 +60,7 @@ class SettingsModel { historyRetentionPeriod: historyRetentionPeriod ?? this.historyRetentionPeriod, workspaceFolderPath: workspaceFolderPath ?? this.workspaceFolderPath, + isSSLDisabled: isSSLDisabled ?? this.isSSLDisabled, ); } @@ -69,7 +69,6 @@ class SettingsModel { }) { return SettingsModel( isDark: isDark, - isSSLDisabled: isSSLDisabled, alwaysShowCollectionPaneScrollbar: alwaysShowCollectionPaneScrollbar, size: size, defaultUriScheme: defaultUriScheme, @@ -80,12 +79,12 @@ class SettingsModel { activeEnvironmentId: activeEnvironmentId, historyRetentionPeriod: historyRetentionPeriod, workspaceFolderPath: workspaceFolderPath, + isSSLDisabled: isSSLDisabled, ); } factory SettingsModel.fromJson(Map data) { final isDark = data["isDark"] as bool?; - final isSSLDisabled = data["isSSLDisabled"] as bool?; final alwaysShowCollectionPaneScrollbar = data["alwaysShowCollectionPaneScrollbar"] as bool?; final width = data["width"] as double?; @@ -134,12 +133,12 @@ class SettingsModel { } } final workspaceFolderPath = data["workspaceFolderPath"] as String?; + final isSSLDisabled = data["isSSLDisabled"] as bool?; const sm = SettingsModel(); return sm.copyWith( isDark: isDark, - isSSLDisabled: isSSLDisabled, alwaysShowCollectionPaneScrollbar: alwaysShowCollectionPaneScrollbar, size: size, offset: offset, @@ -151,13 +150,13 @@ class SettingsModel { historyRetentionPeriod: historyRetentionPeriod ?? HistoryRetentionPeriod.oneWeek, workspaceFolderPath: workspaceFolderPath, + isSSLDisabled: isSSLDisabled, ); } Map toJson() { return { "isDark": isDark, - "isSSLDisabled":isSSLDisabled, "alwaysShowCollectionPaneScrollbar": alwaysShowCollectionPaneScrollbar, "width": size?.width, "height": size?.height, @@ -170,6 +169,7 @@ class SettingsModel { "activeEnvironmentId": activeEnvironmentId, "historyRetentionPeriod": historyRetentionPeriod.name, "workspaceFolderPath": workspaceFolderPath, + "isSSLDisabled": isSSLDisabled, }; } @@ -183,7 +183,6 @@ class SettingsModel { return other is SettingsModel && other.runtimeType == runtimeType && other.isDark == isDark && - other.isSSLDisabled == isSSLDisabled && other.alwaysShowCollectionPaneScrollbar == alwaysShowCollectionPaneScrollbar && other.size == size && @@ -194,7 +193,8 @@ class SettingsModel { other.promptBeforeClosing == promptBeforeClosing && other.activeEnvironmentId == activeEnvironmentId && other.historyRetentionPeriod == historyRetentionPeriod && - other.workspaceFolderPath == workspaceFolderPath; + other.workspaceFolderPath == workspaceFolderPath && + other.isSSLDisabled == isSSLDisabled; } @override @@ -202,7 +202,6 @@ class SettingsModel { return Object.hash( runtimeType, isDark, - isSSLDisabled, alwaysShowCollectionPaneScrollbar, size, offset, @@ -213,6 +212,7 @@ class SettingsModel { activeEnvironmentId, historyRetentionPeriod, workspaceFolderPath, + isSSLDisabled, ); } } diff --git a/lib/providers/settings_providers.dart b/lib/providers/settings_providers.dart index 0fb9ab7d..6b64343a 100644 --- a/lib/providers/settings_providers.dart +++ b/lib/providers/settings_providers.dart @@ -22,7 +22,6 @@ class ThemeStateNotifier extends StateNotifier { Future update({ bool? isDark, - bool? isSSLDisabled, bool? alwaysShowCollectionPaneScrollbar, Size? size, Offset? offset, @@ -33,10 +32,10 @@ class ThemeStateNotifier extends StateNotifier { String? activeEnvironmentId, HistoryRetentionPeriod? historyRetentionPeriod, String? workspaceFolderPath, + bool? isSSLDisabled, }) async { state = state.copyWith( isDark: isDark, - isSSLDisabled: isSSLDisabled, alwaysShowCollectionPaneScrollbar: alwaysShowCollectionPaneScrollbar, size: size, offset: offset, @@ -47,6 +46,7 @@ class ThemeStateNotifier extends StateNotifier { activeEnvironmentId: activeEnvironmentId, historyRetentionPeriod: historyRetentionPeriod, workspaceFolderPath: workspaceFolderPath, + isSSLDisabled: isSSLDisabled, ); await setSettingsToSharedPrefs(state); }