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
7cf4c694
Commit
7cf4c694
authored
May 30, 2016
by
Adam Barth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Complete docs for RenderObject (#4266)
parent
76772608
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
549 additions
and
117 deletions
+549
-117
object.dart
packages/flutter/lib/src/rendering/object.dart
+152
-28
performance_overlay.dart
packages/flutter/lib/src/rendering/performance_overlay.dart
+23
-2
proxy_box.dart
packages/flutter/lib/src/rendering/proxy_box.dart
+157
-27
shifted_box.dart
packages/flutter/lib/src/rendering/shifted_box.dart
+25
-6
view.dart
packages/flutter/lib/src/rendering/view.dart
+10
-0
basic.dart
packages/flutter/lib/src/widgets/basic.dart
+180
-53
performance_overlay.dart
packages/flutter/lib/src/widgets/performance_overlay.dart
+2
-1
No files found.
packages/flutter/lib/src/rendering/object.dart
View file @
7cf4c694
This diff is collapsed.
Click to expand it.
packages/flutter/lib/src/rendering/performance_overlay.dart
View file @
7cf4c694
...
@@ -41,9 +41,28 @@ enum PerformanceOverlayOption {
...
@@ -41,9 +41,28 @@ enum PerformanceOverlayOption {
visualizeEngineStatistics
,
visualizeEngineStatistics
,
}
}
/// Displays performance statistics.
///
/// The overlay show two time series. The first shows how much time was required
/// on this thread to produce each frame. The second shows how much time was
/// required on the GPU thread to produce each frame. Ideally, both these values
/// would be less than the total frame budget for the hardware on which the app
/// is running. For example, if the hardware has a screen that updates at 60 Hz,
/// each thread should ideally spend less than 16ms producing each frame. This
/// ideal condition is indicated by a green vertical line for each thread.
/// Otherwise, the performance overlay shows a red vertical line.
///
/// The simplest way to show the performance overlay is to set
/// [MaterialApp.showPerformanceOverlay] or [WidgetsApp.showPerformanceOverlay]
/// to `true`.
class
RenderPerformanceOverlay
extends
RenderBox
{
class
RenderPerformanceOverlay
extends
RenderBox
{
RenderPerformanceOverlay
({
int
optionsMask:
0
,
int
rasterizerThreshold:
0
})
/// Creates a performance overlay render object.
:
_optionsMask
=
optionsMask
,
///
/// The [optionsMask] and [rasterizerThreshold] arguments must not be null.
RenderPerformanceOverlay
({
int
optionsMask:
0
,
int
rasterizerThreshold:
0
})
:
_optionsMask
=
optionsMask
,
_rasterizerThreshold
=
rasterizerThreshold
;
_rasterizerThreshold
=
rasterizerThreshold
;
/// The mask is created by shifting 1 by the index of the specific
/// The mask is created by shifting 1 by the index of the specific
...
@@ -51,6 +70,7 @@ class RenderPerformanceOverlay extends RenderBox {
...
@@ -51,6 +70,7 @@ class RenderPerformanceOverlay extends RenderBox {
int
get
optionsMask
=>
_optionsMask
;
int
get
optionsMask
=>
_optionsMask
;
int
_optionsMask
;
int
_optionsMask
;
set
optionsMask
(
int
mask
)
{
set
optionsMask
(
int
mask
)
{
assert
(
mask
!=
null
);
if
(
mask
==
_optionsMask
)
if
(
mask
==
_optionsMask
)
return
;
return
;
_optionsMask
=
mask
;
_optionsMask
=
mask
;
...
@@ -63,6 +83,7 @@ class RenderPerformanceOverlay extends RenderBox {
...
@@ -63,6 +83,7 @@ class RenderPerformanceOverlay extends RenderBox {
int
get
rasterizerThreshold
=>
_rasterizerThreshold
;
int
get
rasterizerThreshold
=>
_rasterizerThreshold
;
int
_rasterizerThreshold
;
int
_rasterizerThreshold
;
set
rasterizerThreshold
(
int
threshold
)
{
set
rasterizerThreshold
(
int
threshold
)
{
assert
(
threshold
!=
null
);
if
(
threshold
==
_rasterizerThreshold
)
if
(
threshold
==
_rasterizerThreshold
)
return
;
return
;
_rasterizerThreshold
=
threshold
;
_rasterizerThreshold
=
threshold
;
...
...
packages/flutter/lib/src/rendering/proxy_box.dart
View file @
7cf4c694
This diff is collapsed.
Click to expand it.
packages/flutter/lib/src/rendering/shifted_box.dart
View file @
7cf4c694
...
@@ -91,6 +91,9 @@ abstract class RenderShiftedBox extends RenderBox with RenderObjectWithChildMixi
...
@@ -91,6 +91,9 @@ abstract class RenderShiftedBox extends RenderBox with RenderObjectWithChildMixi
/// size. Padding then sizes itself to its child's size, inflated by the
/// size. Padding then sizes itself to its child's size, inflated by the
/// padding, effectively creating empty space around the child.
/// padding, effectively creating empty space around the child.
class
RenderPadding
extends
RenderShiftedBox
{
class
RenderPadding
extends
RenderShiftedBox
{
/// Creates a render object that insets its child.
///
/// The [padding] argument must not be null and must have non-negative insets.
RenderPadding
({
RenderPadding
({
EdgeInsets
padding
,
EdgeInsets
padding
,
RenderBox
child
RenderBox
child
...
@@ -219,12 +222,16 @@ class RenderPadding extends RenderShiftedBox {
...
@@ -219,12 +222,16 @@ class RenderPadding extends RenderShiftedBox {
}
}
}
}
/// Abstract class for one-child-layout render boxes that use a
/// [FractionalOffset] to align their children.
abstract
class
RenderAligningShiftedBox
extends
RenderShiftedBox
{
abstract
class
RenderAligningShiftedBox
extends
RenderShiftedBox
{
/// Initializes member variables for subclasses.
///
/// The [alignment] argument must not be null.
RenderAligningShiftedBox
({
RenderAligningShiftedBox
({
RenderBox
child
,
FractionalOffset
alignment:
FractionalOffset
.
center
,
FractionalOffset
alignment:
FractionalOffset
.
center
RenderBox
child
})
:
_alignment
=
alignment
,
})
:
_alignment
=
alignment
,
super
(
child
)
{
super
(
child
)
{
assert
(
alignment
!=
null
&&
alignment
.
dx
!=
null
&&
alignment
.
dy
!=
null
);
assert
(
alignment
!=
null
&&
alignment
.
dx
!=
null
&&
alignment
.
dy
!=
null
);
}
}
...
@@ -274,7 +281,7 @@ abstract class RenderAligningShiftedBox extends RenderShiftedBox {
...
@@ -274,7 +281,7 @@ abstract class RenderAligningShiftedBox extends RenderShiftedBox {
}
}
}
}
///
Aligns its child box within itself
.
///
Positions its child using a [FractionalOffset]
.
///
///
/// For example, to align a box at the bottom right, you would pass this box a
/// For example, to align a box at the bottom right, you would pass this box a
/// tight constraint that is bigger than the child's natural size,
/// tight constraint that is bigger than the child's natural size,
...
@@ -285,6 +292,7 @@ abstract class RenderAligningShiftedBox extends RenderShiftedBox {
...
@@ -285,6 +292,7 @@ abstract class RenderAligningShiftedBox extends RenderShiftedBox {
/// dimensions. Using widthFactor and heightFactor you can force this latter
/// dimensions. Using widthFactor and heightFactor you can force this latter
/// behavior in all cases.
/// behavior in all cases.
class
RenderPositionedBox
extends
RenderAligningShiftedBox
{
class
RenderPositionedBox
extends
RenderAligningShiftedBox
{
/// Creates a render object that positions its child.
RenderPositionedBox
({
RenderPositionedBox
({
RenderBox
child
,
RenderBox
child
,
double
widthFactor
,
double
widthFactor
,
...
@@ -427,6 +435,7 @@ class RenderPositionedBox extends RenderAligningShiftedBox {
...
@@ -427,6 +435,7 @@ class RenderPositionedBox extends RenderAligningShiftedBox {
/// child inside a larger parent, use [RenderPositionedBox] and
/// child inside a larger parent, use [RenderPositionedBox] and
/// [RenderConstrainedBox] rather than RenderOverflowBox.
/// [RenderConstrainedBox] rather than RenderOverflowBox.
class
RenderConstrainedOverflowBox
extends
RenderAligningShiftedBox
{
class
RenderConstrainedOverflowBox
extends
RenderAligningShiftedBox
{
/// Creates a render object that lets its child overflow itself.
RenderConstrainedOverflowBox
({
RenderConstrainedOverflowBox
({
RenderBox
child
,
RenderBox
child
,
double
minWidth
,
double
minWidth
,
...
@@ -543,9 +552,12 @@ class RenderConstrainedOverflowBox extends RenderAligningShiftedBox {
...
@@ -543,9 +552,12 @@ class RenderConstrainedOverflowBox extends RenderAligningShiftedBox {
}
}
}
}
/// A render box that
'
s a specific size but passes its original constraints
/// A render box that
i
s a specific size but passes its original constraints
/// through to its child, which will probably overflow.
/// through to its child, which will probably overflow.
class
RenderSizedOverflowBox
extends
RenderAligningShiftedBox
{
class
RenderSizedOverflowBox
extends
RenderAligningShiftedBox
{
/// Creates a render box of a given size that lets its child overflow.
///
/// The [requestedSize] argument must not be null.
RenderSizedOverflowBox
({
RenderSizedOverflowBox
({
RenderBox
child
,
RenderBox
child
,
Size
requestedSize
,
Size
requestedSize
,
...
@@ -617,6 +629,10 @@ class RenderSizedOverflowBox extends RenderAligningShiftedBox {
...
@@ -617,6 +629,10 @@ class RenderSizedOverflowBox extends RenderAligningShiftedBox {
///
///
/// It then tries to size itself to the size of its child.
/// It then tries to size itself to the size of its child.
class
RenderFractionallySizedOverflowBox
extends
RenderAligningShiftedBox
{
class
RenderFractionallySizedOverflowBox
extends
RenderAligningShiftedBox
{
/// Creates a render box that sizes its child to a fraction of the total available space.
///
/// If non-null, the [widthFactor] and [heightFactor] arguments must be
/// non-negative.
RenderFractionallySizedOverflowBox
({
RenderFractionallySizedOverflowBox
({
RenderBox
child
,
RenderBox
child
,
double
widthFactor
,
double
widthFactor
,
...
@@ -755,6 +771,9 @@ class SingleChildLayoutDelegate {
...
@@ -755,6 +771,9 @@ class SingleChildLayoutDelegate {
/// of the parent, but the size of the parent cannot depend on the size of the
/// of the parent, but the size of the parent cannot depend on the size of the
/// child.
/// child.
class
RenderCustomSingleChildLayoutBox
extends
RenderShiftedBox
{
class
RenderCustomSingleChildLayoutBox
extends
RenderShiftedBox
{
/// Creates a render box that defers its layout to a delgate.
///
/// The [delegate] argument must not be null.
RenderCustomSingleChildLayoutBox
({
RenderCustomSingleChildLayoutBox
({
RenderBox
child
,
RenderBox
child
,
SingleChildLayoutDelegate
delegate
SingleChildLayoutDelegate
delegate
...
...
packages/flutter/lib/src/rendering/view.dart
View file @
7cf4c694
...
@@ -48,6 +48,9 @@ class ViewConfiguration {
...
@@ -48,6 +48,9 @@ class ViewConfiguration {
/// bootstrapping the rendering pipeline. The view has a unique child
/// bootstrapping the rendering pipeline. The view has a unique child
/// [RenderBox], which is required to fill the entire output surface.
/// [RenderBox], which is required to fill the entire output surface.
class
RenderView
extends
RenderObject
with
RenderObjectWithChildMixin
<
RenderBox
>
{
class
RenderView
extends
RenderObject
with
RenderObjectWithChildMixin
<
RenderBox
>
{
/// Creates the root of the render tree.
///
/// Typically created by the binding (e.g., [RendererBinding]).
RenderView
({
RenderView
({
RenderBox
child
,
RenderBox
child
,
this
.
timeForRotation
:
const
Duration
(
microseconds:
83333
),
this
.
timeForRotation
:
const
Duration
(
microseconds:
83333
),
...
@@ -115,6 +118,13 @@ class RenderView extends RenderObject with RenderObjectWithChildMixin<RenderBox>
...
@@ -115,6 +118,13 @@ class RenderView extends RenderObject with RenderObjectWithChildMixin<RenderBox>
assert
(
false
);
// nobody tells the screen to rotate, the whole rotate() dance is started from our performResize()
assert
(
false
);
// nobody tells the screen to rotate, the whole rotate() dance is started from our performResize()
}
}
/// Determines the set of render objects located at the given position.
///
/// Returns true if the given point is contained in this render object or one
/// of its descendants. Adds any render objects that contain the point to the
/// given hit test result.
///
/// The [position] argument is in the coordinate system of the render view.
bool
hitTest
(
HitTestResult
result
,
{
Point
position
})
{
bool
hitTest
(
HitTestResult
result
,
{
Point
position
})
{
if
(
child
!=
null
)
if
(
child
!=
null
)
child
.
hitTest
(
result
,
position:
position
);
child
.
hitTest
(
result
,
position:
position
);
...
...
packages/flutter/lib/src/widgets/basic.dart
View file @
7cf4c694
This diff is collapsed.
Click to expand it.
packages/flutter/lib/src/widgets/performance_overlay.dart
View file @
7cf4c694
...
@@ -13,8 +13,9 @@ import 'framework.dart';
...
@@ -13,8 +13,9 @@ import 'framework.dart';
/// required on the GPU thread to produce each frame. Ideally, both these values
/// required on the GPU thread to produce each frame. Ideally, both these values
/// would be less than the total frame budget for the hardware on which the app
/// would be less than the total frame budget for the hardware on which the app
/// is running. For example, if the hardware has a screen that updates at 60 Hz,
/// is running. For example, if the hardware has a screen that updates at 60 Hz,
/// each thread should ideally spend less than 16
ms producing each frame. This
/// each thread should ideally spend less than 16ms producing each frame. This
/// ideal condition is indicated by a green vertical line for each thread.
/// ideal condition is indicated by a green vertical line for each thread.
/// Otherwise, the performance overlay shows a red vertical line.
///
///
/// The simplest way to show the performance overlay is to set
/// The simplest way to show the performance overlay is to set
/// [MaterialApp.showPerformanceOverlay] or [WidgetsApp.showPerformanceOverlay]
/// [MaterialApp.showPerformanceOverlay] or [WidgetsApp.showPerformanceOverlay]
...
...
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