-
Notifications
You must be signed in to change notification settings - Fork 27.7k
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 : is there any way to support multiple child for SliverOverlapAbsorber #22393
Comments
i have done some things to solve this thing, may be you have better solution 。please check it when you have the time. |
Any progress on this issue? This should be fixed in the flutter itself as well |
It’s already in the second half of 2019, and I still haven’t seen any progress on this issue. T_T |
@vanlooverenkoen I don't understand why this ticket was closed. This ticket is definitely not addressed as of today. |
I am still having this issue, it is not yet resolved from flutter |
My approach: use MultiSliver widget from sliver_tools 0.1.8 to wrap the multiple slivers within SliverOverlapAbsorber. Any other possible approaches at the moment? |
Still facing this issue, any updates? |
I am also facing this issue. @zoechi is there any update on this issue? |
me too |
any updates? |
I'm facing the same issue. |
I'm still facing this issue |
I have not tried this yet, but it occurred to me this morning that the sliver_tools package may resolve this. You could use the sliver group - MultiSliver I think - to group more one sliver together and then wrap it in the the SliverOverlapAbsorber. |
totally works many thanks |
@Piinks the sliver_tools is a workaround right? This should still be fixed in flutter itself as well? |
I'm also facing this issue. |
Hey @vanlooverenkoen I am not sure! At this time there is no one actively working on this, but the issue remains open. :) |
This feature would be really helpful! |
|
Also need this feature |
It will be great to have this feature! |
hello, one solution is to use a SliverOverlapAbsorber with pinned = true |
@popalexandru Could you add an example of how it would look like. Was just refactoring code on one project I recently joined and it had |
These example seem it work but ListView inside each tab will affect for all tab when you scroll one of them. |
Using MultiSliver worked out fine for me.
Additionally, you might want to wrap the body with a SliverSafeArea or top padding. |
Not working when using multiple SliverAppBar pinned with flexibleSpaceBar. |
This code support double sliver pinned appbar without the issue where small body go behind second app bar. import 'package:flutter/material.dart';
void main() {
runApp(
MaterialApp(
home: Home(),
),
);
}
class Home extends StatelessWidget {
Home({super.key});
final SliverOverlapAbsorberHandle appBar = SliverOverlapAbsorberHandle();
final SliverOverlapAbsorberHandle disconnectBar =
SliverOverlapAbsorberHandle();
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
body: NestedScrollView(
physics: const ClampingScrollPhysics(),
headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) =>
<Widget>[
SliverOverlapAbsorber(
handle: appBar,
sliver: const SliverAppBar(
pinned: true,
backgroundColor: Colors.red,
elevation: 0,
toolbarHeight: 50,
expandedHeight: 100,
title: Center(
child: Text("First pinned appbar"),
),
),
),
SliverOverlapAbsorber(
handle: disconnectBar,
sliver: const SliverAppBar(
pinned: true,
backgroundColor: Colors.green,
elevation: 0,
primary: false,
toolbarHeight: 20,
expandedHeight: 100,
title: Center(
child: Text("Second pinned appbar"),
),
),
),
],
body: Builder(
builder: (BuildContext context) => CustomScrollView(
slivers: <Widget>[
SliverOverlapInjector(handle: appBar),
SliverOverlapInjector(handle: disconnectBar),
SliverToBoxAdapter(
child: Container(
color: Colors.grey,
height: 100,
width: double.infinity,
child: const Center(child: Text("body")),
),
),
],
),
),
),
);
}
} |
worked out fine for me!! thanks!! |
The solution presented here doesn't work properly when you have a |
It works for my case. and body has CustomScrollview, it has 2 SliverOverlapInjector. It works properly even with CustomScrollView in the body of NestedScrollView |
Resolving #33137 (currently in progress) will resolve this as well since multiple slivers will be able to go into the group, and the group itself will be able to go into the SliverOverlapAbsorber. 👍 |
This has been resolved by #126596. With SliverMainAxisGroup, multiple slivers can be wrapped by the group, and then the group can be provided to the SliverOverlapAbsorber. :) cc @thkim1011 |
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 |
As [flutter document(https://docs.flutter.io/flutter/widgets/NestedScrollView-class.html) said about SliverOverlapAbsorber
// This widget takes the overlapping behavior of the SliverAppBar,
// and redirects it to the SliverOverlapInjector below. If it is
// missing, then it is possible for the nested "inner" scroll view
// below to end up under the SliverAppBar even when the inner
// scroll view thinks it has not been scrolled.
// This is not necessary if the "headerSliverBuilder" only builds
// widgets that do not overlap the next sliver.
SliverOverlapAbsorber can fix the Scroll postion in body scroll widget. is there any way to support
multiple child. as i use a pinned SliverPersistentHeader under a SliverOverlapAbsorber
more info please see the gif and demo code. thanks
main6.zip
The text was updated successfully, but these errors were encountered: