• LongCatIsLooong's avatar
    Add `InlineSpan.visitDirectChildren` (#125656) · f704c689
    LongCatIsLooong authored
    I'd like to find out the `fontSize` of a `PlaceholderSpan`, and currently there doesn't seem to be a way to do `TextStyle` cascading in the framework:
    
     `InlineSpan.visitChildren` traverses the entire `InlineSpan` tree using a preorder traversal, and nodes that don't have "content" will be skipped (https://master-api.flutter.dev/flutter/painting/InlineSpan/visitChildren.html): 
    
    > Walks this [InlineSpan](https://master-api.flutter.dev/flutter/painting/InlineSpan-class.html) and any descendants in pre-order and calls visitor for each span that has content.
    
    which makes it impossible to do `TextStyle` cascading in the framework: 
    - `InlineSpan`s with a non-null `TextStyle` but has no content will be skipped
    - `visitChildren` doesn't directly expose the hierarchy, it only gives information about the flattened tree.
    
    This doesn't look like a breaking change, most internal customers are extending `WidgetSpan` which has a concrete implementation of the new method.
    
    Alternatively I could create a fake `ui.ParagraphBuilder` and record the `ui.TextStyle` at the top of the stack when `addPlaceholder` is called. But `ui.TextStyle` properties are not exposed to the framework.
    f704c689
Name
Last commit
Last update
..
_network_image_io.dart Loading commit data...
_network_image_web.dart Loading commit data...
alignment.dart Loading commit data...
basic_types.dart Loading commit data...
beveled_rectangle_border.dart Loading commit data...
binding.dart Loading commit data...
border_radius.dart Loading commit data...
borders.dart Loading commit data...
box_border.dart Loading commit data...
box_decoration.dart Loading commit data...
box_fit.dart Loading commit data...
box_shadow.dart Loading commit data...
circle_border.dart Loading commit data...
clip.dart Loading commit data...
colors.dart Loading commit data...
continuous_rectangle_border.dart Loading commit data...
debug.dart Loading commit data...
decoration.dart Loading commit data...
decoration_image.dart Loading commit data...
edge_insets.dart Loading commit data...
flutter_logo.dart Loading commit data...
fractional_offset.dart Loading commit data...
geometry.dart Loading commit data...
gradient.dart Loading commit data...
image_cache.dart Loading commit data...
image_decoder.dart Loading commit data...
image_provider.dart Loading commit data...
image_resolution.dart Loading commit data...
image_stream.dart Loading commit data...
inline_span.dart Loading commit data...
linear_border.dart Loading commit data...
matrix_utils.dart Loading commit data...
notched_shapes.dart Loading commit data...
oval_border.dart Loading commit data...
paint_utilities.dart Loading commit data...
placeholder_span.dart Loading commit data...
rounded_rectangle_border.dart Loading commit data...
shader_warm_up.dart Loading commit data...
shape_decoration.dart Loading commit data...
stadium_border.dart Loading commit data...
star_border.dart Loading commit data...
strut_style.dart Loading commit data...
text_painter.dart Loading commit data...
text_span.dart Loading commit data...
text_style.dart Loading commit data...