mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
A few minor improvements
This patch contains a few minor improvements to the framework that I ran across while working on a new layout model.
This commit is contained in:
parent
8ac9cc45cc
commit
3ca80d9e35
@ -1049,7 +1049,7 @@ abstract class RenderBoxContainerDefaultsMixin<ChildType extends RenderBox, Pare
|
||||
/// appear in the child list.
|
||||
double defaultComputeDistanceToFirstActualBaseline(TextBaseline baseline) {
|
||||
assert(!needsLayout);
|
||||
RenderBox child = firstChild;
|
||||
ChildType child = firstChild;
|
||||
while (child != null) {
|
||||
final ParentDataType childParentData = child.parentData;
|
||||
double result = child.getDistanceToActualBaseline(baseline);
|
||||
@ -1067,7 +1067,7 @@ abstract class RenderBoxContainerDefaultsMixin<ChildType extends RenderBox, Pare
|
||||
double defaultComputeDistanceToHighestActualBaseline(TextBaseline baseline) {
|
||||
assert(!needsLayout);
|
||||
double result;
|
||||
RenderBox child = firstChild;
|
||||
ChildType child = firstChild;
|
||||
while (child != null) {
|
||||
final ParentDataType childParentData = child.parentData;
|
||||
double candidate = child.getDistanceToActualBaseline(baseline);
|
||||
@ -1103,13 +1103,24 @@ abstract class RenderBoxContainerDefaultsMixin<ChildType extends RenderBox, Pare
|
||||
|
||||
/// Paints each child by walking the child list forwards.
|
||||
void defaultPaint(PaintingContext context, Offset offset) {
|
||||
RenderBox child = firstChild;
|
||||
ChildType child = firstChild;
|
||||
while (child != null) {
|
||||
final ParentDataType childParentData = child.parentData;
|
||||
context.paintChild(child, childParentData.offset + offset);
|
||||
child = childParentData.nextSibling;
|
||||
}
|
||||
}
|
||||
|
||||
List<ChildType> getChildrenAsList() {
|
||||
List<ChildType> result = <ChildType>[];
|
||||
RenderBox child = firstChild;
|
||||
while (child != null) {
|
||||
final ParentDataType childParentData = child.parentData;
|
||||
result.add(child);
|
||||
child = childParentData.nextSibling;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
class FractionalOffsetTween extends Tween<FractionalOffset> {
|
||||
|
||||
@ -1118,7 +1118,7 @@ class RenderTransform extends RenderProxyBox {
|
||||
/// The alignment of the origin, relative to the size of the box.
|
||||
///
|
||||
/// This is equivalent to setting an origin based on the size of the box.
|
||||
/// If it is specificed at the same time as an offset, both are applied.
|
||||
/// If it is specified at the same time as an offset, both are applied.
|
||||
FractionalOffset get alignment => _alignment;
|
||||
FractionalOffset _alignment;
|
||||
void set alignment (FractionalOffset newAlignment) {
|
||||
|
||||
@ -2570,6 +2570,13 @@ class RepaintBoundary extends SingleChildRenderObjectWidget {
|
||||
return new RepaintBoundary(key: key, child: child);
|
||||
}
|
||||
|
||||
static List<RepaintBoundary> wrapAll(List<Widget> widgets) {
|
||||
List<RepaintBoundary> result = new List<RepaintBoundary>(widgets.length);
|
||||
for (int i = 0; i < result.length; ++i)
|
||||
result[i] = new RepaintBoundary.wrap(widgets[i], i);
|
||||
return result;
|
||||
}
|
||||
|
||||
@override
|
||||
RenderRepaintBoundary createRenderObject(BuildContext context) => new RenderRepaintBoundary();
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user