Giter Site home page Giter Site logo

Comments (8)

Kavantix avatar Kavantix commented on August 15, 2024 1

I have emailed you the current version of the SliverFillRemainingWithMinimum widget
If you agree that it solves this issue we should start on a PR to add it to the package

from sliver_tools.

Kavantix avatar Kavantix commented on August 15, 2024 1

@martipello it wasnt what he needed, feel free to open an issue if you’re running into something

from sliver_tools.

Kavantix avatar Kavantix commented on August 15, 2024

I cannot reproduce your issue.
Could you provide a complete and minimal example?

from sliver_tools.

Kypsis avatar Kypsis commented on August 15, 2024

Parent widget would be:

class ExampleParentScreen extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
          extendBody: true,
          backgroundColor: Themes.white,
          bottomNavigationBar: const NavigationWidget(),
          body: CustomScrollView(
            physics: BouncingScrollPhysics(),
            slivers: <Widget>[
              const ExampleAppBarWidget(),
              const ExampleWidget()
            ],
          ),
        );
      },
}

And ExampleAppBarWidget:

class ExampleAppBarWidget extends StatelessWidget {
  static const double collapsedHeight = 57.0;
  static const double expandedHeight = 465.0;

  const ExploreAppBarWidget();

  @override
  Widget build(BuildContext context) {
    return SliverPersistentHeader(
      pinned: true,
      delegate: _SliverAppBarDelegate(
          minHeight: collapsedHeight + MediaQuery.of(context).padding.top,
          maxHeight: expandedHeight + MediaQuery.of(context).padding.top),
    );
  }
}

class _SliverAppBarDelegate extends SliverPersistentHeaderDelegate {
  final double minHeight;
  final double maxHeight;

  _SliverAppBarDelegate({
    @required this.minHeight,
    @required this.maxHeight,
  });

  @override
  double get minExtent => minHeight;

  @override
  double get maxExtent => max(maxHeight, minHeight);

  @override
  Widget build(BuildContext context, double shrinkOffset, bool overlapsContent) {
    return Container(
          color: Colors.red
    );
  }

  @override
  bool shouldRebuild(_SliverAppBarDelegate oldDelegate) {
    return false;
  }
}

from sliver_tools.

Kavantix avatar Kavantix commented on August 15, 2024

Using your code and having the child as a simple container:

class ExampleItemWidget extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Container(
      height: 100,
      width: double.infinity,
      color: Colors.green,
      margin: const EdgeInsets.all(8),
    );
  }
}

I get this result when setting the fillremaining to blue so it seems to work
Simulator Screen Shot - iPhone 12 - 2021-01-20 at 15 33 41

Are you using 0.1.10+1?

from sliver_tools.

Kypsis avatar Kypsis commented on August 15, 2024

Now Imagine scrolling up so the appbar collapses: the red gets smaller, and the blue gets proportionally bigger. In 1.0.9 that was the behaviour if you didn't specify height to the Container (or SizedBox). In 1.1.10+1 the blue part wont resize so the appbar is not collapsable. You could give a scrollbody to the SliverFillRemaining but then the blue part would be viewport height, and the green list items would be scrollable offscreen. The intended behaviour is that if I have less items in the list than would fill the screen, then SliverFillRemaining would fill the missing part so the appbar is fully collapsable (otherwise the appbar would only be collapsable to the extent I have list items).

The use case would be a situation where I can add and remove items to and from the list. Or better example, I wouldn't want a situation where I only see partly expanded or collapsed appbar assuming I'm showing different content whether it is fully expanded or collapsed.

from sliver_tools.

Kavantix avatar Kavantix commented on August 15, 2024

Sadly I must tell you that the behaviour 0.1.9 had was actually incorrect.
The current version behaves the same as if you didn't place the widgets inside a MuliSliver but directly inside the CustomScrollView.

I do actually have an adapted version of SliverFillRemaining in my private code (it's not open source ready) that allows you to specify a minimum amount of scroll that the SliverFillRemaining should provide.
If you want I can mail it to you and perhaps we can work together to get it included in this package.

from sliver_tools.

martipello avatar martipello commented on August 15, 2024

how did this end?

from sliver_tools.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.