From cc6c454eff402ffc0b3def0150b77dd47eab1d0c Mon Sep 17 00:00:00 2001 From: wanghongenpin Date: Tue, 19 May 2026 19:48:09 +0800 Subject: [PATCH] feat(selection): update clear method and improve selection action bar visibility --- lib/storage/histories.dart | 2 +- lib/ui/desktop/request/list.dart | 70 +++++++++++++------------- pubspec.yaml | 2 +- test/multi_select_controller_test.dart | 4 +- 4 files changed, 39 insertions(+), 39 deletions(-) diff --git a/lib/storage/histories.dart b/lib/storage/histories.dart index cfc9a2e..70dd26e 100644 --- a/lib/storage/histories.dart +++ b/lib/storage/histories.dart @@ -272,7 +272,7 @@ class HistoryTask extends ListenerListEvent { void onBatchRemove(List items) => resetList(); @override - clear() => resetList(); + void clear(List items) => resetList(); Future resetList() async { locked = true; diff --git a/lib/ui/desktop/request/list.dart b/lib/ui/desktop/request/list.dart index d2b67e6..02ffe0e 100644 --- a/lib/ui/desktop/request/list.dart +++ b/lib/ui/desktop/request/list.dart @@ -132,47 +132,45 @@ class DesktopRequestListState extends State with Autom bottomNavigationBar: Search(key: searchKey, onSearch: search), body: Padding( padding: const EdgeInsets.only(right: 5), - child: Obx(() { - return Column(children: [ - if (isSelectionMode) - SelectionActionBar( + child: Column(children: [ + Obx(() => selectionController.selectionMode.value + ? SelectionActionBar( selectionController: selectionController, onRepeat: repeatSelected, onExport: exportSelected, - onDelete: deleteSelected), - Expanded( - child: TabBarView(physics: const NeverScrollableScrollPhysics(), children: [ - DomainList( - key: domainListKey, - list: container, - panel: widget.panel, - proxyServer: widget.proxyServer, - selectionController: selectionController, - selectionHandlers: RequestSelectionHandlers( - onRangeSelection: rangeSelectRequest, - onDeleteSelected: deleteSelected, - onRepeatSelected: repeatSelected, - onExportSelected: exportSelected, - ), - onRemove: domainListRemove, + onDelete: deleteSelected) + : SizedBox()), + Expanded( + child: TabBarView(physics: const NeverScrollableScrollPhysics(), children: [ + DomainList( + key: domainListKey, + list: container, + panel: widget.panel, + proxyServer: widget.proxyServer, + selectionController: selectionController, + selectionHandlers: RequestSelectionHandlers( + onRangeSelection: rangeSelectRequest, + onDeleteSelected: deleteSelected, + onRepeatSelected: repeatSelected, + onExportSelected: exportSelected, ), - RequestSequence( - key: requestSequenceKey, - container: container, - proxyServer: widget.proxyServer, - selectionController: selectionController, - // onSelectionChanged: syncDomainSelectionVisuals, - selectionHandlers: RequestSelectionHandlers( - onRangeSelection: rangeSelectRequest, - onDeleteSelected: deleteSelected, - onRepeatSelected: repeatSelected, - onExportSelected: exportSelected, - ), - onRemove: sequenceRemove, + onRemove: domainListRemove, + ), + RequestSequence( + key: requestSequenceKey, + container: container, + proxyServer: widget.proxyServer, + selectionController: selectionController, + selectionHandlers: RequestSelectionHandlers( + onRangeSelection: rangeSelectRequest, + onDeleteSelected: deleteSelected, + onRepeatSelected: repeatSelected, + onExportSelected: exportSelected, ), - ])), - ]); - }))); + onRemove: sequenceRemove, + ), + ])), + ]))); }))); } diff --git a/pubspec.yaml b/pubspec.yaml index 54d393d..198f724 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -2,7 +2,7 @@ name: proxypin description: ProxyPin publish_to: 'none' # Remove this line if you wish to publish to pub.dev -version: 1.2.7+30 +version: 1.2.8+30 environment: sdk: '>=3.0.2 <4.0.0' diff --git a/test/multi_select_controller_test.dart b/test/multi_select_controller_test.dart index 281ccfb..233477d 100644 --- a/test/multi_select_controller_test.dart +++ b/test/multi_select_controller_test.dart @@ -24,9 +24,11 @@ void main() { expect(controller.selectedIds, {'b', 'c', 'd'}); }); - test('selectAll and prune keep only visible ids', () { + test('prune keeps only visible ids', () { final controller = MultiSelectController(); + controller.selectOnly('b'); + controller.selectRange(['a', 'b', 'c', 'd'], 'c'); controller.prune(['b', 'c', 'd']); expect(controller.isSelectionMode, isTrue);