aboutsummaryrefslogtreecommitdiff
path: root/lib/view/src/actions/chip.dart
diff options
context:
space:
mode:
authormirror <mirror@localhost>2026-11-22 08:41:00 +0900
committermirror <mirror@localhost>2026-11-22 08:41:00 +0900
commit449d8b74bd6d9dae98a07254cdfad677b920e7b0 (patch)
treec131c3528c4d517f56e19b854a7453fedb097d40 /lib/view/src/actions/chip.dart
downloadaves-src-master.tar.gz
aves-src-master.zip
snapshot of aves v1.13.12 (secrets removed: android/app/google-services.json)HEADv1.13.12master
Diffstat (limited to 'lib/view/src/actions/chip.dart')
-rw-r--r--lib/view/src/actions/chip.dart42
1 files changed, 42 insertions, 0 deletions
diff --git a/lib/view/src/actions/chip.dart b/lib/view/src/actions/chip.dart
new file mode 100644
index 0000000..03afd44
--- /dev/null
+++ b/lib/view/src/actions/chip.dart
@@ -0,0 +1,42 @@
+import 'package:aves/theme/icons.dart';
+import 'package:aves/widgets/common/extensions/build_context.dart';
+import 'package:aves_model/aves_model.dart';
+import 'package:flutter/widgets.dart';
+
+extension ExtraChipActionView on ChipAction {
+ String getText(BuildContext context) {
+ final l10n = context.l10n;
+ return switch (this) {
+ ChipAction.goToAlbumPage => l10n.chipActionGoToAlbumPage,
+ ChipAction.goToCountryPage => l10n.chipActionGoToCountryPage,
+ ChipAction.goToPlacePage => l10n.chipActionGoToPlacePage,
+ ChipAction.goToTagPage => l10n.chipActionGoToTagPage,
+ ChipAction.goToExplorerPage => l10n.chipActionGoToExplorerPage,
+ ChipAction.ratingOrGreater ||
+ ChipAction.ratingOrLower =>
+ // different data depending on state
+ toString(),
+ ChipAction.decompose => l10n.chipActionDecompose,
+ ChipAction.reverse =>
+ // different data depending on state
+ l10n.chipActionFilterOut,
+ ChipAction.hide => l10n.chipActionHide,
+ ChipAction.lockVault => l10n.chipActionLock,
+ };
+ }
+
+ Widget getIcon() => Icon(_getIconData());
+
+ IconData _getIconData() => switch (this) {
+ ChipAction.goToAlbumPage => AIcons.album,
+ ChipAction.goToCountryPage => AIcons.country,
+ ChipAction.goToPlacePage => AIcons.place,
+ ChipAction.goToTagPage => AIcons.tag,
+ ChipAction.goToExplorerPage => AIcons.explorer,
+ ChipAction.ratingOrGreater || ChipAction.ratingOrLower => AIcons.rating,
+ ChipAction.decompose => AIcons.split,
+ ChipAction.reverse => AIcons.reverse,
+ ChipAction.hide => AIcons.hide,
+ ChipAction.lockVault => AIcons.vaultLock,
+ };
+}