Skip to content
pubscout

sliver_app_bar_builder

1.1.1, released 3 months ago by netglade.cz

Customizable sliver app bar using builder callbacks.

WASM-ready
$ flutter pub add sliver_app_bar_builder
Source repository

What it does

Provides a SliverAppBar replacement that lets you build the bar, content, and actions with builders. The builders receive expand ratio and current heights for fine‑grained UI adjustments.

AI-written summary of version 1.1.1, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need a sliver app bar that changes appearance as it collapses
  • You want to animate titles, actions, or background based on scroll

Skip it when

  • A simple static AppBar is sufficient
  • You are not using a CustomScrollView or slivers

Strengths

  • Full control over bar, content, and actions via builders
  • Access to expandRatio, barHeight, and contentHeight for animations
  • Works on all Flutter platforms

Weaknesses

  • Adds boilerplate compared to the built‑in SliverAppBar
  • Only works within slivers, not regular Scaffold app bars
  • No built‑in theming or preset styles

Setup

Kind
Flutter widgets
Effort
Low
Code generation
No
Direct dependencies
0
CustomScrollView(
  slivers: [
    SliverAppBarBuilder(
      barHeight: 60,
      pinned: true,
      leadingActions: [
        (context, expandRatio, barHeight, overlapsContent) => SizedBox(
          height: barHeight,
          child: const BackButton(),
        ),
      ],
      initialContentHeight: 150,
      contentBuilder: (context, expandRatio, contentHeight, centerPadding, overlapsContent) =>
        Container(
          alignment: Alignment.centerLeft,
          height: 60,
          transform: Matrix4.translationValues(10 + (1 - expandRatio) * 40, 0, 0),
          child: Text(
            'My Title',
            style: TextStyle(
              fontSize: 22 + expandRatio * 10,
              color: Colors.white,
              fontWeight: FontWeight.bold,
            ),
          ),
        ),
    ),
  ],
);

Alternatives

Packages that do the same job and could replace sliver_app_bar_builder.

  • menu_bar

    A customizable application menu bar widget with submenus for Flutter desktop apps.

  • flutter_icon_snackbar

    Animated snack bar with icon, color, text, and programmatic dismissal

  • rating_bar

    A customizable Flutter rating bar supporting half stars, precise fractional values, custom items and RTL layouts.

  • enhanced_paginated_view

    A customizable Flutter widget for paginated lists, grids, and slivers with pull-to-refresh.