-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Closed
Labels
P3Issues that are less important to the Flutter projectIssues that are less important to the Flutter projecta: animationAnimation APIsAnimation APIsc: new featureNothing broken; request for a new capabilityNothing broken; request for a new capabilityc: proposalA detailed proposal for a change to FlutterA detailed proposal for a change to Flutterframeworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.team-frameworkOwned by Framework teamOwned by Framework teamtriaged-frameworkTriaged by Framework teamTriaged by Framework team
Description
Use case
AnimationController should provide a simple way to repeat n times, currently, this is not possible from what we could find.
This is the nearest and simplest solution: https://stackoverflow.com/questions/59462290/repeating-animations-specific-times-e-g-20-times-by-flutter/59463013#59463013
If an animation should repeat n times, it should do the animation and then jump back to 0 (or 1 for reverse) and do the animation again. Until it reached 1 (or 0 for reverse) n times and then stop there and send a completion event in the status listener.
Proposal
controller = AnimationController(
vsync: this,
duration: const Duration(seconds: 2),
)
..repeat(times: 3)
..addStatusListener((status) {
if (status == AnimationStatus.completed) {
print("Has repeated 3 times. Execution took 6 seconds.");
}
});marius-h, bstenm, Nico04, wujek-srujek, harlanx and 17 moremarius-h, ZainUrRehmanKhan, angelhdzmultimedia, Thesmader and KgotsoKmarius-h, angelhdzmultimedia and KgotsoK
Metadata
Metadata
Assignees
Labels
P3Issues that are less important to the Flutter projectIssues that are less important to the Flutter projecta: animationAnimation APIsAnimation APIsc: new featureNothing broken; request for a new capabilityNothing broken; request for a new capabilityc: proposalA detailed proposal for a change to FlutterA detailed proposal for a change to Flutterframeworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.team-frameworkOwned by Framework teamOwned by Framework teamtriaged-frameworkTriaged by Framework teamTriaged by Framework team