diff options
| author | mirror <mirror@localhost> | 2026-11-22 08:41:00 +0900 |
|---|---|---|
| committer | mirror <mirror@localhost> | 2026-11-22 08:41:00 +0900 |
| commit | 449d8b74bd6d9dae98a07254cdfad677b920e7b0 (patch) | |
| tree | c131c3528c4d517f56e19b854a7453fedb097d40 /lib/view/src/editor | |
| download | aves-src-master.tar.gz aves-src-master.zip | |
Diffstat (limited to 'lib/view/src/editor')
| -rw-r--r-- | lib/view/src/editor/enums.dart | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/lib/view/src/editor/enums.dart b/lib/view/src/editor/enums.dart new file mode 100644 index 0000000..13282f8 --- /dev/null +++ b/lib/view/src/editor/enums.dart @@ -0,0 +1,47 @@ +import 'package:aves/ref/unicode.dart'; +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 ExtraEditorActionView on EditorAction { + String getText(BuildContext context) { + final l10n = context.l10n; + return switch (this) { + EditorAction.transform => l10n.editorActionTransform, + }; + } + + Widget getIcon() => Icon(_getIconData()); + + IconData _getIconData() { + return switch (this) { + EditorAction.transform => AIcons.transform, + }; + } +} + +extension ExtraCropAspectRatioView on CropAspectRatio { + String getText(BuildContext context) { + final l10n = context.l10n; + return switch (this) { + CropAspectRatio.free => l10n.cropAspectRatioFree, + CropAspectRatio.original => l10n.cropAspectRatioOriginal, + CropAspectRatio.square => l10n.cropAspectRatioSquare, + CropAspectRatio.ar_16_9 => '16${UniChars.ratio}9', + CropAspectRatio.ar_4_3 => '4${UniChars.ratio}3', + }; + } + + Widget getIcon() => Icon(_getIconData()); + + IconData _getIconData() { + return switch (this) { + CropAspectRatio.free => AIcons.aspectRatioFree, + CropAspectRatio.original => AIcons.aspectRatioOriginal, + CropAspectRatio.square => AIcons.aspectRatioSquare, + CropAspectRatio.ar_16_9 => AIcons.aspectRatio_16_9, + CropAspectRatio.ar_4_3 => AIcons.aspectRatio_4_3, + }; + } +} |
