Improve accessability
This commit is contained in:
@@ -4,6 +4,7 @@ import 'package:flutter_localizations/flutter_localizations.dart';
|
||||
import 'package:hiddify/core/core_providers.dart';
|
||||
import 'package:hiddify/core/prefs/prefs.dart';
|
||||
import 'package:hiddify/core/router/router.dart';
|
||||
import 'package:hiddify/domain/constants.dart';
|
||||
import 'package:hiddify/features/common/common_controllers.dart';
|
||||
import 'package:hiddify/utils/utils.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
@@ -20,12 +21,13 @@ class AppView extends HookConsumerWidget with PresLogger {
|
||||
ref.watch(commonControllersProvider);
|
||||
|
||||
return MaterialApp.router(
|
||||
builder: (context, child) {
|
||||
return AccessibilityTools(
|
||||
checkFontOverflows: true,
|
||||
child: child,
|
||||
);
|
||||
},
|
||||
// builder: (context, child) {
|
||||
// return AccessibilityTools(
|
||||
// checkFontOverflows: true,
|
||||
// child: child,
|
||||
// );
|
||||
// },
|
||||
// showSemanticsDebugger: true,
|
||||
routerConfig: router,
|
||||
locale: locale,
|
||||
supportedLocales: AppLocaleUtils.supportedLocales,
|
||||
@@ -34,7 +36,7 @@ class AppView extends HookConsumerWidget with PresLogger {
|
||||
themeMode: theme.mode,
|
||||
theme: theme.light(),
|
||||
darkTheme: theme.dark(),
|
||||
title: 'Hiddify Next',
|
||||
title: Constants.appName,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
abstract class Constants {
|
||||
static const appName = "Hiddify Next";
|
||||
static const geoipFileName = "geoip.db";
|
||||
static const geositeFileName = "geosite.db";
|
||||
static const configsFolderName = "configs";
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/rendering.dart';
|
||||
import 'package:gap/gap.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:hiddify/core/core_providers.dart';
|
||||
@@ -48,7 +49,6 @@ class ProfileTile extends HookConsumerWidget {
|
||||
profile.active ? theme.colorScheme.outlineVariant : Colors.transparent;
|
||||
|
||||
return Card(
|
||||
semanticContainer: false,
|
||||
margin: effectiveMargin,
|
||||
elevation: effectiveElevation,
|
||||
shape: RoundedRectangleBorder(
|
||||
@@ -62,7 +62,10 @@ class ProfileTile extends HookConsumerWidget {
|
||||
children: [
|
||||
SizedBox(
|
||||
width: 48,
|
||||
child: ProfileActionButton(profile, !isMain),
|
||||
child: Semantics(
|
||||
sortKey: const OrdinalSortKey(1),
|
||||
child: ProfileActionButton(profile, !isMain),
|
||||
),
|
||||
),
|
||||
VerticalDivider(
|
||||
width: 1,
|
||||
@@ -71,9 +74,14 @@ class ProfileTile extends HookConsumerWidget {
|
||||
Flexible(
|
||||
child: Semantics(
|
||||
button: true,
|
||||
sortKey: isMain ? const OrdinalSortKey(0) : null,
|
||||
focused: isMain,
|
||||
liveRegion: isMain,
|
||||
namesRoute: isMain,
|
||||
label: isMain
|
||||
? t.profile.overviewPageTitle
|
||||
: t.profile.edit.selectActiveTxt,
|
||||
? t.profile.activeProfileBtnSemanticLabel
|
||||
: t.profile
|
||||
.nonActiveProfileBtnSemanticLabel(name: profile.name),
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
if (isMain) {
|
||||
@@ -110,6 +118,10 @@ class ProfileTile extends HookConsumerWidget {
|
||||
Flexible(
|
||||
child: Text(
|
||||
profile.name,
|
||||
semanticsLabel: t.profile
|
||||
.activeProfileNameSemanticLabel(
|
||||
name: profile.name,
|
||||
),
|
||||
style: theme.textTheme.titleMedium,
|
||||
),
|
||||
),
|
||||
@@ -121,6 +133,10 @@ class ProfileTile extends HookConsumerWidget {
|
||||
else
|
||||
Text(
|
||||
profile.name,
|
||||
semanticsLabel:
|
||||
t.profile.nonActiveProfileNameSemanticLabel(
|
||||
name: profile.name,
|
||||
),
|
||||
style: theme.textTheme.titleMedium,
|
||||
),
|
||||
if (subInfo != null) ...[
|
||||
@@ -320,6 +336,11 @@ class ProfileSubscriptionInfo extends HookConsumerWidget {
|
||||
subInfo.total > 10 * 1099511627776 //10TB
|
||||
? "∞ GiB"
|
||||
: subInfo.consumption.sizeOf(subInfo.total),
|
||||
semanticsLabel:
|
||||
t.profile.subscription.remainingTrafficSemanticLabel(
|
||||
consumed: subInfo.consumption.sizeGB(),
|
||||
total: subInfo.total.sizeGB(),
|
||||
),
|
||||
style: theme.textTheme.bodySmall,
|
||||
),
|
||||
),
|
||||
|
||||
@@ -2,6 +2,7 @@ import 'dart:io';
|
||||
|
||||
import 'package:hiddify/core/core_providers.dart';
|
||||
import 'package:hiddify/domain/connectivity/connectivity.dart';
|
||||
import 'package:hiddify/domain/constants.dart';
|
||||
import 'package:hiddify/features/common/connectivity/connectivity_controller.dart';
|
||||
import 'package:hiddify/features/common/window/window_controller.dart';
|
||||
import 'package:hiddify/gen/assets.gen.dart';
|
||||
@@ -22,6 +23,7 @@ class SystemTrayController extends _$SystemTrayController
|
||||
_trayIconPath,
|
||||
isTemplate: Platform.isMacOS,
|
||||
);
|
||||
if (!Platform.isLinux) await trayManager.setToolTip(Constants.appName);
|
||||
trayManager.addListener(this);
|
||||
_initialized = true;
|
||||
}
|
||||
|
||||
@@ -6,6 +6,8 @@ extension ByteFormatter on int {
|
||||
static final _sizeOfFormat =
|
||||
InformationSizeFormat(permissibleValueUnits: {InformationUnit.gibibyte});
|
||||
|
||||
String sizeGB() => _sizeOfFormat.format(bytes());
|
||||
|
||||
String sizeOf(int total) =>
|
||||
"${_sizeOfFormat.format(bytes())} / ${_sizeOfFormat.format(total.bytes())}";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user