znjameswu / flutter_math

Math rendering and editing in pure Flutter.
https://znjameswu.github.io/flutter_math_demo/
Apache License 2.0
123 stars 52 forks source link

Overflow in `cases` environment #17

Closed Skyost closed 3 years ago

Skyost commented 3 years ago

Hey,

First, thank you for this great plugin ! I'm currently trying to implement it in my app alongside flutter_widget_from_html_core. But everytime I'm using the cases environment, I get a RenderLine overflowed of 16 pixels error.

(the second overflow error is due to #8)

The Math widget is inserted as an inline widget and its parent is a Column widget.

znjameswu commented 3 years ago

Thank you for your feedback. I'll check that. Possibly missing some tests.

Meanwhile as a suggestion, for display equation overflow caused by #8, you can always wrap it inside a scrollable widget.

Skyost commented 3 years ago

Meanwhile as a suggestion, for display equation overflow caused by #8, you can always wrap it inside a scrollable widget.

Yes, that's what I figured out too. But the thing is that I don't like when these blocks are scrollable, because Text widgets do not wrap. For example,

Not in a scrollable widget :

Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Nunc gravida ex eu velit sagittis laoreet. Pellentesque placerat
urna ut tempus molestie.

Morbi feugiat ornare orci sed pharetra. Aliquam elit ligula,
bibendum sit amet mi eget, porttitor lobortis nisi. Etiam mattis
tempor pellentesque.

In a scrollable widget :

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc gravida ex eu velit sagittis laoreet. Pellentesque placerat urna ut tempus molestie.

Morbi feugiat ornare orci sed pharetra. Aliquam elit ligula, bibendum sit amet mi eget, porttitor lobortis nisi. Etiam mattis tempor pellentesque.

(and I prefer the first one, but I also think I will have to implement the second one.) It would be great if Flutter allowed us to detect when an overflow occurs (so that I can use scrollable widgets only when needed), but I don't think it's possible, sadly 😄

znjameswu commented 3 years ago

It is a combination of corner cases inside RenderLine layout logic and parsing flaws for cases blocks without a second column. I'll fix it sometime later this week.

This overflow is only painted inside a debug environment. The positioning of all the elements is still correct. It should not have any impact in profile and release mode.

Skyost commented 3 years ago

Great @znjameswu !

Skyost commented 3 years ago

Hey @znjameswu, do you have any news about this one ?

znjameswu commented 3 years ago

Hey @znjameswu, do you have any news about this one ?

Sorry I'm having quite a burnout recently. I will work on this one as soon as possible.

Skyost commented 3 years ago

Take your time @znjameswu, I know what it is to be completely overwhelmed with work.

Skyost commented 3 years ago

Thanks a lot !