Add experimental flag in settings ui
This commit is contained in:
@@ -131,6 +131,8 @@
|
|||||||
"settings": {
|
"settings": {
|
||||||
"pageTitle": "Settings",
|
"pageTitle": "Settings",
|
||||||
"requiresRestartMsg": "For this to take effect restart the app",
|
"requiresRestartMsg": "For this to take effect restart the app",
|
||||||
|
"experimental": "Experimental",
|
||||||
|
"experimentalMsg": "Features with Experimental flag are still in development and might cause issues.",
|
||||||
"general": {
|
"general": {
|
||||||
"sectionTitle": "General",
|
"sectionTitle": "General",
|
||||||
"locale": "Language",
|
"locale": "Language",
|
||||||
|
|||||||
@@ -131,6 +131,8 @@
|
|||||||
"settings": {
|
"settings": {
|
||||||
"pageTitle": "تنظیمات",
|
"pageTitle": "تنظیمات",
|
||||||
"requiresRestartMsg": "برای اعمال این تنظیم برنامه را بازنشانی کنید",
|
"requiresRestartMsg": "برای اعمال این تنظیم برنامه را بازنشانی کنید",
|
||||||
|
"experimental": "آزمایشی",
|
||||||
|
"experimentalMsg": "تنظیماتی که عنوان آزمایشی دارند همچنان در دست توسعه هستند و فعالسازی آنها میتواند خطاهایی بوجود بیاورد.",
|
||||||
"general": {
|
"general": {
|
||||||
"sectionTitle": "عمومی",
|
"sectionTitle": "عمومی",
|
||||||
"locale": "زبان",
|
"locale": "زبان",
|
||||||
|
|||||||
@@ -238,7 +238,9 @@
|
|||||||
"successMsg": "Объект успешно обновлен",
|
"successMsg": "Объект успешно обновлен",
|
||||||
"addRecommended": "Добавить рекомендуемые активы",
|
"addRecommended": "Добавить рекомендуемые активы",
|
||||||
"missingGeoAssetsMsg": "Файлы выбранных ресурсов маршрутизации отсутствуют. Либо скачайте их, либо выберите существующие."
|
"missingGeoAssetsMsg": "Файлы выбранных ресурсов маршрутизации отсутствуют. Либо скачайте их, либо выберите существующие."
|
||||||
}
|
},
|
||||||
|
"experimental": "Экспериментальный",
|
||||||
|
"experimentalMsg": "Функции с флагом «Экспериментально» все еще находятся в разработке и могут вызвать проблемы."
|
||||||
},
|
},
|
||||||
"about": {
|
"about": {
|
||||||
"pageTitle": "О программе",
|
"pageTitle": "О программе",
|
||||||
|
|||||||
@@ -238,7 +238,9 @@
|
|||||||
"successMsg": "Öğe başarıyla güncellendi",
|
"successMsg": "Öğe başarıyla güncellendi",
|
||||||
"addRecommended": "Önerilen Varlıkları Ekle",
|
"addRecommended": "Önerilen Varlıkları Ekle",
|
||||||
"missingGeoAssetsMsg": "Seçilen yönlendirme varlıklarının dosyaları eksik. Bunları indirin veya mevcut olanları seçin."
|
"missingGeoAssetsMsg": "Seçilen yönlendirme varlıklarının dosyaları eksik. Bunları indirin veya mevcut olanları seçin."
|
||||||
}
|
},
|
||||||
|
"experimental": "Deneysel",
|
||||||
|
"experimentalMsg": "Deneysel işaretli özellikler hâlâ geliştirilme aşamasındadır ve sorunlara neden olabilir."
|
||||||
},
|
},
|
||||||
"about": {
|
"about": {
|
||||||
"pageTitle": "Hakkında",
|
"pageTitle": "Hakkında",
|
||||||
|
|||||||
@@ -238,7 +238,9 @@
|
|||||||
"successMsg": "已成功更新资源文件",
|
"successMsg": "已成功更新资源文件",
|
||||||
"addRecommended": "添加建议的资源文件",
|
"addRecommended": "添加建议的资源文件",
|
||||||
"missingGeoAssetsMsg": "所选路由资源的文件丢失。下载它们或选择现有的。"
|
"missingGeoAssetsMsg": "所选路由资源的文件丢失。下载它们或选择现有的。"
|
||||||
}
|
},
|
||||||
|
"experimental": "实验性的",
|
||||||
|
"experimentalMsg": "带有实验标志的功能仍在开发中,可能会导致问题。"
|
||||||
},
|
},
|
||||||
"about": {
|
"about": {
|
||||||
"pageTitle": "关于",
|
"pageTitle": "关于",
|
||||||
|
|||||||
39
lib/core/widget/tip_card.dart
Normal file
39
lib/core/widget/tip_card.dart
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class TipCard extends StatelessWidget {
|
||||||
|
const TipCard({required this.message, super.key});
|
||||||
|
|
||||||
|
final String message;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Card(
|
||||||
|
margin: const EdgeInsets.symmetric(
|
||||||
|
horizontal: 12,
|
||||||
|
vertical: 4,
|
||||||
|
),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
const Padding(
|
||||||
|
padding: EdgeInsets.all(8.0),
|
||||||
|
child: Icon(Icons.lightbulb),
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
|
children: [
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(
|
||||||
|
horizontal: 8,
|
||||||
|
vertical: 8,
|
||||||
|
),
|
||||||
|
child: Text(message),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,6 +5,7 @@ import 'package:gap/gap.dart';
|
|||||||
import 'package:hiddify/core/localization/translations.dart';
|
import 'package:hiddify/core/localization/translations.dart';
|
||||||
import 'package:hiddify/core/model/failures.dart';
|
import 'package:hiddify/core/model/failures.dart';
|
||||||
import 'package:hiddify/core/model/range.dart';
|
import 'package:hiddify/core/model/range.dart';
|
||||||
|
import 'package:hiddify/core/widget/tip_card.dart';
|
||||||
import 'package:hiddify/features/config_option/model/config_option_entity.dart';
|
import 'package:hiddify/features/config_option/model/config_option_entity.dart';
|
||||||
import 'package:hiddify/features/config_option/model/config_option_patch.dart';
|
import 'package:hiddify/features/config_option/model/config_option_patch.dart';
|
||||||
import 'package:hiddify/features/config_option/notifier/config_option_notifier.dart';
|
import 'package:hiddify/features/config_option/notifier/config_option_notifier.dart';
|
||||||
@@ -30,6 +31,10 @@ class ConfigOptionsPage extends HookConsumerWidget {
|
|||||||
await ref.read(configOptionNotifierProvider.notifier).updateOption(patch);
|
await ref.read(configOptionNotifierProvider.notifier).updateOption(patch);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String experimental(String txt) {
|
||||||
|
return "$txt (${t.settings.experimental})";
|
||||||
|
}
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: Text(t.settings.config.pageTitle),
|
title: Text(t.settings.config.pageTitle),
|
||||||
@@ -62,6 +67,7 @@ class ConfigOptionsPage extends HookConsumerWidget {
|
|||||||
body: switch (asyncOptions) {
|
body: switch (asyncOptions) {
|
||||||
AsyncData(value: final options) => ListView(
|
AsyncData(value: final options) => ListView(
|
||||||
children: [
|
children: [
|
||||||
|
TipCard(message: t.settings.experimentalMsg),
|
||||||
ListTile(
|
ListTile(
|
||||||
title: Text(t.settings.config.logLevel),
|
title: Text(t.settings.config.logLevel),
|
||||||
subtitle: Text(options.logLevel.name.toUpperCase()),
|
subtitle: Text(options.logLevel.name.toUpperCase()),
|
||||||
@@ -251,7 +257,7 @@ class ConfigOptionsPage extends HookConsumerWidget {
|
|||||||
const SettingsDivider(),
|
const SettingsDivider(),
|
||||||
SettingsSection(t.settings.config.section.outbound),
|
SettingsSection(t.settings.config.section.outbound),
|
||||||
SwitchListTile(
|
SwitchListTile(
|
||||||
title: Text(t.settings.config.enableTlsFragment),
|
title: Text(experimental(t.settings.config.enableTlsFragment)),
|
||||||
value: options.enableTlsFragment,
|
value: options.enableTlsFragment,
|
||||||
onChanged: (value) async =>
|
onChanged: (value) async =>
|
||||||
changeOption(ConfigOptionPatch(enableTlsFragment: value)),
|
changeOption(ConfigOptionPatch(enableTlsFragment: value)),
|
||||||
@@ -291,14 +297,15 @@ class ConfigOptionsPage extends HookConsumerWidget {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
SwitchListTile(
|
SwitchListTile(
|
||||||
title: Text(t.settings.config.enableTlsMixedSniCase),
|
title:
|
||||||
|
Text(experimental(t.settings.config.enableTlsMixedSniCase)),
|
||||||
value: options.enableTlsMixedSniCase,
|
value: options.enableTlsMixedSniCase,
|
||||||
onChanged: (value) async => changeOption(
|
onChanged: (value) async => changeOption(
|
||||||
ConfigOptionPatch(enableTlsMixedSniCase: value),
|
ConfigOptionPatch(enableTlsMixedSniCase: value),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
SwitchListTile(
|
SwitchListTile(
|
||||||
title: Text(t.settings.config.enableTlsPadding),
|
title: Text(experimental(t.settings.config.enableTlsPadding)),
|
||||||
value: options.enableTlsPadding,
|
value: options.enableTlsPadding,
|
||||||
onChanged: (value) async => changeOption(
|
onChanged: (value) async => changeOption(
|
||||||
ConfigOptionPatch(enableTlsPadding: value),
|
ConfigOptionPatch(enableTlsPadding: value),
|
||||||
|
|||||||
@@ -25,7 +25,8 @@ enum ServiceMode {
|
|||||||
String present(TranslationsEn t) => switch (this) {
|
String present(TranslationsEn t) => switch (this) {
|
||||||
proxy => t.settings.config.serviceModes.proxy,
|
proxy => t.settings.config.serviceModes.proxy,
|
||||||
systemProxy => t.settings.config.serviceModes.systemProxy,
|
systemProxy => t.settings.config.serviceModes.systemProxy,
|
||||||
tun => t.settings.config.serviceModes.tun,
|
tun =>
|
||||||
|
"${t.settings.config.serviceModes.tun}${PlatformUtils.isDesktop ? " (${t.settings.experimental})" : ""}",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user