Backup before removing hiddify references

This commit is contained in:
Hiddify User
2026-01-15 12:28:40 +03:00
parent f54603d129
commit 36d9e31236
231 changed files with 6648 additions and 1832 deletions

View File

@@ -1,4 +1,3 @@
import 'package:combine/combine.dart';
import 'package:fluentui_system_icons/fluentui_system_icons.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
@@ -62,10 +61,10 @@ class AddProfileModal extends HookConsumerWidget {
controller: scrollController,
child: AnimatedSize(
duration: const Duration(milliseconds: 250),
child: Builder(
builder: (context) {
// Fixed button width instead of using LayoutBuilder
final buttonWidth = (MediaQuery.of(context).size.width / 2) - (buttonsPadding + (buttonsGap / 2));
child: LayoutBuilder(
builder: (context, constraints) {
// temporary solution, aspect ratio widget relies on height and in a row there no height!
final buttonWidth = constraints.maxWidth / 2 - (buttonsPadding + (buttonsGap / 2));
return AnimatedCrossFade(
firstChild: SizedBox(
@@ -98,70 +97,42 @@ class AddProfileModal extends HookConsumerWidget {
),
secondChild: Column(
children: [
// Заголовок
Padding(
padding: const EdgeInsets.fromLTRB(24, 16, 24, 8),
child: Text(
t.profile.add.buttonText,
style: theme.textTheme.titleLarge?.copyWith(
fontWeight: FontWeight.bold,
),
),
),
// Основные кнопки в виде больших карточек
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
child: Column(
padding: const EdgeInsets.symmetric(horizontal: buttonsPadding),
child: Row(
children: [
_ModernButton(
_Button(
key: const ValueKey("add_from_clipboard_button"),
label: t.profile.add.fromClipboard,
subtitle: "Paste from clipboard",
icon: FluentIcons.clipboard_paste_24_filled,
gradient: LinearGradient(
colors: [
theme.colorScheme.primaryContainer,
theme.colorScheme.secondaryContainer,
],
),
icon: FluentIcons.clipboard_paste_24_regular,
size: buttonWidth,
onTap: () async {
final captureResult = await Clipboard.getData(Clipboard.kTextPlain).then((value) => value?.text ?? '');
if (addProfileState.isLoading) return;
ref.read(addProfileProvider.notifier).add(captureResult);
},
),
const Gap(12),
const Gap(buttonsGap),
if (!PlatformUtils.isDesktop)
_ModernButton(
_Button(
key: const ValueKey("add_by_qr_code_button"),
label: t.profile.add.scanQr,
subtitle: "Camera scanner",
icon: FluentIcons.qr_code_24_filled,
gradient: LinearGradient(
colors: [
theme.colorScheme.tertiaryContainer,
theme.colorScheme.primaryContainer.withOpacity(0.7),
],
),
icon: FluentIcons.qr_code_24_regular,
size: buttonWidth,
onTap: () async {
final cr = await QRCodeScannerScreen().open(context);
final cr = await const QRCodeScannerScreen().open(context);
if (cr == null) return;
if (addProfileState.isLoading) return;
ref.read(addProfileProvider.notifier).add(cr);
},
)
else
_ModernButton(
_Button(
key: const ValueKey("add_manually_button"),
label: t.profile.add.manually,
subtitle: "Create new config",
icon: FluentIcons.edit_24_filled,
gradient: LinearGradient(
colors: [
theme.colorScheme.tertiaryContainer,
theme.colorScheme.primaryContainer.withOpacity(0.7),
],
),
icon: FluentIcons.add_24_regular,
size: buttonWidth,
onTap: () async {
context.pop();
await const NewProfileRoute().push(context);
@@ -170,32 +141,87 @@ class AddProfileModal extends HookConsumerWidget {
],
),
),
const Gap(16),
// Дополнительные опции
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
padding: const EdgeInsets.symmetric(
horizontal: buttonsPadding,
vertical: 16,
),
child: Column(
children: [
_CompactButton(
key: const ValueKey("add_warp_button"),
label: t.profile.add.addWarp,
icon: FluentIcons.cloud_add_24_regular,
color: theme.colorScheme.primary,
onTap: () async {
await addProfileModal(context, ref);
},
Semantics(
button: true,
child: SizedBox(
height: 36,
child: Material(
key: const ValueKey("add_warp_button"),
elevation: 8,
color: theme.colorScheme.surface,
surfaceTintColor: theme.colorScheme.surfaceTint,
shadowColor: Colors.transparent,
borderRadius: BorderRadius.circular(8),
clipBehavior: Clip.antiAlias,
child: InkWell(
onTap: () async {
await addProfileModal(context, ref);
},
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(
FluentIcons.add_24_regular,
color: theme.colorScheme.primary,
),
const SizedBox(width: 8),
Text(
t.profile.add.addWarp,
style: theme.textTheme.labelLarge?.copyWith(
color: theme.colorScheme.primary,
),
),
],
),
),
),
),
),
if (!PlatformUtils.isDesktop) const Gap(12),
if (!PlatformUtils.isDesktop) const SizedBox(height: 16), // Spacing between the buttons
if (!PlatformUtils.isDesktop)
_CompactButton(
key: const ValueKey("add_manually_button"),
label: t.profile.add.manually,
icon: FluentIcons.edit_24_regular,
color: theme.colorScheme.secondary,
onTap: () async {
context.pop();
await const NewProfileRoute().push(context);
},
Semantics(
button: true,
child: SizedBox(
height: 36,
child: Material(
key: const ValueKey("add_manually_button"),
elevation: 8,
color: theme.colorScheme.surface,
surfaceTintColor: theme.colorScheme.surfaceTint,
shadowColor: Colors.transparent,
borderRadius: BorderRadius.circular(8),
clipBehavior: Clip.antiAlias,
child: InkWell(
onTap: () async {
context.pop();
await const NewProfileRoute().push(context);
},
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(
FluentIcons.add_24_regular,
color: theme.colorScheme.primary,
),
const SizedBox(width: 8),
Text(
t.profile.add.manually,
style: theme.textTheme.labelLarge?.copyWith(
color: theme.colorScheme.primary,
),
),
],
),
),
),
),
),
],
),
@@ -213,10 +239,10 @@ class AddProfileModal extends HookConsumerWidget {
}
Future<void> addProfileModal(BuildContext context, WidgetRef ref) async {
final _prefs = ref.read(sharedPreferencesProvider).requireValue;
final _warp = ref.read(warpOptionNotifierProvider.notifier);
final _profile = ref.read(addProfileProvider.notifier);
final consent = (_prefs.getBool(warpConsentGiven) ?? false);
final prefs = ref.read(sharedPreferencesProvider).requireValue;
final warp = ref.read(warpOptionNotifierProvider.notifier);
final profile = ref.read(addProfileProvider.notifier);
final consent = prefs.getBool(warpConsentGiven) ?? false;
final region = ref.read(ConfigOptions.region.notifier).raw();
context.pop();
@@ -231,10 +257,10 @@ class AddProfileModal extends HookConsumerWidget {
if (agreed != true) return;
}
await _prefs.setBool(warpConsentGiven, true);
await prefs.setBool(warpConsentGiven, true);
var toast = notification.showInfoToast(t.profile.add.addingWarpMsg, duration: const Duration(milliseconds: 100));
toast?.pause();
await _warp.generateWarpConfig();
await warp.generateWarpConfig();
toast?.start();
// final accountId = _prefs.getString("warp2-account-id");
@@ -244,179 +270,17 @@ class AddProfileModal extends HookConsumerWidget {
// if (!hasWarp2Config || true) {
toast = notification.showInfoToast(t.profile.add.addingWarpMsg, duration: const Duration(milliseconds: 100));
toast?.pause();
await _warp.generateWarp2Config();
await warp.generateWarp2Config();
toast?.start();
// }
if (region == "cn") {
await _profile.add("#profile-title: Hiddify WARP\nwarp://p1@auto#National&&detour=warp://p2@auto#WoW"); //
await profile.add("#profile-title: Hiddify WARP\nwarp://p1@auto#National&&detour=warp://p2@auto#WoW"); //
} else {
await _profile.add("https://raw.githubusercontent.com/hiddify/hiddify-next/main/test.configs/warp"); //
await profile.add("https://raw.githubusercontent.com/hiddify/hiddify-next/main/test.configs/warp"); //
}
}
}
// Современная большая кнопка с градиентом
class _ModernButton extends StatelessWidget {
const _ModernButton({
super.key,
required this.label,
required this.subtitle,
required this.icon,
required this.gradient,
required this.onTap,
});
final String label;
final String subtitle;
final IconData icon;
final Gradient gradient;
final VoidCallback onTap;
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
return Semantics(
button: true,
child: Material(
elevation: 4,
shadowColor: theme.colorScheme.primary.withOpacity(0.2),
borderRadius: BorderRadius.circular(20),
clipBehavior: Clip.antiAlias,
child: InkWell(
onTap: onTap,
child: Container(
height: 80,
decoration: BoxDecoration(
gradient: gradient,
borderRadius: BorderRadius.circular(20),
),
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 20),
child: Row(
children: [
Container(
width: 56,
height: 56,
decoration: BoxDecoration(
color: theme.colorScheme.surface.withOpacity(0.9),
borderRadius: BorderRadius.circular(16),
),
child: Icon(
icon,
size: 28,
color: theme.colorScheme.primary,
),
),
const Gap(16),
Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
label,
style: theme.textTheme.titleMedium?.copyWith(
fontWeight: FontWeight.bold,
color: theme.colorScheme.onPrimaryContainer,
),
),
const Gap(2),
Text(
subtitle,
style: theme.textTheme.bodySmall?.copyWith(
color: theme.colorScheme.onPrimaryContainer.withOpacity(0.7),
),
),
],
),
),
Icon(
FluentIcons.chevron_right_24_regular,
color: theme.colorScheme.onPrimaryContainer.withOpacity(0.5),
),
],
),
),
),
),
),
);
}
}
// Компактная кнопка для дополнительных опций
class _CompactButton extends StatelessWidget {
const _CompactButton({
super.key,
required this.label,
required this.icon,
required this.color,
required this.onTap,
});
final String label;
final IconData icon;
final Color color;
final VoidCallback onTap;
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
return Semantics(
button: true,
child: Material(
elevation: 2,
color: theme.colorScheme.surface,
surfaceTintColor: theme.colorScheme.surfaceTint,
shadowColor: Colors.transparent,
borderRadius: BorderRadius.circular(12),
clipBehavior: Clip.antiAlias,
child: InkWell(
onTap: onTap,
child: Container(
height: 56,
padding: const EdgeInsets.symmetric(horizontal: 16),
child: Row(
children: [
Container(
width: 40,
height: 40,
decoration: BoxDecoration(
color: color.withOpacity(0.1),
borderRadius: BorderRadius.circular(10),
),
child: Icon(
icon,
size: 20,
color: color,
),
),
const Gap(12),
Expanded(
child: Text(
label,
style: theme.textTheme.titleSmall?.copyWith(
fontWeight: FontWeight.w600,
color: color,
),
),
),
Icon(
FluentIcons.add_24_regular,
size: 20,
color: color.withOpacity(0.5),
),
],
),
),
),
),
);
}
}
class _Button extends StatelessWidget {
const _Button({
super.key,

View File

@@ -2,7 +2,6 @@ import 'package:hiddify/core/database/database_provider.dart';
import 'package:hiddify/core/directories/directories_provider.dart';
import 'package:hiddify/core/http_client/http_client_provider.dart';
import 'package:hiddify/features/config_option/data/config_option_data_providers.dart';
import 'package:hiddify/features/config_option/notifier/config_option_notifier.dart';
import 'package:hiddify/features/profile/data/profile_data_source.dart';
import 'package:hiddify/features/profile/data/profile_path_resolver.dart';
import 'package:hiddify/features/profile/data/profile_repository.dart';

View File

@@ -1,11 +1,8 @@
library json_editor_flutter;
import 'dart:convert';
import 'dart:async';
import 'dart:convert';
import 'dart:math';
import 'dart:ui';
import 'package:dartx/dartx.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
@@ -49,7 +46,7 @@ const Map<String, Map<String, dynamic>> protocolSchemaValues = {
"type": "xray",
"tag": "xray-out",
"xray_outbound_raw": {},
"xray_fragment": {"packets": "tlshello", "interval": "1-10", "length": "1-10"}
"xray_fragment": {"packets": "tlshello", "interval": "1-10", "length": "1-10"},
},
"warp": {"type": "custom", "key": "", "host": "", "port": 808, "fake_packets": "1-10", "fake_packets_size": "1-10", "fake_packets_delay": "1-10", "fake_packets_mode": "m4"},
"vless": {
@@ -107,7 +104,7 @@ const Map<String, Map<String, dynamic>> protocolSchemaValues = {
"password": "goofy_ahh_password",
"tls": {
"enabled": true,
}
},
},
"shadowsocks": {
"type": "shadowsocks",
@@ -159,7 +156,7 @@ const Map<String, Map<String, dynamic>> protocolSchemaValues = {
"fake_packets": "1-10",
"fake_packets_size": "1-10",
"fake_packets_delay": "1-10",
"fake_packets_mode": "m4"
"fake_packets_mode": "m4",
},
"tuic": {
"type": "tuic",
@@ -191,16 +188,16 @@ const Map<String, Map<String, dynamic>> protocolSchemaValues = {
const Map<String, Map<String, Map<String, dynamic>>> exampleSchemaValues = {
"config.outbounds.transport": {
"browser user-agent": {
"header": {"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:128.0) Gecko/20100101 Firefox/128.0"}
}
"header": {"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:128.0) Gecko/20100101 Firefox/128.0"},
},
},
"config.outbounds.tls": {
"fragment": {
"tls_fragment": {"enabled": true, "size": "1-10", "sleep": "1-10"}
"tls_fragment": {"enabled": true, "size": "1-10", "sleep": "1-10"},
},
"utls": {
"utls": {"enabled": true, "fingerprint": "chrome"}
}
"utls": {"enabled": true, "fingerprint": "chrome"},
},
},
"config.outbounds": {
"multiplex": {
@@ -211,7 +208,7 @@ const Map<String, Map<String, Map<String, dynamic>>> exampleSchemaValues = {
"min_streams": 4,
"max_streams": 0,
"padding": false,
"brutal": {"enabled": true, "up_mbps": 100, "down_mbps": 100}
"brutal": {"enabled": true, "up_mbps": 100, "down_mbps": 100},
},
},
"reality": {
@@ -221,7 +218,7 @@ const Map<String, Map<String, Map<String, dynamic>>> exampleSchemaValues = {
"min_version": "",
"max_version": "",
"utls": {"enabled": true, "fingerprint": "chrome"},
"reality": {"enabled": true, "public_key": "", "short_id": ""}
"reality": {"enabled": true, "public_key": "", "short_id": ""},
},
},
"tls": {
@@ -234,25 +231,25 @@ const Map<String, Map<String, Map<String, dynamic>>> exampleSchemaValues = {
"alpn": [],
"min_version": "",
"max_version": "",
"tls_fragment": {"enabled": false, "size": "1-10", "sleep": "1-10"}
"tls_fragment": {"enabled": false, "size": "1-10", "sleep": "1-10"},
},
},
"websocket": {
"transport": {"type": "ws", "path": "", "headers": {}, "max_early_data": 0, "early_data_header_name": ""}
"transport": {"type": "ws", "path": "", "headers": {}, "max_early_data": 0, "early_data_header_name": ""},
},
"grpc": {
"transport": {"type": "grpc", "service_name": "TunService", "idle_timeout": "15s", "ping_timeout": "15s", "permit_without_stream": false}
"transport": {"type": "grpc", "service_name": "TunService", "idle_timeout": "15s", "ping_timeout": "15s", "permit_without_stream": false},
},
"quic": {
"transport": {"type": "quic"}
"transport": {"type": "quic"},
},
"http": {
"transport": {"type": "http", "host": [], "path": "", "method": "", "headers": {}, "idle_timeout": "15s", "ping_timeout": "15s"}
"transport": {"type": "http", "host": [], "path": "", "method": "", "headers": {}, "idle_timeout": "15s", "ping_timeout": "15s"},
},
"httpupgrade": {
"transport": {"type": "httpupgrade", "host": "", "path": "", "headers": {}}
"transport": {"type": "httpupgrade", "host": "", "path": "", "headers": {}},
},
}
},
};
const Map<String, List<String>> possibleValues = {
@@ -284,7 +281,7 @@ const Map<String, List<String>> possibleValues = {
"block",
"socks",
"http",
]
],
};
/// Edit your JSON object with this Widget. Create, edit and format objects
@@ -417,7 +414,7 @@ class _JsonEditorState extends State<JsonEditor> {
Map<String, bool> getExpandedParents() {
final map = <String, bool>{};
for (var key in widget.expandedObjects) {
for (final key in widget.expandedObjects) {
if (key is List) {
final newExpandList = ["config", ...key];
for (int i = newExpandList.length - 1; i > 0; i--) {
@@ -457,9 +454,9 @@ class _JsonEditorState extends State<JsonEditor> {
});
}
void copyData() async {
Future<void> copyData() async {
await Clipboard.setData(
ClipboardData(text: JsonEncoder.withIndent(' ').convert(_data)),
ClipboardData(text: const JsonEncoder.withIndent(' ').convert(_data)),
);
}
@@ -478,7 +475,7 @@ class _JsonEditorState extends State<JsonEditor> {
void findMatchingKeys(data, String text, List nestedParents) {
if (data is Map) {
final keys = data.keys.toList();
for (var key in keys) {
for (final key in keys) {
final keyName = key.toString();
if (keyName.toLowerCase().contains(text) || (data[key] is String && data[key].toString().toLowerCase().contains(text))) {
_results = _results! + 1;
@@ -533,7 +530,7 @@ class _JsonEditorState extends State<JsonEditor> {
void calculateOffset(data, List parents, List toFind) {
if (keyFound) return;
if (data is Map) {
for (var entry in data.entries) {
for (final entry in data.entries) {
if (keyFound) return;
offset++;
final newList = [...parents, entry.key];
@@ -600,7 +597,7 @@ class _JsonEditorState extends State<JsonEditor> {
void expandAllObjects(data, List expandedList) {
if (data is Map) {
for (var entry in data.entries) {
for (final entry in data.entries) {
if (entry.value is Map || entry.value is List) {
final newList = [...expandedList, entry.key];
_expandedObjects[newList.toString()] = true;
@@ -664,7 +661,7 @@ class _JsonEditorState extends State<JsonEditor> {
? const Border(
bottom: BorderSide(color: Colors.red, width: 2),
)
: null),
: null,),
child: Padding(
padding: const EdgeInsets.symmetric(
vertical: 6,
@@ -802,7 +799,6 @@ class _JsonEditorState extends State<JsonEditor> {
controller: _controller,
onChanged: parseData,
maxLines: null,
minLines: null,
expands: true,
textAlignVertical: TextAlignVertical.top,
decoration: const InputDecoration(
@@ -853,7 +849,7 @@ class _Holder extends StatefulWidget {
// ? '.${parentObject['type']}'
// : '';
return '$basePath';
return basePath;
}
@override
@@ -885,9 +881,9 @@ class _HolderState extends State<_Holder> {
widget.setState(() {});
} else if (selectedItem == "map") {
if (widget.data is Map) {
widget.data[_newKey] = Map<String, dynamic>();
widget.data[_newKey] = <String, dynamic>{};
} else {
widget.data.add(Map<String, dynamic>());
widget.data.add(<String, dynamic>{});
}
setState(() {});
@@ -951,7 +947,7 @@ class _HolderState extends State<_Holder> {
var res = "{";
if (data is Map<String, dynamic>) {
if (widget.expandedObjects[widget.allParents.toString()] ?? false) return "";
final content = data as Map<String, dynamic>;
final content = data;
//res += "${data.length}";
if (content["type"] != null) {
res += "${content["type"]}";
@@ -963,10 +959,10 @@ class _HolderState extends State<_Holder> {
res += " [${d.substring(0, min(20, d.length))}...]";
}
} else if (data is List) {
final content = data as List;
final content = data;
res += "${content.length}";
}
return res + "}";
return "$res}";
}
@override
@@ -975,7 +971,7 @@ class _HolderState extends State<_Holder> {
final mapWidget = <Widget>[];
final widgetData = widget.data as Map<String, dynamic>;
final List<String> keys = widgetData.keys.toList();
for (var key in keys) {
for (final key in keys) {
mapWidget.add(_Holder(
key: Key(key),
data: widget.data[key],
@@ -987,7 +983,7 @@ class _HolderState extends State<_Holder> {
matchedKeys: widget.matchedKeys,
allParents: [...widget.allParents, key],
expandedObjects: widget.expandedObjects,
));
),);
}
return Column(
@@ -1065,7 +1061,7 @@ class _HolderState extends State<_Holder> {
matchedKeys: widget.matchedKeys,
allParents: [...widget.allParents, i],
expandedObjects: widget.expandedObjects,
));
),);
}
return Column(
@@ -1280,8 +1276,7 @@ class _ReplaceTextWithFieldState extends State<_ReplaceTextWithField> {
child: DropdownButton<String>(
hint: Text('Select ${widget.keyPath.replaceAll("config.outbounds", "")}'),
value: _text,
icon: Icon(Icons.arrow_downward),
iconSize: 24,
icon: const Icon(Icons.arrow_downward),
elevation: 16,
underline: Container(
height: 2,
@@ -1384,7 +1379,7 @@ class _Options<T> extends StatelessWidget {
SizedBox(width: 10),
Text("Insert", style: TextStyle(fontSize: 14)),
],
)),
),),
if (keyPath != "config" && T == List)
const _PopupMenuWidget(Row(
mainAxisSize: MainAxisSize.min,
@@ -1394,20 +1389,20 @@ class _Options<T> extends StatelessWidget {
SizedBox(width: 10),
Text("Append", style: TextStyle(fontSize: 14)),
],
)),
),),
if (keyPath != "config" && (T == Map || T == List)) ...[
if (keyPath == "config.outbounds" && T == List) ...[
for (final String key in protocolSchemaValues.keys) ...{
PopupMenuItem<_OptionItems>(
height: _popupMenuHeight,
padding: EdgeInsets.only(left: _popupMenuItemPadding),
padding: const EdgeInsets.only(left: _popupMenuItemPadding),
value: key,
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Icon(Icons.data_object),
SizedBox(width: 10),
Text(key, style: TextStyle(fontSize: 14)),
const Icon(Icons.data_object),
const SizedBox(width: 10),
Text(key, style: const TextStyle(fontSize: 14)),
],
),
),
@@ -1420,14 +1415,14 @@ class _Options<T> extends StatelessWidget {
for (final String key2 in exampleSchemaValues[key]!.keys) ...{
PopupMenuItem<_OptionItems>(
height: _popupMenuHeight,
padding: EdgeInsets.only(left: _popupMenuItemPadding),
value: key + "___" + key2,
padding: const EdgeInsets.only(left: _popupMenuItemPadding),
value: "${key}___$key2",
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Icon(Icons.data_object),
SizedBox(width: 10),
Text(key2, style: TextStyle(fontSize: 14)),
const Icon(Icons.data_object),
const SizedBox(width: 10),
Text(key2, style: const TextStyle(fontSize: 14)),
],
),
),
@@ -1573,12 +1568,12 @@ class _SearchField extends StatelessWidget {
decoration: InputDecoration(
hintText: "Search",
hintStyle: Theme.of(context).textTheme.bodySmall,
constraints: BoxConstraints(maxWidth: 100),
constraints: const BoxConstraints(maxWidth: 100),
border: InputBorder.none,
// fillColor: Colors.transparent,
// filled: true,
isDense: true,
contentPadding: EdgeInsets.all(3),
contentPadding: const EdgeInsets.all(3),
focusedBorder: InputBorder.none,
// hoverColor: Colors.transparent,
),

View File

@@ -54,9 +54,9 @@ class ProfileDetailsNotifier extends _$ProfileDetailsNotifier with AppLogger {
if (configContent.isNotEmpty) {
try {
final jsonObject = jsonDecode(configContent);
List<Map<String, dynamic>> res = [];
final List<Map<String, dynamic>> res = [];
if (jsonObject is Map<String, dynamic> && jsonObject['outbounds'] is List) {
for (var outbound in jsonObject['outbounds'] as List<dynamic>) {
for (final outbound in jsonObject['outbounds'] as List<dynamic>) {
if (outbound is Map<String, dynamic> && outbound['type'] != null && !['selector', 'urltest', 'dns', 'block'].contains(outbound['type']) && !['direct', 'bypass', 'direct-fragment'].contains(outbound['tag'])) {
res.add(outbound);
}

View File

@@ -279,7 +279,7 @@ class ProfileDetailsPage extends HookConsumerWidget with PresLogger {
expandedObjects: const ["outbounds"],
onChanged: (value) {
if (value == null) return;
const encoder = const JsonEncoder.withIndent(' ');
const encoder = JsonEncoder.withIndent(' ');
notifier.setField(configContent: encoder.convert(value));
},

View File

@@ -76,7 +76,7 @@ class AddProfile extends _$AddProfile with AppLogger {
} else if (LinkParser.protocol(rawInput) case (final parsed)?) {
loggy.debug("adding profile, content");
var name = parsed.name;
var oldItem = await _profilesRepo.getByName(name);
final oldItem = await _profilesRepo.getByName(name);
if (name == "Hiddify WARP" && oldItem != null) {
_profilesRepo.deleteById(oldItem.id).run();
}
@@ -111,10 +111,10 @@ class AddProfile extends _$AddProfile with AppLogger {
Future<void> check4Warp(String rawInput) async {
for (final line in rawInput.split("\n")) {
if (line.toLowerCase().startsWith("warp://")) {
final _prefs = ref.read(sharedPreferencesProvider).requireValue;
final _warp = ref.read(warpOptionNotifierProvider.notifier);
final prefs = ref.read(sharedPreferencesProvider).requireValue;
final warp = ref.read(warpOptionNotifierProvider.notifier);
final consent = false && (_prefs.getBool(WarpOptionNotifier.warpConsentGiven) ?? false);
final consent = false && (prefs.getBool(WarpOptionNotifier.warpConsentGiven) ?? false);
final t = ref.read(translationsProvider);
final notification = ref.read(inAppNotificationControllerProvider);
@@ -126,24 +126,24 @@ class AddProfile extends _$AddProfile with AppLogger {
);
if (agreed ?? false) {
await _prefs.setBool(WarpOptionNotifier.warpConsentGiven, true);
await prefs.setBool(WarpOptionNotifier.warpConsentGiven, true);
final toast = notification.showInfoToast(t.profile.add.addingWarpMsg, duration: const Duration(milliseconds: 100));
toast?.pause();
await _warp.generateWarpConfig();
await warp.generateWarpConfig();
toast?.start();
} else {
return;
}
}
final accountId = _prefs.getString("warp2-account-id");
final accessToken = _prefs.getString("warp2-access-token");
final accountId = prefs.getString("warp2-account-id");
final accessToken = prefs.getString("warp2-access-token");
final hasWarp2Config = accountId != null && accessToken != null;
if (!hasWarp2Config || true) {
final toast = notification.showInfoToast(t.profile.add.addingWarpMsg, duration: const Duration(milliseconds: 100));
toast?.pause();
await _warp.generateWarp2Config();
await warp.generateWarp2Config();
toast?.start();
}
}

View File

@@ -80,6 +80,13 @@ class ProfilesOverviewModal extends HookConsumerWidget {
onPressed: () {
const AddProfileRoute().push(context);
},
style: FilledButton.styleFrom(
backgroundColor: Theme.of(context).brightness == Brightness.dark
? const Color(0xFF37474F) // Светлее для темной темы
: const Color(0xFF263238), // Темнее для светлой темы
foregroundColor: Colors.white,
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 12),
),
icon: const Icon(FluentIcons.add_24_filled),
label: Text(t.profile.add.shortBtnTxt),
),
@@ -92,6 +99,13 @@ class ProfilesOverviewModal extends HookConsumerWidget {
},
);
},
style: FilledButton.styleFrom(
backgroundColor: Theme.of(context).brightness == Brightness.dark
? const Color(0xFF37474F) // Светлее для темной темы
: const Color(0xFF263238), // Темнее для светлой темы
foregroundColor: Colors.white,
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 12),
),
icon: const Icon(FluentIcons.arrow_sort_24_filled),
label: Text(t.general.sort),
),
@@ -103,6 +117,13 @@ class ProfilesOverviewModal extends HookConsumerWidget {
)
.trigger();
},
style: FilledButton.styleFrom(
backgroundColor: Theme.of(context).brightness == Brightness.dark
? const Color(0xFF37474F) // Светлее для темной темы
: const Color(0xFF263238), // Темнее для светлой темы
foregroundColor: Colors.white,
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 12),
),
icon: const Icon(FluentIcons.arrow_sync_24_filled),
label: Text(t.profile.update.updateSubscriptions),
),
@@ -123,8 +144,7 @@ class ProfilesSortModal extends HookConsumerWidget {
@override
Widget build(BuildContext context, WidgetRef ref) {
final t = ref.watch(translationsProvider);
final sortNotifier =
ref.watch(profilesOverviewSortNotifierProvider.notifier);
final sortNotifier = ref.watch(profilesOverviewSortNotifierProvider.notifier);
return AlertDialog(
title: Text(t.general.sortBy),
@@ -137,8 +157,7 @@ class ProfilesSortModal extends HookConsumerWidget {
...ProfilesSort.values.map(
(e) {
final selected = sort.by == e;
final double arrowTurn =
sort.mode == SortMode.ascending ? 0 : 0.5;
final double arrowTurn = sort.mode == SortMode.ascending ? 0 : 0.5;
return ListTile(
title: Text(e.present(t)),

View File

@@ -63,7 +63,6 @@ class ProfileTile extends HookConsumerWidget {
),
shadowColor: Colors.transparent,
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
if (profile is RemoteProfileEntity || !isMain) ...[
SizedBox(