Jelajahi Sumber

Allow to save empty caption

ashilkn 2 tahun lalu
induk
melakukan
d7a2d6f093
1 mengubah file dengan 2 tambahan dan 8 penghapusan
  1. 2 8
      lib/ui/viewer/file/file_caption_widget.dart

+ 2 - 8
lib/ui/viewer/file/file_caption_widget.dart

@@ -20,7 +20,7 @@ class _FileCaptionWidgetState extends State<FileCaptionWidget> {
 
   @override
   void dispose() {
-    editCaption(fromDispose: true);
+    editFileCaption(null, widget.file, editedCaption);
     _textController.dispose();
     super.dispose();
   }
@@ -32,7 +32,7 @@ class _FileCaptionWidgetState extends State<FileCaptionWidget> {
     final caption = widget.file.caption;
     return TextField(
       onEditingComplete: () {
-        editCaption();
+        editFileCaption(context, widget.file, editedCaption);
         _focusNode.unfocus();
       },
       controller: _textController,
@@ -66,10 +66,4 @@ class _FileCaptionWidgetState extends State<FileCaptionWidget> {
       },
     );
   }
-
-  void editCaption({bool fromDispose = false}) {
-    if (editedCaption.isNotEmpty) {
-      editFileCaption(fromDispose ? null : context, widget.file, editedCaption);
-    }
-  }
 }