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
b2775340
Unverified
Commit
b2775340
authored
Feb 10, 2020
by
liyuqian
Committed by
GitHub
Feb 10, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Assert cache hints are not set for null painters (#49771)
parent
9fb781a5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
0 deletions
+12
-0
basic.dart
packages/flutter/lib/src/widgets/basic.dart
+7
-0
custom_paint_test.dart
packages/flutter/test/widgets/custom_paint_test.dart
+5
-0
No files found.
packages/flutter/lib/src/widgets/basic.dart
View file @
b2775340
...
...
@@ -479,6 +479,7 @@ class CustomPaint extends SingleChildRenderObjectWidget {
})
:
assert
(
size
!=
null
),
assert
(
isComplex
!=
null
),
assert
(
willChange
!=
null
),
assert
(
painter
!=
null
||
foregroundPainter
!=
null
||
(!
isComplex
&&
!
willChange
)),
super
(
key:
key
,
child:
child
);
/// The painter that paints before the children.
...
...
@@ -503,10 +504,16 @@ class CustomPaint extends SingleChildRenderObjectWidget {
/// frame. If this flag is not set, then the compositor will apply its own
/// heuristics to decide whether the this layer is complex enough to benefit
/// from caching.
///
/// This flag can't be set to true if both [painter] and [foregroundPainter]
/// are null because this flag will be ignored in such case.
final
bool
isComplex
;
/// Whether the raster cache should be told that this painting is likely
/// to change in the next frame.
///
/// This flag can't be set to true if both [painter] and [foregroundPainter]
/// are null because this flag will be ignored in such case.
final
bool
willChange
;
@override
...
...
packages/flutter/test/widgets/custom_paint_test.dart
View file @
b2775340
...
...
@@ -223,4 +223,9 @@ void main() {
expect
(
renderCustom
.
isComplex
,
false
);
expect
(
renderCustom
.
willChange
,
true
);
});
test
(
'Raster cache hints cannot be set with null painters'
,
()
{
expect
(()
=>
CustomPaint
(
isComplex:
true
),
throwsAssertionError
);
expect
(()
=>
CustomPaint
(
willChange:
true
),
throwsAssertionError
);
});
}
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