Repository navigation
Conversation
Passes the string drawn at a soft hyphen line break through TextStyle.getParagraphStyle to dart:ui's ParagraphStyle.hyphenCharacter, the same way as hyphens. Part of flutter#189617
There was a problem hiding this comment.
Code Review
This pull request adds support for a custom hyphenCharacter across Flutter's text rendering stack, including TextPainter, TextStyle, RenderParagraph, RichText, and Text widgets, allowing developers to customize the character displayed at soft hyphen line breaks. The review feedback points out that the _TextStyleProxy.getParagraphStyle method in tests was updated to accept the new hyphenCharacter parameter but fails to forward it to its delegate, which should be resolved to ensure correct proxy behavior.
| int? maxLines, | ||
| ui.TextHeightBehavior? textHeightBehavior, | ||
| Hyphens? hyphens, | ||
| String? hyphenCharacter, |
There was a problem hiding this comment.
There was a problem hiding this comment.
Thanks! I don't think there's anything to forward here, since this proxy's getParagraphStyle just throws UnimplementedError and doesn't call a delegate. It only needed the new parameter so the override still compiles.
|
@gaaclarke would you mind taking a look at this when you have a chance? It's the framework half of #195345, which you reviewed, and it needs the CICD label to run the full tests. Thanks! |
This is outside my jurisdiction =) |
|
Thanks @gaaclarke, sorry about that! @Renzo-Olivares would you mind taking a look when you have a chance, or pointing me to the right reviewer? It needs the CICD label to run the full tests. Thanks! |
Adds
hyphenCharactertoTextStyle.getParagraphStyle,TextPainter,RenderParagraph,RichTextandText, so apps can choose the string drawn at the end of a line that breaks at a soft hyphen (U+00AD). It passes through the same way ashyphensand ends up inParagraphStyle.hyphenCharacterfrom #195345. If it is null, "-" is drawn as before. The empty string draws nothing, and the line still breaks there.The new
getParagraphStyleparameter breaks classes that override it, so I think this needs a breaking change page. The only override I found in this repo is a test one, updated here intheme_test.dart. The page is in flutter/website#14048, and I am happy to change the shape of this if there is a better way to do it.Fixes #189617.
Pre-launch Checklist
///).