minor fixes
This commit is contained in:
parent
4c21c67f50
commit
e578caa4d5
2 changed files with 6 additions and 3 deletions
|
@ -110,7 +110,9 @@ class Settings extends ChangeNotifier {
|
|||
|
||||
double get collectionTileExtent => _prefs.getDouble(collectionTileExtentKey) ?? 0;
|
||||
|
||||
set collectionTileExtent(double newValue) => setAndNotify(collectionTileExtentKey, newValue);
|
||||
// do not notify, as `collectionTileExtent` is only used internally by `TileExtentManager`
|
||||
// and should not trigger rebuilding by change notification
|
||||
set collectionTileExtent(double newValue) => setAndNotify(collectionTileExtentKey, newValue, notify: false);
|
||||
|
||||
bool get showThumbnailLocation => getBoolOrDefault(showThumbnailLocationKey, true);
|
||||
|
||||
|
@ -189,7 +191,7 @@ class Settings extends ChangeNotifier {
|
|||
return _prefs.getStringList(key)?.map((s) => values.firstWhere((el) => el.toString() == s, orElse: () => null))?.where((el) => el != null)?.toList() ?? defaultValue;
|
||||
}
|
||||
|
||||
void setAndNotify(String key, dynamic newValue) {
|
||||
void setAndNotify(String key, dynamic newValue, {bool notify = true}) {
|
||||
var oldValue = _prefs.get(key);
|
||||
if (newValue == null) {
|
||||
_prefs.remove(key);
|
||||
|
@ -209,7 +211,7 @@ class Settings extends ChangeNotifier {
|
|||
oldValue = _prefs.getBool(key);
|
||||
_prefs.setBool(key, newValue);
|
||||
}
|
||||
if (oldValue != newValue) {
|
||||
if (oldValue != newValue && notify) {
|
||||
notifyListeners();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -64,6 +64,7 @@ class StatsPage extends StatelessWidget {
|
|||
final videoByMimeTypes = Map.fromEntries(byMimeTypes.entries.where((kv) => kv.key.startsWith('video/')));
|
||||
final mimeDonuts = Wrap(
|
||||
alignment: WrapAlignment.center,
|
||||
crossAxisAlignment: WrapCrossAlignment.center,
|
||||
children: [
|
||||
_buildMimeDonut(context, (sum) => Intl.plural(sum, one: 'image', other: 'images'), imagesByMimeTypes),
|
||||
_buildMimeDonut(context, (sum) => Intl.plural(sum, one: 'video', other: 'videos'), videoByMimeTypes),
|
||||
|
|
Loading…
Reference in a new issue