Backup before removing hiddify references
This commit is contained in:
@@ -4,9 +4,6 @@ import 'package:fluentui_system_icons/fluentui_system_icons.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hiddify/core/localization/translations.dart';
|
||||
import 'package:hiddify/core/preferences/general_preferences.dart';
|
||||
import 'package:hiddify/core/router/router.dart';
|
||||
import 'package:hiddify/features/common/general_pref_tiles.dart';
|
||||
import 'package:hiddify/features/per_app_proxy/model/per_app_proxy_mode.dart';
|
||||
import 'package:hiddify/features/settings/notifier/platform_settings_notifier.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ import 'package:hiddify/core/localization/translations.dart';
|
||||
import 'package:hiddify/core/preferences/general_preferences.dart';
|
||||
import 'package:hiddify/features/auto_start/notifier/auto_start_notifier.dart';
|
||||
import 'package:hiddify/features/common/general_pref_tiles.dart';
|
||||
import 'package:hiddify/features/config_option/data/config_option_repository.dart';
|
||||
import 'package:hiddify/utils/utils.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
|
||||
@@ -19,9 +20,93 @@ class GeneralSettingTiles extends HookConsumerWidget {
|
||||
|
||||
return Column(
|
||||
children: [
|
||||
const LocalePrefTile(),
|
||||
const ThemeModePrefTile(),
|
||||
// UMBRIX: Язык и тема перенесены в левое меню
|
||||
const EnableAnalyticsPrefTile(),
|
||||
SwitchListTile(
|
||||
title: Text(t.config.blockAds),
|
||||
subtitle: Text(
|
||||
t.config.blockAdsWarning.subtitle,
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
secondary: const Icon(FluentIcons.shield_prohibited_24_regular),
|
||||
value: ref.watch(ConfigOptions.blockAds),
|
||||
onChanged: (value) async {
|
||||
if (value) {
|
||||
// Показываем предупреждение при включении
|
||||
final confirmed = await showDialog<bool>(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
icon: const Icon(Icons.warning_amber_rounded, size: 48),
|
||||
title: Text(t.config.bypassLanWarning.title),
|
||||
content: Text(
|
||||
t.config.blockAdsWarning.message,
|
||||
style: const TextStyle(fontSize: 14),
|
||||
),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.of(context).pop(false),
|
||||
child: Text(t.config.bypassLanWarning.cancel),
|
||||
),
|
||||
FilledButton(
|
||||
onPressed: () => Navigator.of(context).pop(true),
|
||||
child: Text(t.config.bypassLanWarning.enable),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
if (confirmed == true) {
|
||||
ref.read(ConfigOptions.blockAds.notifier).update(true);
|
||||
}
|
||||
} else {
|
||||
ref.read(ConfigOptions.blockAds.notifier).update(false);
|
||||
}
|
||||
},
|
||||
),
|
||||
SwitchListTile(
|
||||
title: Text(t.config.bypassLan),
|
||||
subtitle: Text(
|
||||
t.config.bypassLanWarning.subtitle,
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
secondary: const Icon(FluentIcons.home_24_regular),
|
||||
value: ref.watch(ConfigOptions.bypassLan),
|
||||
onChanged: (value) async {
|
||||
if (value) {
|
||||
final confirmed = await showDialog<bool>(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
icon: const Icon(Icons.warning_amber_rounded, size: 48),
|
||||
title: Text(t.config.bypassLanWarning.title),
|
||||
content: Text(
|
||||
t.config.bypassLanWarning.message,
|
||||
style: const TextStyle(fontSize: 14),
|
||||
),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.of(context).pop(false),
|
||||
child: Text(t.config.bypassLanWarning.cancel),
|
||||
),
|
||||
FilledButton(
|
||||
onPressed: () => Navigator.of(context).pop(true),
|
||||
child: Text(t.config.bypassLanWarning.enable),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
if (confirmed == true) {
|
||||
ref.read(ConfigOptions.bypassLan.notifier).update(true);
|
||||
}
|
||||
} else {
|
||||
ref.read(ConfigOptions.bypassLan.notifier).update(false);
|
||||
}
|
||||
},
|
||||
),
|
||||
SwitchListTile(
|
||||
title: Text(t.settings.general.autoIpCheck),
|
||||
secondary: const Icon(FluentIcons.globe_search_24_regular),
|
||||
|
||||
30
lib/features/settings/widgets/logs_setting_tiles.dart
Normal file
30
lib/features/settings/widgets/logs_setting_tiles.dart
Normal file
@@ -0,0 +1,30 @@
|
||||
import 'package:fluentui_system_icons/fluentui_system_icons.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hiddify/core/localization/translations.dart';
|
||||
import 'package:hiddify/core/router/router.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
|
||||
/// Секция "Логи и отладка" в настройках
|
||||
class LogsSettingTiles extends HookConsumerWidget {
|
||||
const LogsSettingTiles({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final t = ref.watch(translationsProvider);
|
||||
|
||||
return Column(
|
||||
children: [
|
||||
// Переход на страницу логов
|
||||
ListTile(
|
||||
title: Text(t.logs.pageTitle),
|
||||
subtitle: const Text('Просмотр логов приложения и ядра'),
|
||||
leading: const Icon(FluentIcons.document_text_20_regular),
|
||||
trailing: const Icon(FluentIcons.chevron_right_20_regular),
|
||||
onTap: () {
|
||||
const LogsOverviewRoute().push(context);
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -23,7 +23,6 @@ class SettingsInputDialog<T> extends HookConsumerWidget with PresLogger {
|
||||
Future<T?> show(BuildContext context) async {
|
||||
return showDialog(
|
||||
context: context,
|
||||
useRootNavigator: true,
|
||||
builder: (context) => this,
|
||||
);
|
||||
}
|
||||
@@ -86,7 +85,7 @@ class SettingsInputDialog<T> extends HookConsumerWidget with PresLogger {
|
||||
onSelected: (suggestion) {
|
||||
// Handle the selected suggestion
|
||||
print('Selected: $suggestion');
|
||||
textController.text = suggestion.toString();
|
||||
textController.text = suggestion;
|
||||
},
|
||||
)
|
||||
else
|
||||
@@ -120,7 +119,7 @@ class SettingsInputDialog<T> extends HookConsumerWidget with PresLogger {
|
||||
child: TextButton(
|
||||
onPressed: () async {
|
||||
onReset!();
|
||||
await Navigator.of(context).maybePop(null);
|
||||
await Navigator.of(context).maybePop();
|
||||
},
|
||||
child: Text(t.general.reset.toUpperCase()),
|
||||
),
|
||||
@@ -139,7 +138,7 @@ class SettingsInputDialog<T> extends HookConsumerWidget with PresLogger {
|
||||
child: TextButton(
|
||||
onPressed: () async {
|
||||
if (validator?.call(textController.value.text) == false) {
|
||||
await Navigator.of(context).maybePop(null);
|
||||
await Navigator.of(context).maybePop();
|
||||
} else if (mapTo != null) {
|
||||
await Navigator.of(context).maybePop(mapTo!.call(textController.value.text));
|
||||
} else {
|
||||
@@ -164,7 +163,7 @@ class AutocompleteField extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return Autocomplete<String>(
|
||||
initialValue: TextEditingValue(
|
||||
text: this.initialValue, selection: TextSelection(baseOffset: 0, extentOffset: this.initialValue.length), // Selects the entire text
|
||||
text: initialValue, selection: TextSelection(baseOffset: 0, extentOffset: initialValue.length), // Selects the entire text
|
||||
),
|
||||
optionsBuilder: (TextEditingValue textEditingValue) {
|
||||
// if (textEditingValue.text == '') {
|
||||
@@ -200,7 +199,6 @@ class SettingsPickerDialog<T> extends HookConsumerWidget with PresLogger {
|
||||
Future<T?> show(BuildContext context) async {
|
||||
return showDialog(
|
||||
context: context,
|
||||
useRootNavigator: true,
|
||||
builder: (context) => this,
|
||||
);
|
||||
}
|
||||
@@ -231,7 +229,7 @@ class SettingsPickerDialog<T> extends HookConsumerWidget with PresLogger {
|
||||
TextButton(
|
||||
onPressed: () async {
|
||||
onReset!();
|
||||
await Navigator.of(context).maybePop(null);
|
||||
await Navigator.of(context).maybePop();
|
||||
},
|
||||
child: Text(t.general.reset.toUpperCase()),
|
||||
),
|
||||
@@ -270,7 +268,6 @@ class SettingsSliderDialog extends HookConsumerWidget with PresLogger {
|
||||
Future<double?> show(BuildContext context) async {
|
||||
return showDialog(
|
||||
context: context,
|
||||
useRootNavigator: true,
|
||||
builder: (context) => this,
|
||||
);
|
||||
}
|
||||
@@ -299,7 +296,7 @@ class SettingsSliderDialog extends HookConsumerWidget with PresLogger {
|
||||
TextButton(
|
||||
onPressed: () async {
|
||||
onReset!();
|
||||
await Navigator.of(context).maybePop(null);
|
||||
await Navigator.of(context).maybePop();
|
||||
},
|
||||
child: Text(t.general.reset.toUpperCase()),
|
||||
),
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
export 'advanced_setting_tiles.dart';
|
||||
export 'general_setting_tiles.dart';
|
||||
export 'logs_setting_tiles.dart';
|
||||
export 'platform_settings_tiles.dart';
|
||||
export 'sections_widgets.dart';
|
||||
export 'settings_input_dialog.dart';
|
||||
|
||||
Reference in New Issue
Block a user