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
f87c5102
Unverified
Commit
f87c5102
authored
Nov 27, 2019
by
Ian Hickson
Committed by
GitHub
Nov 27, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add more documentation around layers. (#45648)
parent
59ca523b
Changes
5
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
137 additions
and
71 deletions
+137
-71
binding.dart
packages/flutter/lib/src/rendering/binding.dart
+5
-5
layer.dart
packages/flutter/lib/src/rendering/layer.dart
+18
-1
object.dart
packages/flutter/lib/src/rendering/object.dart
+108
-64
proxy_box.dart
packages/flutter/lib/src/rendering/proxy_box.dart
+3
-0
binding.dart
packages/flutter/lib/src/widgets/binding.dart
+3
-1
No files found.
packages/flutter/lib/src/rendering/binding.dart
View file @
f87c5102
...
...
@@ -182,11 +182,12 @@ mixin RendererBinding on BindingBase, ServicesBinding, SchedulerBinding, Gesture
@protected
void
handleTextScaleFactorChanged
()
{
}
/// {@template on_platform_brightness_change}
/// Called when the platform brightness changes.
///
/// The current platform brightness can be queried either from a Flutter
/// binding, or from a [MediaQuery] widget.
/// The current platform brightness can be queried from a Flutter binding or
/// from a [MediaQuery] widget. The latter is preferred from widgets because
/// it causes the widget to be automatically rebuilt when the brightness
/// changes.
///
/// {@tool sample}
/// Querying [Window.platformBrightness].
...
...
@@ -197,7 +198,7 @@ mixin RendererBinding on BindingBase, ServicesBinding, SchedulerBinding, Gesture
/// {@end-tool}
///
/// {@tool sample}
/// Querying [MediaQuery] directly.
/// Querying [MediaQuery] directly.
Preferred.
///
/// ```dart
/// final Brightness brightness = MediaQuery.platformBrightnessOf(context);
...
...
@@ -214,7 +215,6 @@ mixin RendererBinding on BindingBase, ServicesBinding, SchedulerBinding, Gesture
/// {@end-tool}
///
/// See [Window.onPlatformBrightnessChanged].
/// {@endtemplate}
@protected
void
handlePlatformBrightnessChanged
()
{
}
...
...
packages/flutter/lib/src/rendering/layer.dart
View file @
f87c5102
...
...
@@ -1673,6 +1673,11 @@ class OpacityLayer extends ContainerLayer {
}
/// A composited layer that applies a shader to its children.
///
/// The shader is only applied inside the given [maskRect]. The shader itself
/// uses the top left of the [maskRect] as its origin.
///
/// The [maskRect] does not affect the positions of any child layers.
class
ShaderMaskLayer
extends
ContainerLayer
{
/// Creates a shader mask layer.
///
...
...
@@ -1688,8 +1693,16 @@ class ShaderMaskLayer extends ContainerLayer {
/// The shader to apply to the children.
///
/// The origin of the shader (e.g. of the coordinate system used by the `from`
/// and `to` arguments to [ui.Gradient.linear]) is at the top left of the
/// [maskRect].
///
/// The scene must be explicitly recomposited after this property is changed
/// (as described at [Layer]).
///
/// See also:
///
/// * [ui.Gradient] and [ui.ImageShader], two shader types that can be used.
Shader
get
shader
=>
_shader
;
Shader
_shader
;
set
shader
(
Shader
value
)
{
...
...
@@ -1699,7 +1712,10 @@ class ShaderMaskLayer extends ContainerLayer {
}
}
/// The size of the shader.
/// The position and size of the shader.
///
/// The [shader] is only rendered inside this rectangle, using the top left of
/// the rectangle as its origin.
///
/// The scene must be explicitly recomposited after this property is changed
/// (as described at [Layer]).
...
...
@@ -1730,6 +1746,7 @@ class ShaderMaskLayer extends ContainerLayer {
assert
(
shader
!=
null
);
assert
(
maskRect
!=
null
);
assert
(
blendMode
!=
null
);
assert
(
layerOffset
!=
null
);
final
Rect
shiftedMaskRect
=
layerOffset
==
Offset
.
zero
?
maskRect
:
maskRect
.
shift
(
layerOffset
);
engineLayer
=
builder
.
pushShaderMask
(
shader
,
shiftedMaskRect
,
blendMode
,
oldLayer:
_engineLayer
);
addChildrenToScene
(
builder
,
layerOffset
);
...
...
packages/flutter/lib/src/rendering/object.dart
View file @
f87c5102
This diff is collapsed.
Click to expand it.
packages/flutter/lib/src/rendering/proxy_box.dart
View file @
f87c5102
...
...
@@ -968,6 +968,9 @@ class RenderShaderMask extends RenderProxyBox {
///
/// The shader callback is called with the current size of the child so that
/// it can customize the shader to the size and location of the child.
///
/// The rectangle will always be at the origin when called by
/// [RenderShaderMask].
// TODO(abarth): Use the delegate pattern here to avoid generating spurious
// repaints when the ShaderCallback changes identity.
ShaderCallback
get
shaderCallback
=>
_shaderCallback
;
...
...
packages/flutter/lib/src/widgets/binding.dart
View file @
f87c5102
...
...
@@ -214,7 +214,9 @@ abstract class WidgetsBindingObserver {
/// boilerplate.
void
didChangeTextScaleFactor
()
{
}
/// {@macro on_platform_brightness_change}
/// Called when the platform brightness changes.
///
/// This method exposes notifications from [Window.onPlatformBrightnessChanged].
void
didChangePlatformBrightness
()
{
}
/// Called when the system tells the app that the user's locale has
...
...
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