Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 16 additions & 7 deletions lib/image_editor_plus.dart
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ class ImageEditor extends StatelessWidget {
final o.FlipOption? flipOption;
final o.RotateOption? rotateOption;
final o.TextOption? textOption;
final o.LinkOption? linkOption;

const ImageEditor({
super.key,
Expand All @@ -68,6 +69,7 @@ class ImageEditor extends StatelessWidget {
this.flipOption = const o.FlipOption(),
this.rotateOption = const o.RotateOption(),
this.textOption = const o.TextOption(),
this.linkOption = const o.LinkOption(),
});

@override
Expand All @@ -94,6 +96,7 @@ class ImageEditor extends StatelessWidget {
flipOption: flipOption,
rotateOption: rotateOption,
textOption: textOption,
linkOption: linkOption,
);
} else {
return MultiImageEditor(
Expand All @@ -109,6 +112,7 @@ class ImageEditor extends StatelessWidget {
flipOption: flipOption,
rotateOption: rotateOption,
textOption: textOption,
linkOption: linkOption,
);
}
}
Expand Down Expand Up @@ -159,6 +163,7 @@ class MultiImageEditor extends StatefulWidget {
final o.FlipOption? flipOption;
final o.RotateOption? rotateOption;
final o.TextOption? textOption;
final o.LinkOption? linkOption;

const MultiImageEditor({
super.key,
Expand All @@ -174,6 +179,7 @@ class MultiImageEditor extends StatefulWidget {
this.flipOption = const o.FlipOption(),
this.rotateOption = const o.RotateOption(),
this.textOption = const o.TextOption(),
this.linkOption = const o.LinkOption(),
});

@override
Expand Down Expand Up @@ -411,6 +417,7 @@ class SingleImageEditor extends StatefulWidget {
final o.FlipOption? flipOption;
final o.RotateOption? rotateOption;
final o.TextOption? textOption;
final o.LinkOption? linkOption;

const SingleImageEditor({
super.key,
Expand All @@ -426,6 +433,7 @@ class SingleImageEditor extends StatefulWidget {
this.flipOption = const o.FlipOption(),
this.rotateOption = const o.RotateOption(),
this.textOption = const o.TextOption(),
this.linkOption = const o.LinkOption(),
});

@override
Expand Down Expand Up @@ -950,7 +958,7 @@ class _SingleImageEditorState extends State<SingleImageEditor> {
setState(() {});
},
),
if (widget.textOption != null)
if (widget.linkOption != null)
BottomButton(
icon: Icons.link,
text: i18n('Link'),
Expand Down Expand Up @@ -982,32 +990,33 @@ class _SingleImageEditorState extends State<SingleImageEditor> {
});
},
),
if (widget.rotateOption != null)
if (widget.rotateOption != null && widget.rotateOption!.left)
BottomButton(
icon: Icons.rotate_left,
text: i18n('Rotate left'),
onTap: () {
var t = currentImage.width;
var temp = currentImage.width;
currentImage.width = currentImage.height;
currentImage.height = t;
currentImage.height = temp;

rotateValue--;
setState(() {});
},
),
if (widget.rotateOption != null)
if (widget.rotateOption != null && widget.rotateOption!.right)
BottomButton(
icon: Icons.rotate_right,
text: i18n('Rotate right'),
onTap: () {
var t = currentImage.width;
var temp = currentImage.width;
currentImage.width = currentImage.height;
currentImage.height = t;
currentImage.height = temp;

rotateValue++;
setState(() {});
},
),

if (widget.blurOption != null)
BottomButton(
icon: Icons.blur_on,
Expand Down
12 changes: 11 additions & 1 deletion lib/options.dart
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,23 @@ class FlipOption {
}

class RotateOption {
const RotateOption();
final bool left;
final bool right;

const RotateOption({
this.left = true,
this.right = true,
});
}

class TextOption {
const TextOption();
}

class LinkOption {
const LinkOption();
}

class ImagePickerOption {
final bool pickFromGallery, captureFromCamera;
final int maxLength;
Expand Down