'How to hide actions from SliverAppBar when it's expanded?

I have a SliverAppBar with a background image and a list of actions, but I would like the actions to show only when the image disappears (when the SliverAppBar is collapsed). Is there a way to do this?

Thank you in advance.

My SliverAppBar code:

SliverAppBar(
  backgroundColor: const Color(0xff86ba86),
  expandedHeight: heigth,
  pinned: true,
  elevation: 0,
  actions: navBarItems(),
  flexibleSpace: FlexibleSpaceBar(
    background: background,
  ),
)


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source