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
d8fd537c
Commit
d8fd537c
authored
Jan 08, 2016
by
Adam Barth
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1136 from abarth/optimize_scaffold
Optimize repainting in Scaffold
parents
606887a1
ee88a685
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
32 additions
and
6 deletions
+32
-6
scaffold.dart
packages/flutter/lib/src/material/scaffold.dart
+6
-5
custom_layout.dart
packages/flutter/lib/src/rendering/custom_layout.dart
+1
-1
debug.dart
packages/flutter/lib/src/rendering/debug.dart
+6
-0
object.dart
packages/flutter/lib/src/rendering/object.dart
+11
-0
print.dart
packages/flutter/lib/src/services/print.dart
+8
-0
No files found.
packages/flutter/lib/src/material/scaffold.dart
View file @
d8fd537c
...
...
@@ -39,17 +39,17 @@ class _ScaffoldLayout extends MultiChildLayoutDelegate {
// in this case the toolbar appears -after- the body in the stacking order,
// so the toolbar's shadow is drawn on top of the body.
final
BoxConstraints
toolBar
Constraints
=
looseConstraints
.
tightenWidth
(
size
.
width
);
final
BoxConstraints
fullWidth
Constraints
=
looseConstraints
.
tightenWidth
(
size
.
width
);
Size
toolBarSize
=
Size
.
zero
;
if
(
isChild
(
_Child
.
toolBar
))
{
toolBarSize
=
layoutChild
(
_Child
.
toolBar
,
toolBar
Constraints
);
toolBarSize
=
layoutChild
(
_Child
.
toolBar
,
fullWidth
Constraints
);
positionChild
(
_Child
.
toolBar
,
Offset
.
zero
);
}
if
(
isChild
(
_Child
.
body
))
{
final
double
bodyHeight
=
size
.
height
-
toolBarSize
.
height
;
final
BoxConstraints
bodyConstraints
=
toolBar
Constraints
.
tightenHeight
(
bodyHeight
);
final
BoxConstraints
bodyConstraints
=
fullWidth
Constraints
.
tightenHeight
(
bodyHeight
);
layoutChild
(
_Child
.
body
,
bodyConstraints
);
positionChild
(
_Child
.
body
,
new
Offset
(
0.0
,
toolBarSize
.
height
));
}
...
...
@@ -63,7 +63,6 @@ class _ScaffoldLayout extends MultiChildLayoutDelegate {
// non-zero height then it's inset from the parent's right and bottom edges
// by _kFloatingActionButtonMargin.
final
BoxConstraints
fullWidthConstraints
=
looseConstraints
.
tightenWidth
(
size
.
width
);
Size
bottomSheetSize
=
Size
.
zero
;
Size
snackBarSize
=
Size
.
zero
;
...
...
@@ -89,10 +88,12 @@ class _ScaffoldLayout extends MultiChildLayoutDelegate {
}
if
(
isChild
(
_Child
.
drawer
))
{
layoutChild
(
_Child
.
drawer
,
looseConstraints
);
layoutChild
(
_Child
.
drawer
,
new
BoxConstraints
.
tight
(
size
)
);
positionChild
(
_Child
.
drawer
,
Offset
.
zero
);
}
}
bool
shouldRelayout
(
MultiChildLayoutDelegate
oldDelegate
)
=>
false
;
}
class
Scaffold
extends
StatefulComponent
{
...
...
packages/flutter/lib/src/rendering/custom_layout.dart
View file @
d8fd537c
...
...
@@ -92,7 +92,7 @@ abstract class MultiChildLayoutDelegate {
}
/// Override this method to return true when the children need to be laid out.
bool
shouldRelayout
(
MultiChildLayoutDelegate
oldDelegate
)
=>
true
;
bool
shouldRelayout
(
MultiChildLayoutDelegate
oldDelegate
);
/// Layout and position all children given this widget's size and the specified
/// constraints. This method must apply layoutChild() to each child. It should
...
...
packages/flutter/lib/src/rendering/debug.dart
View file @
d8fd537c
...
...
@@ -52,6 +52,12 @@ HSVColor debugCurrentRepaintColor = const HSVColor.fromAHSV(0.4, 60.0, 1.0, 1.0)
/// The amount to increment the hue of the current repaint color.
double
debugRepaintRainboxHueIncrement
=
2.0
;
/// Log the call stacks that mark render objects as needing paint.
bool
debugPrintMarkNeedsPaintStacks
=
false
;
/// Log the call stacks that mark render objects as needing layout.
bool
debugPrintMarkNeedsLayoutStacks
=
false
;
List
<
String
>
debugDescribeTransform
(
Matrix4
transform
)
{
List
<
String
>
matrix
=
transform
.
toString
().
split
(
'
\n
'
).
map
((
String
s
)
=>
'
$s
'
).
toList
();
matrix
.
removeLast
();
...
...
packages/flutter/lib/src/rendering/object.dart
View file @
d8fd537c
...
...
@@ -8,6 +8,7 @@ import 'dart:ui' as ui;
import
'package:flutter/gestures.dart'
;
import
'package:flutter/scheduler.dart'
;
import
'package:flutter/services.dart'
;
import
'package:vector_math/vector_math_64.dart'
;
import
'debug.dart'
;
...
...
@@ -556,6 +557,11 @@ abstract class RenderObject extends AbstractNode implements HitTestTarget {
}
assert
(
parent
==
this
.
parent
);
}
else
{
assert
(()
{
if
(
debugPrintMarkNeedsLayoutStacks
)
debugPrintStack
();
return
true
;
});
_nodesNeedingLayout
.
add
(
this
);
Scheduler
.
instance
.
ensureVisualUpdate
();
}
...
...
@@ -950,6 +956,11 @@ abstract class RenderObject extends AbstractNode implements HitTestTarget {
return
;
_needsPaint
=
true
;
if
(
hasLayer
)
{
assert
(()
{
if
(
debugPrintMarkNeedsPaintStacks
)
debugPrintStack
();
return
true
;
});
// If we always have our own layer, then we can just repaint
// ourselves without involving any other nodes.
assert
(
_layer
!=
null
);
...
...
packages/flutter/lib/src/services/print.dart
View file @
d8fd537c
...
...
@@ -44,3 +44,11 @@ void _debugPrintTask() {
_debugPrintStopwatch
.
start
();
}
}
void
debugPrintStack
(
)
{
try
{
throw
new
Exception
();
}
catch
(
e
,
stack
)
{
debugPrint
(
stack
.
toString
());
}
}
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