Skip to content

Commit

Permalink
[animations] Handle DualTransitionBuilder name conflict with flutter/…
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
Shi-Hao Hong authored Jun 18, 2020
1 parent 9d90dd3 commit c9c8e8f
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 13 deletions.
3 changes: 3 additions & 0 deletions packages/animations/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 3 additions & 0 deletions packages/animations/lib/src/dual_transition_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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].
Expand Down
6 changes: 4 additions & 2 deletions packages/animations/lib/src/fade_scale_transition.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -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,
Expand Down
6 changes: 4 additions & 2 deletions packages/animations/lib/src/fade_through_transition.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down
8 changes: 5 additions & 3 deletions packages/animations/lib/src/shared_axis_transition.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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,
Expand All @@ -264,7 +266,7 @@ class SharedAxisTransition extends StatelessWidget {
child: child,
);
},
child: DualTransitionBuilder(
child: dual_transition_builder.DualTransitionBuilder(
animation: ReverseAnimation(secondaryAnimation),
forwardBuilder: (
BuildContext context,
Expand Down
2 changes: 1 addition & 1 deletion packages/animations/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
13 changes: 8 additions & 5 deletions packages/animations/test/dual_transition_builder_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -15,7 +18,7 @@ void main() {
);

await tester.pumpWidget(Center(
child: DualTransitionBuilder(
child: dual_transition_builder.DualTransitionBuilder(
animation: controller,
forwardBuilder: (
BuildContext context,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit c9c8e8f

Please sign in to comment.