fluttercommunity / flutter_sticky_headers

Flutter Sticky Headers - Lets you place "sticky headers" into any scrollable content in your Flutter app. No special wrappers or magic required. Maintainer: @slightfoot
https://pub.dev/packages/sticky_headers
MIT License
1.1k stars 129 forks source link

one way to fixed sliver app bar overlap #48

Open a616781689 opened 3 years ago

a616781689 commented 3 years ago

// find sliverlist renderobject
    RenderSliver? renderSliver  = context.findAncestorRenderObjectOfType<RenderSliver>();  

// determineStuckOffset
  double determineStuckOffset() {
    double dy;

    try {
      dy = localToGlobal(Offset(0, -renderSliver.constraints.overlap), ancestor: renderSliver).dy;
    } catch (e) {
      // ignore and fall-through and return 0.0
      dy = 0.0;
    }
    return dy;
  }