Unverified Commit 08a23498 authored by Jonah Williams's avatar Jonah Williams Committed by GitHub

Revert changes to opacity/fade transition repaint boundary and secondary change (#101844)

parent 9526c84b
...@@ -242,7 +242,7 @@ class Directionality extends InheritedWidget { ...@@ -242,7 +242,7 @@ class Directionality extends InheritedWidget {
/// opacity. /// opacity.
/// * [Image], which can directly provide a partially transparent image with /// * [Image], which can directly provide a partially transparent image with
/// much less performance hit. /// much less performance hit.
class Opacity extends StatelessWidget { class Opacity extends SingleChildRenderObjectWidget {
/// Creates a widget that makes its child partially transparent. /// Creates a widget that makes its child partially transparent.
/// ///
/// The [opacity] argument must not be null and must be between 0.0 and 1.0 /// The [opacity] argument must not be null and must be between 0.0 and 1.0
...@@ -251,10 +251,10 @@ class Opacity extends StatelessWidget { ...@@ -251,10 +251,10 @@ class Opacity extends StatelessWidget {
Key? key, Key? key,
required this.opacity, required this.opacity,
this.alwaysIncludeSemantics = false, this.alwaysIncludeSemantics = false,
this.child, Widget? child,
}) : assert(opacity != null && opacity >= 0.0 && opacity <= 1.0), }) : assert(opacity != null && opacity >= 0.0 && opacity <= 1.0),
assert(alwaysIncludeSemantics != null), assert(alwaysIncludeSemantics != null),
super(key: key); super(key: key, child: child);
/// The fraction to scale the child's alpha value. /// The fraction to scale the child's alpha value.
/// ///
...@@ -278,44 +278,6 @@ class Opacity extends StatelessWidget { ...@@ -278,44 +278,6 @@ class Opacity extends StatelessWidget {
/// would otherwise contribute relevant semantics. /// would otherwise contribute relevant semantics.
final bool alwaysIncludeSemantics; final bool alwaysIncludeSemantics;
/// The widget below this widget in the tree.
///
/// {@macro flutter.widgets.ProxyWidget.child}
final Widget? child;
@override
Widget build(BuildContext context) {
return _Opacity(
opacity: opacity,
alwaysIncludeSemantics: alwaysIncludeSemantics,
child: RepaintBoundary(
child: child,
),
);
}
@override
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
super.debugFillProperties(properties);
properties.add(DoubleProperty('opacity', opacity));
properties.add(FlagProperty('alwaysIncludeSemantics', value: alwaysIncludeSemantics, ifTrue: 'alwaysIncludeSemantics'));
}
}
/// The backing implementation of [Opacity].
class _Opacity extends SingleChildRenderObjectWidget {
const _Opacity({
Key? key,
required this.opacity,
this.alwaysIncludeSemantics = false,
Widget? child,
}) : assert(opacity != null && opacity >= 0.0 && opacity <= 1.0),
assert(alwaysIncludeSemantics != null),
super(key: key, child: child);
final double opacity;
final bool alwaysIncludeSemantics;
@override @override
RenderOpacity createRenderObject(BuildContext context) { RenderOpacity createRenderObject(BuildContext context) {
return RenderOpacity( return RenderOpacity(
...@@ -330,6 +292,13 @@ class _Opacity extends SingleChildRenderObjectWidget { ...@@ -330,6 +292,13 @@ class _Opacity extends SingleChildRenderObjectWidget {
..opacity = opacity ..opacity = opacity
..alwaysIncludeSemantics = alwaysIncludeSemantics; ..alwaysIncludeSemantics = alwaysIncludeSemantics;
} }
@override
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
super.debugFillProperties(properties);
properties.add(DoubleProperty('opacity', opacity));
properties.add(FlagProperty('alwaysIncludeSemantics', value: alwaysIncludeSemantics, ifTrue: 'alwaysIncludeSemantics'));
}
} }
/// A widget that applies a mask generated by a [Shader] to its child. /// A widget that applies a mask generated by a [Shader] to its child.
......
...@@ -1759,9 +1759,7 @@ class _AnimatedOpacityState extends ImplicitlyAnimatedWidgetState<AnimatedOpacit ...@@ -1759,9 +1759,7 @@ class _AnimatedOpacityState extends ImplicitlyAnimatedWidgetState<AnimatedOpacit
return FadeTransition( return FadeTransition(
opacity: _opacityAnimation, opacity: _opacityAnimation,
alwaysIncludeSemantics: widget.alwaysIncludeSemantics, alwaysIncludeSemantics: widget.alwaysIncludeSemantics,
child: RepaintBoundary( child: widget.child,
child: widget.child,
),
); );
} }
} }
......
...@@ -519,7 +519,7 @@ class SizeTransition extends AnimatedWidget { ...@@ -519,7 +519,7 @@ class SizeTransition extends AnimatedWidget {
/// * [Opacity], which does not animate changes in opacity. /// * [Opacity], which does not animate changes in opacity.
/// * [AnimatedOpacity], which animates changes in opacity without taking an /// * [AnimatedOpacity], which animates changes in opacity without taking an
/// explicit [Animation] argument. /// explicit [Animation] argument.
class FadeTransition extends StatelessWidget { class FadeTransition extends SingleChildRenderObjectWidget {
/// Creates an opacity transition. /// Creates an opacity transition.
/// ///
/// The [opacity] argument must not be null. /// The [opacity] argument must not be null.
...@@ -527,9 +527,9 @@ class FadeTransition extends StatelessWidget { ...@@ -527,9 +527,9 @@ class FadeTransition extends StatelessWidget {
Key? key, Key? key,
required this.opacity, required this.opacity,
this.alwaysIncludeSemantics = false, this.alwaysIncludeSemantics = false,
this.child, Widget? child,
}) : assert(opacity != null), }) : assert(opacity != null),
super(key: key); super(key: key, child: child);
/// The animation that controls the opacity of the child. /// The animation that controls the opacity of the child.
/// ///
...@@ -549,44 +549,6 @@ class FadeTransition extends StatelessWidget { ...@@ -549,44 +549,6 @@ class FadeTransition extends StatelessWidget {
/// would otherwise contribute relevant semantics. /// would otherwise contribute relevant semantics.
final bool alwaysIncludeSemantics; final bool alwaysIncludeSemantics;
/// The widget below this widget in the tree.
///
/// {@macro flutter.widgets.ProxyWidget.child}
final Widget? child;
@override
Widget build(BuildContext context) {
return _FadeTransition(
opacity: opacity,
alwaysIncludeSemantics: alwaysIncludeSemantics,
child: RepaintBoundary(
child: child,
),
);
}
@override
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
super.debugFillProperties(properties);
properties.add(DiagnosticsProperty<Animation<double>>('opacity', opacity));
properties.add(FlagProperty('alwaysIncludeSemantics', value: alwaysIncludeSemantics, ifTrue: 'alwaysIncludeSemantics'));
}
}
/// The backing implementation of a [FadeTransition].
class _FadeTransition extends SingleChildRenderObjectWidget {
const _FadeTransition({
Key? key,
required this.opacity,
this.alwaysIncludeSemantics = false,
Widget? child,
}) : assert(opacity != null),
super(key: key, child: child);
final Animation<double> opacity;
final bool alwaysIncludeSemantics;
@override @override
RenderAnimatedOpacity createRenderObject(BuildContext context) { RenderAnimatedOpacity createRenderObject(BuildContext context) {
return RenderAnimatedOpacity( return RenderAnimatedOpacity(
...@@ -601,6 +563,13 @@ class _FadeTransition extends SingleChildRenderObjectWidget { ...@@ -601,6 +563,13 @@ class _FadeTransition extends SingleChildRenderObjectWidget {
..opacity = opacity ..opacity = opacity
..alwaysIncludeSemantics = alwaysIncludeSemantics; ..alwaysIncludeSemantics = alwaysIncludeSemantics;
} }
@override
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
super.debugFillProperties(properties);
properties.add(DiagnosticsProperty<Animation<double>>('opacity', opacity));
properties.add(FlagProperty('alwaysIncludeSemantics', value: alwaysIncludeSemantics, ifTrue: 'alwaysIncludeSemantics'));
}
} }
/// Animates the opacity of a sliver widget. /// Animates the opacity of a sliver widget.
......
...@@ -951,7 +951,7 @@ void main() { ...@@ -951,7 +951,7 @@ void main() {
); );
await expectLater( await expectLater(
find.byType(RepaintBoundary).first, find.byType(RepaintBoundary).last,
matchesGoldenFile('nav_bar_test.large_title.png'), matchesGoldenFile('nav_bar_test.large_title.png'),
); );
}, },
......
...@@ -128,8 +128,6 @@ void main() { ...@@ -128,8 +128,6 @@ void main() {
' RepaintBoundary-[GlobalKey#00000]\n' ' RepaintBoundary-[GlobalKey#00000]\n'
' IgnorePointer\n' ' IgnorePointer\n'
' AnimatedBuilder\n' ' AnimatedBuilder\n'
' RepaintBoundary\n'
' _FadeTransition\n'
' FadeTransition\n' ' FadeTransition\n'
' FractionalTranslation\n' ' FractionalTranslation\n'
' SlideTransition\n' ' SlideTransition\n'
...@@ -304,8 +302,6 @@ void main() { ...@@ -304,8 +302,6 @@ void main() {
' MediaQuery\n' ' MediaQuery\n'
' Padding\n' ' Padding\n'
' SafeArea\n' ' SafeArea\n'
' RepaintBoundary\n'
' _FadeTransition\n'
' FadeTransition\n' ' FadeTransition\n'
' IconTheme\n' ' IconTheme\n'
' IconTheme\n' ' IconTheme\n'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment