Skip to content

armgit / ente

Public Imported from GitHub
0

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

Merge branch 'main' into claude/fix-custom-order-auth-011CUpM1xsFFYLvFXCpaShkm

Prateek Sunal85a4de03d041
diff --cc mobile/apps/auth/lib/ui/home_page.dart
index d8c0fd1220,c74c4dc726..44200452c3
--- a/mobile/apps/auth/lib/ui/home_page.dart
+++ b/mobile/apps/auth/lib/ui/home_page.dart
@@@ -429,111 -1257,214 +1257,214 @@@ class _HomePageState extends State<Home
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();
+ return ValueListenableBuilder<bool>(
+ valueListenable: _codeDisplayStore.isSelectionModeActive,
+ builder: (context, isSelecting, child) {
+ final bool isDesktop = PlatformUtil.isDesktop();
+ final appBar = _buildStandardAppBar(l10n, isDesktop);
+ 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();
+ },
+ ),
+ ),
+ bottomNavigationBar: isSelecting
+ ? (isDesktop && _currentGridColumns > 1
+ ? _buildDesktopSelectionBottomBar()
+ : _buildSelectionActionBar())
+ : null,
+ resizeToAvoidBottomInset: false,
+ appBar: appBar,
+ floatingActionButton: isSelecting
+ ? null
+ : (!_hasLoaded ||
+ (_allCodes?.isEmpty ?? true) ||
+ !PreferenceService.instance.hasShownCoachMark()
+ ? null
+ : _getFab()),
+ ),
+ );
},
- canPop: false,
- child: Scaffold(
- key: scaffoldKey,
- drawerEnableOpenDragGesture: !Platform.isAndroid,
- drawer: Drawer(
- width: 428,
- child: _settingsPage,
+ );
+ }
+
+ PreferredSizeWidget _buildStandardAppBar(
+ AppLocalizations l10n,
+ bool isDesktop,
+ ) {
+ return 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,
+ ),
+ centerTitle: 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) {
++ if (newOrder == CodeSortKey.manual) {
+ await navigateToReorderPage(_allCodes!);
+ }
+ setState(() {
+ _codeSortKey = newOrder;
+ });
+ if (mounted) {
+ _applyFilteringAndRefresh();
+ }
+ },
+ ),
),
- onDrawerChanged: (isOpened) => _isSettingsOpen = isOpened,
- body: SafeArea(
- bottom: false,
- child: Builder(
- builder: (context) {
- return _getBody();
+ if (isDesktop)
+ IconButton(
+ icon: const Icon(Icons.lock),
+ tooltip: l10n.appLock,
+ padding: const EdgeInsets.all(8.0),
+ onPressed: () async {
+ await navigateToLockScreen();
},
),
+ 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();
+ });
+ },
),
- 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,
- ),
- 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) {
- await navigateToReorderPage(_allCodes!);
- }
- setState(() {
- _codeSortKey = newOrder;
- });
- if (mounted) {
- _applyFilteringAndRefresh();
- }
- },
+ ],
+ );
+ }
+
+ Widget _buildDesktopSelectionBottomBar() {
+ final l10n = context.l10n;
+ final visibleIds = _filteredCodes.map((c) => c.selectionKey).toSet();
+ final colorScheme = getEnteColorScheme(context);
+ final isDarkMode = Theme.of(context).brightness == Brightness.dark;
+ final bottomPadding = MediaQuery.of(context).padding.bottom;
+
+ return ValueListenableBuilder<Set<String>>(
+ valueListenable: _codeDisplayStore.selectedCodeIds,
+ builder: (context, selectedIds, _) {
+ final bool allVisibleSelected =
+ visibleIds.isNotEmpty && selectedIds.containsAll(visibleIds);
+ return Container(
+ decoration: BoxDecoration(
+ color: isDarkMode
+ ? colorScheme.fillFaint
+ : colorScheme.backgroundElevated2,
+ border: Border(
+ top: BorderSide(
+ color: colorScheme.strokeMuted.withValues(alpha: 0.1),
+ width: 1,
),
),
- if (PlatformUtil.isDesktop())
+ boxShadow: [
+ BoxShadow(
+ color: isDarkMode
+ ? Colors.black.withValues(alpha: 0.4)
+ : Colors.grey.withValues(alpha: 0.2),
+ blurRadius: 8,
+ offset: const Offset(0, -2),
+ ),
+ ],
+ ),
+ padding: EdgeInsets.fromLTRB(24, 20, 24, 20 + bottomPadding),
+ child: Row(
+ children: [
+ // Close button and count
IconButton(
- icon: const Icon(Icons.lock),
- tooltip: l10n.appLock,
- padding: const EdgeInsets.all(8.0),
- onPressed: () async {
- await navigateToLockScreen();
- },
+ icon: const Icon(Icons.close),
+ tooltip: l10n.cancel,
+ onPressed: () => _codeDisplayStore.clearSelection(),
+ padding: const EdgeInsets.all(12),
),
- 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: !_hasLoaded ||
- (_allCodes?.isEmpty ?? true) ||
- !PreferenceService.instance.hasShownCoachMark()
- ? null
- : _getFab(),
- ),
+ const SizedBox(width: 8),
+ Text(
+ '${selectedIds.length} ${l10n.selected}',
+ style: Theme.of(context)
+ .textTheme
+ .titleMedium
+ ?.copyWith(fontWeight: FontWeight.w600),
+ ),
+ const Spacer(),
+ // Action buttons in center
+ _buildDesktopActionRow(context),
+ const Spacer(),
+ // Select all chip
+ _buildSelectAllChip(
+ context: context,
+ enabled: !allVisibleSelected,
+ onPressed: allVisibleSelected
+ ? null
+ : () {
+ final newSelection = Set<String>.from(visibleIds);
+ _codeDisplayStore.selectedCodeIds.value = newSelection;
+ _codeDisplayStore.isSelectionModeActive.value =
+ newSelection.isNotEmpty;
+ },
+ ),
+ ],
+ ),
+ );
+ },
);
}