flutter-quill icon indicating copy to clipboard operation
flutter-quill copied to clipboard

Quill editor overflows ConstrainedBox

Open 781flyingdutchman opened this issue 1 year ago • 4 comments

Is there an existing issue for this?

Flutter Quill version

9.3.5

Steps to reproduce

I use the following widget to render the editor contents within a constrained box, within a Card. The Card shows that the contrainedBox is working: it grows with the contents up to the desired 300 height. The text from the editor however somehow overflows the sizedBox (to the bottom) and extends to the full length of the available text, well beyond the 300.

Card(child:
ConstrainedBox(
        constraints: const BoxConstraints(minHeight: 0, maxHeight: 300),
        child: QuillEditor.basic(
        focusNode: focusNode,
        scrollController: scrollController,
        configurations: QuillEditorConfigurations(
          scrollable: false,
          expands: false,
          controller: controller,
          sharedConfigurations:
              QuillSharedConfigurations(locale: Localizations.localeOf(context)),
        ),
      )
)

Expected results

Expect the editor to stay within the parent ConstrainedBox

Actual results

Editor overflows the ContrainedBox (and Card)

Code sample

Card(child:
ConstrainedBox(
        constraints: const BoxConstraints(minHeight: 0, maxHeight: 300),
        child: QuillEditor.basic(
        focusNode: focusNode,
        scrollController: scrollController,
        configurations: QuillEditorConfigurations(
          scrollable: false,
          expands: false,
          controller: controller,
          sharedConfigurations:
              QuillSharedConfigurations(locale: Localizations.localeOf(context)),
        ),
      )
)

Screenshots or Video

No response

Logs

No response

781flyingdutchman avatar May 08 '24 00:05 781flyingdutchman

You can using maxHeigh, minHeight in QuillEditor alternative for ConstrainedBox image

hoangsang17th avatar May 13 '24 09:05 hoangsang17th

Thanks - it affects the height communicated to the parent (a Card widget in my case, which shrinks to the size set by maxHeight) but the actual text is still visible below the card, so this does not solve the problem. See screenshot Screenshot from 2024-05-17 01-02-23

781flyingdutchman avatar May 17 '24 08:05 781flyingdutchman

That my mistake, with the new issue, u can wrapCard by a ClipRRect

hoangsang17th avatar May 22 '24 08:05 hoangsang17th

If still have issues, please comment with a mention of me

hoangsang17th avatar May 22 '24 08:05 hoangsang17th