const AnimationStyle (#160564)
[**AnimationStyle**](https://main-api.flutter.dev/flutter/animation/AnimationStyle-class.html) is an [`@immutable`](https://main-api.flutter.dev/flutter/meta/immutable-constant.html) class with all `final` fields. This pull request gives it a `const` constructor. <br> related: #160563
This commit is contained in:
@@ -51,9 +51,9 @@ class _MaterialAppExampleState extends State<MaterialAppExample> {
|
||||
case AnimationStyles.defaultStyle:
|
||||
_animationStyle = null;
|
||||
case AnimationStyles.custom:
|
||||
_animationStyle = AnimationStyle(
|
||||
_animationStyle = const AnimationStyle(
|
||||
curve: Easing.emphasizedAccelerate,
|
||||
duration: const Duration(seconds: 1),
|
||||
duration: Duration(seconds: 1),
|
||||
);
|
||||
case AnimationStyles.none:
|
||||
_animationStyle = AnimationStyle.noAnimation;
|
||||
|
||||
@@ -53,9 +53,9 @@ class _BottomSheetExampleState extends State<BottomSheetExample> {
|
||||
setState(() {
|
||||
_animationStyle = switch (styles.first) {
|
||||
AnimationStyles.defaultStyle => null,
|
||||
AnimationStyles.custom => AnimationStyle(
|
||||
duration: const Duration(seconds: 3),
|
||||
reverseDuration: const Duration(seconds: 1),
|
||||
AnimationStyles.custom => const AnimationStyle(
|
||||
duration: Duration(seconds: 3),
|
||||
reverseDuration: Duration(seconds: 1),
|
||||
),
|
||||
AnimationStyles.none => AnimationStyle.noAnimation,
|
||||
};
|
||||
|
||||
@@ -53,9 +53,9 @@ class _ModalBottomSheetExampleState extends State<ModalBottomSheetExample> {
|
||||
setState(() {
|
||||
_animationStyle = switch (styles.first) {
|
||||
AnimationStyles.defaultStyle => null,
|
||||
AnimationStyles.custom => AnimationStyle(
|
||||
duration: const Duration(seconds: 3),
|
||||
reverseDuration: const Duration(seconds: 1),
|
||||
AnimationStyles.custom => const AnimationStyle(
|
||||
duration: Duration(seconds: 3),
|
||||
reverseDuration: Duration(seconds: 1),
|
||||
),
|
||||
AnimationStyles.none => AnimationStyle.noAnimation,
|
||||
};
|
||||
|
||||
@@ -43,9 +43,9 @@ class _ChipAnimationStyleExampleState extends State<ChipAnimationStyleExample> {
|
||||
children: <Widget>[
|
||||
FilterChip.elevated(
|
||||
chipAnimationStyle: ChipAnimationStyle(
|
||||
enableAnimation: AnimationStyle(
|
||||
duration: const Duration(seconds: 3),
|
||||
reverseDuration: const Duration(seconds: 1),
|
||||
enableAnimation: const AnimationStyle(
|
||||
duration: Duration(seconds: 3),
|
||||
reverseDuration: Duration(seconds: 1),
|
||||
),
|
||||
),
|
||||
onSelected: !enabled ? null : (bool value) {},
|
||||
@@ -69,9 +69,9 @@ class _ChipAnimationStyleExampleState extends State<ChipAnimationStyleExample> {
|
||||
children: <Widget>[
|
||||
FilterChip.elevated(
|
||||
chipAnimationStyle: ChipAnimationStyle(
|
||||
selectAnimation: AnimationStyle(
|
||||
duration: const Duration(seconds: 3),
|
||||
reverseDuration: const Duration(seconds: 1),
|
||||
selectAnimation: const AnimationStyle(
|
||||
duration: Duration(seconds: 3),
|
||||
reverseDuration: Duration(seconds: 1),
|
||||
),
|
||||
),
|
||||
backgroundColor: Colors.amber,
|
||||
@@ -102,9 +102,9 @@ class _ChipAnimationStyleExampleState extends State<ChipAnimationStyleExample> {
|
||||
children: <Widget>[
|
||||
FilterChip.elevated(
|
||||
chipAnimationStyle: ChipAnimationStyle(
|
||||
avatarDrawerAnimation: AnimationStyle(
|
||||
duration: const Duration(seconds: 2),
|
||||
reverseDuration: const Duration(seconds: 1),
|
||||
avatarDrawerAnimation: const AnimationStyle(
|
||||
duration: Duration(seconds: 2),
|
||||
reverseDuration: Duration(seconds: 1),
|
||||
),
|
||||
),
|
||||
selected: showCheckmark,
|
||||
@@ -127,9 +127,9 @@ class _ChipAnimationStyleExampleState extends State<ChipAnimationStyleExample> {
|
||||
children: <Widget>[
|
||||
FilterChip.elevated(
|
||||
chipAnimationStyle: ChipAnimationStyle(
|
||||
deleteDrawerAnimation: AnimationStyle(
|
||||
duration: const Duration(seconds: 2),
|
||||
reverseDuration: const Duration(seconds: 1),
|
||||
deleteDrawerAnimation: const AnimationStyle(
|
||||
duration: Duration(seconds: 2),
|
||||
reverseDuration: Duration(seconds: 1),
|
||||
),
|
||||
),
|
||||
onDeleted: showDeleteIcon ? () {} : null,
|
||||
|
||||
@@ -46,7 +46,7 @@ class _ExpansionTileAnimationStyleAppState extends State<ExpansionTileAnimationS
|
||||
case AnimationStyles.defaultStyle:
|
||||
_animationStyle = null;
|
||||
case AnimationStyles.custom:
|
||||
_animationStyle = AnimationStyle(
|
||||
_animationStyle = const AnimationStyle(
|
||||
curve: Easing.emphasizedAccelerate,
|
||||
duration: Durations.extralong1,
|
||||
);
|
||||
|
||||
@@ -59,9 +59,9 @@ class _PopupMenuExampleState extends State<PopupMenuExample> {
|
||||
case AnimationStyles.defaultStyle:
|
||||
_animationStyle = null;
|
||||
case AnimationStyles.custom:
|
||||
_animationStyle = AnimationStyle(
|
||||
_animationStyle = const AnimationStyle(
|
||||
curve: Easing.emphasizedDecelerate,
|
||||
duration: const Duration(seconds: 3),
|
||||
duration: Duration(seconds: 3),
|
||||
);
|
||||
case AnimationStyles.none:
|
||||
_animationStyle = AnimationStyle.noAnimation;
|
||||
|
||||
@@ -50,9 +50,9 @@ class _SnackBarExampleState extends State<SnackBarExample> {
|
||||
setState(() {
|
||||
_animationStyle = switch (styles.first) {
|
||||
AnimationStyles.defaultStyle => null,
|
||||
AnimationStyles.custom => AnimationStyle(
|
||||
duration: const Duration(seconds: 3),
|
||||
reverseDuration: const Duration(seconds: 1),
|
||||
AnimationStyles.custom => const AnimationStyle(
|
||||
duration: Duration(seconds: 3),
|
||||
reverseDuration: Duration(seconds: 1),
|
||||
),
|
||||
AnimationStyles.none => AnimationStyle.noAnimation,
|
||||
};
|
||||
|
||||
@@ -53,9 +53,9 @@ class _ShowBottomSheetExampleState extends State<ShowBottomSheetExample> {
|
||||
setState(() {
|
||||
_animationStyle = switch (styles.first) {
|
||||
AnimationStyles.defaultStyle => null,
|
||||
AnimationStyles.custom => AnimationStyle(
|
||||
duration: const Duration(seconds: 3),
|
||||
reverseDuration: const Duration(seconds: 1),
|
||||
AnimationStyles.custom => const AnimationStyle(
|
||||
duration: Duration(seconds: 3),
|
||||
reverseDuration: Duration(seconds: 1),
|
||||
),
|
||||
AnimationStyles.none => AnimationStyle.noAnimation,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user