AppFlowy-IO / appflowy-editor

A highly customizable rich-text editor for Flutter. The AppFlowy Editor project for AppFlowy and beyond.
https://pub.dev/packages/appflowy_editor
Other
473 stars 201 forks source link

fix: cursor height is inconsistent after upgrading to Flutter 3.22 #827

Closed LucasXu0 closed 5 months ago

LucasXu0 commented 5 months ago

There's a breaking change in Flutter 3.22.x

The getFullHeightForCaret didn't respect the font size anymore if it's in the sub level

                RichText(
                  key: richTextKey,
                  text: const TextSpan(
                    children: [
                      TextSpan(
                        text: 'AppFlowy ',
                        style: TextStyle(
                          inherit: true,
                          color: Color(0xff000000),
                          fontSize: 16.0,
                          decoration: TextDecoration.none,
                        ),
                      ),
                      TextSpan(
                        text: ' Editor',
                        style: TextStyle(
                          inherit: true,
                          color: Color(0xff000000),
                          fontSize: 20.0,
                          decoration: TextDecoration.none,
                        ),
                      ),
                    ],
                  ),

Flutter 3.19.0

https://github.com/AppFlowy-IO/appflowy-editor/assets/11863087/8892bcba-fa02-4c38-8546-e2442ac0dea7

Flutter 3.22.0

https://github.com/AppFlowy-IO/appflowy-editor/assets/11863087/86871f04-1baf-4dcb-a7a2-e226d3561574

Now

https://github.com/AppFlowy-IO/appflowy-editor/assets/11863087/b98255e0-b433-4c53-a9e2-d64da1fd0218

workaournd:

get the maximum line height and font size from sub textspans and set them to the parent textspan

closes https://github.com/AppFlowy-IO/appflowy-editor/issues/819

codecov[bot] commented 5 months ago

Codecov Report

Attention: Patch coverage is 91.89189% with 3 lines in your changes missing coverage. Please review.

Project coverage is 74.79%. Comparing base (d6388a4) to head (8c448ce).

Files Patch % Lines
.../block_component/rich_text/appflowy_rich_text.dart 91.89% 3 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #827 +/- ## ========================================== - Coverage 74.79% 74.79% -0.01% ========================================== Files 301 301 Lines 14199 14201 +2 ========================================== + Hits 10620 10621 +1 - Misses 3579 3580 +1 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.