backup: before config simplification - quick settings mode
This commit is contained in:
@@ -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(
|
// Карточка с информацией о прокси и локации
|
||||||
|
Card(
|
||||||
|
elevation: 2,
|
||||||
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(16)),
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(16),
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
_InfoProp(
|
// Название прокси
|
||||||
icon: FluentIcons.arrow_routing_20_regular,
|
Row(
|
||||||
text: proxy.selectedName.isNotNullOrBlank
|
children: [
|
||||||
|
Icon(
|
||||||
|
FluentIcons.arrow_routing_20_regular,
|
||||||
|
size: 20,
|
||||||
|
color: theme.colorScheme.primary,
|
||||||
|
),
|
||||||
|
const Gap(12),
|
||||||
|
Expanded(
|
||||||
|
child: Text(
|
||||||
|
proxy.selectedName.isNotNullOrBlank
|
||||||
? proxy.selectedName!
|
? proxy.selectedName!
|
||||||
: proxy.name,
|
: proxy.name,
|
||||||
semanticLabel: t.proxies.activeProxySemanticLabel,
|
semanticsLabel: t.proxies.activeProxySemanticLabel,
|
||||||
|
style: theme.textTheme.titleMedium?.copyWith(
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
fontFamily: FontFamily.emoji,
|
||||||
),
|
),
|
||||||
const Gap(8),
|
overflow: TextOverflow.ellipsis,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
const Gap(12),
|
||||||
|
const Divider(height: 1),
|
||||||
|
const Gap(12),
|
||||||
|
// Информация о стране
|
||||||
switch (ipInfo) {
|
switch (ipInfo) {
|
||||||
AsyncData(value: final info) => Row(
|
AsyncData(value: final info) => InkWell(
|
||||||
|
onTap: () async {
|
||||||
|
ref.read(ipInfoNotifierProvider.notifier).refresh();
|
||||||
|
},
|
||||||
|
borderRadius: BorderRadius.circular(8),
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(vertical: 4),
|
||||||
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
IPCountryFlag(countryCode: info.countryCode),
|
IPCountryFlag(countryCode: info.countryCode),
|
||||||
const Gap(8),
|
const Gap(12),
|
||||||
IPText(
|
Expanded(
|
||||||
ip: info.ip,
|
child: Column(
|
||||||
onLongPress: () async {
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
ref
|
children: [
|
||||||
.read(ipInfoNotifierProvider.notifier)
|
Text(
|
||||||
.refresh();
|
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 _) => Row(
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
AsyncError(error: final UnknownIp _) => InkWell(
|
||||||
|
onTap: () async {
|
||||||
|
ref.read(ipInfoNotifierProvider.notifier).refresh();
|
||||||
|
},
|
||||||
|
borderRadius: BorderRadius.circular(8),
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(vertical: 4),
|
||||||
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
const Icon(FluentIcons.arrow_sync_20_regular),
|
const Icon(FluentIcons.arrow_sync_20_regular),
|
||||||
const Gap(8),
|
const Gap(12),
|
||||||
UnknownIPText(
|
Text(
|
||||||
text: t.proxies.checkIp,
|
t.proxies.checkIp,
|
||||||
onTap: () async {
|
style: theme.textTheme.bodyMedium,
|
||||||
ref
|
|
||||||
.read(ipInfoNotifierProvider.notifier)
|
|
||||||
.refresh();
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
AsyncError() => Row(
|
),
|
||||||
|
),
|
||||||
|
AsyncError() => InkWell(
|
||||||
|
onTap: () async {
|
||||||
|
ref.read(ipInfoNotifierProvider.notifier).refresh();
|
||||||
|
},
|
||||||
|
borderRadius: BorderRadius.circular(8),
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(vertical: 4),
|
||||||
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
const Icon(FluentIcons.error_circle_20_regular),
|
Icon(
|
||||||
const Gap(8),
|
FluentIcons.error_circle_20_regular,
|
||||||
UnknownIPText(
|
color: theme.colorScheme.error,
|
||||||
text: t.proxies.unknownIp,
|
),
|
||||||
onTap: () async {
|
const Gap(12),
|
||||||
ref
|
Text(
|
||||||
.read(ipInfoNotifierProvider.notifier)
|
t.proxies.unknownIp,
|
||||||
.refresh();
|
style: theme.textTheme.bodyMedium?.copyWith(
|
||||||
},
|
color: theme.colorScheme.error,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
_ => const Row(
|
),
|
||||||
|
),
|
||||||
|
_ => const Padding(
|
||||||
|
padding: EdgeInsets.symmetric(vertical: 4),
|
||||||
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
Icon(FluentIcons.question_circle_20_regular),
|
Icon(FluentIcons.question_circle_20_regular),
|
||||||
Gap(8),
|
Gap(12),
|
||||||
Flexible(
|
Expanded(
|
||||||
child: ShimmerSkeleton(
|
child: ShimmerSkeleton(height: 16, widthFactor: 0.6),
|
||||||
height: 16,
|
|
||||||
widthFactor: 1,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const _StatsColumn(),
|
),
|
||||||
|
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: [
|
||||||
|
Icon(
|
||||||
|
FluentIcons.arrow_bidirectional_up_down_20_regular,
|
||||||
|
size: 24,
|
||||||
|
color: theme.colorScheme.secondary,
|
||||||
|
),
|
||||||
|
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,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -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,
|
||||||
|
|||||||
Reference in New Issue
Block a user