File tree Expand file tree Collapse file tree 1 file changed +12
-10
lines changed Expand file tree Collapse file tree 1 file changed +12
-10
lines changed Original file line number Diff line number Diff line change @@ -45,16 +45,18 @@ class _ItemInfoState extends State<ItemInfo> with TickerProviderStateMixin {
45
45
children: < Widget > [
46
46
NotificationListener <ScrollNotification >(
47
47
onNotification: (ScrollNotification notification) {
48
- var scrollY = notification.metrics.pixels;
49
- if (scrollY > 0 ) {
50
- var opacity = scrollY / 230 ;
51
- setState (() {
52
- appBarOpacity = opacity <= 1 ? opacity : 1 ;
53
- });
54
- } else if (scrollY < 0 ) {
55
- setState (() {
56
- appBarOpacity = 0 ;
57
- });
48
+ if (notification.metrics.axis == Axis .vertical) {
49
+ var scrollY = notification.metrics.pixels;
50
+ if (scrollY > 0 ) {
51
+ var opacity = scrollY / 230 ;
52
+ setState (() {
53
+ appBarOpacity = opacity <= 1 ? opacity : 1 ;
54
+ });
55
+ } else if (scrollY < 0 ) {
56
+ setState (() {
57
+ appBarOpacity = 0 ;
58
+ });
59
+ }
58
60
}
59
61
return false ;
60
62
},
You can’t perform that action at this time.
0 commit comments