mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Always push layer for RenderAnimatedOpacityMixin (#83145)
This commit is contained in:
parent
4562cce44b
commit
048baa7591
@ -993,7 +993,7 @@ mixin RenderAnimatedOpacityMixin<T extends RenderObject> on RenderObjectWithChil
|
||||
_alpha = ui.Color.getAlphaFromOpacity(opacity.value);
|
||||
if (oldAlpha != _alpha) {
|
||||
final bool? didNeedCompositing = _currentlyNeedsCompositing;
|
||||
_currentlyNeedsCompositing = _alpha! > 0 && _alpha! < 255;
|
||||
_currentlyNeedsCompositing = _alpha! > 0;
|
||||
if (child != null && didNeedCompositing != _currentlyNeedsCompositing)
|
||||
markNeedsCompositingBitsUpdate();
|
||||
markNeedsPaint();
|
||||
@ -1010,12 +1010,6 @@ mixin RenderAnimatedOpacityMixin<T extends RenderObject> on RenderObjectWithChil
|
||||
layer = null;
|
||||
return;
|
||||
}
|
||||
if (_alpha == 255) {
|
||||
// No need to keep the layer. We'll create a new one if necessary.
|
||||
layer = null;
|
||||
context.paintChild(child!, offset);
|
||||
return;
|
||||
}
|
||||
assert(needsCompositing);
|
||||
layer = context.pushOpacity(offset, _alpha!, super.paint, oldLayer: layer as OpacityLayer?);
|
||||
}
|
||||
|
||||
@ -306,7 +306,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;
|
||||
@ -318,7 +318,7 @@ void main() {
|
||||
);
|
||||
|
||||
layout(renderAnimatedOpacity, phase: EnginePhase.composite);
|
||||
expect(renderAnimatedOpacity.needsCompositing, false);
|
||||
expect(renderAnimatedOpacity.needsCompositing, true);
|
||||
});
|
||||
|
||||
test('RenderAnimatedOpacity reuses its layer', () {
|
||||
|
||||
@ -102,7 +102,7 @@ void main() {
|
||||
expect(renderSliverAnimatedOpacity.needsCompositing, false);
|
||||
});
|
||||
|
||||
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;
|
||||
@ -124,7 +124,7 @@ void main() {
|
||||
);
|
||||
|
||||
layout(root, phase: EnginePhase.composite);
|
||||
expect(renderSliverAnimatedOpacity.needsCompositing, false);
|
||||
expect(renderSliverAnimatedOpacity.needsCompositing, true);
|
||||
});
|
||||
|
||||
test('RenderSliverAnimatedOpacity reuses its layer', () {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user