sticky_headers 0.1.8+1

Flutter Community: sticky_headers

Flutter Sticky Headers #

pub package

Lets you place headers on scrollable content that will stick to the top of the container whilst the content is scrolled.

Usage #

You can place a StickyHeader or StickyHeaderBuilder inside any scrollable content, such as: ListView, GridView, CustomScrollView, SingleChildScrollView or similar.

Depend on it:

  sticky_headers: "^0.1.8"

Import it:

import 'package:sticky_headers/sticky_headers.dart';

Use it:

class Example extends StatelessWidget {
  Widget build(BuildContext context) {
    return ListView.builder(itemBuilder: (context, index) {
      return StickyHeader(
        header: Container(
          height: 50.0,
          color: Colors.blueGrey[700],
          padding: EdgeInsets.symmetric(horizontal: 16.0),
          alignment: Alignment.centerLeft,
          child: Text('Header #$index',
            style: const TextStyle(color: Colors.white),
        content: Container(
          child:, fit: BoxFit.cover,
            width: double.infinity, height: 200.0),

Examples #

Example 1 - Headers and Content #

Demo 1

Example 2 - Animated Headers with Content #

Demo 2

Example 3 - Headers overlapping the Content #

Demo 3

Bugs/Requests #

If you encounter any problems feel free to open an issue. If you feel the library is missing a feature, please raise a ticket on Github and I'll look into it. Pull request are also welcome.

Changelog #

0.1.8+1 #

  • Added New Flutter Community Banner.

0.1.8 #

  • Resolved endOfFrame/dispose race condition.

0.1.7+1 - 0.1.7+2 #

  • Updated authors.

0.1.7 #

  • Updated Docs.

0.1.6 #

  • Added Flutter Community Logo.

0.1.5 #

0.1.1 ~ 0.1.4 #

  • Improved readme, docs and formatting.

0.1.0 #

  • Initial version release


Sticky Headers Example #

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  sticky_headers: ^0.1.8+1

2. Install it

You can install packages from the command line:

with Flutter:

$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:sticky_headers/sticky_headers.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Feb 18, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.1
  • pana: 0.13.5
  • Flutter: 1.12.13+hotfix.7

Health suggestions

Format lib/sticky_headers/render.dart.

Run flutter format to format lib/sticky_headers/render.dart.

Format lib/sticky_headers/widget.dart.

Run flutter format to format lib/sticky_headers/widget.dart.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
flutter 0.0.0
meta ^1.1.7 1.1.8
Transitive dependencies
collection 1.14.11 1.14.12
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies