Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
2d0634eb
Unverified
Commit
2d0634eb
authored
Aug 20, 2020
by
Todd Volkert
Committed by
GitHub
Aug 20, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove `childToSlot` pattern (#64217)
parent
0fa1de3c
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
34 additions
and
53 deletions
+34
-53
text_selection.dart
packages/flutter/lib/src/cupertino/text_selection.dart
+15
-17
chip.dart
packages/flutter/lib/src/material/chip.dart
+6
-12
input_decorator.dart
packages/flutter/lib/src/material/input_decorator.dart
+6
-12
list_tile.dart
packages/flutter/lib/src/material/list_tile.dart
+6
-12
framework.dart
packages/flutter/lib/src/widgets/framework.dart
+1
-0
No files found.
packages/flutter/lib/src/cupertino/text_selection.dart
View file @
2d0634eb
...
...
@@ -779,8 +779,7 @@ class _CupertinoTextSelectionToolbarItemsElement extends RenderObjectElement {
if
(
slot
is
_CupertinoTextSelectionToolbarItemsSlot
)
{
assert
(
child
is
RenderBox
);
_updateRenderObject
(
child
as
RenderBox
,
slot
);
assert
(
renderObject
.
childToSlot
.
containsKey
(
child
));
assert
(
renderObject
.
slotToChild
.
containsKey
(
slot
));
assert
(
renderObject
.
slottedChildren
.
containsKey
(
slot
));
return
;
}
if
(
slot
is
IndexedSlot
)
{
...
...
@@ -807,11 +806,9 @@ class _CupertinoTextSelectionToolbarItemsElement extends RenderObjectElement {
// Check if the child is in a slot.
if
(
slot
is
_CupertinoTextSelectionToolbarItemsSlot
)
{
assert
(
child
is
RenderBox
);
assert
(
renderObject
.
slotToChild
.
containsKey
(
slot
));
assert
(
renderObject
.
childToSlot
.
containsKey
(
child
));
assert
(
renderObject
.
slottedChildren
.
containsKey
(
slot
));
_updateRenderObject
(
null
,
slot
);
assert
(!
renderObject
.
childToSlot
.
containsKey
(
child
));
assert
(!
renderObject
.
slotToChild
.
containsKey
(
slot
));
assert
(!
renderObject
.
slottedChildren
.
containsKey
(
slot
));
return
;
}
...
...
@@ -919,23 +916,24 @@ class _CupertinoTextSelectionToolbarItemsRenderBox extends RenderBox with Contai
_page
=
page
,
super
();
final
Map
<
_CupertinoTextSelectionToolbarItemsSlot
,
RenderBox
>
slotToChild
=
<
_CupertinoTextSelectionToolbarItemsSlot
,
RenderBox
>{};
final
Map
<
RenderBox
,
_CupertinoTextSelectionToolbarItemsSlot
>
childToSlot
=
<
RenderBox
,
_CupertinoTextSelectionToolbarItemsSlot
>{};
final
Map
<
_CupertinoTextSelectionToolbarItemsSlot
,
RenderBox
>
slottedChildren
=
<
_CupertinoTextSelectionToolbarItemsSlot
,
RenderBox
>{};
RenderBox
_updateChild
(
RenderBox
oldChild
,
RenderBox
newChild
,
_CupertinoTextSelectionToolbarItemsSlot
slot
)
{
if
(
oldChild
!=
null
)
{
dropChild
(
oldChild
);
childToSlot
.
remove
(
oldChild
);
slotToChild
.
remove
(
slot
);
slottedChildren
.
remove
(
slot
);
}
if
(
newChild
!=
null
)
{
childToSlot
[
newChild
]
=
slot
;
slotToChild
[
slot
]
=
newChild
;
slottedChildren
[
slot
]
=
newChild
;
adoptChild
(
newChild
);
}
return
newChild
;
}
bool
_isSlottedChild
(
RenderBox
child
)
{
return
child
==
_backButton
||
child
==
_nextButton
||
child
==
_nextButtonDisabled
;
}
int
_page
;
int
get
page
=>
_page
;
set
page
(
int
value
)
{
...
...
@@ -1001,7 +999,7 @@ class _CupertinoTextSelectionToolbarItemsRenderBox extends RenderBox with Contai
childParentData
.
shouldPaint
=
false
;
// Skip slotted children and children on pages after the visible page.
if
(
childToSlot
.
containsKey
(
child
)
||
currentPage
>
_page
)
{
if
(
_isSlottedChild
(
child
)
||
currentPage
>
_page
)
{
return
;
}
...
...
@@ -1165,9 +1163,9 @@ class _CupertinoTextSelectionToolbarItemsRenderBox extends RenderBox with Contai
super
.
attach
(
owner
);
// Attach slot children.
childToSlot
.
forEach
((
RenderBox
child
,
_
)
{
for
(
final
RenderBox
child
in
slottedChildren
.
values
)
{
child
.
attach
(
owner
);
}
);
}
}
@override
...
...
@@ -1176,9 +1174,9 @@ class _CupertinoTextSelectionToolbarItemsRenderBox extends RenderBox with Contai
super
.
detach
();
// Detach slot children.
childToSlot
.
forEach
((
RenderBox
child
,
_
)
{
for
(
final
RenderBox
child
in
slottedChildren
.
values
)
{
child
.
detach
();
}
);
}
}
@override
...
...
packages/flutter/lib/src/material/chip.dart
View file @
2d0634eb
...
...
@@ -2151,18 +2151,15 @@ class _RenderChipElement extends RenderObjectElement {
void
insertRenderObjectChild
(
RenderObject
child
,
_ChipSlot
slot
)
{
assert
(
child
is
RenderBox
);
_updateRenderObject
(
child
,
slot
);
assert
(
renderObject
.
childToSlot
.
keys
.
contains
(
child
));
assert
(
renderObject
.
slotToChild
.
keys
.
contains
(
slot
));
assert
(
renderObject
.
children
.
keys
.
contains
(
slot
));
}
@override
void
removeRenderObjectChild
(
RenderObject
child
,
_ChipSlot
slot
)
{
assert
(
child
is
RenderBox
);
assert
(
renderObject
.
childToSlot
[
child
]
==
slot
);
assert
(
renderObject
.
slotToChild
[
slot
]
==
child
);
assert
(
renderObject
.
children
[
slot
]
==
child
);
_updateRenderObject
(
null
,
slot
);
assert
(!
renderObject
.
childToSlot
.
keys
.
contains
(
child
));
assert
(!
renderObject
.
slotToChild
.
keys
.
contains
(
slot
));
assert
(!
renderObject
.
children
.
keys
.
contains
(
slot
));
}
@override
...
...
@@ -2258,8 +2255,7 @@ class _RenderChip extends RenderBox {
enableAnimation
.
addListener
(
markNeedsPaint
);
}
final
Map
<
_ChipSlot
,
RenderBox
>
slotToChild
=
<
_ChipSlot
,
RenderBox
>{};
final
Map
<
RenderBox
,
_ChipSlot
>
childToSlot
=
<
RenderBox
,
_ChipSlot
>{};
final
Map
<
_ChipSlot
,
RenderBox
>
children
=
<
_ChipSlot
,
RenderBox
>{};
bool
value
;
bool
isEnabled
;
...
...
@@ -2274,12 +2270,10 @@ class _RenderChip extends RenderBox {
RenderBox
_updateChild
(
RenderBox
oldChild
,
RenderBox
newChild
,
_ChipSlot
slot
)
{
if
(
oldChild
!=
null
)
{
dropChild
(
oldChild
);
childToSlot
.
remove
(
oldChild
);
slotToChild
.
remove
(
slot
);
children
.
remove
(
slot
);
}
if
(
newChild
!=
null
)
{
childToSlot
[
newChild
]
=
slot
;
slotToChild
[
slot
]
=
newChild
;
children
[
slot
]
=
newChild
;
adoptChild
(
newChild
);
}
return
newChild
;
...
...
packages/flutter/lib/src/material/input_decorator.dart
View file @
2d0634eb
...
...
@@ -645,18 +645,15 @@ class _RenderDecoration extends RenderBox {
_expands
=
expands
;
static
const
double
subtextGap
=
8.0
;
final
Map
<
_DecorationSlot
,
RenderBox
>
slotToChild
=
<
_DecorationSlot
,
RenderBox
>{};
final
Map
<
RenderBox
,
_DecorationSlot
>
childToSlot
=
<
RenderBox
,
_DecorationSlot
>{};
final
Map
<
_DecorationSlot
,
RenderBox
>
children
=
<
_DecorationSlot
,
RenderBox
>{};
RenderBox
_updateChild
(
RenderBox
oldChild
,
RenderBox
newChild
,
_DecorationSlot
slot
)
{
if
(
oldChild
!=
null
)
{
dropChild
(
oldChild
);
childToSlot
.
remove
(
oldChild
);
slotToChild
.
remove
(
slot
);
children
.
remove
(
slot
);
}
if
(
newChild
!=
null
)
{
childToSlot
[
newChild
]
=
slot
;
slotToChild
[
slot
]
=
newChild
;
children
[
slot
]
=
newChild
;
adoptChild
(
newChild
);
}
return
newChild
;
...
...
@@ -1657,18 +1654,15 @@ class _RenderDecorationElement extends RenderObjectElement {
void
insertRenderObjectChild
(
RenderObject
child
,
_DecorationSlot
slot
)
{
assert
(
child
is
RenderBox
);
_updateRenderObject
(
child
as
RenderBox
,
slot
);
assert
(
renderObject
.
childToSlot
.
keys
.
contains
(
child
));
assert
(
renderObject
.
slotToChild
.
keys
.
contains
(
slot
));
assert
(
renderObject
.
children
.
keys
.
contains
(
slot
));
}
@override
void
removeRenderObjectChild
(
RenderObject
child
,
_DecorationSlot
slot
)
{
assert
(
child
is
RenderBox
);
assert
(
renderObject
.
childToSlot
[
child
]
==
slot
);
assert
(
renderObject
.
slotToChild
[
slot
]
==
child
);
assert
(
renderObject
.
children
[
slot
]
==
child
);
_updateRenderObject
(
null
,
slot
);
assert
(!
renderObject
.
childToSlot
.
keys
.
contains
(
child
));
assert
(!
renderObject
.
slotToChild
.
keys
.
contains
(
slot
));
assert
(!
renderObject
.
children
.
keys
.
contains
(
slot
));
}
@override
...
...
packages/flutter/lib/src/material/list_tile.dart
View file @
2d0634eb
...
...
@@ -1253,18 +1253,15 @@ class _ListTileElement extends RenderObjectElement {
void
insertRenderObjectChild
(
RenderObject
child
,
_ListTileSlot
slot
)
{
assert
(
child
is
RenderBox
);
_updateRenderObject
(
child
as
RenderBox
,
slot
);
assert
(
renderObject
.
childToSlot
.
keys
.
contains
(
child
));
assert
(
renderObject
.
slotToChild
.
keys
.
contains
(
slot
));
assert
(
renderObject
.
children
.
keys
.
contains
(
slot
));
}
@override
void
removeRenderObjectChild
(
RenderObject
child
,
_ListTileSlot
slot
)
{
assert
(
child
is
RenderBox
);
assert
(
renderObject
.
childToSlot
[
child
]
==
slot
);
assert
(
renderObject
.
slotToChild
[
slot
]
==
child
);
assert
(
renderObject
.
children
[
slot
]
==
child
);
_updateRenderObject
(
null
,
slot
);
assert
(!
renderObject
.
childToSlot
.
keys
.
contains
(
child
));
assert
(!
renderObject
.
slotToChild
.
keys
.
contains
(
slot
));
assert
(!
renderObject
.
children
.
keys
.
contains
(
slot
));
}
@override
...
...
@@ -1299,18 +1296,15 @@ class _RenderListTile extends RenderBox {
// The minimum padding on the top and bottom of the title and subtitle widgets.
static
const
double
_minVerticalPadding
=
4.0
;
final
Map
<
_ListTileSlot
,
RenderBox
>
slotToChild
=
<
_ListTileSlot
,
RenderBox
>{};
final
Map
<
RenderBox
,
_ListTileSlot
>
childToSlot
=
<
RenderBox
,
_ListTileSlot
>{};
final
Map
<
_ListTileSlot
,
RenderBox
>
children
=
<
_ListTileSlot
,
RenderBox
>{};
RenderBox
_updateChild
(
RenderBox
oldChild
,
RenderBox
newChild
,
_ListTileSlot
slot
)
{
if
(
oldChild
!=
null
)
{
dropChild
(
oldChild
);
childToSlot
.
remove
(
oldChild
);
slotToChild
.
remove
(
slot
);
children
.
remove
(
slot
);
}
if
(
newChild
!=
null
)
{
childToSlot
[
newChild
]
=
slot
;
slotToChild
[
slot
]
=
newChild
;
children
[
slot
]
=
newChild
;
adoptChild
(
newChild
);
}
return
newChild
;
...
...
packages/flutter/lib/src/widgets/framework.dart
View file @
2d0634eb
...
...
@@ -6079,6 +6079,7 @@ class SingleChildRenderObjectElement extends RenderObjectElement {
@override
void
removeRenderObjectChild
(
RenderObject
child
,
dynamic
slot
)
{
final
RenderObjectWithChildMixin
<
RenderObject
>
renderObject
=
this
.
renderObject
as
RenderObjectWithChildMixin
<
RenderObject
>;
assert
(
slot
==
null
);
assert
(
renderObject
.
child
==
child
);
renderObject
.
child
=
null
;
assert
(
renderObject
==
this
.
renderObject
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment