Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions packages/flutter/lib/src/cupertino/action_sheet.dart
Original file line number Diff line number Diff line change
Expand Up @@ -448,13 +448,13 @@ class _CupertinoAlertRenderElement extends RenderObjectElement {
}

@override
void insertChildRenderObject(RenderObject child, _AlertSections slot) {
void insertRenderObjectChild(RenderObject child, _AlertSections slot) {
_placeChildInSlot(child, slot);
}

@override
void moveChildRenderObject(RenderObject child, _AlertSections slot) {
_placeChildInSlot(child, slot);
void moveRenderObjectChild(RenderObject child, _AlertSections oldSlot, _AlertSections newSlot) {
_placeChildInSlot(child, newSlot);
}

@override
Expand All @@ -478,7 +478,7 @@ class _CupertinoAlertRenderElement extends RenderObjectElement {
}

@override
void removeChildRenderObject(RenderObject child) {
void removeRenderObjectChild(RenderObject child, _AlertSections slot) {
assert(child == renderObject.contentSection || child == renderObject.actionsSection);
if (renderObject.contentSection == child) {
renderObject.contentSection = null;
Expand Down
6 changes: 3 additions & 3 deletions packages/flutter/lib/src/cupertino/dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ class _CupertinoDialogRenderElement extends RenderObjectElement {
}

@override
void insertChildRenderObject(RenderObject child, _AlertDialogSections slot) {
void insertRenderObjectChild(RenderObject child, _AlertDialogSections slot) {
assert(slot != null);
switch (slot) {
case _AlertDialogSections.contentSection:
Expand All @@ -446,7 +446,7 @@ class _CupertinoDialogRenderElement extends RenderObjectElement {
}

@override
void moveChildRenderObject(RenderObject child, _AlertDialogSections slot) {
void moveRenderObjectChild(RenderObject child, _AlertDialogSections oldSlot, _AlertDialogSections newSlot) {
assert(false);
}

Expand All @@ -470,7 +470,7 @@ class _CupertinoDialogRenderElement extends RenderObjectElement {
}

@override
void removeChildRenderObject(RenderObject child) {
void removeRenderObjectChild(RenderObject child, _AlertDialogSections slot) {
assert(child == renderObject.contentSection || child == renderObject.actionsSection);
if (renderObject.contentSection == child) {
renderObject.contentSection = null;
Expand Down
15 changes: 8 additions & 7 deletions packages/flutter/lib/src/cupertino/text_selection.dart
Original file line number Diff line number Diff line change
Expand Up @@ -775,10 +775,9 @@ class _CupertinoTextSelectionToolbarItemsElement extends RenderObjectElement {
}

@override
void insertChildRenderObject(RenderObject child, dynamic slot) {
void insertRenderObjectChild(RenderObject child, dynamic slot) {
if (slot is _CupertinoTextSelectionToolbarItemsSlot) {
assert(child is RenderBox);
assert(slot is _CupertinoTextSelectionToolbarItemsSlot);
_updateRenderObject(child as RenderBox, slot);
assert(renderObject.childToSlot.containsKey(child));
assert(renderObject.slotToChild.containsKey(slot));
Expand All @@ -794,28 +793,30 @@ class _CupertinoTextSelectionToolbarItemsElement extends RenderObjectElement {

// This is not reachable for children that don't have an IndexedSlot.
@override
void moveChildRenderObject(RenderObject child, IndexedSlot<Element> slot) {
void moveRenderObjectChild(RenderObject child, IndexedSlot<Element> oldSlot, IndexedSlot<Element> newSlot) {
assert(child.parent == renderObject);
renderObject.move(child as RenderBox, after: slot?.value?.renderObject as RenderBox);
renderObject.move(child as RenderBox, after: newSlot?.value?.renderObject as RenderBox);
}

static bool _shouldPaint(Element child) {
return (child.renderObject.parentData as ToolbarItemsParentData).shouldPaint;
}

@override
void removeChildRenderObject(RenderObject child) {
void removeRenderObjectChild(RenderObject child, dynamic slot) {
// Check if the child is in a slot.
if (renderObject.childToSlot.containsKey(child)) {
if (slot is _CupertinoTextSelectionToolbarItemsSlot) {
assert(child is RenderBox);
assert(renderObject.slotToChild.containsKey(slot));
assert(renderObject.childToSlot.containsKey(child));
_updateRenderObject(null, renderObject.childToSlot[child]);
_updateRenderObject(null, slot);
assert(!renderObject.childToSlot.containsKey(child));
assert(!renderObject.slotToChild.containsKey(slot));
return;
}

// Otherwise look for it in the list of children.
assert(slot is IndexedSlot);
assert(child.parent == renderObject);
renderObject.remove(child as RenderBox);
}
Expand Down
13 changes: 6 additions & 7 deletions packages/flutter/lib/src/material/chip.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2148,26 +2148,25 @@ class _RenderChipElement extends RenderObjectElement {
}

@override
void insertChildRenderObject(RenderObject child, dynamic slotValue) {
void insertRenderObjectChild(RenderObject child, _ChipSlot slot) {
assert(child is RenderBox);
assert(slotValue is _ChipSlot);
final _ChipSlot slot = slotValue as _ChipSlot;
_updateRenderObject(child, slot);
assert(renderObject.childToSlot.keys.contains(child));
assert(renderObject.slotToChild.keys.contains(slot));
}

@override
void removeChildRenderObject(RenderObject child) {
void removeRenderObjectChild(RenderObject child, _ChipSlot slot) {
assert(child is RenderBox);
assert(renderObject.childToSlot.keys.contains(child));
_updateRenderObject(null, renderObject.childToSlot[child]);
assert(renderObject.childToSlot[child] == slot);
assert(renderObject.slotToChild[slot] == child);
_updateRenderObject(null, slot);
assert(!renderObject.childToSlot.keys.contains(child));
assert(!renderObject.slotToChild.keys.contains(slot));
}

@override
void moveChildRenderObject(RenderObject child, dynamic slotValue) {
void moveRenderObjectChild(RenderObject child, dynamic oldSlot, dynamic newSlot) {
assert(false, 'not reachable');
}
}
Expand Down
13 changes: 6 additions & 7 deletions packages/flutter/lib/src/material/input_decorator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1654,26 +1654,25 @@ class _RenderDecorationElement extends RenderObjectElement {
}

@override
void insertChildRenderObject(RenderObject child, dynamic slotValue) {
void insertRenderObjectChild(RenderObject child, _DecorationSlot slot) {
assert(child is RenderBox);
assert(slotValue is _DecorationSlot);
final _DecorationSlot slot = slotValue as _DecorationSlot;
_updateRenderObject(child as RenderBox, slot);
assert(renderObject.childToSlot.keys.contains(child));
assert(renderObject.slotToChild.keys.contains(slot));
}

@override
void removeChildRenderObject(RenderObject child) {
void removeRenderObjectChild(RenderObject child, _DecorationSlot slot) {
assert(child is RenderBox);
assert(renderObject.childToSlot.keys.contains(child));
_updateRenderObject(null, renderObject.childToSlot[child]);
assert(renderObject.childToSlot[child] == slot);
assert(renderObject.slotToChild[slot] == child);
_updateRenderObject(null, slot);
assert(!renderObject.childToSlot.keys.contains(child));
assert(!renderObject.slotToChild.keys.contains(slot));
}

@override
void moveChildRenderObject(RenderObject child, dynamic slotValue) {
void moveRenderObjectChild(RenderObject child, dynamic oldSlot, dynamic newSlot) {
assert(false, 'not reachable');
}
}
Expand Down
13 changes: 6 additions & 7 deletions packages/flutter/lib/src/material/list_tile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1250,26 +1250,25 @@ class _ListTileElement extends RenderObjectElement {
}

@override
void insertChildRenderObject(RenderObject child, dynamic slotValue) {
void insertRenderObjectChild(RenderObject child, _ListTileSlot slot) {
assert(child is RenderBox);
assert(slotValue is _ListTileSlot);
final _ListTileSlot slot = slotValue as _ListTileSlot;
_updateRenderObject(child as RenderBox, slot);
assert(renderObject.childToSlot.keys.contains(child));
assert(renderObject.slotToChild.keys.contains(slot));
}

@override
void removeChildRenderObject(RenderObject child) {
void removeRenderObjectChild(RenderObject child, _ListTileSlot slot) {
assert(child is RenderBox);
assert(renderObject.childToSlot.keys.contains(child));
_updateRenderObject(null, renderObject.childToSlot[child]);
assert(renderObject.childToSlot[child] == slot);
assert(renderObject.slotToChild[slot] == child);
_updateRenderObject(null, slot);
assert(!renderObject.childToSlot.keys.contains(child));
assert(!renderObject.slotToChild.keys.contains(slot));
}

@override
void moveChildRenderObject(RenderObject child, dynamic slotValue) {
void moveRenderObjectChild(RenderObject child, dynamic oldSlot, dynamic newSlot) {
assert(false, 'not reachable');
}
}
Expand Down
6 changes: 3 additions & 3 deletions packages/flutter/lib/src/widgets/binding.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1268,19 +1268,19 @@ class RenderObjectToWidgetElement<T extends RenderObject> extends RootRenderObje
RenderObjectWithChildMixin<T> get renderObject => super.renderObject as RenderObjectWithChildMixin<T>;

@override
void insertChildRenderObject(RenderObject child, dynamic slot) {
void insertRenderObjectChild(RenderObject child, dynamic slot) {
assert(slot == _rootChildSlot);
assert(renderObject.debugValidateChild(child));
renderObject.child = child as T;
}

@override
void moveChildRenderObject(RenderObject child, dynamic slot) {
void moveRenderObjectChild(RenderObject child, dynamic oldSlot, dynamic newSlot) {
assert(false);
}

@override
void removeChildRenderObject(RenderObject child) {
void removeRenderObjectChild(RenderObject child, dynamic slot) {
assert(renderObject.child == child);
renderObject.child = null;
}
Expand Down
Loading