sticky_headers 0.1.8

Flutter Community

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 new ListView.builder(itemBuilder: (context, index) {
      return new StickyHeader(
        header: new Container(
          height: 50.0,
          color: Colors.blueGrey[700],
          padding: new EdgeInsets.symmetric(horizontal: 16.0),
          alignment: Alignment.centerLeft,
          child: new Text('Header #$index',
            style: const TextStyle(color: Colors.white),
        content: new Container(
          child: new, 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 #

  • 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

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 Sep 13, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.5.0
  • pana: 0.12.21
  • Flutter: 1.9.1+hotfix.2


Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

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.2 1.1.7
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