backup: before config simplification - quick settings mode

This commit is contained in:
Hiddify User
2025-12-26 03:08:20 +03:00
parent 3b9d3ef2b7
commit f1591ae399

View File

@@ -19,8 +19,10 @@ class ActiveProxyFooter extends HookConsumerWidget {
@override @override
Widget build(BuildContext context, WidgetRef ref) { Widget build(BuildContext context, WidgetRef ref) {
final t = ref.watch(translationsProvider); final t = ref.watch(translationsProvider);
final theme = Theme.of(context);
final activeProxy = ref.watch(activeProxyNotifierProvider); final activeProxy = ref.watch(activeProxyNotifierProvider);
final ipInfo = ref.watch(ipInfoNotifierProvider); final ipInfo = ref.watch(ipInfoNotifierProvider);
final stats = ref.watch(statsNotifierProvider).value;
return AnimatedVisibility( return AnimatedVisibility(
axis: Axis.vertical, axis: Axis.vertical,
@@ -28,81 +30,215 @@ class ActiveProxyFooter extends HookConsumerWidget {
child: switch (activeProxy) { child: switch (activeProxy) {
AsyncData(value: final proxy) => Padding( AsyncData(value: final proxy) => Padding(
padding: const EdgeInsets.symmetric(vertical: 12, horizontal: 16), padding: const EdgeInsets.symmetric(vertical: 12, horizontal: 16),
child: Row( child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Flexible( // Карточка с информацией о прокси и локации
child: Column( Card(
crossAxisAlignment: CrossAxisAlignment.start, elevation: 2,
children: [ shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(16)),
_InfoProp( child: Padding(
icon: FluentIcons.arrow_routing_20_regular, padding: const EdgeInsets.all(16),
text: proxy.selectedName.isNotNullOrBlank child: Column(
? proxy.selectedName! crossAxisAlignment: CrossAxisAlignment.start,
: proxy.name, children: [
semanticLabel: t.proxies.activeProxySemanticLabel, // Название прокси
), Row(
const Gap(8), children: [
switch (ipInfo) { Icon(
AsyncData(value: final info) => Row( FluentIcons.arrow_routing_20_regular,
children: [ size: 20,
IPCountryFlag(countryCode: info.countryCode), color: theme.colorScheme.primary,
const Gap(8), ),
IPText( const Gap(12),
ip: info.ip, Expanded(
onLongPress: () async { child: Text(
ref proxy.selectedName.isNotNullOrBlank
.read(ipInfoNotifierProvider.notifier) ? proxy.selectedName!
.refresh(); : proxy.name,
}, semanticsLabel: t.proxies.activeProxySemanticLabel,
style: theme.textTheme.titleMedium?.copyWith(
fontWeight: FontWeight.w600,
fontFamily: FontFamily.emoji,
),
overflow: TextOverflow.ellipsis,
), ),
], ),
), ],
AsyncError(error: final UnknownIp _) => Row( ),
children: [ const Gap(12),
const Icon(FluentIcons.arrow_sync_20_regular), const Divider(height: 1),
const Gap(8), const Gap(12),
UnknownIPText( // Информация о стране
text: t.proxies.checkIp, switch (ipInfo) {
onTap: () async { AsyncData(value: final info) => InkWell(
ref onTap: () async {
.read(ipInfoNotifierProvider.notifier) ref.read(ipInfoNotifierProvider.notifier).refresh();
.refresh(); },
}, borderRadius: BorderRadius.circular(8),
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 4),
child: Row(
children: [
IPCountryFlag(countryCode: info.countryCode),
const Gap(12),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
info.countryCode.toUpperCase(),
style: theme.textTheme.bodyLarge?.copyWith(
fontWeight: FontWeight.w500,
),
),
if (info.org?.isNotEmpty ?? false)
Text(
info.org!,
style: theme.textTheme.bodySmall?.copyWith(
color: theme.colorScheme.onSurfaceVariant,
),
overflow: TextOverflow.ellipsis,
),
],
),
),
],
),
), ),
], ),
), AsyncError(error: final UnknownIp _) => InkWell(
AsyncError() => Row( onTap: () async {
children: [ ref.read(ipInfoNotifierProvider.notifier).refresh();
const Icon(FluentIcons.error_circle_20_regular), },
const Gap(8), borderRadius: BorderRadius.circular(8),
UnknownIPText( child: Padding(
text: t.proxies.unknownIp, padding: const EdgeInsets.symmetric(vertical: 4),
onTap: () async { child: Row(
ref children: [
.read(ipInfoNotifierProvider.notifier) const Icon(FluentIcons.arrow_sync_20_regular),
.refresh(); const Gap(12),
}, Text(
t.proxies.checkIp,
style: theme.textTheme.bodyMedium,
),
],
),
), ),
], ),
), AsyncError() => InkWell(
_ => const Row( onTap: () async {
ref.read(ipInfoNotifierProvider.notifier).refresh();
},
borderRadius: BorderRadius.circular(8),
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 4),
child: Row(
children: [
Icon(
FluentIcons.error_circle_20_regular,
color: theme.colorScheme.error,
),
const Gap(12),
Text(
t.proxies.unknownIp,
style: theme.textTheme.bodyMedium?.copyWith(
color: theme.colorScheme.error,
),
),
],
),
),
),
_ => const Padding(
padding: EdgeInsets.symmetric(vertical: 4),
child: Row(
children: [
Icon(FluentIcons.question_circle_20_regular),
Gap(12),
Expanded(
child: ShimmerSkeleton(height: 16, widthFactor: 0.6),
),
],
),
),
},
],
),
),
),
const Gap(12),
// Карточки со статистикой
Row(
children: [
Expanded(
child: Card(
elevation: 2,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(16)),
child: Padding(
padding: const EdgeInsets.all(16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Icon(FluentIcons.question_circle_20_regular), Icon(
Gap(8), FluentIcons.arrow_bidirectional_up_down_20_regular,
Flexible( size: 24,
child: ShimmerSkeleton( color: theme.colorScheme.secondary,
height: 16, ),
widthFactor: 1, const Gap(8),
Text(
(stats?.downlinkTotal ?? 0).size(),
semanticsLabel: t.stats.totalTransferred,
style: theme.textTheme.titleLarge?.copyWith(
fontWeight: FontWeight.bold,
),
),
Text(
t.stats.totalTransferred,
style: theme.textTheme.bodySmall?.copyWith(
color: theme.colorScheme.onSurfaceVariant,
), ),
), ),
], ],
), ),
}, ),
], ),
), ),
const Gap(12),
Expanded(
child: Card(
elevation: 2,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(16)),
child: Padding(
padding: const EdgeInsets.all(16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Icon(
FluentIcons.arrow_download_20_regular,
size: 24,
color: theme.colorScheme.tertiary,
),
const Gap(8),
Text(
(stats?.downlink ?? 0).speed(),
semanticsLabel: t.stats.speed,
style: theme.textTheme.titleLarge?.copyWith(
fontWeight: FontWeight.bold,
),
),
Text(
t.stats.speed,
style: theme.textTheme.bodySmall?.copyWith(
color: theme.colorScheme.onSurfaceVariant,
),
),
],
),
),
),
),
],
), ),
const _StatsColumn(),
], ],
), ),
), ),
@@ -112,38 +248,6 @@ class ActiveProxyFooter extends HookConsumerWidget {
} }
} }
class _StatsColumn extends HookConsumerWidget {
const _StatsColumn();
@override
Widget build(BuildContext context, WidgetRef ref) {
final t = ref.watch(translationsProvider);
final stats = ref.watch(statsNotifierProvider).value;
return Directionality(
textDirection: TextDirection.values[
(Directionality.of(context).index + 1) % TextDirection.values.length],
child: Flexible(
child: Column(
children: [
_InfoProp(
icon: FluentIcons.arrow_bidirectional_up_down_20_regular,
text: (stats?.downlinkTotal ?? 0).size(),
semanticLabel: t.stats.totalTransferred,
),
const Gap(8),
_InfoProp(
icon: FluentIcons.arrow_download_20_regular,
text: (stats?.downlink ?? 0).speed(),
semanticLabel: t.stats.speed,
),
],
),
),
);
}
}
class _InfoProp extends StatelessWidget { class _InfoProp extends StatelessWidget {
const _InfoProp({ const _InfoProp({
required this.icon, required this.icon,