Skip to content

armgit / ente

Public Imported from GitHub
0

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

[auth] Make tag strips horizontally scrollable

Neeraj Gupta5bf489a33271
diff --git a/mobile/apps/auth/lib/ui/components/horizontal_scroll_area.dart b/mobile/apps/auth/lib/ui/components/horizontal_scroll_area.dart
new file mode 100644
index 0000000000..4777eb249c
--- /dev/null
+++ b/mobile/apps/auth/lib/ui/components/horizontal_scroll_area.dart
@@ -0,0 +1,65 @@
+import 'package:flutter/gestures.dart';
+import 'package:flutter/material.dart';
+
+class HorizontalScrollArea extends StatefulWidget {
+ final Widget Function(BuildContext context, ScrollController controller)
+ builder;
+
+ const HorizontalScrollArea({super.key, required this.builder});
+
+ @override
+ State<HorizontalScrollArea> createState() => _HorizontalScrollAreaState();
+}
+
+class _HorizontalScrollAreaState extends State<HorizontalScrollArea> {
+ final ScrollController _controller = ScrollController();
+
+ @override
+ void dispose() {
+ _controller.dispose();
+ super.dispose();
+ }
+
+ void _handlePointerSignal(PointerSignalEvent event) {
+ if (event is! PointerScrollEvent || !_controller.hasClients) {
+ return;
+ }
+
+ if (event.scrollDelta.dx != 0 || event.scrollDelta.dy == 0) {
+ return;
+ }
+
+ final scrollDelta = event.scrollDelta.dy;
+ GestureBinding.instance.pointerSignalResolver.register(event, (_) {
+ final position = _controller.position;
+ final nextOffset = (_controller.offset + scrollDelta)
+ .clamp(position.minScrollExtent, position.maxScrollExtent)
+ .toDouble();
+ if (nextOffset != _controller.offset) {
+ _controller.jumpTo(nextOffset);
+ }
+ });
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ return Listener(
+ onPointerSignal: _handlePointerSignal,
+ child: ScrollConfiguration(
+ behavior: const _HorizontalScrollBehavior(),
+ child: widget.builder(context, _controller),
+ ),
+ );
+ }
+}
+
+class _HorizontalScrollBehavior extends MaterialScrollBehavior {
+ const _HorizontalScrollBehavior();
+
+ @override
+ Set<PointerDeviceKind> get dragDevices => {
+ ...super.dragDevices,
+ PointerDeviceKind.mouse,
+ PointerDeviceKind.trackpad,
+ };
+}
diff --git a/mobile/apps/auth/lib/ui/home/add_tag_sheet.dart b/mobile/apps/auth/lib/ui/home/add_tag_sheet.dart
index b666c606d8..06e36a12f8 100644
--- a/mobile/apps/auth/lib/ui/home/add_tag_sheet.dart
+++ b/mobile/apps/auth/lib/ui/home/add_tag_sheet.dart
@@ -9,6 +9,7 @@ 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/horizontal_scroll_area.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';
@@ -172,45 +173,49 @@ class _AddTagSheetState extends State<AddTagSheet> {
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;
+ child: HorizontalScrollArea(
+ builder: (context, scrollController) => ListView.separated(
+ controller: scrollController,
+ 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: [
- Container(
- width: 50,
- height: 50,
- decoration: BoxDecoration(
- color: colorScheme.fillFaint.withValues(alpha: 0.02),
- borderRadius: BorderRadius.circular(8),
- ),
- child: Center(
- child: IconUtils.instance
- .getIcon(context, iconData.trim(), width: 28),
+ return SizedBox(
+ width: 60,
+ child: Column(
+ mainAxisAlignment: MainAxisAlignment.center,
+ children: [
+ Container(
+ width: 50,
+ height: 50,
+ decoration: BoxDecoration(
+ color:
+ colorScheme.fillFaint.withValues(alpha: 0.02),
+ borderRadius: BorderRadius.circular(8),
+ ),
+ child: Center(
+ child: IconUtils.instance
+ .getIcon(context, iconData.trim(), width: 28),
+ ),
),
- ),
- const SizedBox(height: 8),
- Text(
- code.issuer,
- overflow: TextOverflow.ellipsis,
- style: textTheme.mini.copyWith(
- color: colorScheme.textMuted,
+ const SizedBox(height: 8),
+ Text(
+ code.issuer,
+ overflow: TextOverflow.ellipsis,
+ style: textTheme.mini.copyWith(
+ color: colorScheme.textMuted,
+ ),
),
- ),
- ],
- ),
- );
- },
+ ],
+ ),
+ );
+ },
+ ),
),
),
const SizedBox(height: 24),
diff --git a/mobile/apps/auth/lib/ui/home_page.dart b/mobile/apps/auth/lib/ui/home_page.dart
index daa18e4f97..b932acf28b 100644
--- a/mobile/apps/auth/lib/ui/home_page.dart
+++ b/mobile/apps/auth/lib/ui/home_page.dart
@@ -28,6 +28,7 @@ import 'package:ente_auth/ui/common/loading_widget.dart';
import 'package:ente_auth/ui/components/auth_qr_dialog.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/horizontal_scroll_area.dart';
import 'package:ente_auth/ui/components/models/button_type.dart';
import 'package:ente_auth/ui/components/note_dialog.dart';
import 'package:ente_auth/ui/home/add_tag_sheet.dart';
@@ -1738,72 +1739,75 @@ class _HomePageState extends State<HomePage> {
if (!anyCodeHasError) ...[
SizedBox(
height: 48,
- child: ListView.separated(
- scrollDirection: Axis.horizontal,
- padding:
- const EdgeInsets.symmetric(horizontal: 16, vertical: 2),
- separatorBuilder: (context, index) =>
- const SizedBox(width: 8),
- itemCount: itemCount,
- itemBuilder: (context, index) {
- if (showAllChip && index == 0) {
- return TagChip(
- label: l10n.all,
- state: selectedTag == "" && _isTrashOpen == false
- ? TagChipState.selected
- : TagChipState.unselected,
- onTap: () {
- _codeDisplayStore.clearSelection();
- selectedTag = "";
- _isTrashOpen = false;
+ child: HorizontalScrollArea(
+ builder: (context, scrollController) => ListView.separated(
+ controller: scrollController,
+ scrollDirection: Axis.horizontal,
+ padding:
+ const EdgeInsets.symmetric(horizontal: 16, vertical: 2),
+ separatorBuilder: (context, index) =>
+ const SizedBox(width: 8),
+ itemCount: itemCount,
+ itemBuilder: (context, index) {
+ if (showAllChip && index == 0) {
+ return TagChip(
+ label: l10n.all,
+ state: selectedTag == "" && _isTrashOpen == false
+ ? TagChipState.selected
+ : TagChipState.unselected,
+ onTap: () {
+ _codeDisplayStore.clearSelection();
+ selectedTag = "";
+ _isTrashOpen = false;
- setState(() {});
- _applyFilteringAndRefresh();
- },
- );
- }
+ setState(() {});
+ _applyFilteringAndRefresh();
+ },
+ );
+ }
- if (showTrashChip && index == itemCount - 1) {
- return TagChip(
- label: l10n.trash,
- state: _isTrashOpen
- ? TagChipState.selected
- : TagChipState.unselected,
- onTap: () {
- _codeDisplayStore.clearSelection();
- selectedTag = "";
- _isTrashOpen = !_isTrashOpen;
- setState(() {});
- _applyFilteringAndRefresh();
- },
- iconData: Icons.delete,
- );
- }
- final customTagIndex = index - (showAllChip ? 1 : 0);
- if (customTagIndex >= 0 && customTagIndex < tags.length) {
- return TagChip(
- label: tags[customTagIndex],
- action: TagChipAction.menu,
- state: selectedTag == tags[customTagIndex]
- ? TagChipState.selected
- : TagChipState.unselected,
- onTap: () {
- _codeDisplayStore.clearSelection();
- _isTrashOpen = false;
- if (selectedTag == tags[customTagIndex]) {
+ if (showTrashChip && index == itemCount - 1) {
+ return TagChip(
+ label: l10n.trash,
+ state: _isTrashOpen
+ ? TagChipState.selected
+ : TagChipState.unselected,
+ onTap: () {
+ _codeDisplayStore.clearSelection();
selectedTag = "";
+ _isTrashOpen = !_isTrashOpen;
setState(() {});
_applyFilteringAndRefresh();
- return;
- }
- selectedTag = tags[customTagIndex];
- setState(() {});
- _applyFilteringAndRefresh();
- },
- );
- }
- return const SizedBox.shrink();
- },
+ },
+ iconData: Icons.delete,
+ );
+ }
+ final customTagIndex = index - (showAllChip ? 1 : 0);
+ if (customTagIndex >= 0 && customTagIndex < tags.length) {
+ return TagChip(
+ label: tags[customTagIndex],
+ action: TagChipAction.menu,
+ state: selectedTag == tags[customTagIndex]
+ ? TagChipState.selected
+ : TagChipState.unselected,
+ onTap: () {
+ _codeDisplayStore.clearSelection();
+ _isTrashOpen = false;
+ if (selectedTag == tags[customTagIndex]) {
+ selectedTag = "";
+ setState(() {});
+ _applyFilteringAndRefresh();
+ return;
+ }
+ selectedTag = tags[customTagIndex];
+ setState(() {});
+ _applyFilteringAndRefresh();
+ },
+ );
+ }
+ return const SizedBox.shrink();
+ },
+ ),
),
),
const SizedBox(height: 8),
diff --git a/mobile/apps/auth/scripts/internal_changes.txt b/mobile/apps/auth/scripts/internal_changes.txt
index e171a25ca2..0168743aef 100644
--- a/mobile/apps/auth/scripts/internal_changes.txt
+++ b/mobile/apps/auth/scripts/internal_changes.txt
@@ -1,4 +1,5 @@
- 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
- 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