Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

added multiselect feature

a5xwin87c236b6297f
diff --git a/mobile/apps/auth/lib/l10n/arb/app_en.arb b/mobile/apps/auth/lib/l10n/arb/app_en.arb
index bc38ad3bc4..c84fd8dda1 100644
--- a/mobile/apps/auth/lib/l10n/arb/app_en.arb
+++ b/mobile/apps/auth/lib/l10n/arb/app_en.arb
@@ -11,6 +11,7 @@
"setupFirstAccount": "Setup your first account",
"importScanQrCode": "Scan a QR Code",
"qrCode": "QR Code",
+ "qr": "QR",
"importEnterSetupKey": "Enter a setup key",
"importAccountPageTitle": "Enter account details",
"secretCanNotBeEmpty": "Secret can not be empty",
@@ -139,6 +140,7 @@
"existingUser": "Existing User",
"newUser": "New to Ente",
"delete": "Delete",
+ "addTag": "Add tag",
"enterYourPasswordHint": "Enter your password",
"forgotPassword": "Forgot password",
"oops": "Oops",
@@ -546,5 +548,9 @@
"saveAction":"Save",
"saveBackup":"Save backup",
"changeLocation": "Change location",
- "changeCurrentLocation": "Change current location"
+ "changeCurrentLocation": "Change current location",
+ "done": "Done",
+ "addNew": "Add new",
+ "selected": "selected",
+ "moveMultipleToTrashMessage": "Are you sure you want to move {count} item(s) to the trash?"
}
\ No newline at end of file
diff --git a/mobile/apps/auth/lib/onboarding/view/view_qr_page.dart b/mobile/apps/auth/lib/onboarding/view/view_qr_page.dart
index ea088ca7e6..0ccf341166 100644
--- a/mobile/apps/auth/lib/onboarding/view/view_qr_page.dart
+++ b/mobile/apps/auth/lib/onboarding/view/view_qr_page.dart
@@ -54,9 +54,14 @@ class ViewQrPage extends StatelessWidget {
const SizedBox(
width: 10,
),
- Text(
- code?.account ?? '',
- style: enteTextTheme.largeBold,
+ Expanded(
+ child: SingleChildScrollView(
+ scrollDirection: Axis.horizontal,
+ child: Text(
+ code?.account ?? '',
+ style: enteTextTheme.largeBold,
+ ),
+ ),
),
],
),
@@ -73,9 +78,14 @@ class ViewQrPage extends StatelessWidget {
const SizedBox(
width: 10,
),
- Text(
- code?.issuer ?? '',
- style: enteTextTheme.largeBold,
+ Expanded(
+ child: SingleChildScrollView(
+ scrollDirection: Axis.horizontal,
+ child: Text(
+ code?.issuer ?? '',
+ style: enteTextTheme.largeBold,
+ ),
+ ),
),
],
),
diff --git a/mobile/apps/auth/lib/store/code_display_store.dart b/mobile/apps/auth/lib/store/code_display_store.dart
index 0522afa788..bd7b03ce8b 100644
--- a/mobile/apps/auth/lib/store/code_display_store.dart
+++ b/mobile/apps/auth/lib/store/code_display_store.dart
@@ -14,6 +14,31 @@ class CodeDisplayStore {
late CodeStore _codeStore;
+ final ValueNotifier<bool> isSelectionModeActive = ValueNotifier(false);
+ final ValueNotifier<Set<String>> selectedCodeIds = ValueNotifier(<String>{});
+
+ // toggles the selection status of a code
+ void toggleSelection(String codeId){
+ final newSelection = Set<String>.from(selectedCodeIds.value);
+
+ if(newSelection.contains(codeId)){
+ newSelection.remove(codeId);
+ }
+
+ else{
+ newSelection.add(codeId);
+ }
+
+ selectedCodeIds.value = newSelection; //if we selected atleast one code, then we're in selection mode.. else: exit selection mode
+ isSelectionModeActive.value = newSelection.isNotEmpty;
+ }
+
+ //method to clear the entire selection
+ void clearSelection(){
+ selectedCodeIds.value = <String>{};
+ isSelectionModeActive.value = false;
+ }
+
Future<void> init() async {
_codeStore = CodeStore.instance;
}
diff --git a/mobile/apps/auth/lib/ui/code_widget.dart b/mobile/apps/auth/lib/ui/code_widget.dart
index 72279b615c..988523ff31 100644
--- a/mobile/apps/auth/lib/ui/code_widget.dart
+++ b/mobile/apps/auth/lib/ui/code_widget.dart
@@ -10,10 +10,10 @@ import 'package:ente_auth/models/code.dart';
import 'package:ente_auth/onboarding/view/setup_enter_secret_key_page.dart';
import 'package:ente_auth/onboarding/view/view_qr_page.dart';
import 'package:ente_auth/services/preference_service.dart';
+import 'package:ente_auth/store/code_display_store.dart';
import 'package:ente_auth/store/code_store.dart';
import 'package:ente_auth/theme/ente_theme.dart';
import 'package:ente_auth/ui/code_timer_progress.dart';
-import 'package:ente_auth/ui/components/bottom_action_bar_widget.dart';
import 'package:ente_auth/ui/components/models/button_type.dart';
import 'package:ente_auth/ui/share/code_share.dart';
import 'package:ente_auth/ui/utils/icon_utils.dart';
@@ -103,7 +103,6 @@ class _CodeWidgetState extends State<CodeWidget> {
@override
Widget build(BuildContext context) {
ignorePin = widget.sortKey != null && widget.sortKey == CodeSortKey.manual;
- final colorScheme = getEnteColorScheme(context);
if (isMaskingEnabled != PreferenceService.instance.shouldHideCodes()) {
isMaskingEnabled = PreferenceService.instance.shouldHideCodes();
_hideCode = isMaskingEnabled;
@@ -118,96 +117,110 @@ class _CodeWidgetState extends State<CodeWidget> {
}
final l10n = context.l10n;
- Widget getCardContents(AppLocalizations l10n) {
- return Stack(
- children: [
- if (!ignorePin && widget.code.isPinned)
- Align(
- alignment: Alignment.topRight,
- child: CustomPaint(
- painter: PinBgPainter(
- color: colorScheme.pinnedBgColor,
- ),
- size: widget.isCompactMode
- ? const Size(24, 24)
- : const Size(39, 39),
- ),
+ Widget getCardContents(AppLocalizations l10n, {required bool isSelected}) {
+ final colorScheme = getEnteColorScheme(context);
+ return Stack(
+ children: [
+ if (!ignorePin && widget.code.isPinned)
+ Align(
+ alignment: Alignment.topRight,
+ child: CustomPaint(
+ painter: PinBgPainter(
+ color: colorScheme.pinnedBgColor,
),
- if (widget.code.isTrashed && kDebugMode)
- Align(
- alignment: Alignment.topLeft,
- child: CustomPaint(
- painter: PinBgPainter(
- color: colorScheme.warning700,
- ),
- size: const Size(39, 39),
- ),
+ size: widget.isCompactMode
+ ? const Size(24, 24)
+ : const Size(39, 39),
+ ),
+ ),
+ if (widget.code.isTrashed && kDebugMode)
+ Align(
+ alignment: Alignment.topLeft,
+ child: CustomPaint(
+ painter: PinBgPainter(
+ color: colorScheme.warning700,
),
- Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
+ size: const Size(39, 39),
+ ),
+ ),
+ Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
+ children: [
+ if (widget.code.type.isTOTPCompatible)
+ CodeTimerProgress(
+ key: ValueKey('period_${widget.code.period}'),
+ period: widget.code.period,
+ isCompactMode: widget.isCompactMode,
+ timeOffsetInMilliseconds:
+ PreferenceService.instance.timeOffsetInMilliSeconds(),
+ ),
+ widget.isCompactMode
+ ? const SizedBox(height: 4)
+ : const SizedBox(height: 28),
+ Row(
children: [
- if (widget.code.type.isTOTPCompatible)
- CodeTimerProgress(
- key: ValueKey('period_${widget.code.period}'),
- period: widget.code.period,
- isCompactMode: widget.isCompactMode,
- timeOffsetInMilliseconds:
- PreferenceService.instance.timeOffsetInMilliSeconds(),
+ _shouldShowLargeIcon ? _getIcon() : const SizedBox.shrink(),
+ Expanded(
+ child: Column(
+ children: [
+ _getTopRow(isSelected: isSelected),
+ widget.isCompactMode
+ ? const SizedBox.shrink()
+ : const SizedBox(height: 4),
+ _getBottomRow(l10n),
+ ],
),
- widget.isCompactMode
- ? const SizedBox(height: 4)
- : const SizedBox(height: 28),
- Row(
- children: [
- _shouldShowLargeIcon ? _getIcon() : const SizedBox.shrink(),
- Expanded(
- child: Column(
- children: [
- _getTopRow(),
- widget.isCompactMode
- ? const SizedBox.shrink()
- : const SizedBox(height: 4),
- _getBottomRow(l10n),
- ],
- ),
- ),
- ],
),
- widget.isCompactMode
- ? const SizedBox(height: 4)
- : const SizedBox(height: 32),
],
),
- if (!ignorePin && widget.code.isPinned) ...[
- Align(
- alignment: Alignment.topRight,
- child: Padding(
- padding: widget.isCompactMode
- ? const EdgeInsets.only(right: 4, top: 4)
- : const EdgeInsets.only(right: 6, top: 6),
- child: SvgPicture.asset(
- "assets/svg/pin-card.svg",
- width: widget.isCompactMode ? 8 : null,
- height: widget.isCompactMode ? 8 : null,
- ),
- ),
- ),
- ],
+ widget.isCompactMode
+ ? const SizedBox(height: 4)
+ : const SizedBox(height: 32),
],
- );
- }
+ ),
+ if (!ignorePin && widget.code.isPinned) ...[
+ Align(
+ alignment: Alignment.topRight,
+ child: Padding(
+ padding: widget.isCompactMode
+ ? const EdgeInsets.only(right: 4, top: 4)
+ : const EdgeInsets.only(right: 6, top: 6),
+ child: SvgPicture.asset(
+ "assets/svg/pin-card.svg",
+ width: widget.isCompactMode ? 8 : null,
+ height: widget.isCompactMode ? 8 : null,
+ ),
+ ),
+ ),
+ ],
+ ],
+ );
+}
+
+Widget clippedCard(AppLocalizations l10n) {
+ final colorScheme = getEnteColorScheme(context);
+
+ return ValueListenableBuilder<Set<String>>(
+ valueListenable: CodeDisplayStore.instance.selectedCodeIds,
+ builder: (context, selectedIds, child) {
+ final isSelected = selectedIds.contains(widget.code.rawData);
- Widget clippedCard(AppLocalizations l10n) {
return Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
- color: Theme.of(context).colorScheme.codeCardBackgroundColor,
+ color: isSelected
+ ? colorScheme.primary400.withValues(alpha: 0.08)
+ : Theme.of(context).colorScheme.codeCardBackgroundColor,
+ //add purple overlay when selected
+ border: isSelected
+ ? Border.all(color: colorScheme.primary400, width: 2)
+ : null,
boxShadow:
- widget.code.isPinned ? colorScheme.pinnedCardBoxShadow : [],
+ (widget.code.isPinned && !isSelected) ? colorScheme.pinnedCardBoxShadow : [],
),
child: ClipRRect(
- borderRadius: BorderRadius.circular(8),
+ borderRadius: BorderRadius.circular(6),
child: Material(
color: Colors.transparent,
child: InkWell(
@@ -215,7 +228,12 @@ class _CodeWidgetState extends State<CodeWidget> {
borderRadius: BorderRadius.circular(10),
),
onTap: () {
- _copyCurrentOTPToClipboard();
+ final store = CodeDisplayStore.instance;
+ if (store.isSelectionModeActive.value) {
+ store.toggleSelection(widget.code.rawData);
+ } else {
+ _copyCurrentOTPToClipboard();
+ }
},
onDoubleTap: isMaskingEnabled
? () {
@@ -229,30 +247,16 @@ class _CodeWidgetState extends State<CodeWidget> {
onLongPress: widget.isReordering
? null
: () {
- showModalBottomSheet(
- context: context,
- builder: (_) {
- return BottomActionBarWidget(
- code: widget.code,
- showPin: !ignorePin,
- onEdit: () => _onEditPressed(true),
- onShare: () => _onSharePressed(true),
- onPin: () => _onPinPressed(true),
- onTrashed: () => _onTrashPressed(true),
- onDelete: () => _onDeletePressed(true),
- onRestore: () => _onRestoreClicked(true),
- onShowQR: () => _onShowQrPressed(true),
- onCancel: () => Navigator.of(context).pop(),
- );
- },
- );
+ CodeDisplayStore.instance.toggleSelection(widget.code.rawData);
},
- child: getCardContents(l10n),
+ child: getCardContents(l10n, isSelected: isSelected),
),
),
),
);
- }
+ },
+ );
+}
return Container(
margin: widget.isCompactMode
@@ -273,7 +277,7 @@ class _CodeWidgetState extends State<CodeWidget> {
),
if (!widget.code.isTrashed)
MenuItem(
- label: 'QR',
+ label: context.l10n.qr,
icon: Icons.qr_code_2_outlined,
onSelected: () => _onShowQrPressed(null),
),
@@ -307,7 +311,7 @@ class _CodeWidgetState extends State<CodeWidget> {
const MenuDivider(),
MenuItem(
label: widget.code.isTrashed ? l10n.delete : l10n.trash,
- value: "Delete",
+ value: l10n.delete,
icon: widget.code.isTrashed
? Icons.delete_forever
: Icons.delete,
@@ -403,54 +407,64 @@ class _CodeWidgetState extends State<CodeWidget> {
);
}
- Widget _getTopRow() {
- bool isCompactMode = widget.isCompactMode;
- return Padding(
- padding: const EdgeInsets.only(left: 16, right: 16),
- child: Row(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Expanded(
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(
- safeDecode(widget.code.issuer).trim(),
- style: isCompactMode
- ? Theme.of(context).textTheme.bodyMedium
- : Theme.of(context).textTheme.titleLarge,
- ),
- if (!isCompactMode) const SizedBox(height: 2),
- Text(
- safeDecode(widget.code.account).trim(),
- style: Theme.of(context).textTheme.bodySmall?.copyWith(
- fontSize: isCompactMode ? 12 : 12,
- color: Colors.grey,
- ),
- ),
- ],
+ Widget _getTopRow({required bool isSelected}) {
+ final colorScheme = getEnteColorScheme(context);
+ bool isCompactMode = widget.isCompactMode;
+ return Padding(
+ padding: const EdgeInsets.only(left: 16, right: 16),
+ child: Row(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ if (isSelected)
+ Padding(
+ padding: const EdgeInsets.only(right: 8.0),
+ child: Icon(
+ Icons.check_circle,
+ color: colorScheme.primary400,
+ size: isCompactMode ? 20 : 24,
),
),
- const SizedBox(width: 8),
- Row(
- mainAxisAlignment: MainAxisAlignment.end,
+ Expanded(
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
children: [
- (widget.code.hasSynced != null && widget.code.hasSynced!) ||
- !hasConfiguredAccount
- ? const SizedBox.shrink()
- : const Icon(
- Icons.sync_disabled,
- size: 20,
- color: Colors.amber,
+ Text(
+ safeDecode(widget.code.issuer).trim(),
+ style: isCompactMode
+ ? Theme.of(context).textTheme.bodyMedium
+ : Theme.of(context).textTheme.titleLarge,
+ ),
+ if (!isCompactMode) const SizedBox(height: 2),
+ Text(
+ safeDecode(widget.code.account).trim(),
+ style: Theme.of(context).textTheme.bodySmall?.copyWith(
+ fontSize: isCompactMode ? 12 : 12,
+ color: Colors.grey,
),
- const SizedBox(width: 12),
- _shouldShowLargeIcon ? const SizedBox.shrink() : _getIcon(),
+ ),
],
),
- ],
- ),
- );
- }
+ ),
+ const SizedBox(width: 8),
+ Row(
+ mainAxisAlignment: MainAxisAlignment.end,
+ children: [
+ (widget.code.hasSynced != null && widget.code.hasSynced!) ||
+ !hasConfiguredAccount
+ ? const SizedBox.shrink()
+ : const Icon(
+ Icons.sync_disabled,
+ size: 20,
+ color: Colors.amber,
+ ),
+ const SizedBox(width: 12),
+ _shouldShowLargeIcon ? const SizedBox.shrink() : _getIcon(),
+ ],
+ ),
+ ],
+ ),
+ );
+}
Widget _getIcon() {
final String iconData;
diff --git a/mobile/apps/auth/lib/ui/home/add_tag_sheet.dart b/mobile/apps/auth/lib/ui/home/add_tag_sheet.dart
new file mode 100644
index 0000000000..677603505c
--- /dev/null
+++ b/mobile/apps/auth/lib/ui/home/add_tag_sheet.dart
@@ -0,0 +1,243 @@
+import 'dart:async';
+
+import 'package:ente_auth/l10n/l10n.dart';
+import 'package:ente_auth/models/code.dart';
+import 'package:ente_auth/store/code_display_store.dart';
+import 'package:ente_auth/store/code_store.dart';
+import 'package:ente_auth/theme/ente_theme.dart';
+import 'package:ente_auth/ui/components/buttons/button_widget.dart';
+import 'package:ente_auth/ui/components/models/button_type.dart';
+import 'package:ente_auth/ui/utils/icon_utils.dart';
+import 'package:flutter/material.dart';
+
+
+
+class AddTagSheet extends StatefulWidget {
+ final List<Code> selectedCodes;
+
+ const AddTagSheet({
+ super.key,
+ required this.selectedCodes,
+ });
+
+ @override
+ State<AddTagSheet> createState() => _AddTagSheetState();
+}
+
+class _AddTagSheetState extends State<AddTagSheet> {
+ List<String> _allTags = [];
+ final Set<String> _selectedTagsInSheet = {};
+ bool _isLoading = true;
+
+ @override
+ void initState() {
+ super.initState();
+ _loadInitialState();
+ }
+
+ Future<void> _loadInitialState() async {
+ final allTagsFromServer = await CodeDisplayStore.instance.getAllTags();
+ final initialTagsForSelection = <String>{};
+
+ for (final code in widget.selectedCodes) {
+ initialTagsForSelection.addAll(code.display.tags);
+ }
+
+ if (mounted) {
+ setState(() {
+ _allTags = allTagsFromServer;
+ _selectedTagsInSheet.addAll(initialTagsForSelection);
+ _isLoading = false;
+ });
+ }
+ }
+
+ Future<void> _onDonePressed() async {
+ final List<Future> updateFutures = [];
+ for (final code in widget.selectedCodes) {
+ final updatedCode = code.copyWith(
+ display: code.display.copyWith(tags: _selectedTagsInSheet.toList()),
+ );
+ updateFutures.add(CodeStore.instance.updateCode(code, updatedCode));
+ }
+ await Future.wait(updateFutures);
+ if (mounted) {
+ Navigator.of(context).pop();
+ }
+ }
+
+ Future<void> _showCreateTagDialog() async {
+ final textController = TextEditingController();
+ final newTag = await showDialog<String>(
+ context: context,
+ builder: (context) {
+ return StatefulBuilder(
+ builder: (context, setState) {
+ return AlertDialog(
+ title: Text(context.l10n.createNewTag),
+ content: TextField(
+ controller: textController,
+ autofocus: true,
+ onChanged: (_) => setState(() {}),
+ ),
+ actions: [
+ Row(
+ children: [
+ Expanded(
+ child: ButtonWidget(
+ buttonType: ButtonType.secondary,
+ labelText: context.l10n.cancel,
+ onTap: () async => Navigator.of(context).pop(),
+ ),
+ ),
+ const SizedBox(width: 8),
+ Expanded(
+ child: ButtonWidget(
+ buttonType: ButtonType.primary,
+ labelText: context.l10n.create,
+ isDisabled: textController.text.trim().isEmpty,
+ onTap: () async => Navigator.of(context).pop(textController.text.trim()),
+ ),
+ ),
+ ],
+ ),
+ ],
+ );
+ },
+ );
+ },
+ );
+
+ if (newTag != null && newTag.isNotEmpty) {
+ setState(() {
+ if (!_allTags.contains(newTag)) {
+ _allTags.add(newTag);
+ _allTags.sort();
+ }
+ _selectedTagsInSheet.add(newTag);
+ });
+ }
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ final colorScheme = getEnteColorScheme(context);
+ final textTheme = getEnteTextTheme(context);
+ final bottomPadding = MediaQuery.of(context).padding.bottom;
+
+ return Padding(
+ padding: EdgeInsets.fromLTRB(16, 16, 16, 16 + bottomPadding),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ Row(
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
+ children: [
+ Text(
+ '${widget.selectedCodes.length} ${context.l10n.selected}',
+ style: textTheme.large,
+ ),
+ IconButton(
+ icon: const Icon(Icons.close),
+ onPressed: () => Navigator.of(context).pop(),
+ ),
+ ],
+ ),
+ const SizedBox(height: 16),
+ SizedBox(
+ height: 80,
+ child: ListView.separated(
+ scrollDirection: Axis.horizontal,
+ itemCount: widget.selectedCodes.length,
+ separatorBuilder: (_, __) => const SizedBox(width: 16),
+ itemBuilder: (context, index) {
+ final code = widget.selectedCodes[index];
+ final iconData =
+ code.display.isCustomIcon ? code.display.iconID : code.issuer;
+
+ return SizedBox(
+ width: 60,
+ child: Column(
+ mainAxisAlignment: MainAxisAlignment.center,
+ children: [
+ IconUtils.instance.getIcon(context, iconData.trim(), width: 40),
+ const SizedBox(height: 8),
+ Text(
+ code.issuer,
+ overflow: TextOverflow.ellipsis,
+ style: textTheme.mini.copyWith(color: colorScheme.textMuted,),
+ ),
+ ],
+ ),
+ );
+ },
+ ),
+ ),
+ const SizedBox(height: 24),
+ Text(context.l10n.tags, style: textTheme.body),
+ const SizedBox(height: 12),
+ Flexible(
+ child: SingleChildScrollView(
+ child: _isLoading
+ ? const Center(child: CircularProgressIndicator())
+ : Wrap(
+ spacing: 8.0,
+ runSpacing: 4.0,
+ children: [
+ ..._allTags.map((tag) {
+ final isSelected = _selectedTagsInSheet.contains(tag);
+ return ChoiceChip(
+ label: Text(tag),
+ selected: isSelected,
+ onSelected: (selected) {
+ setState(() {
+ if (selected) {
+ _selectedTagsInSheet.add(tag);
+ } else {
+ _selectedTagsInSheet.remove(tag);
+ }
+ });
+ },
+ selectedColor: colorScheme.primary400,
+ backgroundColor: colorScheme.fillFaint,
+ labelStyle: TextStyle(
+ color: isSelected ? Colors.white : colorScheme.textBase,
+ ),
+ avatar: isSelected ? const Icon(Icons.check, color: Colors.white, size: 16) : null,
+ side: BorderSide.none,
+ shape: const StadiumBorder(),
+ );
+ }),
+ ActionChip(
+ avatar: const Icon(Icons.add, size: 18),
+ label: Text(context.l10n.addNew),
+ onPressed: _showCreateTagDialog,
+ side: BorderSide.none,
+ shape: const StadiumBorder(),
+ backgroundColor: colorScheme.fillFaint,
+ ),
+ ],
+ ),
+ ),
+ ),
+
+ const SizedBox(height: 24),
+ SizedBox(
+ width: double.infinity,
+ child: ElevatedButton(
+ style: ElevatedButton.styleFrom(
+ backgroundColor: colorScheme.fillBase,
+ foregroundColor: colorScheme.backgroundBase,
+ padding: const EdgeInsets.symmetric(vertical: 16),
+ shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
+ ),
+ onPressed: _onDonePressed,
+ child: Text(context.l10n.done),
+ ),
+ ),
+ ],
+ ),
+ );
+ }
+}
\ No newline at end of file
diff --git a/mobile/apps/auth/lib/ui/home_page.dart b/mobile/apps/auth/lib/ui/home_page.dart
index a0a3e86165..d0753ef813 100644
--- a/mobile/apps/auth/lib/ui/home_page.dart
+++ b/mobile/apps/auth/lib/ui/home_page.dart
@@ -14,6 +14,7 @@ import 'package:ente_auth/models/code.dart';
import 'package:ente_auth/onboarding/model/tag_enums.dart';
import 'package:ente_auth/onboarding/view/common/tag_chip.dart';
import 'package:ente_auth/onboarding/view/setup_enter_secret_key_page.dart';
+import 'package:ente_auth/onboarding/view/view_qr_page.dart';
import 'package:ente_auth/services/preference_service.dart';
import 'package:ente_auth/store/code_display_store.dart';
import 'package:ente_auth/store/code_store.dart';
@@ -26,17 +27,22 @@ import 'package:ente_auth/ui/common/loading_widget.dart';
import 'package:ente_auth/ui/components/buttons/button_widget.dart';
import 'package:ente_auth/ui/components/dialog_widget.dart';
import 'package:ente_auth/ui/components/models/button_type.dart';
+import 'package:ente_auth/ui/home/add_tag_sheet.dart';
import 'package:ente_auth/ui/home/coach_mark_widget.dart';
import 'package:ente_auth/ui/home/home_empty_state.dart';
import 'package:ente_auth/ui/home/speed_dial_label_widget.dart';
import 'package:ente_auth/ui/reorder_codes_page.dart';
import 'package:ente_auth/ui/scanner_page.dart';
import 'package:ente_auth/ui/settings_page.dart';
+import 'package:ente_auth/ui/share/code_share.dart';
import 'package:ente_auth/ui/sort_option_menu.dart';
+import 'package:ente_auth/ui/utils/icon_utils.dart';
import 'package:ente_auth/utils/dialog_util.dart';
import 'package:ente_auth/utils/platform_util.dart';
+import 'package:ente_auth/utils/toast_util.dart';
import 'package:ente_auth/utils/totp_util.dart';
import 'package:ente_events/event_bus.dart';
+import 'package:ente_lock_screen/local_authentication_service.dart';
import 'package:ente_lock_screen/lock_screen_settings.dart';
import 'package:ente_lock_screen/ui/app_lock.dart';
import 'package:ente_qr/ente_qr.dart';
@@ -58,6 +64,7 @@ class HomePage extends BaseHomePage {
}
class _HomePageState extends State<HomePage> {
+ final _codeDisplayStore = CodeDisplayStore.instance;
late final _settingsPage = SettingsPage(
emailNotifier: UserService.instance.emailValueNotifier,
scaffoldKey: scaffoldKey,
@@ -120,6 +127,568 @@ class _HomePageState extends State<HomePage> {
ServicesBinding.instance.keyboard.addHandler(_handleKeyEvent);
}
+ void _onAddTagPressed() {
+ final selectedIds = _codeDisplayStore.selectedCodeIds.value;
+ final selectedCodes = _allCodes?.where((c) => selectedIds.contains(c.rawData)).toList() ?? [];
+
+ if (selectedCodes.isEmpty) return;
+
+ showModalBottomSheet(
+ context: context,
+ isScrollControlled: true,
+ builder: (_) {
+ return AddTagSheet(selectedCodes: selectedCodes);
+ },
+ ).then((_) {
+ _codeDisplayStore.clearSelection();
+ });
+}
+
+Future<void> _onRestoreSelectedPressed() async {
+ final selectedIds = _codeDisplayStore.selectedCodeIds.value;
+ if (selectedIds.isEmpty) return;
+
+ FocusScope.of(context).requestFocus();
+
+ try {
+ final codesToRestore = _allCodes?.where((c) => selectedIds.contains(c.rawData)).toList() ?? [];
+ for (final code in codesToRestore) {
+ final updatedCode = code.copyWith(display: code.display.copyWith(trashed: false));
+ unawaited(CodeStore.instance.updateCode(code, updatedCode));
+ }
+ } catch (e) {
+ if (mounted) {
+ showGenericErrorDialog(context: context, error: e).ignore();
+ }
+ } finally {
+ _codeDisplayStore.clearSelection();
+ }
+}
+
+Future<void> _onDeleteForeverPressed() async {
+ final l10n = context.l10n;
+ final selectedIds = _codeDisplayStore.selectedCodeIds.value;
+ if (selectedIds.isEmpty) return;
+
+ bool isAuthSuccessful =
+ await LocalAuthenticationService.instance.requestLocalAuthentication(
+ context,
+ context.l10n.deleteCodeAuthMessage,
+ );
+
+ if (!isAuthSuccessful) return;
+
+ FocusScope.of(context).requestFocus();
+ await showChoiceActionSheet(
+ context,
+ title: l10n.deleteCodeTitle,
+ body: l10n.deleteCodeMessage,
+ firstButtonLabel: l10n.delete,
+ isCritical: true,
+ firstButtonOnTap: () async {
+ try {
+ final codesToDelete = _allCodes?.where((c) => selectedIds.contains(c.rawData)).toList() ?? [];
+ for (final code in codesToDelete) {
+ await CodeStore.instance.removeCode(code);
+ }
+ }
+ catch (e) {
+ if (mounted) {
+ showGenericErrorDialog(context: context, error: e).ignore();
+ }
+ }
+
+ finally {
+ _codeDisplayStore.clearSelection();
+ }
+ },
+ );
+}
+
+Widget _buildTrashSelectActions() {
+ return Container(
+ decoration: BoxDecoration(
+ color: Theme.of(context).brightness == Brightness.light
+ ? const Color(0xFFF7F7F7)
+ : const Color(0xFF1E1E1E),
+ borderRadius: BorderRadius.circular(12),
+ ),
+ child: Row(
+ children: [
+ _buildClearActionButton(Icons.restore,context.l10n.restore, _onRestoreSelectedPressed,),
+ _buildClearActionButton(Icons.delete_forever,context.l10n.delete, _onDeleteForeverPressed),
+ ],
+ ),
+ );
+}
+
+
+ Future<void> _onPinSelectedPressed() async {
+ final selectedIds = _codeDisplayStore.selectedCodeIds.value;
+ if (selectedIds.isEmpty) return;
+
+ final codesToUpdate = _allCodes?.where((c) => selectedIds.contains(c.rawData)).toList() ?? [];
+ if (codesToUpdate.isEmpty) return;
+
+ // Determine the state of the current selection
+ final bool allArePinned = codesToUpdate.every((code) => code.isPinned);
+
+ //If all selected codes are already pinned, UNPIN all of them
+ if (allArePinned) {
+ for (final code in codesToUpdate) {
+ final updatedCode = code.copyWith(display: code.display.copyWith(pinned: false));
+ unawaited(CodeStore.instance.updateCode(code, updatedCode));
+ }
+
+ if (codesToUpdate.length == 1) {
+ showToast(context, context.l10n.unpinnedCodeMessage(codesToUpdate.first.issuer));
+ }
+ else {
+ showToast(context, 'Unpinned ${codesToUpdate.length} item(s)');
+ }
+ }
+ //If there's a mix or if all are unpinned, PIN selected unpinned codes
+ else {
+ int pinnedCount = 0;
+ for (final code in codesToUpdate) {
+ if (!code.isPinned) { // Only pin the codes that are currently unpinned
+ final updatedCode = code.copyWith(display: code.display.copyWith(pinned: true));
+ unawaited(CodeStore.instance.updateCode(code, updatedCode));
+ pinnedCount++;
+ }
+ }
+
+ if (pinnedCount == 1){
+ final pinnedCode = codesToUpdate.firstWhere((c) => !c.isPinned);
+ showToast(context, context.l10n.pinnedCodeMessage(pinnedCode.issuer));
+ }
+ else if (pinnedCount > 0) {
+ showToast(context, 'Pinned $pinnedCount item(s)');
+ }
+ }
+
+ _codeDisplayStore.clearSelection();
+}
+
+ Future<void> _onTrashSelectedPressed() async {
+ final l10n = context.l10n;
+ final selectedIds = _codeDisplayStore.selectedCodeIds.value;
+ if (selectedIds.isEmpty) return;
+
+ bool isAuthSuccessful =
+ await LocalAuthenticationService.instance.requestLocalAuthentication(
+ context,
+ context.l10n.deleteCodeAuthMessage,
+ );
+ if (!isAuthSuccessful) return;
+
+ FocusScope.of(context).requestFocus();
+ await showChoiceActionSheet(
+ context,
+ title: l10n.trashCode,
+
+ body: ((){
+ if (selectedIds.length == 1){
+ final code = _allCodes!.firstWhere((c) => c.rawData == selectedIds.first);
+ final issuerAccount = code.account.isNotEmpty ? '${code.issuer} (${code.account})' : code.issuer;
+ return l10n.trashCodeMessage(issuerAccount);
+ }
+ else{
+ return l10n.moveMultipleToTrashMessage(selectedIds.length);
+ }
+ })(),
+
+ firstButtonLabel: l10n.trash,
+ isCritical: true,
+ firstButtonOnTap: () async {
+ try {
+ final codesToTrash = _allCodes?.where((c) => selectedIds.contains(c.rawData)).toList() ?? [];
+
+ for (final code in codesToTrash) {
+ final updatedCode = code.copyWith(
+ display: code.display.copyWith(trashed: true),
+ );
+ unawaited(CodeStore.instance.updateCode(code, updatedCode));
+ }
+ } catch (e) {
+ _logger.severe('Failed to trash code(s): ${e.toString()}');
+ if (mounted) {
+ showGenericErrorDialog(context: context, error: e).ignore();
+ }
+ } finally {
+ _codeDisplayStore.clearSelection();
+ }
+ },
+ );
+}
+
+
+Future<void> _onEditPressed(Code code) async {
+ bool isAuthSuccessful = await LocalAuthenticationService.instance
+ .requestLocalAuthentication(context, context.l10n.editCodeAuthMessage);
+ await PlatformUtil.refocusWindows();
+ if (!isAuthSuccessful) return;
+
+ _codeDisplayStore.clearSelection();
+ final Code? updatedCode = await Navigator.of(context).push(
+ MaterialPageRoute(
+ builder: (BuildContext context) {
+ return SetupEnterSecretKeyPage(code: code);
+ },
+ ),
+ );
+
+ if (updatedCode != null){
+ await CodeStore.instance.updateCode(code, updatedCode);
+ }
+}
+
+Future<void> _onSharePressed(Code code) async {
+ bool isAuthSuccessful = await LocalAuthenticationService.instance
+ .requestLocalAuthentication(context, context.l10n.authenticateGeneric);
+ await PlatformUtil.refocusWindows();
+ if (!isAuthSuccessful) return;
+
+ _codeDisplayStore.clearSelection();
+ showShareDialog(context, code);
+}
+
+Future<void> _onShowQrPressed(Code code) async {
+ bool isAuthSuccessful = await LocalAuthenticationService.instance
+ .requestLocalAuthentication(context, context.l10n.showQRAuthMessage);
+ await PlatformUtil.refocusWindows();
+ if (!isAuthSuccessful) return;
+
+ _codeDisplayStore.clearSelection();
+ await Navigator.of(context).push(
+ MaterialPageRoute(
+ builder: (BuildContext context) {
+ return ViewQrPage(code: code);
+ },
+ ),
+ );
+}
+
+Widget _buildClearActionButton(IconData icon, String label, VoidCallback onTap) {
+ final colorScheme = getEnteColorScheme(context);
+ final textTheme = getEnteTextTheme(context);
+
+ return Expanded(
+ child: InkWell(
+ onTap: onTap,
+ borderRadius: BorderRadius.circular(12),
+ highlightColor: colorScheme.textBase.withValues(alpha: 0.1),
+ splashColor: colorScheme.textBase.withValues(alpha: 0.1),
+ child: Padding(
+ padding: const EdgeInsets.symmetric(vertical: 12.0),
+ child: Column(
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ Icon(icon, color: colorScheme.textBase, size: 18), //bottom row icon props
+ const SizedBox(height: 8),
+ Text(label, style: textTheme.small.copyWith(color: colorScheme.textBase, fontSize: 11)),
+ ],
+ ),
+ ),
+ ),
+ );
+}
+Widget _buildSingleSelectActions(Code code) {
+ final colorScheme = getEnteColorScheme(context);
+ return Column(
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ Row(
+ children: [
+ _buildActionButton(Icons.edit_outlined, context.l10n.edit, () => _onEditPressed(code)),
+ const SizedBox(width: 10),
+ _buildActionButton(Icons.share_outlined, context.l10n.share, () => _onSharePressed(code)),
+ const SizedBox(width: 10),
+ _buildActionButton(Icons.qr_code, context.l10n.qrCode, () => _onShowQrPressed(code)),
+ ],
+ ),
+ const SizedBox(height: 16),
+ Container(
+ decoration: BoxDecoration(
+ color: Theme.of(context).brightness == Brightness.dark
+ ? colorScheme.backgroundElevated2
+ : const Color(0xFFF7F7F7),
+ //color of the bottom button row on single select
+ borderRadius: BorderRadius.circular(12),
+ ),
+ child: Row(
+ children: [
+ ValueListenableBuilder<Set<String>>(
+ valueListenable: _codeDisplayStore.selectedCodeIds,
+ builder: (context, selectedIds, child) {
+ if (selectedIds.isEmpty) return const Expanded(child: SizedBox.shrink());
+
+ final selectedCodes = _allCodes?.where((c) => selectedIds.contains(c.rawData)).toList() ?? [];
+ if (selectedCodes.isEmpty) return const Expanded(child: SizedBox.shrink());
+
+ final bool allArePinned = selectedCodes.every((code) => code.isPinned);
+
+ return _buildClearActionButton(
+ allArePinned ? Icons.push_pin : Icons.push_pin_outlined,
+ allArePinned ? context.l10n.unpinText : context.l10n.pinText,
+ _onPinSelectedPressed,
+ );
+ },
+),
+ _buildClearActionButton(Icons.label_outline, context.l10n.addTag, _onAddTagPressed),
+ _buildClearActionButton(Icons.delete_outline, context.l10n.trash, _onTrashSelectedPressed),
+ ],
+ ),
+ ),
+ ],
+ );
+}
+
+Widget _buildMultiSelectActions(Set<String> selectedIds) {
+ final colorScheme = getEnteColorScheme(context);
+ return Container(
+ decoration: BoxDecoration(
+ color: Theme.of(context).brightness == Brightness.dark
+ ? colorScheme.backgroundElevated2
+ : const Color(0xFFF7F7F7),
+ //color of the bottom button row on multi select
+ borderRadius: BorderRadius.circular(12),
+ ),
+ child: Row(
+ children: [
+ ValueListenableBuilder<Set<String>>(
+ valueListenable: _codeDisplayStore.selectedCodeIds,
+ builder: (context, selectedIds, child) {
+ if (selectedIds.isEmpty) return const Expanded(child: SizedBox.shrink());
+
+ final selectedCodes = _allCodes?.where((c) => selectedIds.contains(c.rawData)).toList() ?? [];
+ if (selectedCodes.isEmpty) return const Expanded(child: SizedBox.shrink());
+
+ final bool allArePinned = selectedCodes.every((code) => code.isPinned);
+
+ return _buildClearActionButton(
+ allArePinned ? Icons.push_pin : Icons.push_pin_outlined,
+ allArePinned ? context.l10n.unpinText : context.l10n.pinText,
+ _onPinSelectedPressed,
+ );
+ },
+),
+ _buildClearActionButton(Icons.label_outline, context.l10n.addTag, _onAddTagPressed),
+ _buildClearActionButton(Icons.delete_outline, context.l10n.trash, _onTrashSelectedPressed),
+ ],
+ ),
+ );
+}
+ Widget _buildActionButton(IconData icon, String label, VoidCallback onTap) {
+ final colorScheme = getEnteColorScheme(context);
+ final textTheme = getEnteTextTheme(context);
+
+ return Expanded(
+ child: Container(
+ decoration: BoxDecoration(
+ color: Theme.of(context).brightness == Brightness.dark
+ ? colorScheme.backgroundElevated2
+ : const Color(0xFFF7F7F7),
+
+ borderRadius: BorderRadius.circular(12),
+ ),
+ child: InkWell(
+ onTap: onTap,
+ borderRadius: BorderRadius.circular(12),
+ highlightColor: colorScheme.textBase.withValues(alpha: 0.7),
+ splashColor: colorScheme.textBase.withValues(alpha: 0.7),
+ child: Padding(
+ padding: const EdgeInsets.symmetric(vertical: 12.0),
+ child: Column(
+ mainAxisAlignment: MainAxisAlignment.center,
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ Icon(icon, color: colorScheme.textBase, size: 18), //top row icon props
+ const SizedBox(height: 8),
+ Text(
+ label,
+ style: textTheme.small.copyWith(color: colorScheme.textBase, fontSize: 11),
+ textAlign: TextAlign.center,
+ ),
+ ],
+ ),
+ ),
+ ),
+ ),
+ );
+}
+
+Widget _buildActionButtons() {
+ if (_isTrashOpen) {
+ return _buildTrashSelectActions();
+ }
+ return ValueListenableBuilder<Set<String>>(
+ valueListenable: _codeDisplayStore.selectedCodeIds,
+ builder: (context, selectedIds, child) {
+ if (selectedIds.isEmpty) {
+ return const SizedBox.shrink();
+ }
+
+ if (selectedIds.length == 1) {
+ final selectedCode = _allCodes?.firstWhereOrNull(
+ (c) => c.rawData == selectedIds.first,
+ );
+ if (selectedCode == null) return const SizedBox.shrink();
+ return _buildSingleSelectActions(selectedCode);
+ } else {
+ return _buildMultiSelectActions(selectedIds);
+ }
+ },
+ );
+}
+
+ Widget _buildSelectionActionBar() {
+ final bottomPadding = MediaQuery.of(context).padding.bottom;
+ final colorScheme = getEnteColorScheme(context);
+
+ return ConstrainedBox(
+ constraints: BoxConstraints(
+ maxHeight: MediaQuery.of(context).size.height * 0.4,
+ ),
+ child: Card(
+ margin: EdgeInsets.zero,
+ shape: const RoundedRectangleBorder(
+ borderRadius: BorderRadius.only(
+ topLeft: Radius.circular(16),
+ topRight: Radius.circular(16),
+ ),
+ ),
+ elevation: 4,
+ color: Theme.of(context).brightness == Brightness.dark
+ ? colorScheme.fillFaint
+ : colorScheme.backgroundElevated2,
+ child: Padding(
+ padding: EdgeInsets.fromLTRB(16, 16, 16, 16 + bottomPadding),
+ child: SingleChildScrollView(
+ child: Column(
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ Row(
+ children: [
+ //Select all pill
+ Material(
+ shape: StadiumBorder(
+ side: BorderSide(color: colorScheme.strokeMuted, width: 0.5),
+ ),
+ color: colorScheme.backgroundElevated2,
+ clipBehavior: Clip.antiAlias,
+ child: InkWell(
+ onTap: () {
+ final allVisibleCodeIds =
+ _filteredCodes.map((c) => c.rawData).toSet();
+ _codeDisplayStore.selectedCodeIds.value = allVisibleCodeIds;
+ },
+ child: Padding(
+ padding: const EdgeInsets.symmetric(horizontal: 12.0, vertical: 8.0),
+ child: Row(
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ const Icon(
+ Icons.check_circle_outline_outlined,
+ color: Colors.grey,
+ size: 15,
+ ),
+ const SizedBox(width: 6),
+ Text(context.l10n.selectAll, style: const TextStyle(fontSize: 11)),
+ ],
+ ),
+ ),
+ ),
+ ),
+
+ // Center code logo icon
+ Expanded(
+ child: ValueListenableBuilder<Set<String>>(
+ valueListenable: _codeDisplayStore.selectedCodeIds,
+ builder: (context, selectedIds, child) {
+ if (selectedIds.isEmpty) {
+ return const SizedBox.shrink();
+ }
+ final selectedCodes = _allCodes
+ ?.where((c) => selectedIds.contains(c.rawData))
+ .toList() ??
+ [];
+ final codesToShow = selectedCodes.take(3).toList();
+ return Row(
+ mainAxisAlignment: MainAxisAlignment.center,
+ children: [
+ ...codesToShow.map((code) {
+ final iconData = code.display.isCustomIcon
+ ? code.display.iconID
+ : code.issuer;
+ return Padding(
+ padding: const EdgeInsets.symmetric(horizontal: 4.0),
+ child: IconUtils.instance
+ .getIcon(context, iconData.trim(), width: 17),
+ );
+ }),
+ if (selectedIds.length > 3)
+ Padding(
+ padding: const EdgeInsets.only(left: 4.0),
+ child: Text(
+ '+${selectedIds.length - 3}',
+ style: const TextStyle(),
+ ),
+ ),
+ ],
+ );
+ },
+ ),
+ ),
+
+ // N selected pill
+ ValueListenableBuilder<Set<String>>(
+ valueListenable: _codeDisplayStore.selectedCodeIds,
+ builder: (context, selectedIds, child) {
+ return Material(
+ shape: StadiumBorder(
+ side: BorderSide(color: colorScheme.strokeMuted, width: 0.5),
+ ),
+ color: colorScheme.backgroundElevated2,
+ clipBehavior: Clip.antiAlias,
+ child: InkWell(
+ onTap: () {
+ _codeDisplayStore.clearSelection();
+ },
+ child: Padding(
+ padding: const EdgeInsets.symmetric(horizontal: 12.0, vertical: 8.0),
+ child: Row(
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ Text(
+ '${selectedIds.length} selected',
+ style: const TextStyle(fontSize: 11),
+ ),
+ const SizedBox(width: 6),
+ const Icon(
+ Icons.close,
+ size: 15,
+ color: Colors.grey,
+ ),
+ ],
+ ),
+ ),
+ ),
+ );
+ },
+ ),
+ ],
+),
+ const SizedBox(height: 16),
+ _buildActionButtons(),
+ ],
+ ),
+ ),
+ ),
+ ),
+ );
+}
+
bool _handleKeyEvent(KeyEvent event) {
if (event is KeyDownEvent) {
_pressedKeys.add(event.logicalKey);
@@ -420,120 +989,135 @@ class _HomePageState extends State<HomePage> {
}
@override
- Widget build(BuildContext context) {
- LockScreenSettings.instance
- .setLightMode(getEnteColorScheme(context).isLightTheme);
- final l10n = context.l10n;
- isCompactMode = PreferenceService.instance.isCompactMode();
-
- return PopScope(
- onPopInvokedWithResult: (_, result) async {
- if (_isSettingsOpen) {
- scaffoldKey.currentState!.closeDrawer();
- return;
- } else if (!Platform.isAndroid) {
- Navigator.of(context).pop();
- return;
- }
- await MoveToBackground.moveTaskToBack();
- },
- canPop: false,
- child: Scaffold(
- key: scaffoldKey,
- drawerEnableOpenDragGesture: !Platform.isAndroid,
- drawer: Drawer(
- width: 428,
- child: _settingsPage,
- ),
- onDrawerChanged: (isOpened) => _isSettingsOpen = isOpened,
- body: SafeArea(
+Widget build(BuildContext context) {
+ LockScreenSettings.instance
+ .setLightMode(getEnteColorScheme(context).isLightTheme);
+ final l10n = context.l10n;
+ isCompactMode = PreferenceService.instance.isCompactMode();
+
+ return ValueListenableBuilder<bool>(
+ valueListenable: _codeDisplayStore.isSelectionModeActive,
+ builder: (context, isSelecting, child) {
+ return PopScope(
+ canPop: false,
+ onPopInvokedWithResult: (_, result) async {
+ if (isSelecting) {
+ _codeDisplayStore.clearSelection();
+ return;
+ }
+
+ if (_isSettingsOpen) {
+ scaffoldKey.currentState!.closeDrawer();
+ return;
+ } else if (!Platform.isAndroid) {
+ Navigator.of(context).pop();
+ return;
+ }
+ await MoveToBackground.moveTaskToBack();
+ },
+ child: Scaffold(
+ key: scaffoldKey,
+ drawerEnableOpenDragGesture: !Platform.isAndroid,
+ drawer: Drawer(
+ width: 428,
+ child: _settingsPage,
+ ),
+ onDrawerChanged: (isOpened) => _isSettingsOpen = isOpened,
+ body: SafeArea(
bottom: false,
child: Builder(
builder: (context) {
return _getBody();
},
),
- ),
- resizeToAvoidBottomInset: false,
- appBar: AppBar(
- title: !_showSearchBox
- ? const Text('Ente Auth', style: brandStyleMedium)
- : TextField(
- autocorrect: false,
- enableSuggestions: false,
- autofocus: _autoFocusSearch,
- controller: _textController,
- onChanged: (val) {
- _searchText = val;
- _applyFilteringAndRefresh();
- },
- decoration: InputDecoration(
- hintText: l10n.searchHint,
- border: InputBorder.none,
- focusedBorder: InputBorder.none,
+ ),
+ bottomNavigationBar: isSelecting ? _buildSelectionActionBar() : null,
+ resizeToAvoidBottomInset: false,
+ appBar: AppBar(
+ backgroundColor: Theme.of(context).scaffoldBackgroundColor,
+ surfaceTintColor: Colors.transparent,
+ title: !_showSearchBox
+ ? const Text('Ente Auth', style: brandStyleMedium)
+ : TextField(
+ autocorrect: false,
+ enableSuggestions: false,
+ autofocus: _autoFocusSearch,
+ controller: _textController,
+ onChanged: (val) {
+ _searchText = val;
+ _applyFilteringAndRefresh();
+ },
+ decoration: InputDecoration(
+ hintText: l10n.searchHint,
+ border: InputBorder.none,
+ focusedBorder: InputBorder.none,
+ ),
+ focusNode: searchBoxFocusNode,
),
- focusNode: searchBoxFocusNode,
+ centerTitle: PlatformUtil.isDesktop() ? false : true,
+ actions: <Widget>[
+ Padding(
+ padding: const EdgeInsets.all(8.0),
+ child: SortCodeMenuWidget(
+ currentKey: PreferenceService.instance.codeSortKey(),
+ onSelected: (newOrder) async {
+ await PreferenceService.instance.setCodeSortKey(newOrder);
+ if (newOrder == CodeSortKey.manual &&
+ newOrder == _codeSortKey) {
+ await navigateToReorderPage(_allCodes!);
+ }
+ setState(() {
+ _codeSortKey = newOrder;
+ });
+ if (mounted) {
+ _applyFilteringAndRefresh();
+ }
+ },
),
- centerTitle: PlatformUtil.isDesktop() ? false : true,
- actions: <Widget>[
- Padding(
- padding: const EdgeInsets.all(8.0),
- child: SortCodeMenuWidget(
- currentKey: PreferenceService.instance.codeSortKey(),
- onSelected: (newOrder) async {
- await PreferenceService.instance.setCodeSortKey(newOrder);
- if (newOrder == CodeSortKey.manual &&
- newOrder == _codeSortKey) {
- await navigateToReorderPage(_allCodes!);
- }
- setState(() {
- _codeSortKey = newOrder;
- });
- if (mounted) {
- _applyFilteringAndRefresh();
- }
- },
),
- ),
- if (PlatformUtil.isDesktop())
+ if (PlatformUtil.isDesktop())
+ IconButton(
+ icon: const Icon(Icons.lock),
+ tooltip: l10n.appLock,
+ padding: const EdgeInsets.all(8.0),
+ onPressed: () async {
+ await navigateToLockScreen();
+ },
+ ),
IconButton(
- icon: const Icon(Icons.lock),
- tooltip: l10n.appLock,
+ icon: _showSearchBox
+ ? const Icon(Icons.clear)
+ : const Icon(Icons.search),
+ tooltip: l10n.search,
padding: const EdgeInsets.all(8.0),
- onPressed: () async {
- await navigateToLockScreen();
+ onPressed: () {
+ setState(() {
+ _showSearchBox = !_showSearchBox;
+ if (!_showSearchBox) {
+ _textController.clear();
+ _searchText = "";
+ } else {
+ _searchText = _textController.text;
+ searchBoxFocusNode.requestFocus();
+ }
+ _applyFilteringAndRefresh();
+ });
},
),
- IconButton(
- icon: _showSearchBox
- ? const Icon(Icons.clear)
- : const Icon(Icons.search),
- tooltip: l10n.search,
- padding: const EdgeInsets.all(8.0),
- onPressed: () {
- setState(() {
- _showSearchBox = !_showSearchBox;
- if (!_showSearchBox) {
- _textController.clear();
- _searchText = "";
- } else {
- _searchText = _textController.text;
- searchBoxFocusNode.requestFocus();
- }
- _applyFilteringAndRefresh();
- });
- },
- ),
- ],
+ ],
+ ),
+ floatingActionButton: isSelecting
+ ? null
+ : (!_hasLoaded ||
+ (_allCodes?.isEmpty ?? true) ||
+ !PreferenceService.instance.hasShownCoachMark()
+ ? null
+ : _getFab()),
),
- floatingActionButton: !_hasLoaded ||
- (_allCodes?.isEmpty ?? true) ||
- !PreferenceService.instance.hasShownCoachMark()
- ? null
- : _getFab(),
- ),
- );
- }
+ );
+ },
+ );
+}
Widget _getBody() {
final l10n = context.l10n;
@@ -571,6 +1155,7 @@ class _HomePageState extends State<HomePage> {
? TagChipState.selected
: TagChipState.unselected,
onTap: () {
+ _codeDisplayStore.clearSelection();
selectedTag = "";
_isTrashOpen = false;
@@ -587,6 +1172,7 @@ class _HomePageState extends State<HomePage> {
? TagChipState.selected
: TagChipState.unselected,
onTap: () {
+ _codeDisplayStore.clearSelection();
selectedTag = "";
_isTrashOpen = !_isTrashOpen;
setState(() {});
@@ -604,6 +1190,7 @@ class _HomePageState extends State<HomePage> {
? TagChipState.selected
: TagChipState.unselected,
onTap: () {
+ _codeDisplayStore.clearSelection();
_isTrashOpen = false;
if (selectedTag == tags[customTagIndex]) {
selectedTag = "";
diff --git a/mobile/apps/auth/lib/ui/settings/data/local_backup_settings_page.dart b/mobile/apps/auth/lib/ui/settings/data/local_backup_settings_page.dart
index 1bf998d75e..d430a9a9a6 100644
--- a/mobile/apps/auth/lib/ui/settings/data/local_backup_settings_page.dart
+++ b/mobile/apps/auth/lib/ui/settings/data/local_backup_settings_page.dart
@@ -361,7 +361,7 @@ class _LocalBackupSettingsPageState extends State<LocalBackupSettingsPage> {
const SizedBox(height: 4),
if (_backupPath != null)
Text(
- _backupPath!,
+ _simplifyPath(_backupPath!),
style: getEnteTextTheme(context).small,
)
else
@@ -385,7 +385,7 @@ class _LocalBackupSettingsPageState extends State<LocalBackupSettingsPage> {
);
} else {
return Text(
- snapshot.data ?? '',
+ _simplifyPath(snapshot.data ?? ''),
style: getEnteTextTheme(context)
.small
.copyWith(color: Colors.grey),