singerdmx / flutter-quill

Rich text editor for Flutter
https://pub.dev/packages/flutter_quill
MIT License
2.58k stars 832 forks source link

Unable to type in quill field in release mode #1899

Closed Prajit7 closed 1 month ago

Prajit7 commented 5 months ago

Is there an existing issue for this?

Flutter Quill version

No response

Steps to reproduce

QuillProvider( configurations: QuillConfigurations( controller: quillController, ), child: QuillEditor( focusNode: _focusNode, scrollController: bodyScrollController, configurations: QuillEditorConfigurations( showCursor: true, textSelectionThemeData: TextSelectionThemeData( selectionColor: Colors.blue.withOpacity(0.2), ),

                  autoFocus: false,
                  expands: false,
                  padding: const EdgeInsets.all(16),
                  scrollable: true,
                  minHeight: MediaQuery.of(context).size.height - 250,
                  textInputAction: TextInputAction.newline,
                  placeholder: "Add Message",
                  customStyles: const DefaultStyles(
                    placeHolder: DefaultTextBlockStyle(
                      TextStyle(
                        fontSize: 18,
                        color: Colors.grey,
                      ),
                      VerticalSpacing(0, 0),
                      VerticalSpacing(0, 0),
                      BoxDecoration(),
                    ),
                  ),
                ),
              ),
            ),

When we move from normal textfield to quill-field, the cursor and keyboard appears but unable to type anything.

https://github.com/singerdmx/flutter-quill/assets/71118373/4e62a3ab-e818-4cc3-af31-fc8a809bbe5d

Expected results

After moving from normal text-field the quill-field should work.

Actual results

When we move from normal textfield to quill-field, the cursor and keyboard appears but unable to type anything.

Code sample

QuillProvider( configurations: QuillConfigurations( controller: quillController, ), child: QuillEditor( focusNode: _focusNode, scrollController: bodyScrollController, configurations: QuillEditorConfigurations( showCursor: true, textSelectionThemeData: TextSelectionThemeData( selectionColor: Colors.blue.withOpacity(0.2), ),

                  autoFocus: false,
                  expands: false,
                  padding: const EdgeInsets.all(16),
                  scrollable: true,
                  minHeight: MediaQuery.of(context).size.height - 250,
                  textInputAction: TextInputAction.newline,
                  placeholder: "Add Message",
                  customStyles: const DefaultStyles(
                    placeHolder: DefaultTextBlockStyle(
                      TextStyle(
                        fontSize: 18,
                        color: Colors.grey,
                      ),
                      VerticalSpacing(0, 0),
                      VerticalSpacing(0, 0),
                      BoxDecoration(),
                    ),
                  ),
                ),
              ),
            ),

Screenshots or Video

https://github.com/singerdmx/flutter-quill/assets/71118373/4bce27a4-21b2-46e4-b9cd-edb5ab333a99

Logs

After adding the below code for QuillProvider, the keyboard works fine but cursor is not coming with some exception.

onTapDown: (details, p1) {

                        _focusNode.hasFocus ? _focusNode.requestFocus() : null;
                        return true;
                      },

If used the above property the exception is:

   Null check operator used on a null value
I/flutter (11856): [2024-05-28 11:39:49.741400] MyApp: #0      RenderEditor.selectPosition (package:flutter_quill/src/widgets/editor/editor.dart:1024)
I/flutter (11856): [2024-05-28 11:39:49.741937] MyApp: #1      _QuillEditorSelectionGestureDetectorBuilder.onSingleTapUp (package:flutter_quill/src/widgets/editor/editor.dart:545)
I/flutter (11856): [2024-05-28 11:39:49.742209] MyApp: #2      _EditorTextSelectionGestureDetectorState._handleTapUp (package:flutter_quill/src/widgets/text_selection.dart:774)
I/flutter (11856): [2024-05-28 11:39:49.742283] MyApp: #3      TapGestureRecognizer.handleTapUp.<anonymous closure> (package:flutter/src/gestures/tap.dart:649)      
I/flutter (11856): [2024-05-28 11:39:49.742318] MyApp: #4      GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:315)
I/flutter (11856): [2024-05-28 11:39:49.742462] MyApp: #5      TapGestureRecognizer.handleTapUp (package:flutter/src/gestures/tap.dart:649)
I/flutter (11856): [2024-05-28 11:39:49.742795] MyApp: #6      BaseTapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:309)
I/flutter (11856): [2024-05-28 11:39:49.742969] MyApp: #7      BaseTapGestureRecognizer.acceptGesture (package:flutter/src/gestures/tap.dart:279)
I/flutter (11856): [2024-05-28 11:39:49.743105] MyApp: #8      GestureArenaManager.sweep (package:flutter/src/gestures/arena.dart:167)
I/flutter (11856): [2024-05-28 11:39:49.743186] MyApp: #9      GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:499)
I/flutter (11856): [2024-05-28 11:39:49.743222] MyApp: #10     GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:475)
I/flutter (11856): [2024-05-28 11:39:49.743255] MyApp: #11     RendererBinding.dispatchEvent (package:flutter/src/rendering/binding.dart:430)
I/flutter (11856): [2024-05-28 11:39:49.743516] MyApp: #12     GestureBinding._handlePointerEventImmediately (package:flutter/src/gestures/binding.dart:420)
I/flutter (11856): [2024-05-28 11:39:49.743595] MyApp: #13     GestureBinding.handlePointerEvent (package:flutter/src/gestures/binding.dart:383)
I/flutter (11856): [2024-05-28 11:39:49.743630] MyApp: #14     GestureBinding._flushPointerEventQueue (package:flutter/src/gestures/binding.dart:330)
I/flutter (11856): [2024-05-28 11:39:49.743681] MyApp: #15     GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:299)
I/flutter (11856): [2024-05-28 11:39:49.743715] MyApp: #19     _invoke1 (dart:ui/hooks.dart:330)
I/flutter (11856): [2024-05-28 11:39:49.743749] MyApp: #20     PlatformDispatcher._dispatchPointerDataPacket (dart:ui/platform_dispatcher.dart:429)
I/flutter (11856): [2024-05-28 11:39:49.743781] MyApp: #21     _dispatchPointerDataPacket (dart:ui/hooks.dart:262)
suesitran commented 4 months ago

I second this. Having the same issue on Android 14 devices too. Simple remedy is that user needs to manually tap on QuillEditor again, if it works, it works, if it fails, tap again.

AtlasAutocode commented 2 months ago

A recent update to fix scrolling when changing editor controls maybe related to this issue. Similarly, the simple remedy was to click on the editor. Can you try the current version and see if this is still an issue?

CatHood0 commented 1 month ago

Since we don't have any response of the OP, i will close this issue. If the issue persists, please reopen.