Closed tomasbaran closed 2 years ago
I'm facing this issue too
I'm facing this issue too
我也遇到这个问题
@tomasbaran did you find any solution to that?
@chiragmittal19 Unfortunately I did not.
Are any of you guys not using an AppBar? Or if you are, is your elevation 0?
Based on https://github.com/fluttercommunity/flutter_sticky_headers/pull/28, I have a feeling the code isn't taking non-default elevations into account.
I did use that PR in my code, but quickly found a bug that wasn't keeping headers stickied. I realized that the v0.1.8+1 released on flutter pub.dev packages isn't even the same code as this repository.
So I downloaded the tar from pub.dev and patched #28's PR and it seems to be working now with some modifications on my end too.
old code:
return body;
new code:
var theme = Theme.of(context);
return Theme(
data: theme.copyWith(appBarTheme: theme.appBarTheme.copyWith(elevation: 4)),
child: body,
);
pubspec:
dependencies:
...
sticky_headers:
git:
url: https://github.com/while-loop/flutter_sticky_headers.git
ref: "ac28980d81b8adf8a3bd14a875abedea5e89ea3f"
Also.. I wasn't able to reproduce this on a Pixel 3XL, but was able to on a regular Pixel 3.
@while-loop Where are you placing this new code? I am facing this issue sadly. Thanks in advance for any help
@while-loop I found it but your fix presents the error
The method 'toDouble' was called on null. Receiver: null Tried calling: toDouble()
`The relevant error-causing widget was: StickyHeader file:///Users/haydgately/Documents/GitHub/project/lib/screens/tables/tables_screen.dart:132:44 When the exception was thrown, this was the stack:
...
The following RenderObject was being processed when the exception was fired: RenderStickyHeader#16d7f relayoutBoundary=up6
... needs compositing
... parentData:
any solution for this?
I abandoned using the whole thing I'm afraid!
I abandoned using the whole thing I'm afraid!
I actually managed to solve it thanks to @while-loop. The only problem i had was that his fork wasn't null safety so i added that myself based on the last commit on the original repository. Here's the link if anyone wants to try it
In my case i had no AppBar so what i did was add in the scaffold where i have the list
Scaffold(body:...)
the following elevation as @while-loop suggested
var theme = Theme.of(context)
Scaffold(
body: Theme(
data: theme.copyWith(
appBarTheme: theme.appBarTheme.copyWith(elevation: 4)),
child:...
with the dependency in pubspec.yaml pointing to my fork like this:
dependencies:
[...]
sticky_headers:
git:
url: https://github.com/Cosminnv/flutter_sticky_headers.git
ref: ddecfaf85a7fb3bb0838e60a8644730d0db955fe
Now it seems to be working all right.
Another workaround is to wrap the header in the Container widget and set the border color matching the color of the header.
header: Container(
decoration: BoxDecoration(
color: Colors.white,
border: Border.all(
color: Colors.white,
),
),
child: ........
),
Fixed as-of v0.3.0.
@slightfoot Sorry but seems still happening..
flutter 3.0.0 sticky_headers: ^0.3.0+2
I made a PR to make it fixed. Just changed 'round' logics to 'ceil' for conservative pixel calculation. Then it worked in iOS, Web without blinking line.
https://github.com/fluttercommunity/flutter_sticky_headers/pull/63
@slightfoot Still exist on iPhone XR
Another workaround is to wrap the header in the Container widget and set the border color matching the color of the header.
This worked for me after one addition (v0.3.0+2
):
header: Container(
decoration: BoxDecoration(
color: Colors.white,
border: Border.all(
color: Colors.white,
+ strokeAlign: BorderSide.strokeAlignOutside
),
),
child: ........
),
Another workaround is to wrap the header in the Container widget and set the border color matching the color of the header.
This worked for me after one addition (
v0.3.0+2
):header: Container( decoration: BoxDecoration( color: Colors.white, border: Border.all( color: Colors.white, + strokeAlign: BorderSide.strokeAlignOutside ), ), child: ........ ),
great,it also work for me!
First off, huge thanks for this plugin. Big big help!
Tiny bug: When scrolling there is a 1px line above the header. See here: https://share.icloud.com/photos/00iofG5V2K9aKDL6Mb2gZ8uKg
demostration: https://share.icloud.com/photos/0O38S_lN4_3i1TAmXjyu22QiQ
Here is the code: