Unverified Commit 6c049ec2 authored by Greg Spencer's avatar Greg Spencer Committed by GitHub

Rename AnimatedChildSwitcher to AnimatedSwitcher (#16551)

We don't really like the name AnimatedChildSwitcher, and we think that AnimatedSwitcher might be better (since the Child part is redundant). We also considered AnimatedChild, AnimatedTransition and AnimatedReplacement (among others).

Nothing in here besides a rename.
parent ea30c95d
...@@ -1399,12 +1399,12 @@ class _RawChipState extends State<RawChip> with TickerProviderStateMixin<RawChip ...@@ -1399,12 +1399,12 @@ class _RawChipState extends State<RawChip> with TickerProviderStateMixin<RawChip
style: widget.labelStyle ?? chipTheme.labelStyle, style: widget.labelStyle ?? chipTheme.labelStyle,
child: widget.label, child: widget.label,
), ),
avatar: new AnimatedChildSwitcher( avatar: new AnimatedSwitcher(
child: widget.avatar, child: widget.avatar,
duration: _kDrawerDuration, duration: _kDrawerDuration,
switchInCurve: Curves.fastOutSlowIn, switchInCurve: Curves.fastOutSlowIn,
), ),
deleteIcon: new AnimatedChildSwitcher( deleteIcon: new AnimatedSwitcher(
child: _buildDeleteIcon(context, theme, chipTheme), child: _buildDeleteIcon(context, theme, chipTheme),
duration: _kDrawerDuration, duration: _kDrawerDuration,
switchInCurve: Curves.fastOutSlowIn, switchInCurve: Curves.fastOutSlowIn,
......
...@@ -100,7 +100,7 @@ typedef Widget AnimatedCrossFadeBuilder(Widget topChild, Key topChildKey, Widget ...@@ -100,7 +100,7 @@ typedef Widget AnimatedCrossFadeBuilder(Widget topChild, Key topChildKey, Widget
/// ///
/// * [AnimatedSize], the lower-level widget which [AnimatedCrossFade] uses to /// * [AnimatedSize], the lower-level widget which [AnimatedCrossFade] uses to
/// automatically change size. /// automatically change size.
/// * [AnimatedChildSwitcher], which switches out a child for a new one with a /// * [AnimatedSwitcher], which switches out a child for a new one with a
/// customizable transition. /// customizable transition.
class AnimatedCrossFade extends StatefulWidget { class AnimatedCrossFade extends StatefulWidget {
/// Creates a cross-fade animation widget. /// Creates a cross-fade animation widget.
......
...@@ -11,11 +11,11 @@ import 'ticker_provider.dart'; ...@@ -11,11 +11,11 @@ import 'ticker_provider.dart';
import 'transitions.dart'; import 'transitions.dart';
// Internal representation of a child that, now or in the past, was set on the // Internal representation of a child that, now or in the past, was set on the
// AnimatedChildSwitcher.child field, but is now in the process of // AnimatedSwitcher.child field, but is now in the process of
// transitioning. The internal representation includes fields that we don't want // transitioning. The internal representation includes fields that we don't want
// to expose to the public API (like the controller). // to expose to the public API (like the controller).
class _AnimatedChildSwitcherChildEntry { class _AnimatedSwitcherChildEntry {
_AnimatedChildSwitcherChildEntry({ _AnimatedSwitcherChildEntry({
@required this.animation, @required this.animation,
@required this.transition, @required this.transition,
@required this.controller, @required this.controller,
...@@ -37,31 +37,31 @@ class _AnimatedChildSwitcherChildEntry { ...@@ -37,31 +37,31 @@ class _AnimatedChildSwitcherChildEntry {
} }
/// Signature for builders used to generate custom transitions for /// Signature for builders used to generate custom transitions for
/// [AnimatedChildSwitcher]. /// [AnimatedSwitcher].
/// ///
/// The [child] should be transitioning in when the [animation] is running in /// The [child] should be transitioning in when the [animation] is running in
/// the forward direction. /// the forward direction.
/// ///
/// The function should return a widget which wraps the given [child]. It may /// The function should return a widget which wraps the given [child]. It may
/// also use the [animation] to inform its transition. It must not return null. /// also use the [animation] to inform its transition. It must not return null.
typedef Widget AnimatedChildSwitcherTransitionBuilder(Widget child, Animation<double> animation); typedef Widget AnimatedSwitcherTransitionBuilder(Widget child, Animation<double> animation);
/// Signature for builders used to generate custom layouts for /// Signature for builders used to generate custom layouts for
/// [AnimatedChildSwitcher]. /// [AnimatedSwitcher].
/// ///
/// The function should return a widget which contains the given children, laid /// The function should return a widget which contains the given children, laid
/// out as desired. It must not return null. /// out as desired. It must not return null.
typedef Widget AnimatedChildSwitcherLayoutBuilder(List<Widget> children); typedef Widget AnimatedSwitcherLayoutBuilder(List<Widget> children);
/// A widget that by default does a [FadeTransition] between a new widget and /// A widget that by default does a [FadeTransition] between a new widget and
/// the widget previously set on the [AnimatedChildSwitcher] as a child. /// the widget previously set on the [AnimatedSwitcher] as a child.
/// ///
/// If they are swapped fast enough (i.e. before [duration] elapses), more than /// If they are swapped fast enough (i.e. before [duration] elapses), more than
/// one previous child can exist and be transitioning out while the newest one /// one previous child can exist and be transitioning out while the newest one
/// is transitioning in. /// is transitioning in.
/// ///
/// If the "new" child is the same widget type as the "old" child, but with /// If the "new" child is the same widget type as the "old" child, but with
/// different parameters, then [AnimatedChildSwitcher] will *not* do a /// different parameters, then [AnimatedSwitcher] will *not* do a
/// transition between them, since as far as the framework is concerned, they /// transition between them, since as far as the framework is concerned, they
/// are the same widget, and the existing widget can be updated with the new /// are the same widget, and the existing widget can be updated with the new
/// parameters. If you wish to force the transition to occur, set a [Key] /// parameters. If you wish to force the transition to occur, set a [Key]
...@@ -88,7 +88,7 @@ typedef Widget AnimatedChildSwitcherLayoutBuilder(List<Widget> children); ...@@ -88,7 +88,7 @@ typedef Widget AnimatedChildSwitcherLayoutBuilder(List<Widget> children);
/// child: Column( /// child: Column(
/// mainAxisAlignment: MainAxisAlignment.center, /// mainAxisAlignment: MainAxisAlignment.center,
/// children: <Widget>[ /// children: <Widget>[
/// new AnimatedChildSwitcher( /// new AnimatedSwitcher(
/// duration: const Duration(milliseconds: 200), /// duration: const Duration(milliseconds: 200),
/// transitionBuilder: (Widget child, Animation<double> animation) { /// transitionBuilder: (Widget child, Animation<double> animation) {
/// return new ScaleTransition(child: child, scale: animation); /// return new ScaleTransition(child: child, scale: animation);
...@@ -119,20 +119,20 @@ typedef Widget AnimatedChildSwitcherLayoutBuilder(List<Widget> children); ...@@ -119,20 +119,20 @@ typedef Widget AnimatedChildSwitcherLayoutBuilder(List<Widget> children);
/// ///
/// * [AnimatedCrossFade], which only fades between two children, but also /// * [AnimatedCrossFade], which only fades between two children, but also
/// interpolates their sizes, and is reversible. /// interpolates their sizes, and is reversible.
/// * [FadeTransition] which [AnimatedChildSwitcher] uses to perform the transition. /// * [FadeTransition] which [AnimatedSwitcher] uses to perform the transition.
class AnimatedChildSwitcher extends StatefulWidget { class AnimatedSwitcher extends StatefulWidget {
/// Creates an [AnimatedChildSwitcher]. /// Creates an [AnimatedSwitcher].
/// ///
/// The [duration], [transitionBuilder], [layoutBuilder], [switchInCurve], and /// The [duration], [transitionBuilder], [layoutBuilder], [switchInCurve], and
/// [switchOutCurve] parameters must not be null. /// [switchOutCurve] parameters must not be null.
const AnimatedChildSwitcher({ const AnimatedSwitcher({
Key key, Key key,
this.child, this.child,
@required this.duration, @required this.duration,
this.switchInCurve: Curves.linear, this.switchInCurve: Curves.linear,
this.switchOutCurve: Curves.linear, this.switchOutCurve: Curves.linear,
this.transitionBuilder: AnimatedChildSwitcher.defaultTransitionBuilder, this.transitionBuilder: AnimatedSwitcher.defaultTransitionBuilder,
this.layoutBuilder: AnimatedChildSwitcher.defaultLayoutBuilder, this.layoutBuilder: AnimatedSwitcher.defaultLayoutBuilder,
}) : assert(duration != null), }) : assert(duration != null),
assert(switchInCurve != null), assert(switchInCurve != null),
assert(switchOutCurve != null), assert(switchOutCurve != null),
...@@ -161,37 +161,37 @@ class AnimatedChildSwitcher extends StatefulWidget { ...@@ -161,37 +161,37 @@ class AnimatedChildSwitcher extends StatefulWidget {
/// the [child] in when the animation runs in the forward direction and out /// the [child] in when the animation runs in the forward direction and out
/// when the animation runs in the reverse direction. /// when the animation runs in the reverse direction.
/// ///
/// The default is [AnimatedChildSwitcher.defaultTransitionBuilder]. /// The default is [AnimatedSwitcher.defaultTransitionBuilder].
/// ///
/// See also: /// See also:
/// ///
/// * [AnimatedChildSwitcherTransitionBuilder] for more information about /// * [AnimatedSwitcherTransitionBuilder] for more information about
/// how a transition builder should function. /// how a transition builder should function.
final AnimatedChildSwitcherTransitionBuilder transitionBuilder; final AnimatedSwitcherTransitionBuilder transitionBuilder;
/// A function that wraps all of the children that are transitioning out, and /// A function that wraps all of the children that are transitioning out, and
/// the [child] that's transitioning in, with a widget that lays all of them /// the [child] that's transitioning in, with a widget that lays all of them
/// out. /// out.
/// ///
/// The default is [AnimatedChildSwitcher.defaultLayoutBuilder]. /// The default is [AnimatedSwitcher.defaultLayoutBuilder].
/// ///
/// See also: /// See also:
/// ///
/// * [AnimatedChildSwitcherLayoutBuilder] for more information about /// * [AnimatedSwitcherLayoutBuilder] for more information about
/// how a layout builder should function. /// how a layout builder should function.
final AnimatedChildSwitcherLayoutBuilder layoutBuilder; final AnimatedSwitcherLayoutBuilder layoutBuilder;
@override @override
_AnimatedChildSwitcherState createState() => new _AnimatedChildSwitcherState(); _AnimatedSwitcherState createState() => new _AnimatedSwitcherState();
/// The default transition algorithm used by [AnimatedChildSwitcher]. /// The default transition algorithm used by [AnimatedSwitcher].
/// ///
/// The new child is given a [FadeTransition] which increases opacity as /// The new child is given a [FadeTransition] which increases opacity as
/// the animation goes from 0.0 to 1.0, and decreases when the animation is /// the animation goes from 0.0 to 1.0, and decreases when the animation is
/// reversed. /// reversed.
/// ///
/// The default value for the [transitionBuilder], an /// The default value for the [transitionBuilder], an
/// [AnimatedChildSwitcherTransitionBuilder] function. /// [AnimatedSwitcherTransitionBuilder] function.
static Widget defaultTransitionBuilder(Widget child, Animation<double> animation) { static Widget defaultTransitionBuilder(Widget child, Animation<double> animation) {
return new FadeTransition( return new FadeTransition(
opacity: animation, opacity: animation,
...@@ -199,14 +199,14 @@ class AnimatedChildSwitcher extends StatefulWidget { ...@@ -199,14 +199,14 @@ class AnimatedChildSwitcher extends StatefulWidget {
); );
} }
/// The default layout algorithm used by [AnimatedChildSwitcher]. /// The default layout algorithm used by [AnimatedSwitcher].
/// ///
/// The new child is placed in a [Stack] that sizes itself to match the /// The new child is placed in a [Stack] that sizes itself to match the
/// largest of the child or a previous child. The children are centered on /// largest of the child or a previous child. The children are centered on
/// each other. /// each other.
/// ///
/// This is the default value for [layoutBuilder]. It implements /// This is the default value for [layoutBuilder]. It implements
/// [AnimatedChildSwitcherLayoutBuilder]. /// [AnimatedSwitcherLayoutBuilder].
static Widget defaultLayoutBuilder(List<Widget> children) { static Widget defaultLayoutBuilder(List<Widget> children) {
return new Stack( return new Stack(
children: children, children: children,
...@@ -215,9 +215,9 @@ class AnimatedChildSwitcher extends StatefulWidget { ...@@ -215,9 +215,9 @@ class AnimatedChildSwitcher extends StatefulWidget {
} }
} }
class _AnimatedChildSwitcherState extends State<AnimatedChildSwitcher> with TickerProviderStateMixin { class _AnimatedSwitcherState extends State<AnimatedSwitcher> with TickerProviderStateMixin {
final Set<_AnimatedChildSwitcherChildEntry> _children = new Set<_AnimatedChildSwitcherChildEntry>(); final Set<_AnimatedSwitcherChildEntry> _children = new Set<_AnimatedSwitcherChildEntry>();
_AnimatedChildSwitcherChildEntry _currentChild; _AnimatedSwitcherChildEntry _currentChild;
@override @override
void initState() { void initState() {
...@@ -232,11 +232,11 @@ class _AnimatedChildSwitcherState extends State<AnimatedChildSwitcher> with Tick ...@@ -232,11 +232,11 @@ class _AnimatedChildSwitcherState extends State<AnimatedChildSwitcher> with Tick
); );
} }
_AnimatedChildSwitcherChildEntry _newEntry({ _AnimatedSwitcherChildEntry _newEntry({
@required AnimationController controller, @required AnimationController controller,
@required Animation<double> animation, @required Animation<double> animation,
}) { }) {
final _AnimatedChildSwitcherChildEntry entry = new _AnimatedChildSwitcherChildEntry( final _AnimatedSwitcherChildEntry entry = new _AnimatedSwitcherChildEntry(
widgetChild: widget.child, widgetChild: widget.child,
transition: _generateTransition(animation), transition: _generateTransition(animation),
animation: animation, animation: animation,
...@@ -293,7 +293,7 @@ class _AnimatedChildSwitcherState extends State<AnimatedChildSwitcher> with Tick ...@@ -293,7 +293,7 @@ class _AnimatedChildSwitcherState extends State<AnimatedChildSwitcher> with Tick
if (_currentChild != null) { if (_currentChild != null) {
_currentChild.controller.dispose(); _currentChild.controller.dispose();
} }
for (_AnimatedChildSwitcherChildEntry child in _children) { for (_AnimatedSwitcherChildEntry child in _children) {
child.controller.dispose(); child.controller.dispose();
} }
super.dispose(); super.dispose();
...@@ -303,7 +303,7 @@ class _AnimatedChildSwitcherState extends State<AnimatedChildSwitcher> with Tick ...@@ -303,7 +303,7 @@ class _AnimatedChildSwitcherState extends State<AnimatedChildSwitcher> with Tick
bool get hasOldChild => _currentChild != null; bool get hasOldChild => _currentChild != null;
@override @override
void didUpdateWidget(AnimatedChildSwitcher oldWidget) { void didUpdateWidget(AnimatedSwitcher oldWidget) {
super.didUpdateWidget(oldWidget); super.didUpdateWidget(oldWidget);
if (hasNewChild != hasOldChild || hasNewChild && if (hasNewChild != hasOldChild || hasNewChild &&
!Widget.canUpdate(widget.child, _currentChild.widgetChild)) { !Widget.canUpdate(widget.child, _currentChild.widgetChild)) {
...@@ -319,7 +319,7 @@ class _AnimatedChildSwitcherState extends State<AnimatedChildSwitcher> with Tick ...@@ -319,7 +319,7 @@ class _AnimatedChildSwitcherState extends State<AnimatedChildSwitcher> with Tick
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final List<Widget> children = _children.map<Widget>( final List<Widget> children = _children.map<Widget>(
(_AnimatedChildSwitcherChildEntry entry) { (_AnimatedSwitcherChildEntry entry) {
return entry.transition; return entry.transition;
}, },
).toList(); ).toList();
......
...@@ -14,10 +14,10 @@ library widgets; ...@@ -14,10 +14,10 @@ library widgets;
export 'package:vector_math/vector_math_64.dart' show Matrix4; export 'package:vector_math/vector_math_64.dart' show Matrix4;
export 'src/widgets/animated_child_switcher.dart';
export 'src/widgets/animated_cross_fade.dart'; export 'src/widgets/animated_cross_fade.dart';
export 'src/widgets/animated_list.dart'; export 'src/widgets/animated_list.dart';
export 'src/widgets/animated_size.dart'; export 'src/widgets/animated_size.dart';
export 'src/widgets/animated_switcher.dart';
export 'src/widgets/app.dart'; export 'src/widgets/app.dart';
export 'src/widgets/async.dart'; export 'src/widgets/async.dart';
export 'src/widgets/automatic_keep_alive.dart'; export 'src/widgets/automatic_keep_alive.dart';
......
...@@ -6,12 +6,12 @@ import 'package:flutter/widgets.dart'; ...@@ -6,12 +6,12 @@ import 'package:flutter/widgets.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
void main() { void main() {
testWidgets('AnimatedChildSwitcher fades in a new child.', (WidgetTester tester) async { testWidgets('AnimatedSwitcher fades in a new child.', (WidgetTester tester) async {
final UniqueKey containerOne = new UniqueKey(); final UniqueKey containerOne = new UniqueKey();
final UniqueKey containerTwo = new UniqueKey(); final UniqueKey containerTwo = new UniqueKey();
final UniqueKey containerThree = new UniqueKey(); final UniqueKey containerThree = new UniqueKey();
await tester.pumpWidget( await tester.pumpWidget(
new AnimatedChildSwitcher( new AnimatedSwitcher(
duration: const Duration(milliseconds: 100), duration: const Duration(milliseconds: 100),
child: new Container(key: containerOne, color: const Color(0x00000000)), child: new Container(key: containerOne, color: const Color(0x00000000)),
switchInCurve: Curves.linear, switchInCurve: Curves.linear,
...@@ -23,7 +23,7 @@ void main() { ...@@ -23,7 +23,7 @@ void main() {
expect(transition.opacity.value, equals(1.0)); expect(transition.opacity.value, equals(1.0));
await tester.pumpWidget( await tester.pumpWidget(
new AnimatedChildSwitcher( new AnimatedSwitcher(
duration: const Duration(milliseconds: 100), duration: const Duration(milliseconds: 100),
child: new Container(key: containerTwo, color: const Color(0xff000000)), child: new Container(key: containerTwo, color: const Color(0xff000000)),
switchInCurve: Curves.linear, switchInCurve: Curves.linear,
...@@ -36,7 +36,7 @@ void main() { ...@@ -36,7 +36,7 @@ void main() {
expect(transition.opacity.value, equals(0.5)); expect(transition.opacity.value, equals(0.5));
await tester.pumpWidget( await tester.pumpWidget(
new AnimatedChildSwitcher( new AnimatedSwitcher(
duration: const Duration(milliseconds: 100), duration: const Duration(milliseconds: 100),
child: new Container(key: containerThree, color: const Color(0xffff0000)), child: new Container(key: containerThree, color: const Color(0xffff0000)),
switchInCurve: Curves.linear, switchInCurve: Curves.linear,
...@@ -54,9 +54,9 @@ void main() { ...@@ -54,9 +54,9 @@ void main() {
await tester.pumpAndSettle(); await tester.pumpAndSettle();
}); });
testWidgets("AnimatedChildSwitcher doesn't transition in a new child of the same type.", (WidgetTester tester) async { testWidgets("AnimatedSwitcher doesn't transition in a new child of the same type.", (WidgetTester tester) async {
await tester.pumpWidget( await tester.pumpWidget(
new AnimatedChildSwitcher( new AnimatedSwitcher(
duration: const Duration(milliseconds: 100), duration: const Duration(milliseconds: 100),
child: new Container(color: const Color(0x00000000)), child: new Container(color: const Color(0x00000000)),
switchInCurve: Curves.linear, switchInCurve: Curves.linear,
...@@ -68,7 +68,7 @@ void main() { ...@@ -68,7 +68,7 @@ void main() {
expect(transition.opacity.value, equals(1.0)); expect(transition.opacity.value, equals(1.0));
await tester.pumpWidget( await tester.pumpWidget(
new AnimatedChildSwitcher( new AnimatedSwitcher(
duration: const Duration(milliseconds: 100), duration: const Duration(milliseconds: 100),
child: new Container(color: const Color(0xff000000)), child: new Container(color: const Color(0xff000000)),
switchInCurve: Curves.linear, switchInCurve: Curves.linear,
...@@ -82,9 +82,9 @@ void main() { ...@@ -82,9 +82,9 @@ void main() {
await tester.pumpAndSettle(); await tester.pumpAndSettle();
}); });
testWidgets('AnimatedChildSwitcher handles null children.', (WidgetTester tester) async { testWidgets('AnimatedSwitcher handles null children.', (WidgetTester tester) async {
await tester.pumpWidget( await tester.pumpWidget(
const AnimatedChildSwitcher( const AnimatedSwitcher(
duration: const Duration(milliseconds: 100), duration: const Duration(milliseconds: 100),
child: null, child: null,
switchInCurve: Curves.linear, switchInCurve: Curves.linear,
...@@ -95,7 +95,7 @@ void main() { ...@@ -95,7 +95,7 @@ void main() {
expect(find.byType(FadeTransition), findsNothing); expect(find.byType(FadeTransition), findsNothing);
await tester.pumpWidget( await tester.pumpWidget(
new AnimatedChildSwitcher( new AnimatedSwitcher(
duration: const Duration(milliseconds: 100), duration: const Duration(milliseconds: 100),
child: new Container(color: const Color(0xff000000)), child: new Container(color: const Color(0xff000000)),
switchInCurve: Curves.linear, switchInCurve: Curves.linear,
...@@ -109,7 +109,7 @@ void main() { ...@@ -109,7 +109,7 @@ void main() {
await tester.pumpAndSettle(); await tester.pumpAndSettle();
await tester.pumpWidget( await tester.pumpWidget(
new AnimatedChildSwitcher( new AnimatedSwitcher(
duration: const Duration(milliseconds: 100), duration: const Duration(milliseconds: 100),
child: new Container(color: const Color(0x00000000)), child: new Container(color: const Color(0x00000000)),
switchInCurve: Curves.linear, switchInCurve: Curves.linear,
...@@ -121,7 +121,7 @@ void main() { ...@@ -121,7 +121,7 @@ void main() {
expect(transition.opacity.value, equals(1.0)); expect(transition.opacity.value, equals(1.0));
await tester.pumpWidget( await tester.pumpWidget(
const AnimatedChildSwitcher( const AnimatedSwitcher(
duration: const Duration(milliseconds: 100), duration: const Duration(milliseconds: 100),
child: null, child: null,
switchInCurve: Curves.linear, switchInCurve: Curves.linear,
...@@ -134,7 +134,7 @@ void main() { ...@@ -134,7 +134,7 @@ void main() {
expect(transition.opacity.value, equals(0.5)); expect(transition.opacity.value, equals(0.5));
await tester.pumpWidget( await tester.pumpWidget(
const AnimatedChildSwitcher( const AnimatedSwitcher(
duration: const Duration(milliseconds: 100), duration: const Duration(milliseconds: 100),
child: null, child: null,
switchInCurve: Curves.linear, switchInCurve: Curves.linear,
...@@ -149,8 +149,8 @@ void main() { ...@@ -149,8 +149,8 @@ void main() {
await tester.pumpAndSettle(); await tester.pumpAndSettle();
}); });
testWidgets("AnimatedChildSwitcher doesn't start any animations after dispose.", (WidgetTester tester) async { testWidgets("AnimatedSwitcher doesn't start any animations after dispose.", (WidgetTester tester) async {
await tester.pumpWidget(new AnimatedChildSwitcher( await tester.pumpWidget(new AnimatedSwitcher(
duration: const Duration(milliseconds: 100), duration: const Duration(milliseconds: 100),
child: new Container(color: const Color(0xff000000)), child: new Container(color: const Color(0xff000000)),
switchInCurve: Curves.linear, switchInCurve: Curves.linear,
...@@ -162,7 +162,7 @@ void main() { ...@@ -162,7 +162,7 @@ void main() {
expect(await tester.pumpAndSettle(const Duration(milliseconds: 100)), equals(1)); expect(await tester.pumpAndSettle(const Duration(milliseconds: 100)), equals(1));
}); });
testWidgets('AnimatedChildSwitcher uses custom layout.', (WidgetTester tester) async { testWidgets('AnimatedSwitcher uses custom layout.', (WidgetTester tester) async {
Widget newLayoutBuilder(List<Widget> children) { Widget newLayoutBuilder(List<Widget> children) {
return new Column( return new Column(
children: children, children: children,
...@@ -170,7 +170,7 @@ void main() { ...@@ -170,7 +170,7 @@ void main() {
} }
await tester.pumpWidget( await tester.pumpWidget(
new AnimatedChildSwitcher( new AnimatedSwitcher(
duration: const Duration(milliseconds: 100), duration: const Duration(milliseconds: 100),
child: new Container(color: const Color(0x00000000)), child: new Container(color: const Color(0x00000000)),
switchInCurve: Curves.linear, switchInCurve: Curves.linear,
...@@ -181,7 +181,7 @@ void main() { ...@@ -181,7 +181,7 @@ void main() {
expect(find.byType(Column), findsOneWidget); expect(find.byType(Column), findsOneWidget);
}); });
testWidgets('AnimatedChildSwitcher uses custom transitions.', (WidgetTester tester) async { testWidgets('AnimatedSwitcher uses custom transitions.', (WidgetTester tester) async {
final List<Widget> transitions = <Widget>[]; final List<Widget> transitions = <Widget>[];
Widget newLayoutBuilder(List<Widget> children) { Widget newLayoutBuilder(List<Widget> children) {
transitions.clear(); transitions.clear();
...@@ -201,7 +201,7 @@ void main() { ...@@ -201,7 +201,7 @@ void main() {
await tester.pumpWidget( await tester.pumpWidget(
new Directionality( new Directionality(
textDirection: TextDirection.rtl, textDirection: TextDirection.rtl,
child: new AnimatedChildSwitcher( child: new AnimatedSwitcher(
duration: const Duration(milliseconds: 100), duration: const Duration(milliseconds: 100),
child: new Container(color: const Color(0x00000000)), child: new Container(color: const Color(0x00000000)),
switchInCurve: Curves.linear, switchInCurve: Curves.linear,
......
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