feat(selection): update clear method and improve selection action bar visibility

This commit is contained in:
wanghongenpin
2026-05-19 19:48:09 +08:00
parent bb88aac6b8
commit cc6c454eff
4 changed files with 39 additions and 39 deletions

View File

@@ -272,7 +272,7 @@ class HistoryTask extends ListenerListEvent<HttpRequest> {
void onBatchRemove(List<HttpRequest> items) => resetList();
@override
clear() => resetList();
void clear(List<HttpRequest> items) => resetList();
Future<void> resetList() async {
locked = true;

View File

@@ -132,47 +132,45 @@ class DesktopRequestListState extends State<DesktopRequestListWidget> 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,
),
])),
])));
})));
}

View File

@@ -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'

View File

@@ -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);