Skip to main content
The Stac SliverVisibility allows you to conditionally show or hide a sliver inside a CustomScrollView. When the sliver is not visible, it can either be completely removed from the scroll layout or replaced with another sliver, depending on the configuration. To know more about the SliverVisibility widget in Flutter, refer to the official documentation.

Properties

PropertyTypeDescription
sliverMap<String, dynamic>The sliver widget whose visibility is controlled.
replacementSliverMap<String, dynamic>?The sliver to display when visible is false. Defaults to an empty sliver.
visibleboolWhether the sliver is visible. Defaults to true.
maintainStateboolWhether to maintain the state of the sliver when hidden.
maintainAnimationboolWhether to maintain animations when the sliver is hidden.
maintainSizeboolWhether to maintain layout space when the sliver is hidden.
maintainSemanticsboolWhether to maintain semantics when the sliver is hidden.
maintainInteractivityboolWhether to maintain interactivity when the sliver is hidden.

Example

StacSliverVisibility(
  visible: false,
  sliver: StacSliverToBoxAdapter(
    child: StacContainer(
      height: 180,
      color: 'warning',
      child: StacCenter(
        child: StacText(data: 'This sliver is hidden'),
      ),
    ),
  ),
)