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
a75743e8
Unverified
Commit
a75743e8
authored
Apr 26, 2022
by
Kate Lovett
Committed by
GitHub
Apr 26, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Re-land reverse case for AppBar scrolled under" (#102580)
parent
6132b86d
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
295 additions
and
479 deletions
+295
-479
app_bar.dart
packages/flutter/lib/src/material/app_bar.dart
+9
-25
scroll_notification_observer.dart
...flutter/lib/src/widgets/scroll_notification_observer.dart
+6
-26
app_bar_test.dart
packages/flutter/test/material/app_bar_test.dart
+280
-426
debug_test.dart
packages/flutter/test/material/debug_test.dart
+0
-1
scaffold_test.dart
packages/flutter/test/material/scaffold_test.dart
+0
-1
No files found.
packages/flutter/lib/src/material/app_bar.dart
View file @
a75743e8
...
...
@@ -767,33 +767,17 @@ class _AppBarState extends State<AppBar> {
}
void
_handleScrollNotification
(
ScrollNotification
notification
)
{
final
bool
oldScrolledUnder
=
_scrolledUnder
;
final
ScrollMetrics
metrics
=
notification
.
metrics
;
if
(
notification
.
depth
!=
0
)
{
_scrolledUnder
=
false
;
}
else
{
switch
(
metrics
.
axisDirection
)
{
case
AxisDirection
.
up
:
// Scroll view is reversed
_scrolledUnder
=
metrics
.
extentAfter
>
0
;
break
;
case
AxisDirection
.
down
:
_scrolledUnder
=
metrics
.
extentBefore
>
0
;
break
;
case
AxisDirection
.
right
:
case
AxisDirection
.
left
:
// Scrolled under is only supported in the vertical axis.
_scrolledUnder
=
false
;
break
;
if
(
notification
is
ScrollUpdateNotification
)
{
final
bool
oldScrolledUnder
=
_scrolledUnder
;
_scrolledUnder
=
notification
.
depth
==
0
&&
notification
.
metrics
.
extentBefore
>
0
&&
notification
.
metrics
.
axis
==
Axis
.
vertical
;
if
(
_scrolledUnder
!=
oldScrolledUnder
)
{
setState
(()
{
// React to a change in MaterialState.scrolledUnder
});
}
}
if
(
_scrolledUnder
!=
oldScrolledUnder
)
{
setState
(()
{
// React to a change in MaterialState.scrolledUnder
});
}
}
Color
_resolveColor
(
Set
<
MaterialState
>
states
,
Color
?
widgetColor
,
Color
?
themeColor
,
Color
defaultColor
)
{
...
...
packages/flutter/lib/src/widgets/scroll_notification_observer.dart
View file @
a75743e8
...
...
@@ -9,7 +9,6 @@ import 'package:flutter/foundation.dart';
import
'framework.dart'
;
import
'notification_listener.dart'
;
import
'scroll_notification.dart'
;
import
'scroll_position.dart'
;
/// A [ScrollNotification] listener for [ScrollNotificationObserver].
///
...
...
@@ -152,26 +151,14 @@ class ScrollNotificationObserverState extends State<ScrollNotificationObserver>
@override
Widget
build
(
BuildContext
context
)
{
// A ScrollMetricsNotification allows listeners to be notified for an
// initial state, as well as if the content dimensions change without
// scrolling.
return
NotificationListener
<
ScrollMetricsNotification
>(
onNotification:
(
ScrollMetricsNotification
notification
)
{
_notifyListeners
(
_ConvertedScrollMetricsNotification
(
metrics:
notification
.
metrics
,
context:
notification
.
context
,
));
return
NotificationListener
<
ScrollNotification
>(
onNotification:
(
ScrollNotification
notification
)
{
_notifyListeners
(
notification
);
return
false
;
},
child:
NotificationListener
<
ScrollNotification
>(
onNotification:
(
ScrollNotification
notification
)
{
_notifyListeners
(
notification
);
return
false
;
},
child:
_ScrollNotificationObserverScope
(
scrollNotificationObserverState:
this
,
child:
widget
.
child
,
),
child:
_ScrollNotificationObserverScope
(
scrollNotificationObserverState:
this
,
child:
widget
.
child
,
),
);
}
...
...
@@ -183,10 +170,3 @@ class ScrollNotificationObserverState extends State<ScrollNotificationObserver>
super
.
dispose
();
}
}
class
_ConvertedScrollMetricsNotification
extends
ScrollNotification
{
_ConvertedScrollMetricsNotification
({
required
super
.
metrics
,
required
super
.
context
,
});
}
packages/flutter/test/material/app_bar_test.dart
View file @
a75743e8
This diff is collapsed.
Click to expand it.
packages/flutter/test/material/debug_test.dart
View file @
a75743e8
...
...
@@ -349,7 +349,6 @@ void main() {
' Material
\n
'
' _ScrollNotificationObserverScope
\n
'
' NotificationListener<ScrollNotification>
\n
'
' NotificationListener<ScrollMetricsNotification>
\n
'
' ScrollNotificationObserver
\n
'
' _ScaffoldScope
\n
'
' Scaffold-[LabeledGlobalKey<ScaffoldState>#00000]
\n
'
...
...
packages/flutter/test/material/scaffold_test.dart
View file @
a75743e8
...
...
@@ -2339,7 +2339,6 @@ void main() {
' Material
\n
'
' _ScrollNotificationObserverScope
\n
'
' NotificationListener<ScrollNotification>
\n
'
' NotificationListener<ScrollMetricsNotification>
\n
'
' ScrollNotificationObserver
\n
'
' _ScaffoldScope
\n
'
' Scaffold
\n
'
...
...
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