Improve ping indicator

This commit is contained in:
problematicconsumer
2024-02-15 12:25:04 +03:30
parent 19f6ac8ab0
commit 97a308a351
3 changed files with 24 additions and 9 deletions

View File

@@ -16,7 +16,8 @@
"agree": "Agree", "agree": "Agree",
"decline": "Decline", "decline": "Decline",
"unknown": "Unknown", "unknown": "Unknown",
"hidden": "Hidden" "hidden": "Hidden",
"timeout": "timeout"
}, },
"intro": { "intro": {
"termsAndPolicyCaution(rich)": "by continuing you agree with ${tap(@:about.termsAndConditions)}", "termsAndPolicyCaution(rich)": "by continuing you agree with ${tap(@:about.termsAndConditions)}",
@@ -132,6 +133,7 @@
"activeProxySemanticLabel": "Active proxy", "activeProxySemanticLabel": "Active proxy",
"delaySemantics": { "delaySemantics": {
"result": "delay: ${delay}ms", "result": "delay: ${delay}ms",
"timeout": "delay test timeout",
"testing": "delay: testing..." "testing": "delay: testing..."
}, },
"ipInfoSemantics": { "ipInfoSemantics": {

View File

@@ -11,6 +11,7 @@ extension AppLocaleX on AppLocale {
"ru" => "Русский", "ru" => "Русский",
"zh" || "zh_CN" => "中文", "zh" || "zh_CN" => "中文",
"tr" => "Türkçe", "tr" => "Türkçe",
"es" => "Spanish",
_ => "Unknown", _ => "Unknown",
}; };
} }

View File

@@ -23,6 +23,7 @@ class ActiveProxyDelayIndicator extends HookConsumerWidget {
switch (activeProxy) { switch (activeProxy) {
case AsyncData(value: final proxy): case AsyncData(value: final proxy):
final delay = proxy.urlTestDelay; final delay = proxy.urlTestDelay;
final timeout = delay > 65000;
return Center( return Center(
child: InkWell( child: InkWell(
onTap: () async { onTap: () async {
@@ -41,17 +42,28 @@ class ActiveProxyDelayIndicator extends HookConsumerWidget {
const Gap(8), const Gap(8),
if (delay > 0) if (delay > 0)
Text.rich( Text.rich(
semanticsLabel: semanticsLabel: timeout
t.proxies.delaySemantics.result(delay: delay), ? t.proxies.delaySemantics.timeout
: t.proxies.delaySemantics.result(delay: delay),
TextSpan( TextSpan(
children: [ children: [
if (timeout)
TextSpan( TextSpan(
text: delay > 65000 ? "×" : delay.toString(), text: t.general.timeout,
style: theme.textTheme.titleMedium?.copyWith(
fontWeight: FontWeight.bold,
color: theme.colorScheme.error,
),
)
else ...[
TextSpan(
text: delay.toString(),
style: theme.textTheme.titleMedium style: theme.textTheme.titleMedium
?.copyWith(fontWeight: FontWeight.bold), ?.copyWith(fontWeight: FontWeight.bold),
), ),
const TextSpan(text: " ms"), const TextSpan(text: " ms"),
], ],
],
), ),
) )
else else