Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add extensions for creating
AnimationSpec
and Duration
- Loading branch information
Showing
6 changed files
with
45 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/// Extension for creating [Duration]s from [int]s. | ||
extension DurationFromIntExtension on int { | ||
/// A [Duration] that is as many **days** long as this value. | ||
Duration get d => Duration(days: this); | ||
|
||
/// A [Duration] that is as many **hours** long as this value. | ||
Duration get h => Duration(hours: this); | ||
|
||
/// A [Duration] that is as many **minutes** long as this value. | ||
Duration get m => Duration(minutes: this); | ||
|
||
/// A [Duration] that is as many **seconds** long as this value. | ||
Duration get s => Duration(seconds: this); | ||
|
||
/// A [Duration] that is as many **milliseconds** long as this value. | ||
Duration get ms => Duration(milliseconds: this); | ||
|
||
/// A [Duration] that is as many **microseconds** long as this value. | ||
Duration get us => Duration(microseconds: this); | ||
} |