From c9c8e8f5f520cd9ea70466ea9c28fd7aaa3cedb2 Mon Sep 17 00:00:00 2001 From: Shi-Hao Hong Date: Thu, 18 Jun 2020 09:45:38 +0800 Subject: [PATCH] [animations] Handle DualTransitionBuilder name conflict with flutter/flutter (#173) * Handle DualTransitionBuilder conflict with flutter/flutter Require animations package to use internal version of DualTransitionBuilder to avoid conflicts with flutter/flutter\'s recently merged copy of DualTransitionBuilder'. * Update changelog and pubspec.yaml --- packages/animations/CHANGELOG.md | 3 +++ .../animations/lib/src/dual_transition_builder.dart | 3 +++ .../animations/lib/src/fade_scale_transition.dart | 6 ++++-- .../animations/lib/src/fade_through_transition.dart | 6 ++++-- .../animations/lib/src/shared_axis_transition.dart | 8 +++++--- packages/animations/pubspec.yaml | 2 +- .../test/dual_transition_builder_test.dart | 13 ++++++++----- 7 files changed, 28 insertions(+), 13 deletions(-) diff --git a/packages/animations/CHANGELOG.md b/packages/animations/CHANGELOG.md index 765bb80ef290..3fe05ccf720a 100644 --- a/packages/animations/CHANGELOG.md +++ b/packages/animations/CHANGELOG.md @@ -2,6 +2,9 @@ All notable changes to this project will be documented in this file. +## [1.1.1] - June 19, 2020 + +* Hide implementation of `DualTransitionBuilder` as the widget has been implemented in the Flutter framework. ## [1.1.0] - June 2, 2020 diff --git a/packages/animations/lib/src/dual_transition_builder.dart b/packages/animations/lib/src/dual_transition_builder.dart index 5534a6d4162b..763696bbce28 100644 --- a/packages/animations/lib/src/dual_transition_builder.dart +++ b/packages/animations/lib/src/dual_transition_builder.dart @@ -2,6 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +// TODO(shihaohong): Remove DualTransitionBuilder once flutter/flutter's `stable` +// branch contains DualTransitionBuilder. + import 'package:flutter/widgets.dart'; /// Builder callback used by [DualTransitionBuilder]. diff --git a/packages/animations/lib/src/fade_scale_transition.dart b/packages/animations/lib/src/fade_scale_transition.dart index b01fa1e6b0f6..63d217c42f15 100644 --- a/packages/animations/lib/src/fade_scale_transition.dart +++ b/packages/animations/lib/src/fade_scale_transition.dart @@ -4,7 +4,9 @@ import 'package:flutter/material.dart'; -import 'dual_transition_builder.dart'; +// TODO(shihaohong): Remove DualTransitionBuilder once flutter/flutter's `stable` +// branch contains DualTransitionBuilder. +import 'dual_transition_builder.dart' as dual_transition_builder; import 'modal.dart'; import 'utils/curves.dart'; @@ -151,7 +153,7 @@ class FadeScaleTransition extends StatelessWidget { @override Widget build(BuildContext context) { - return DualTransitionBuilder( + return dual_transition_builder.DualTransitionBuilder( animation: animation, forwardBuilder: ( BuildContext context, diff --git a/packages/animations/lib/src/fade_through_transition.dart b/packages/animations/lib/src/fade_through_transition.dart index f6978e4bbbdf..aa69f53dd631 100644 --- a/packages/animations/lib/src/fade_through_transition.dart +++ b/packages/animations/lib/src/fade_through_transition.dart @@ -4,7 +4,9 @@ import 'package:flutter/material.dart'; -import 'dual_transition_builder.dart'; +// TODO(shihaohong): Remove DualTransitionBuilder once flutter/flutter's `stable` +// branch contains DualTransitionBuilder. +import 'dual_transition_builder.dart' as dual_transition_builder; /// Used by [PageTransitionsTheme] to define a page route transition animation /// in which the outgoing page fades out, then the incoming page fades in and @@ -223,7 +225,7 @@ class _ZoomedFadeInFadeOut extends StatelessWidget { @override Widget build(BuildContext context) { - return DualTransitionBuilder( + return dual_transition_builder.DualTransitionBuilder( animation: animation, forwardBuilder: ( BuildContext context, diff --git a/packages/animations/lib/src/shared_axis_transition.dart b/packages/animations/lib/src/shared_axis_transition.dart index 3439bd49a249..79404304c46c 100644 --- a/packages/animations/lib/src/shared_axis_transition.dart +++ b/packages/animations/lib/src/shared_axis_transition.dart @@ -7,7 +7,9 @@ import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter/widgets.dart'; -import 'dual_transition_builder.dart'; +// TODO(shihaohong): Remove DualTransitionBuilder once flutter/flutter's `stable` +// branch contains DualTransitionBuilder. +import 'dual_transition_builder.dart' as dual_transition_builder; import 'utils/curves.dart'; /// Determines which type of shared axis transition is used. @@ -238,7 +240,7 @@ class SharedAxisTransition extends StatelessWidget { @override Widget build(BuildContext context) { final Color color = fillColor ?? Theme.of(context).canvasColor; - return DualTransitionBuilder( + return dual_transition_builder.DualTransitionBuilder( animation: animation, forwardBuilder: ( BuildContext context, @@ -264,7 +266,7 @@ class SharedAxisTransition extends StatelessWidget { child: child, ); }, - child: DualTransitionBuilder( + child: dual_transition_builder.DualTransitionBuilder( animation: ReverseAnimation(secondaryAnimation), forwardBuilder: ( BuildContext context, diff --git a/packages/animations/pubspec.yaml b/packages/animations/pubspec.yaml index 5094e3499864..3635d0f81121 100644 --- a/packages/animations/pubspec.yaml +++ b/packages/animations/pubspec.yaml @@ -1,6 +1,6 @@ name: animations description: Fancy pre-built animations that can easily be integrated into any Flutter application. -version: 1.1.0 +version: 1.1.1 homepage: https://github.com/flutter/packages/tree/master/packages/animations environment: diff --git a/packages/animations/test/dual_transition_builder_test.dart b/packages/animations/test/dual_transition_builder_test.dart index 4a1d65e4da4a..917ab76c9279 100644 --- a/packages/animations/test/dual_transition_builder_test.dart +++ b/packages/animations/test/dual_transition_builder_test.dart @@ -2,7 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'package:animations/src/dual_transition_builder.dart'; +// TODO(shihaohong): Remove DualTransitionBuilder once flutter/flutter's `stable` +// branch contains DualTransitionBuilder. +import 'package:animations/src/dual_transition_builder.dart' + as dual_transition_builder; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:flutter/widgets.dart'; @@ -15,7 +18,7 @@ void main() { ); await tester.pumpWidget(Center( - child: DualTransitionBuilder( + child: dual_transition_builder.DualTransitionBuilder( animation: controller, forwardBuilder: ( BuildContext context, @@ -85,7 +88,7 @@ void main() { await tester.pumpWidget(Directionality( textDirection: TextDirection.ltr, child: Center( - child: DualTransitionBuilder( + child: dual_transition_builder.DualTransitionBuilder( animation: controller, forwardBuilder: ( BuildContext context, @@ -147,7 +150,7 @@ void main() { duration: const Duration(milliseconds: 300), ); await tester.pumpWidget(Center( - child: DualTransitionBuilder( + child: dual_transition_builder.DualTransitionBuilder( animation: controller, forwardBuilder: ( BuildContext context, @@ -213,7 +216,7 @@ void main() { duration: const Duration(milliseconds: 300), ); await tester.pumpWidget(Center( - child: DualTransitionBuilder( + child: dual_transition_builder.DualTransitionBuilder( animation: controller, forwardBuilder: ( BuildContext context,