• 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
..
flutter Loading commit data...
flutter_driver Loading commit data...
flutter_goldens Loading commit data...
flutter_goldens_client Loading commit data...
flutter_localizations Loading commit data...
flutter_test Loading commit data...
flutter_tools Loading commit data...
flutter_web_plugins Loading commit data...
fuchsia_remote_debug_protocol Loading commit data...
integration_test Loading commit data...
analysis_options.yaml Loading commit data...