Sitelet https://github.com/gskinner/flutter_animate/issues/69
Skip to content

Allow for declarative tween defaults using an InheritedWidget #69

Description

@esDotDev

In some cases you want a group of tweens to share some default duration, curve, or delay. It might be nice if this could be declared in the widget tree:

return AnimateDefaults(
  duration: 1.seconds,
  delay: .5.seconds,
  curve: Curves.easeInOut,
  child: Column(
     children: [
        childA.animate().fadeIn();
        childB.animate().fadeIn().scale(...);
        childC.animate().fadeIn().slide(...);
    ]
  )
);

These would simply act as new defaults, nothing more fancy than that.

This could be accomplished by with class AnimateDefaults extends InheritedWidget, and then calling AnimateDefaults.maybeOf(context) from within Animate to look up the closest ancestor with default overrides (if any).

Activity

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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions