Skip to content

Text inline widgets, TextSpan rework#30069

Closed
GaryQian wants to merge 101 commits into
flutter:masterfrom
GaryQian:inline
Closed

Text inline widgets, TextSpan rework#30069
GaryQian wants to merge 101 commits into
flutter:masterfrom
GaryQian:inline

Conversation

@GaryQian

@GaryQian GaryQian commented Mar 27, 2019

Copy link
Copy Markdown
Contributor

This PR implements the capability of embedding widgets inline into paragraphs.

New TextSpan inheritance structure is the following:

InlineSpan --> TextSpan
         |
         ----> PlaceholderSpan ---> WidgetSpan

Wrap widgets to embed in WidgetSpan(widget: <yourwidgethere>)

The TextSpan changes make this a breaking change, although existing code passing <TextSpan>[] into RichText or TextPainter should still work as expected. Only code directly modifying a InlineSpan tree will be affected.

Fix/Addition for #2022

Dependent on the engine/LibTxt side PR: flutter-team-archive/engine#8207

Work continued in #33946

@GaryQian GaryQian added a: text input Entering text in a text field or keyboard related problems c: new feature Nothing broken; request for a new capability a: typography Text rendering, possibly libtxt work in progress; do not review labels Mar 27, 2019
@jonahwilliams

Copy link
Copy Markdown
Contributor

@GaryQian lets make that widgets placed as inline text widgets can also contribute semantics

@GaryQian

Copy link
Copy Markdown
Contributor Author

Have checked that semantics are being correctly built up and passed through, although I will verify with some people who are more familiar with semantics if it is indeed the full behavior

@goderbauer goderbauer added the framework flutter/packages/flutter repository. See also f: labels. label Mar 30, 2019
Comment thread packages/flutter/lib/src/material/input_decorator.dart Outdated
Comment thread packages/flutter/lib/src/painting/inline_span.dart Outdated
Comment thread packages/flutter/lib/src/painting/inline_span.dart Outdated
Comment thread packages/flutter/lib/src/painting/inline_span.dart Outdated
Comment thread packages/flutter/lib/src/painting/inline_span.dart Outdated
Comment thread packages/flutter/lib/src/painting/inline_span.dart Outdated
Comment thread packages/flutter/lib/src/rendering/paragraph.dart Outdated
Comment thread packages/flutter/lib/src/rendering/paragraph.dart Outdated
Comment thread packages/flutter/lib/src/rendering/paragraph.dart Outdated
Comment thread packages/flutter/lib/src/rendering/paragraph.dart Outdated
Comment thread packages/flutter/lib/src/widgets/widget_span.dart Outdated
Comment thread packages/flutter/lib/src/rendering/paragraph.dart
Comment thread packages/flutter/lib/src/rendering/paragraph.dart Outdated
Comment thread packages/flutter/lib/src/rendering/paragraph.dart
Comment thread packages/flutter/lib/src/rendering/paragraph.dart Outdated
Comment thread packages/flutter/lib/src/painting/inline_span.dart Outdated
Comment thread packages/flutter/lib/src/rendering/paragraph.dart Outdated
Comment thread packages/flutter/lib/src/rendering/paragraph.dart Outdated
Comment thread packages/flutter/lib/src/rendering/paragraph.dart Outdated

@goderbauer goderbauer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@@ -415,11 +415,8 @@ class RenderParagraph extends RenderBox
assert(() {
final Offset manualPosition = (position - textParentData.offset) / textParentData.scale;
// Compare the two offsets ignoring floating point error.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: remove this comment? It's rather obvious what's happening below, I think.

@GaryQian

GaryQian commented Jun 3, 2019

Copy link
Copy Markdown
Contributor Author

Due to versioning calculation, #33794 squashes this PR on top of master. Further changes can be seen there.

@GaryQian

GaryQian commented Jun 4, 2019

Copy link
Copy Markdown
Contributor Author

Closing this, will be landing the other version.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

a: text input Entering text in a text field or keyboard related problems a: typography Text rendering, possibly libtxt c: API break Backwards-incompatible API changes c: new feature Nothing broken; request for a new capability framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants