Persist updated sort key to disk

This commit is contained in:
vishnukvmd 2021-09-11 12:31:47 +05:30
parent 29b016661a
commit 1578bf2529
2 changed files with 4 additions and 3 deletions

View file

@ -228,7 +228,8 @@ class _CollectionsGalleryWidgetState extends State<CollectionsGalleryWidget>
],
),
),
onSelected: (int index) {
onSelected: (int index) async {
await LocalSettings.instance.setAlbumSortKey(sortKey);
setState(() {
sortKey = AlbumSortKey.values[index];
});

View file

@ -22,7 +22,7 @@ class LocalSettings {
AlbumSortKey.lastUpdated;
}
void setAlbumSortKey(AlbumSortKey key) {
_prefs.setInt(kCollectionSortPref, key.index);
Future<bool> setAlbumSortKey(AlbumSortKey key) {
return _prefs.setInt(kCollectionSortPref, key.index);
}
}