New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NestedScrollView SliverAppBar TabBarView listview combination physics:BouncingScrollPhysics Scroll abnormal #33367
Comments
I am glad not to be the only one experiencing this behavior, so I can definitely confirm this problem. It only appears when running on iOS. All in all this makes using the app quite quirky. It happens in the combination:
I'm pretty sure that since NestedScrollView shares its ScrollViewController with both outer and inner ScrollViews, the bounce effect of the inner ScrollView (normally a CustomScrollView representing the current selected TabView) is bringing the ScrollController out of sync. flutter doctor [√] Android toolchain - develop for Android devices (Android SDK version 28.0.3) ! Doctor found issues in 1 category. |
ListView中增加physics属性进行判断,默认状态ClampingScrollPhysics(),当满足条件的时候再把状态改为BouncingScrollPhysics()。 eg:
|
Is this solution working as @meetqy suggest? I haven't tested it yet. |
I found a solution that might work:
|
modify
|
Maybe, I can help you! Widget build(BuildContext context) {
return Scaffold(
body: NestendScrollView(
headerSliverBuilder: (BuildContext context, bool value) {
return <Widget>[
SliverAppBar(),
];
},
body: SafeArea(
child: Builder(
builder: (context) {
final _scr = PrimaryScrollController.of(context);
_scr.addListener(() {
if (_scr.position.pixels == _scr.position.maxScrollExtent) {
print('At DOWNW!!!');
}
});
return CustomScrollView(
controller: _scr,
slivers: <Widget>[
SliverOverlapAbsorber(
handle: NestedScrollView.sliverOverlapAbsorberHandleFor(
context,
),
),
SliverList(
delegate: SliverChildListDelegate(
List.generate(100, (int index) {
return Text('ITEM -> $index');
}),
),
)
],
);
},
),
),
),
);
} |
Same issue here, still not fixed! |
Same issue here... |
It would be very helpful to have a complete demo app that shows this problem, it's not 100% clear how the code above is supposed to be run to show the issue. |
// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file import 'package:flutter/material.dart'; void main() => runApp(MyApp()); class MyApp extends StatelessWidget { class MyHomePage extends StatefulWidget { final String title; @OverRide class _MyHomePageState extends State final List tabViews = [ @OverRide class MyTabContainer extends StatelessWidget { @OverRide |
Cool! |
Same problem here. This is really, REALLY problematic for us since we are going to showcase a flutter application to our CTO in order to consider future flutter adoption in our company and we have a nested scrollview right in our home page. |
We are experiencing this also. Similar to @ezamagni, we cannot show our Flutter demo app to our CEO and CTO because of this issue. We are worried that they will see the problem and judge that we've made a poor choice in proposing we use Flutter as a fundamental technology going forward. A simplified version of @zayedelfasa app below. On iOS with a very quick swipe upwards, the scrolling starts and then unexpected snaps back to the position before swipe began.
|
Is this issue actually a duplicate of #29264 ? |
Yes, it's the exact same problem |
@Hixie should this issue be closed as a duplicate in favor of the earlier issue? |
Please follow up on #29264 |
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of |
code:
List _tabs = ["111","dasdsa","dsad"];
@OverRide
Widget build(BuildContext context) {
// This method is rerun every time setState is called, for instance as done
// by the _incrementCounter method above.
//
// The Flutter framework has been optimized to make rerunning build methods
// fast, so that you can just rebuild anything that needs updating rather
// than having to individually change instances of widgets.
// floating: true,
pinned: true,
expandedHeight: 300,
snap: false,
primary: true,
forceElevated: innerBoxIsScrolled,
bottom: TabBar(
// These are the widgets to put in each tab in the tab bar.
tabs: _tabs.map((String name) => Tab(text: name)).toList(),
),
),
),
),
];
},
body: TabBarView(
children: _tabs.map((String name) {
return SafeArea(
top: false,
bottom: false,
child: Builder(
// physics:new ClampingScrollPhysics(),
key: PageStorageKey(name),
slivers: [
SliverOverlapInjector(
handle:
NestedScrollView.sliverOverlapAbsorberHandleFor(
context),
),
SliverPadding(
padding: const EdgeInsets.all(8.0),
sliver: SliverFixedExtentList(
itemExtent: 60.0,
delegate: SliverChildBuilderDelegate(
(BuildContext context, int index) {
// This builder is called for each child.
// In this example, we just number each list item.
return Container(
color: Color((math.Random().nextDouble() *
0xFFFFFF)
.toInt() <<
0)
.withOpacity(1.0));
},
// The childCount of the SliverChildBuilderDelegate
// specifies how many children this inner list
// has. In this example, each tab has a list of
// exactly 30 items, but this is arbitrary.
childCount: 30,
),
),
),
],
);
},
),
);
}).toList(),
),
),
),
),
);
}
The text was updated successfully, but these errors were encountered: