π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
[auth] Make tag chips keyboard selectable
Neeraj Guptaae982eee376d
diff --git a/mobile/apps/auth/lib/onboarding/view/common/tag_chip.dart b/mobile/apps/auth/lib/onboarding/view/common/tag_chip.dartindex fd8586d1d6..33230593fe 100644--- a/mobile/apps/auth/lib/onboarding/view/common/tag_chip.dart+++ b/mobile/apps/auth/lib/onboarding/view/common/tag_chip.dart@@ -3,8 +3,9 @@ import "package:ente_auth/onboarding/model/tag_enums.dart";import "package:ente_auth/store/code_display_store.dart";import "package:ente_auth/theme/ente_theme.dart";import "package:flutter/material.dart";+import "package:flutter/services.dart";-class TagChip extends StatelessWidget {+class TagChip extends StatefulWidget {final String label;final VoidCallback? onTap;final TagChipState state;@@ -20,117 +21,159 @@ class TagChip extends StatelessWidget {this.iconData,});+ @override+ State<TagChip> createState() => _TagChipState();+}++class _TagChipState extends State<TagChip> {+ bool _hasFocus = false;+@overrideWidget build(BuildContext context) {final colorScheme = getEnteColorScheme(context);final textTheme = getEnteTextTheme(context);- final isSelected = state == TagChipState.selected;+ final isSelected = widget.state == TagChipState.selected;final textColor = isSelected ? Colors.white : colorScheme.textBase;+ final focusBorderColor = isSelected ? Colors.white : colorScheme.primary700;- return GestureDetector(- onTap: onTap,- child: Container(- constraints: const BoxConstraints(minHeight: 40),- decoration: BoxDecoration(- color: isSelected ? colorScheme.primary700 : colorScheme.fillFaint,- borderRadius: const BorderRadius.all(Radius.circular(24.0)),+ return FocusableActionDetector(+ enabled: widget.onTap != null,+ mouseCursor: widget.onTap != null+ ? SystemMouseCursors.click+ : SystemMouseCursors.basic,+ shortcuts: const {+ SingleActivator(LogicalKeyboardKey.enter): ActivateIntent(),+ SingleActivator(LogicalKeyboardKey.space): ActivateIntent(),+ },+ actions: {+ ActivateIntent: CallbackAction<ActivateIntent>(+ onInvoke: (_) {+ widget.onTap?.call();+ return null;+ },),- padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 16)- .copyWith(right: 0),- child: Row(- mainAxisSize: MainAxisSize.min,- children: [- MediaQuery(- data: MediaQuery.of(context).copyWith(- textScaler: const TextScaler.linear(1),- ),- child: Row(- children: [- if (iconData != null)- Icon(- iconData,- size: label.isNotEmpty ? 16 : 20,- color: textColor,- ),- if (iconData != null && label.isNotEmpty)- const SizedBox(width: 8),- if (label.isNotEmpty)- Text(- label,- style: textTheme.small.copyWith(- color: textColor,- ),- ),- ],+ },+ onShowFocusHighlight: (value) {+ if (_hasFocus != value) {+ setState(() => _hasFocus = value);+ }+ },+ child: GestureDetector(+ onTap: widget.onTap,+ child: Semantics(+ button: widget.onTap != null,+ selected: isSelected,+ child: Container(+ constraints: const BoxConstraints(minHeight: 40),+ decoration: BoxDecoration(+ color: isSelected+ ? colorScheme.primary700+ : colorScheme.fillFaint,+ borderRadius: const BorderRadius.all(Radius.circular(24.0)),+ border: Border.all(+ color: _hasFocus ? focusBorderColor : Colors.transparent,),),- if (isSelected && action == TagChipAction.check) ...[- const SizedBox(width: 16),- const Icon(- Icons.check,- size: 16,- color: Colors.white,- ),- const SizedBox(width: 16),- ] else if (isSelected && action == TagChipAction.menu) ...[- SizedBox(- width: 48,- child: PopupMenuButton<int>(- iconSize: 16,- padding: const EdgeInsets.symmetric(horizontal: 16),- shape: RoundedRectangleBorder(- borderRadius: BorderRadius.circular(8),- ),- surfaceTintColor: Theme.of(context).cardColor,- iconColor: Colors.white,- initialValue: -1,- onSelected: (value) {- if (value == 0) {- CodeDisplayStore.instance.showEditDialog(context, label);- } else if (value == 1) {- CodeDisplayStore.instance- .showDeleteTagDialog(context, label);- }- },- itemBuilder: (BuildContext context) {- return [- PopupMenuItem(- child: Row(- children: [- const Icon(Icons.edit_outlined, size: 16),- const SizedBox(width: 12),- Text(context.l10n.edit),- ],+ padding: const EdgeInsets.symmetric(+ vertical: 8,+ horizontal: 16,+ ).copyWith(right: 0),+ child: Row(+ mainAxisSize: MainAxisSize.min,+ children: [+ MediaQuery(+ data: MediaQuery.of(+ context,+ ).copyWith(textScaler: const TextScaler.linear(1)),+ child: Row(+ children: [+ if (widget.iconData != null)+ Icon(+ widget.iconData,+ size: widget.label.isNotEmpty ? 16 : 20,+ color: textColor,),- value: 0,+ if (widget.iconData != null && widget.label.isNotEmpty)+ const SizedBox(width: 8),+ if (widget.label.isNotEmpty)+ Text(+ widget.label,+ style: textTheme.small.copyWith(color: textColor),+ ),+ ],+ ),+ ),+ if (isSelected && widget.action == TagChipAction.check) ...[+ const SizedBox(width: 16),+ const Icon(Icons.check, size: 16, color: Colors.white),+ const SizedBox(width: 16),+ ] else if (isSelected &&+ widget.action == TagChipAction.menu) ...[+ SizedBox(+ width: 48,+ child: PopupMenuButton<int>(+ iconSize: 16,+ padding: const EdgeInsets.symmetric(horizontal: 16),+ shape: RoundedRectangleBorder(+ borderRadius: BorderRadius.circular(8),),- PopupMenuItem(- child: Row(- children: [- Icon(- Icons.delete_outline,- size: 16,- color: colorScheme.deleteTagIconColor,+ surfaceTintColor: Theme.of(context).cardColor,+ iconColor: Colors.white,+ initialValue: -1,+ onSelected: (value) {+ if (value == 0) {+ CodeDisplayStore.instance.showEditDialog(+ context,+ widget.label,+ );+ } else if (value == 1) {+ CodeDisplayStore.instance.showDeleteTagDialog(+ context,+ widget.label,+ );+ }+ },+ itemBuilder: (BuildContext context) {+ return [+ PopupMenuItem(+ value: 0,+ child: Row(+ children: [+ const Icon(Icons.edit_outlined, size: 16),+ const SizedBox(width: 12),+ Text(context.l10n.edit),+ ],),- const SizedBox(width: 12),- Text(- context.l10n.delete,- style: TextStyle(- color: colorScheme.deleteTagTextColor,- ),+ ),+ PopupMenuItem(+ value: 1,+ child: Row(+ children: [+ Icon(+ Icons.delete_outline,+ size: 16,+ color: colorScheme.deleteTagIconColor,+ ),+ const SizedBox(width: 12),+ Text(+ context.l10n.delete,+ style: TextStyle(+ color: colorScheme.deleteTagTextColor,+ ),+ ),+ ],),- ],- ),- value: 1,- ),- ];- },- ),- ),- ] else ...[- const SizedBox(width: 16),- ],- ],+ ),+ ];+ },+ ),+ ),+ ] else ...[+ const SizedBox(width: 16),+ ],+ ],+ ),+ ),),),);diff --git a/mobile/apps/auth/scripts/internal_changes.txt b/mobile/apps/auth/scripts/internal_changes.txtindex 0168743aef..4f3c3190b7 100644--- a/mobile/apps/auth/scripts/internal_changes.txt+++ b/mobile/apps/auth/scripts/internal_changes.txt@@ -1,5 +1,6 @@- Upgraded Auth to Flutter 3.38.10 and Android target SDK 36- Made overflowing Auth tag strips scrollable with desktop mouse wheel and drag interactions+- Made Auth tag chips reachable by keyboard Tab and selectable with Enter or Space- Fixed saved theme selection being reset after unlocking Auth and improved password manager autofill detection for password fields- Focus newly added Auth codes so stale search or tag filters do not hide successful additions- Added custom icons for 1984 Hosting, Art Fight, BJ-Share, CatRealm, Cove Backup, eClinicalWorks, HaloPSA, JumpCloud, Patchmon, Racket Coach, RustDesk, Sherweb, Smogon, Sony, Zabbix, and Zyxel Nebula