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
7e1e8409
Unverified
Commit
7e1e8409
authored
Sep 08, 2022
by
Jonah Williams
Committed by
GitHub
Sep 08, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[framework] revert removal of opacity (#111202)
parent
5f2d730f
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
16 deletions
+12
-16
proxy_box.dart
packages/flutter/lib/src/rendering/proxy_box.dart
+2
-7
proxy_box_test.dart
packages/flutter/test/rendering/proxy_box_test.dart
+4
-4
proxy_sliver_test.dart
packages/flutter/test/rendering/proxy_sliver_test.dart
+3
-2
animated_opacity_repaint_test.dart
...s/flutter/test/widgets/animated_opacity_repaint_test.dart
+3
-3
No files found.
packages/flutter/lib/src/rendering/proxy_box.dart
View file @
7e1e8409
...
...
@@ -883,7 +883,7 @@ class RenderOpacity extends RenderProxyBox {
super
(
child
);
@override
bool
get
alwaysNeedsCompositing
=>
child
!=
null
&&
(
_alpha
>
0
&&
_alpha
<
255
)
;
bool
get
alwaysNeedsCompositing
=>
child
!=
null
&&
_alpha
>
0
;
int
_alpha
;
...
...
@@ -949,11 +949,6 @@ class RenderOpacity extends RenderProxyBox {
layer
=
null
;
return
;
}
if
(
_alpha
==
255
)
{
// No need to keep the layer. We'll create a new one if necessary.
layer
=
null
;
return
super
.
paint
(
context
,
offset
);
}
assert
(
needsCompositing
);
layer
=
context
.
pushOpacity
(
offset
,
_alpha
,
super
.
paint
,
oldLayer:
layer
as
OpacityLayer
?);
...
...
@@ -1060,7 +1055,7 @@ mixin RenderAnimatedOpacityMixin<T extends RenderObject> on RenderObjectWithChil
_alpha
=
ui
.
Color
.
getAlphaFromOpacity
(
opacity
.
value
);
if
(
oldAlpha
!=
_alpha
)
{
final
bool
?
wasRepaintBoundary
=
_currentlyIsRepaintBoundary
;
_currentlyIsRepaintBoundary
=
_alpha
!
>
0
&&
_alpha
!
<
255
;
_currentlyIsRepaintBoundary
=
_alpha
!
>
0
;
if
(
child
!=
null
&&
wasRepaintBoundary
!=
_currentlyIsRepaintBoundary
)
{
markNeedsCompositingBitsUpdate
();
}
...
...
packages/flutter/test/rendering/proxy_box_test.dart
View file @
7e1e8409
...
...
@@ -328,13 +328,13 @@ void main() {
expect
(
renderOpacity
.
needsCompositing
,
false
);
});
test
(
'RenderOpacity does
not
composite if it is opaque'
,
()
{
test
(
'RenderOpacity does composite if it is opaque'
,
()
{
final
RenderOpacity
renderOpacity
=
RenderOpacity
(
child:
RenderSizedBox
(
const
Size
(
1.0
,
1.0
)),
// size doesn't matter
);
layout
(
renderOpacity
,
phase:
EnginePhase
.
composite
);
expect
(
renderOpacity
.
needsCompositing
,
fals
e
);
expect
(
renderOpacity
.
needsCompositing
,
tru
e
);
});
test
(
'RenderOpacity does composite if it is partially opaque'
,
()
{
...
...
@@ -370,7 +370,7 @@ void main() {
expect
(
renderAnimatedOpacity
.
needsCompositing
,
false
);
});
test
(
'RenderAnimatedOpacity does
not
composite if it is opaque'
,
()
{
test
(
'RenderAnimatedOpacity does composite if it is opaque'
,
()
{
final
Animation
<
double
>
opacityAnimation
=
AnimationController
(
vsync:
FakeTickerProvider
(),
)..
value
=
1.0
;
...
...
@@ -381,7 +381,7 @@ void main() {
);
layout
(
renderAnimatedOpacity
,
phase:
EnginePhase
.
composite
);
expect
(
renderAnimatedOpacity
.
needsCompositing
,
fals
e
);
expect
(
renderAnimatedOpacity
.
needsCompositing
,
tru
e
);
});
test
(
'RenderAnimatedOpacity does composite if it is partially opaque'
,
()
{
...
...
packages/flutter/test/rendering/proxy_sliver_test.dart
View file @
7e1e8409
...
...
@@ -47,6 +47,7 @@ void main() {
layout
(
root
,
phase:
EnginePhase
.
composite
);
expect
(
renderSliverOpacity
.
needsCompositing
,
true
);
});
test
(
'RenderSliverOpacity reuses its layer'
,
()
{
final
RenderSliverOpacity
renderSliverOpacity
=
RenderSliverOpacity
(
opacity:
0.5
,
...
...
@@ -121,7 +122,7 @@ void main() {
expect
(
renderSliverAnimatedOpacity
.
needsCompositing
,
true
);
});
test
(
'RenderSliverAnimatedOpacity does
not
composite if it is opaque'
,
()
{
test
(
'RenderSliverAnimatedOpacity does composite if it is opaque'
,
()
{
final
Animation
<
double
>
opacityAnimation
=
AnimationController
(
vsync:
FakeTickerProvider
(),
)..
value
=
1.0
;
...
...
@@ -141,7 +142,7 @@ void main() {
);
layout
(
root
,
phase:
EnginePhase
.
composite
);
expect
(
renderSliverAnimatedOpacity
.
needsCompositing
,
fals
e
);
expect
(
renderSliverAnimatedOpacity
.
needsCompositing
,
tru
e
);
});
test
(
'RenderSliverAnimatedOpacity reuses its layer'
,
()
{
...
...
packages/flutter/test/widgets/animated_opacity_repaint_test.dart
View file @
7e1e8409
...
...
@@ -7,7 +7,7 @@ import 'package:flutter/rendering.dart';
import
'package:flutter_test/flutter_test.dart'
;
void
main
(
)
{
testWidgets
(
'RenderAnimatedOpacityMixin d
rops
layer when animating to 1'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'RenderAnimatedOpacityMixin d
oes not drop
layer when animating to 1'
,
(
WidgetTester
tester
)
async
{
RenderTestObject
.
paintCount
=
0
;
final
AnimationController
controller
=
AnimationController
(
vsync:
const
TestVSync
(),
duration:
const
Duration
(
seconds:
1
));
final
Tween
<
double
>
opacityTween
=
Tween
<
double
>(
begin:
0
,
end:
1
);
...
...
@@ -32,12 +32,12 @@ void main() {
await
tester
.
pump
();
await
tester
.
pump
(
const
Duration
(
milliseconds:
500
));
expect
(
RenderTestObject
.
paintCount
,
2
);
expect
(
RenderTestObject
.
paintCount
,
1
);
controller
.
stop
();
await
tester
.
pump
();
expect
(
RenderTestObject
.
paintCount
,
2
);
expect
(
RenderTestObject
.
paintCount
,
1
);
});
testWidgets
(
'RenderAnimatedOpacityMixin avoids repainting child as it animates'
,
(
WidgetTester
tester
)
async
{
...
...
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