Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/accessibility fixes #70

Merged
merged 12 commits into from
Nov 17, 2024
9 changes: 8 additions & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,10 @@ android {

signingConfigs {
release {
storeFile file(System.getenv("AVM_KEYSTORE_FILE"))
def keystorePath = System.getenv("AVM_KEYSTORE_FILE")
if (keystorePath != null) {
storeFile file(keystorePath)
}
storePassword System.getenv("AVM_KEYSTORE_PASSWORD")
keyAlias System.getenv("AVM_KEY_ALIAS")
keyPassword System.getenv("AVM_KEY_PASSWORD")
Expand All @@ -70,6 +73,10 @@ android {
release {
signingConfig signingConfigs.release
}

debug {
// no signing config for debug builds
}
}
}

Expand Down
1 change: 1 addition & 0 deletions devtools_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
extensions:
42 changes: 42 additions & 0 deletions lib/l10n/app_localizations.dart
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,48 @@ abstract class AppLocalizations {
/// **'Podpísať iným certifikátom'**
String get buttonSignWithDifferentCertificateLabel;

/// No description provided for @buttonMenuLabelSemantics.
///
/// In sk, this message translates to:
/// **'Otvoriť menu'**
String get buttonMenuLabelSemantics;

/// No description provided for @qrCodeScannerTorchOnSemantics.
///
/// In sk, this message translates to:
/// **'Zapnúť blesk'**
String get qrCodeScannerTorchOnSemantics;

/// No description provided for @qrCodeScannerTorchOffSemantics.
///
/// In sk, this message translates to:
/// **'Vypnúť blesk'**
String get qrCodeScannerTorchOffSemantics;

/// No description provided for @qrCodeScannerBackSemantics.
///
/// In sk, this message translates to:
/// **'Späť'**
String get qrCodeScannerBackSemantics;

/// No description provided for @qrCodeScannerOpenSemantics.
///
/// In sk, this message translates to:
/// **'Podpísať vzdialený dokument pomocou QR kódu'**
String get qrCodeScannerOpenSemantics;

/// No description provided for @shareDocumentPreviewSemantics.
///
/// In sk, this message translates to:
/// **'Zdieľať náhľad dokumentu'**
String get shareDocumentPreviewSemantics;

/// No description provided for @previewDocumentSemantics.
///
/// In sk, this message translates to:
/// **'Náhľad dokumentu'**
String get previewDocumentSemantics;

/// No description provided for @deepLinkParseErrorMessage.
///
/// In sk, this message translates to:
Expand Down
21 changes: 21 additions & 0 deletions lib/l10n/app_localizations_sk.dart
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,27 @@ class AppLocalizationsSk extends AppLocalizations {
@override
String get buttonSignWithDifferentCertificateLabel => 'Podpísať iným certifikátom';

@override
String get buttonMenuLabelSemantics => 'Otvoriť menu';

@override
String get qrCodeScannerTorchOnSemantics => 'Zapnúť blesk';

@override
String get qrCodeScannerTorchOffSemantics => 'Vypnúť blesk';

@override
String get qrCodeScannerBackSemantics => 'Späť';

@override
String get qrCodeScannerOpenSemantics => 'Podpísať vzdialený dokument pomocou QR kódu';

@override
String get shareDocumentPreviewSemantics => 'Zdieľať náhľad dokumentu';

@override
String get previewDocumentSemantics => 'Náhľad dokumentu';

@override
String deepLinkParseErrorMessage(Object error) {
return 'Nepodporovaný alebo nesprávny odkaz:\n$error';
Expand Down
7 changes: 7 additions & 0 deletions lib/l10n/app_sk.arb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@
"buttonSelectCertificateLabel": "Vybrať certifikát",
"buttonSignWithCertificateLabel": "Podpísať ako {subject}",
"buttonSignWithDifferentCertificateLabel": "Podpísať iným certifikátom",
"buttonMenuLabelSemantics": "Otvoriť menu",
"qrCodeScannerTorchOnSemantics": "Zapnúť blesk",
"qrCodeScannerTorchOffSemantics": "Vypnúť blesk",
"qrCodeScannerBackSemantics": "Späť",
"qrCodeScannerOpenSemantics": "Podpísať vzdialený dokument pomocou QR kódu",
"shareDocumentPreviewSemantics": "Zdieľať náhľad dokumentu",
"previewDocumentSemantics": "Náhľad dokumentu",

"deepLinkParseErrorMessage": "Nepodporovaný alebo nesprávny odkaz:\n{error}",
"stepIndicatorText": "Krok {stepNumber} z {totalSteps}",
Expand Down
11 changes: 7 additions & 4 deletions lib/ui/screens/about_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,13 @@ class _Body extends StatelessWidget {

final child = Column(
children: [
Text(
strings.appName,
textAlign: TextAlign.center,
style: Theme.of(context).textTheme.headlineLarge,
Semantics(
header: true,
child: Text(
strings.appName,
textAlign: TextAlign.center,
style: Theme.of(context).textTheme.headlineLarge,
),
),
const SizedBox(height: 16),
const AppVersionText(),
Expand Down
28 changes: 17 additions & 11 deletions lib/ui/screens/main_menu_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,15 @@ class MainMenuScreen extends StatelessWidget {
const Spacer(flex: 1),
Padding(
padding: const EdgeInsets.only(bottom: 20),
child: Text(
strings.menuTitle,
style: const TextStyle(
fontSize: 20,
fontWeight: FontWeight.w700,
letterSpacing: 0.15,
child: Semantics(
header: true,
child: Text(
strings.menuTitle,
style: const TextStyle(
fontSize: 20,
fontWeight: FontWeight.w700,
letterSpacing: 0.15,
),
),
),
),
Expand Down Expand Up @@ -157,11 +160,14 @@ class _MenuItem extends StatelessWidget {

return Padding(
padding: const EdgeInsets.symmetric(vertical: 4),
child: InkWell(
onTap: onPressed,
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 8),
child: text,
child: Semantics(
button: true,
child: InkWell(
onTap: onPressed,
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 8),
child: text,
),
),
),
);
Expand Down
30 changes: 20 additions & 10 deletions lib/ui/screens/main_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -233,21 +233,31 @@ AppBar _MainAppBar({
return AppBar(
foregroundColor: kMainAppBarForegroundColor,
backgroundColor: kMainAppBarBackgroundColor,
leading: IconButton(
icon: SvgPicture.asset(
'assets/icons/menu.svg',
colorFilter: colorFilter,
leading: Semantics(
button: true,
excludeSemantics: true,
label: context.strings.buttonMenuLabelSemantics,
child: IconButton(
icon: SvgPicture.asset(
'assets/icons/menu.svg',
colorFilter: colorFilter,
),
onPressed: onMenuPressed,
),
onPressed: onMenuPressed,
),
actions: [
if (showQrCodeScannerIcon)
IconButton(
icon: SvgPicture.asset(
'assets/icons/qr_code_scanner.svg',
colorFilter: colorFilter,
Semantics(
label: context.strings.qrCodeScannerOpenSemantics,
button: true,
excludeSemantics: true,
child: IconButton(
icon: SvgPicture.asset(
'assets/icons/qr_code_scanner.svg',
colorFilter: colorFilter,
),
onPressed: onQrCodeScannerPressed,
),
onPressed: onQrCodeScannerPressed,
),
],
title: Builder(builder: (context) {
Expand Down
36 changes: 24 additions & 12 deletions lib/ui/screens/preview_document_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,15 @@ class PreviewDocumentScreen extends StatelessWidget {
title: Text(context.strings.previewDocumentTitle),
actions: [
if (file != null)
IconButton(
onPressed: () => _onShareRequested(context),
icon: const Icon(Icons.share_outlined),
color: Theme.of(context).colorScheme.primary,
Semantics(
label: context.strings.shareDocumentPreviewSemantics,
excludeSemantics: true,
button: true,
child: IconButton(
onPressed: () => _onShareRequested(context),
icon: const Icon(Icons.share_outlined),
color: Theme.of(context).colorScheme.primary,
),
),
],
),
Expand Down Expand Up @@ -143,20 +148,27 @@ class _SuccessContent extends StatelessWidget {
@override
Widget build(BuildContext context) {
final dashColor = Theme.of(context).colorScheme.primary;

print(" mime ${visualization.filename}" ?? "");
return Column(
children: [
// Document preview
Expanded(
child: Padding(
padding: const EdgeInsets.only(bottom: 16),
child: DottedBorder(
color: dashColor,
strokeWidth: 4,
dashPattern: const [16, 16],
padding: const EdgeInsets.all(2),
child: DocumentVisualization(
visualization: visualization,
child: Semantics(
image: ["jpeg", "jpg", "png", "gif", "bmp", "webp", "svg", "heic"]
.any((element) =>
visualization.filename?.endsWith(element) ?? false),
label: context.strings.previewDocumentSemantics,
excludeSemantics: true,
child: DottedBorder(
color: dashColor,
strokeWidth: 4,
dashPattern: const [16, 16],
padding: const EdgeInsets.all(2),
child: DocumentVisualization(
visualization: visualization,
),
),
),
),
Expand Down
36 changes: 26 additions & 10 deletions lib/ui/screens/qr_code_scanner_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,18 @@ class _QRCodeScannerScreenState extends State<QRCodeScannerScreen> {
padding: kScreenMargin.copyWith(
top: MediaQuery.of(context).padding.top,
),
child: SquareButton(
onPressed: () {
Navigator.maybePop(context);
},
child: Icon(
Icons.arrow_back,
color: Theme.of(context).colorScheme.onBackground,
child: Semantics(
label: context.strings.qrCodeScannerBackSemantics,
button: true,
excludeSemantics: true,
child: SquareButton(
onPressed: () {
Navigator.maybePop(context);
},
child: Icon(
Icons.arrow_back,
color: Theme.of(context).colorScheme.onBackground,
),
),
),
),
Expand Down Expand Up @@ -93,9 +98,20 @@ class _QRCodeScannerScreenState extends State<QRCodeScannerScreen> {
TorchState.on => Icons.flashlight_off,
};

return Icon(
icon,
color: Theme.of(context).colorScheme.onBackground,
final semanticsLabel = switch (torchState) {
TorchState.off =>
context.strings.qrCodeScannerTorchOnSemantics,
TorchState.on =>
context.strings.qrCodeScannerTorchOffSemantics,
};

return Semantics(
button: true,
label: semanticsLabel,
child: Icon(
icon,
color: Theme.of(context).colorScheme.onBackground,
),
);
},
),
Expand Down
17 changes: 10 additions & 7 deletions lib/ui/screens/settings_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -191,12 +191,15 @@ class _ValueListenableBoundTile<T> extends StatelessWidget {
builder: (context, value, _) {
final summary = summaryGetter(setting.value);

return PreferenceTile(
title: title,
summary: summary,
onPressed: () {
_onEditItemRequested(context, value);
},
return Semantics(
button: true,
child: PreferenceTile(
title: title,
summary: summary,
onPressed: () {
_onEditItemRequested(context, value);
},
),
);
},
);
Expand Down Expand Up @@ -242,7 +245,7 @@ class _ValueListenableBoundTile<T> extends StatelessWidget {
);

return AlertDialog(
title: Text(title),
title: Semantics(header: true, child: Text(title)),
content: content,
);
},
Expand Down
28 changes: 16 additions & 12 deletions lib/ui/widgets/option_picker.dart
Original file line number Diff line number Diff line change
Expand Up @@ -55,18 +55,22 @@ class OptionPicker<T> extends StatelessWidget {
),
);

return Material(
child: InkWell(
onTap: () {
onValueChanged(value);
},
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
radio,
const SizedBox(width: 8),
label,
],
return Semantics(
checked: value == selectedValue,
inMutuallyExclusiveGroup: true,
child: Material(
child: InkWell(
onTap: () {
onValueChanged(value);
},
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
ExcludeSemantics(child: radio),
const SizedBox(width: 8),
label,
],
),
),
),
);
Expand Down
Loading
Loading