Skip to content

Commit 3b04eb6

Browse files
committed
fix(text-layers): delete empty text layers and update text editor logic
1 parent 2cbb89b commit 3b04eb6

File tree

5 files changed

+14
-6
lines changed

5 files changed

+14
-6
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Changelog
22

3+
## 10.5.4
4+
- **FEAT**(text-layers): Delete the edited 'TextLayers' if the new text is empty.
5+
36
## 10.5.3
47
- **FIX**(helper-lines): Resolve lint issues after upgrading to `flutter_lints: ^6.0.0`.
58

example/pubspec.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ dependencies:
1919
bot_toast: ^4.1.0
2020
cupertino_icons: ^1.0.8
2121
file_picker: ^10.2.0
22-
gal: ^2.3.1
22+
gal: ^2.3.2
2323
google_fonts: ^6.2.1
2424
file_saver: ^0.2.14
2525
firebase_core: ^3.14.0
@@ -29,15 +29,15 @@ dependencies:
2929
image_background_remover: ^1.0.0
3030
image_picker: ^1.1.2
3131
mime: ^2.0.0
32-
url_launcher: ^6.3.1
32+
url_launcher: ^6.3.2
3333
flutter_colorpicker: ^1.1.0
3434
vibration: ^3.1.1
3535

3636
# Video-Editing
37-
pro_video_editor: ^0.1.8
37+
pro_video_editor: ^0.2.0
3838
### Choose one player below
3939
video_player: ^2.10.0
40-
chewie: ^1.11.3
40+
chewie: ^1.12.1
4141
flick_video_player: ^0.9.0
4242
media_kit: ^1.2.0 # Primary package.
4343
media_kit_video: ^1.3.0 # For video rendering.

lib/features/main_editor/main_editor.dart

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1209,6 +1209,11 @@ class ProImageEditorState extends State<ProImageEditor>
12091209

12101210
if (layer == null || !mounted) return;
12111211

1212+
if (layer.text.isEmpty) {
1213+
removeLayer(layerData);
1214+
return;
1215+
}
1216+
12121217
int i = activeLayers.indexWhere((element) => element.id == layerData.id);
12131218
if (i >= 0) {
12141219
_setTempLayer(layerData);

lib/features/text_editor/text_editor.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ class TextEditorState extends State<TextEditor>
310310
/// Handles the "Done" action, either by applying changes or closing the
311311
/// editor.
312312
void done() {
313-
if (textCtrl.text.trim().isNotEmpty) {
313+
if (textCtrl.text.trim().isNotEmpty || widget.layer != null) {
314314
TextLayer layer = TextLayer(
315315
text: textCtrl.text.trim(),
316316
background: _backgroundColor,

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: pro_image_editor
22
description: "A Flutter image editor: Seamlessly enhance your images with user-friendly editing features."
3-
version: 10.5.3
3+
version: 10.5.4
44
homepage: https://github.com/hm21/pro_image_editor/
55
repository: https://github.com/hm21/pro_image_editor/
66
documentation: https://github.com/hm21/pro_image_editor/

0 commit comments

Comments
 (0)