Skip to content

Commit

Permalink
Deprecate M2 curves (#134417)
Browse files Browse the repository at this point in the history
These have 1:1 replacements with a new name, introduced in
#129942

Land after flutter/packages#4898

Part of #116525

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#overview
[Tree Hygiene]: https://github.com/flutter/flutter/wiki/Tree-hygiene
[test-exempt]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#handling-breaking-changes
[Discord]: https://github.com/flutter/flutter/wiki/Chat
  • Loading branch information
guidezpl committed Jan 18, 2024
1 parent cd06ba7 commit ef5beec
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 21 deletions.
12 changes: 6 additions & 6 deletions packages/flutter/lib/fix_data/fix_material/fix_material.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -897,9 +897,9 @@ transforms:
oldName: 'showTrackOnHover'
newName: 'trackVisibility'

# Changes made in https://github.com/flutter/flutter/pull/129942
# Changes made in https://github.com/flutter/flutter/pull/134417
- title: "Migrate to 'Easing.legacy'"
date: 2023-07-04
date: 2023-12-12
element:
uris: [ 'material.dart' ]
variable: 'standardEasing'
Expand All @@ -910,9 +910,9 @@ transforms:
field: legacy
inClass: Easing

# Changes made in https://github.com/flutter/flutter/pull/129942
# Changes made in https://github.com/flutter/flutter/pull/134417
- title: "Migrate to 'Easing.legacyAccelerate'"
date: 2023-07-04
date: 2023-12-12
element:
uris: [ 'material.dart' ]
variable: 'accelerateEasing'
Expand All @@ -923,9 +923,9 @@ transforms:
field: legacyAccelerate
inClass: Easing

# Changes made in https://github.com/flutter/flutter/pull/129942
# Changes made in https://github.com/flutter/flutter/pull/134417
- title: "Migrate to 'Easing.legacyDecelerate'"
date: 2023-07-04
date: 2023-12-12
element:
uris: [ 'material.dart' ]
variable: 'decelerateEasing'
Expand Down
23 changes: 18 additions & 5 deletions packages/flutter/lib/src/material/curves.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,33 +6,46 @@ import 'package:flutter/animation.dart';

// The easing curves of the Material Library

// TODO(guidezpl): deprecate the three curves below once customers (packages/plugins) are migrated

/// The standard easing curve in the Material specification.
/// The standard easing curve in the Material 2 specification.
///
/// Elements that begin and end at rest use standard easing.
/// They speed up quickly and slow down gradually, in order
/// to emphasize the end of the transition.
///
/// See also:
/// * <https://material.io/design/motion/speed.html#easing>
@Deprecated(
'Use Easing.legacy (M2) or Easing.standard (M3) instead. '
'This curve is updated in M3. '
'This feature was deprecated after v3.18.0-0.1.pre.'
)
const Curve standardEasing = Curves.fastOutSlowIn;

/// The accelerate easing curve in the Material specification.
/// The accelerate easing curve in the Material 2 specification.
///
/// Elements exiting a screen use acceleration easing,
/// where they start at rest and end at peak velocity.
///
/// See also:
/// * <https://material.io/design/motion/speed.html#easing>
@Deprecated(
'Use Easing.legacyAccelerate (M2) or Easing.standardAccelerate (M3) instead. '
'This curve is updated in M3. '
'This feature was deprecated after v3.18.0-0.1.pre.'
)
const Curve accelerateEasing = Cubic(0.4, 0.0, 1.0, 1.0);

/// The decelerate easing curve in the Material specification.
/// The decelerate easing curve in the Material 2 specification.
///
/// Incoming elements are animated using deceleration easing,
/// which starts a transition at peak velocity (the fastest
/// point of an element’s movement) and ends at rest.
///
/// See also:
/// * <https://material.io/design/motion/speed.html#easing>
@Deprecated(
'Use Easing.legacyDecelerate (M2) or Easing.standardDecelerate (M3) instead. '
'This curve is updated in M3. '
'This feature was deprecated after v3.18.0-0.1.pre.'
)
const Curve decelerateEasing = Cubic(0.0, 0.0, 0.2, 1.0);
9 changes: 4 additions & 5 deletions packages/flutter/test_fixes/material/material.dart
Original file line number Diff line number Diff line change
Expand Up @@ -318,11 +318,10 @@ void main() {
);
final Clip clip = details.clipBehavior;

// Changes made in https://github.com/flutter/flutter/pull/129942
// TODO(guidezpl): enable fix after https://github.com/dart-lang/sdk/issues/52902
// const Curve curve = standardEasing; expect Easing.legacy
// const Curve curve = accelerateEasing; expect Easing.legacyAccelerate
// const Curve curve = decelerateEasing; expect Easing.legacyDecelerate
// Changes made in https://github.com/flutter/flutter/pull/134417
const Curve curve = standardEasing;
const Curve curve = accelerateEasing;
const Curve curve = decelerateEasing;

final PlatformMenuBar platformMenuBar = PlatformMenuBar(menus: <PlatformMenuItem>[], body: const SizedBox());
final Widget bodyValue = platformMenuBar.body;
Expand Down
9 changes: 4 additions & 5 deletions packages/flutter/test_fixes/material/material.dart.expect
Original file line number Diff line number Diff line change
Expand Up @@ -314,11 +314,10 @@ void main() {
);
final Clip clip = details.decorationClipBehavior;

// Changes made in https://github.com/flutter/flutter/pull/129942
// TODO(guidezpl): enable fix after https://github.com/dart-lang/sdk/issues/52902
// const Curve curve = standardEasing; expect Easing.legacy
// const Curve curve = accelerateEasing; expect Easing.legacyAccelerate
// const Curve curve = decelerateEasing; expect Easing.legacyDecelerate
// Changes made in https://github.com/flutter/flutter/pull/134417
const Curve curve = Easing.legacy;
const Curve curve = Easing.legacyAccelerate;
const Curve curve = Easing.legacyDecelerate;

final PlatformMenuBar platformMenuBar = PlatformMenuBar(menus: <PlatformMenuItem>[], child: const SizedBox());
final Widget bodyValue = platformMenuBar.child;
Expand Down

0 comments on commit ef5beec

Please sign in to comment.