Skip to content

Commit 1de4319

Browse files
committed
🐛 Make sort delegate a static constant same as text delegate.
Related to #24 .
1 parent ed03daf commit 1de4319

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

lib/src/constants/constants.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/// [Author] Alex (https://github.com/AlexVincent525)
33
/// [Date] 2020/3/31 16:02
44
///
5-
import '../delegates/text_delegate.dart';
5+
import 'constants.dart';
66

77
export '../delegates/sort_path_delegate.dart';
88
export '../delegates/text_delegate.dart';
@@ -16,4 +16,5 @@ class Constants {
1616
const Constants._();
1717

1818
static TextDelegate textDelegate = DefaultTextDelegate();
19+
static SortPathDelegate sortPathDelegate = SortPathDelegate.common;
1920
}

lib/src/provider/asset_picker_provider.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ class AssetPickerProvider extends ChangeNotifier {
2727
if (selectedAssets?.isNotEmpty ?? false) {
2828
_selectedAssets = List<AssetEntity>.from(selectedAssets);
2929
}
30+
Constants.sortPathDelegate = sortPathDelegate ?? SortPathDelegate.common;
3031
Future<void>.delayed(routeDuration).then(
3132
(dynamic _) async {
3233
await getAssetPathList();
@@ -212,7 +213,7 @@ class AssetPickerProvider extends ChangeNotifier {
212213
);
213214

214215
/// Sort path using sort path delegate.
215-
sortPathDelegate.sort(_list);
216+
Constants.sortPathDelegate.sort(_list);
216217

217218
for (final AssetPathEntity pathEntity in _list) {
218219
// Use sync method to avoid unnecessary wait.

0 commit comments

Comments
 (0)