Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
f12c83ea
Unverified
Commit
f12c83ea
authored
Jan 18, 2022
by
Casey Rogers
Committed by
GitHub
Jan 18, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix animate to curve argument (#96627)
* copied over changes from * copied over changes from
parent
b17a531d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
2 deletions
+49
-2
draggable_scrollable_sheet.dart
...s/flutter/lib/src/widgets/draggable_scrollable_sheet.dart
+2
-2
draggable_scrollable_sheet_test.dart
...flutter/test/widgets/draggable_scrollable_sheet_test.dart
+47
-0
No files found.
packages/flutter/lib/src/widgets/draggable_scrollable_sheet.dart
View file @
f12c83ea
...
...
@@ -117,7 +117,7 @@ class DraggableScrollableController extends ChangeNotifier {
animationController
.
stop
();
}
});
CurvedAnimation
(
parent:
animationController
,
curve:
curve
)
.
addListener
(()
{
animationController
.
addListener
(()
{
_attachedController
!.
extent
.
updateSize
(
animationController
.
value
,
_attachedController
!.
position
.
context
.
notificationContext
!,
...
...
@@ -128,7 +128,7 @@ class DraggableScrollableController extends ChangeNotifier {
animationController
.
stop
(
canceled:
false
);
}
});
await
animationController
.
animateTo
(
size
,
duration:
duration
);
await
animationController
.
animateTo
(
size
,
duration:
duration
,
curve:
curve
);
}
/// Jumps the attached sheet from its current size to the given [size], a
...
...
packages/flutter/test/widgets/draggable_scrollable_sheet_test.dart
View file @
f12c83ea
...
...
@@ -785,6 +785,53 @@ void main() {
});
}
testWidgets
(
'Can animateTo with a nonlinear curve'
,
(
WidgetTester
tester
)
async
{
const
Key
stackKey
=
ValueKey
<
String
>(
'stack'
);
const
Key
containerKey
=
ValueKey
<
String
>(
'container'
);
final
DraggableScrollableController
controller
=
DraggableScrollableController
();
await
tester
.
pumpWidget
(
_boilerplate
(
null
,
controller:
controller
,
stackKey:
stackKey
,
containerKey:
containerKey
,
));
await
tester
.
pumpAndSettle
();
final
double
screenHeight
=
tester
.
getSize
(
find
.
byKey
(
stackKey
)).
height
;
controller
.
animateTo
(.
6
,
curve:
Curves
.
linear
,
duration:
const
Duration
(
milliseconds:
100
));
// We need to call one pump first to get the animation to start.
await
tester
.
pump
();
await
tester
.
pump
(
const
Duration
(
milliseconds:
50
));
expect
(
tester
.
getSize
(
find
.
byKey
(
containerKey
)).
height
/
screenHeight
,
closeTo
(.
55
,
precisionErrorTolerance
),
);
await
tester
.
pumpAndSettle
();
expect
(
tester
.
getSize
(
find
.
byKey
(
containerKey
)).
height
/
screenHeight
,
closeTo
(.
6
,
precisionErrorTolerance
),
);
controller
.
animateTo
(.
7
,
curve:
const
Interval
(.
5
,
1
),
duration:
const
Duration
(
milliseconds:
100
));
await
tester
.
pump
();
await
tester
.
pump
(
const
Duration
(
milliseconds:
50
));
// The curve should result in the sheet not moving for the first 50 ms.
expect
(
tester
.
getSize
(
find
.
byKey
(
containerKey
)).
height
/
screenHeight
,
closeTo
(.
6
,
precisionErrorTolerance
),
);
await
tester
.
pump
(
const
Duration
(
milliseconds:
25
));
expect
(
tester
.
getSize
(
find
.
byKey
(
containerKey
)).
height
/
screenHeight
,
closeTo
(.
65
,
precisionErrorTolerance
),
);
await
tester
.
pumpAndSettle
();
expect
(
tester
.
getSize
(
find
.
byKey
(
containerKey
)).
height
/
screenHeight
,
closeTo
(.
7
,
precisionErrorTolerance
),
);
});
testWidgets
(
'Can reuse a controller after the old controller is disposed'
,
(
WidgetTester
tester
)
async
{
const
Key
stackKey
=
ValueKey
<
String
>(
'stack'
);
const
Key
containerKey
=
ValueKey
<
String
>(
'container'
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment