Skip to content

Commit

Permalink
feat: openfoodfacts#304 - added comments after code review
Browse files Browse the repository at this point in the history
Impacted file:
* `ProductImage.dart`
  • Loading branch information
monsieurtanuki committed Dec 9, 2021
1 parent a033813 commit a70e6b9
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions lib/model/ProductImage.dart
Expand Up @@ -61,10 +61,18 @@ extension ImageSizeExtension on ImageSize? {
);
}

/// Angle for image rotation.
enum ImageAngle {
/// Noon = no rotation
NOON,

/// 3 o'clock
THREE_O_CLOCK,

/// 6 o'clock
SIX_O_CLOCK,

/// 9 o'clock
NINE_O_CLOCK,
}

Expand All @@ -78,9 +86,10 @@ extension ImageAngleExtension on ImageAngle {

String get degreesClockwise => _DEGREES_CLOCKWISE[this]?.toString() ?? '0';

static ImageAngle? fromInt(final int? angle) {
for (MapEntry<ImageAngle, int> entry in _DEGREES_CLOCKWISE.entries) {
if (entry.value == angle) {
/// Returns the corresponding [ImageAngle], or null if not found.
static ImageAngle? fromInt(final int? clockwiseDegree) {
for (final MapEntry<ImageAngle, int> entry in _DEGREES_CLOCKWISE.entries) {
if (entry.value == clockwiseDegree) {
return entry.key;
}
}
Expand Down

0 comments on commit a70e6b9

Please sign in to comment.