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

View File

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

View File

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