summaryrefslogtreecommitdiff
path: root/lib/view/src/storage/volume.dart
diff options
context:
space:
mode:
Diffstat (limited to 'lib/view/src/storage/volume.dart')
-rw-r--r--lib/view/src/storage/volume.dart15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/view/src/storage/volume.dart b/lib/view/src/storage/volume.dart
new file mode 100644
index 0000000..4a77b7f
--- /dev/null
+++ b/lib/view/src/storage/volume.dart
@@ -0,0 +1,15 @@
+import 'package:aves/widgets/common/extensions/build_context.dart';
+import 'package:aves_model/aves_model.dart';
+import 'package:flutter/widgets.dart';
+
+extension ExtraStorageVolumeView on StorageVolume {
+ String getDescription(BuildContext? context) {
+ if (description != null) return description!;
+ // ideally, the context should always be provided, but in some cases (e.g. album comparison),
+ // this would require numerous additional methods to have the context as argument
+ // for such a minor benefit: fallback volume description on Android < N
+ final l10n = context?.l10n;
+ if (isPrimary) return l10n?.storageVolumeDescriptionFallbackPrimary ?? 'Internal Storage';
+ return l10n?.storageVolumeDescriptionFallbackNonPrimary ?? 'SD card';
+ }
+}