Skip to content

Commit

Permalink
[two_dimensional_scrollables] prepare for const AnimationStyle (#8397)
Browse files Browse the repository at this point in the history
unblocks flutter/flutter#160564

Will go back through and implement `const` constructors in these spots once the framework PR lands.
  • Loading branch information
nate-thegrate authored Jan 14, 2025
1 parent d1fd623 commit 6a0f122
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,7 @@ class TreeView<T> extends StatefulWidget {

/// The default [AnimationStyle] used for node expand and collapse animations,
/// when one has not been provided in [toggleAnimationStyle].
// ignore: prefer_const_constructors
static AnimationStyle defaultToggleAnimationStyle = AnimationStyle(
curve: defaultAnimationCurve,
duration: defaultAnimationDuration,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,7 @@ void main() {
// Customize the animation
treeView = TreeView<String>(
tree: treeNodes,
// ignore: prefer_const_constructors
toggleAnimationStyle: AnimationStyle(
duration: const Duration(milliseconds: 500),
curve: Curves.bounceIn,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,7 @@ void main() {
// Default
expect(
style,
// ignore: prefer_const_constructors
AnimationStyle(
duration: TreeView.defaultAnimationDuration,
curve: TreeView.defaultAnimationCurve,
Expand Down Expand Up @@ -574,6 +575,7 @@ void main() {
await tester.pumpWidget(MaterialApp(
home: TreeView<String>(
tree: simpleNodeSet,
// ignore: prefer_const_constructors
toggleAnimationStyle: AnimationStyle(
curve: Curves.easeIn,
duration: const Duration(milliseconds: 200),
Expand Down Expand Up @@ -757,6 +759,7 @@ void main() {
home: TreeView<String>(
tree: tree,
controller: controller,
// ignore: prefer_const_constructors
toggleAnimationStyle: AnimationStyle(
curve: Curves.easeInOut,
duration: Duration.zero,
Expand Down Expand Up @@ -843,6 +846,7 @@ void main() {
home: TreeView<String>(
tree: tree,
controller: controller,
// ignore: prefer_const_constructors
toggleAnimationStyle: AnimationStyle(
curve: Curves.easeInOut,
duration: const Duration(milliseconds: 200),
Expand Down

0 comments on commit 6a0f122

Please sign in to comment.