Skip to content

Commit 9be23d3

Browse files
committed
⚡️ Stop enabling drag to select when maxAssets == 1
1 parent 669a131 commit 9be23d3

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ that can be found in the LICENSE file. -->
1212
**Improvements**
1313

1414
- Improve how `MediaQuery` is being listened.
15+
- Stop enabling drag to select when `maxAssets == 1`.
1516

1617
## 9.5.1
1718

lib/src/constants/config.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,9 @@ class AssetPickerConfig {
213213
///
214214
/// The feature enables by default if no accessibility service is being used.
215215
/// 在未使用辅助功能的情况下会默认启用该功能。
216+
///
217+
/// The feature is not available when `maxAssets` is `1`.
218+
/// 当 `maxAssets``1` 时,该功能不可用。
216219
/// {@endtemplate}
217220
final bool? dragToSelect;
218221
}

lib/src/delegates/asset_picker_builder_delegate.dart

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1372,8 +1372,12 @@ class DefaultAssetPickerBuilderDelegate
13721372
specialItem: specialItem,
13731373
);
13741374

1375-
// Enables drag-to-select.
1376-
if (dragToSelect ?? !accessibleNavigation) {
1375+
// Enables drag-to-select when:
1376+
// 1. The feature is enabled manually.
1377+
// 2. The accessibility service is not being used.
1378+
// 3. The picker is not in single asset mode.
1379+
if ((dragToSelect ?? !accessibleNavigation) &&
1380+
!isSingleAssetMode) {
13771381
child = GestureDetector(
13781382
excludeFromSemantics: true,
13791383
onHorizontalDragStart: (d) {

0 commit comments

Comments
 (0)