• Kate Lovett's avatar
    Allow multiple ParentDataWidgets to write to ParentData (#133581) · 67d4a831
    Kate Lovett authored
    Fixes https://github.com/flutter/flutter/issues/133089
    
    This allows more than one ParentDataWidget to write to the ParentData of a child render object. Previously only one was allowed. There are some rules though:
    1. Only one of a given type of `ParentDataWidget` can write to the `ParentData` of a given child.
      a. For example, 2 `Positioned` widgets wrapping a child of a `Stack` would not be allowed, as only one of type `Positioned` can contribute data.
    
    2. The type of `ParentData` **must** be compatible with all of the `ParentDataWidget`s that want to contribute data.
      a. For example, `TwoDimensionalViewportParentData` mixes in the `KeepAliveParentDataMixin`. So the `ParentData` of a given child would be compatible with the `KeepAlive` `ParentDataWidget`, as well as another `ParentDataWidget` that writes `TwoDimensionalViewportParentData` (or a subclass of `TwoDimensionalViewportParentData` - This was the motivation for this change, where a `ParentDataWidget` is being used in `TableView` with the parent data type being a subclass of `TwoDimensionalViewportParentData`.)
    67d4a831
parent_data_test.dart 20.5 KB