这是indexloc提供的服务,不要输入任何密码

above_hero 1.2.0 copy "above_hero: ^1.2.0" to clipboard
above_hero: ^1.2.0 copied to clipboard

Allows limited control of the Hero widget's z-index by placing page elements ABOVE it

Above Hero #

Pub Version License: MIT

Русская версия

A package that allows limited control over the z-index of the Hero widget by placing page elements above it during page transitions.

Preview: #

combined preview
without above_hero
with above_hero

Online demo: https://thela.space/above_hero

Usage #

Simply wrap the widgets that should be displayed above the Hero in AboveHero:

Stack(
  children: <Widget>[
    Hero(tag: "myHero", child: MyHeroContent()),
    Positioned(
      top: 16,
      left: 16,
      child: AboveHero(
        child: ElevatedButton(
          onPressed: () => Navigator.pop(context),
          child: Icon(Icons.arrow_back),
        ),
      ),
    ),
  ],
)

How does it work? #

During the transition animation, both pages are located in the navigation overlay. Hero adds itself to this overlay at the very top.

above_hero... does the same.

  1. Tracks the moment the transition animation starts
  2. Waits for Hero to appear in the overlay
  3. Moves its child widget to the top, replacing it with a placeholder.

In the overlay, AboveHero correctly positions the widget and applies the same transition animation to it that is applied to the screen.

Visually, everything looks as if the widget is still part of the screen.

After the animation is complete, AboveHero returns the widget to its rightful place on the page.

License #

This project is licensed under the MIT License - see the LICENSE file for details.

4
likes
160
points
67
downloads

Publisher

verified publisherthela.space

Weekly Downloads

Allows limited control of the Hero widget's z-index by placing page elements ABOVE it

Repository (GitHub)
View/report issues

Topics

#hero #z-index #overlay #navigation #animation

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on above_hero