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
070a5a9b
Unverified
Commit
070a5a9b
authored
Jan 26, 2022
by
Suhwan Cha
Committed by
GitHub
Jan 26, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use a more appropriate curve on ScrollsToTop (#96574)
parent
610b41e8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
2 deletions
+31
-2
scaffold.dart
packages/flutter/lib/src/material/scaffold.dart
+2
-2
scaffold_test.dart
packages/flutter/test/material/scaffold_test.dart
+29
-0
No files found.
packages/flutter/lib/src/material/scaffold.dart
View file @
070a5a9b
...
@@ -2583,8 +2583,8 @@ class ScaffoldState extends State<Scaffold> with TickerProviderStateMixin, Resto
...
@@ -2583,8 +2583,8 @@ class ScaffoldState extends State<Scaffold> with TickerProviderStateMixin, Resto
if
(
primaryScrollController
!=
null
&&
primaryScrollController
.
hasClients
)
{
if
(
primaryScrollController
!=
null
&&
primaryScrollController
.
hasClients
)
{
primaryScrollController
.
animateTo
(
primaryScrollController
.
animateTo
(
0.0
,
0.0
,
duration:
const
Duration
(
milliseconds:
3
00
),
duration:
const
Duration
(
milliseconds:
10
00
),
curve:
Curves
.
linear
,
// TODO(ianh): Use a more appropriate curve.
curve:
Curves
.
easeOutCirc
,
);
);
}
}
}
}
...
...
packages/flutter/test/material/scaffold_test.dart
View file @
070a5a9b
...
@@ -389,6 +389,35 @@ void main() {
...
@@ -389,6 +389,35 @@ void main() {
expect
(
scrollable
.
position
.
pixels
,
equals
(
0.0
));
expect
(
scrollable
.
position
.
pixels
,
equals
(
0.0
));
},
variant:
const
TargetPlatformVariant
(<
TargetPlatform
>{
TargetPlatform
.
iOS
,
TargetPlatform
.
macOS
}));
},
variant:
const
TargetPlatformVariant
(<
TargetPlatform
>{
TargetPlatform
.
iOS
,
TargetPlatform
.
macOS
}));
testWidgets
(
'Tapping the status bar scrolls to top with ease out curve animation'
,
(
WidgetTester
tester
)
async
{
const
int
duration
=
1000
;
final
List
<
double
>
stops
=
<
double
>[
0.842
,
0.959
,
0.993
,
1.0
];
const
double
scrollOffset
=
1000
;
await
tester
.
pumpWidget
(
_buildStatusBarTestApp
(
debugDefaultTargetPlatformOverride
));
final
ScrollableState
scrollable
=
tester
.
state
(
find
.
byType
(
Scrollable
));
scrollable
.
position
.
jumpTo
(
scrollOffset
);
await
tester
.
tapAt
(
const
Offset
(
100.0
,
10.0
));
await
tester
.
pump
(
Duration
.
zero
);
expect
(
scrollable
.
position
.
pixels
,
equals
(
scrollOffset
));
for
(
int
i
=
0
;
i
<
stops
.
length
;
i
++)
{
await
tester
.
pump
(
Duration
(
milliseconds:
duration
~/
stops
.
length
));
// Scroll pixel position is very long double, compare with floored int
// pixel position
expect
(
scrollable
.
position
.
pixels
.
toInt
(),
equals
(
(
scrollOffset
*
(
1
-
stops
[
i
])).
toInt
()
)
);
}
// Finally stops at the top.
expect
(
scrollable
.
position
.
pixels
,
equals
(
0.0
));
},
variant:
const
TargetPlatformVariant
(<
TargetPlatform
>{
TargetPlatform
.
iOS
,
TargetPlatform
.
macOS
}));
testWidgets
(
'Tapping the status bar does not scroll to top'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'Tapping the status bar does not scroll to top'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
_buildStatusBarTestApp
(
TargetPlatform
.
android
));
await
tester
.
pumpWidget
(
_buildStatusBarTestApp
(
TargetPlatform
.
android
));
final
ScrollableState
scrollable
=
tester
.
state
(
find
.
byType
(
Scrollable
));
final
ScrollableState
scrollable
=
tester
.
state
(
find
.
byType
(
Scrollable
));
...
...
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