Skip to content

Make CurveTween curve a regular parameter #21433

Description

@sir-boformer

Right now the CurveTween constructor looks like this:

  /// Creates a curve tween.
  ///
  /// The [curve] argument must not be null.
  CurveTween({ @required this.curve })
    : assert(curve != null);

Usage currently looks like this:

CurveTween(curve: Curves.easeInOut);

There is a single required parameter, and I think it's quite certain that a CurveTween needs a Curve to function.

I propose to make it a regular parameter to make usage easier and a bit more fail-safe:

CurveTween(Curves.easeInOut);

If this is approved by the Flutter team, I will create a PR.

Activity

  1. added
    c: new featureNothing broken; request for a new capability
    frameworkflutter/packages/flutter repository. See also f: labels.
    on Sep 5, 2018
  2. zoechi commented on Sep 5, 2018

    @zoechi
    Contributor
  3. Hixie commented on Sep 5, 2018

    @Hixie
    Contributor

    I agree that this would make sense, but unfortunately it would be a breaking change, so it's probably too late to really make this change.

  4. Hixie commented on Sep 5, 2018

    @Hixie
    Contributor

    FWIW, the original thinking here was that we might add a "reverseCurve" argument, similar to how CurvedAnimation works. We haven't done that yet but it's still possible that we should one day do that.

  5. sir-boformer commented on Sep 5, 2018

    @sir-boformer
    ContributorAuthor

    I guess if you really need a reverseCurve it would make sense to create a separate tween class that requires two curves.

    Would a (small) breaking change be a problem? After all Flutter is still in beta.

  6. Hixie commented on Sep 5, 2018

    @Hixie
    Contributor

    The problem isn't one small breaking change, it's 1,001 small breaking changes. If we make this change, we'd also have to make a thousand other breaking changes of the same nature, and eventually everyone would be spending all their time just handling our breaking changes.

  7. Hixie commented on Oct 28, 2021

    @Hixie
    Contributor

    This should be possible now that we have dart fix...

  8. added
    P3Issues that are less important to the Flutter project
    on Feb 21, 2023
  9. adil192 commented on Apr 23, 2026

    @adil192
    Contributor

    Should this be closed now that we have dot shorthands? (#166012 (review))

    Edit: No, the code sample in the linked comment isn't (currently) supported since Curve and Curves are completely distinct to Dart.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Issues that are less important to the Flutter projecta: animationAnimation APIsc: API breakBackwards-incompatible API changesc: new featureNothing broken; request for a new capabilityframeworkflutter/packages/flutter repository. See also f: labels.team-frameworkOwned by Framework teamtriaged-frameworkTriaged by Framework team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions