stretchy_header 1.0.4

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • 81

Stretchy Header #

pub package

This package allows us to create a elastic header, to give a good effect when you scroll down the widget.

Sample 1

Sample 2

Sample 3


https://media.giphy.com/media/1NUOenNf2oKU3YuWb1/giphy.gif

Getting started #

You should ensure that you add the router as a dependency in your flutter project.

dependencies:
  stretchy_header: "^1.0.4"

You should then run flutter packages upgrade or update your packages in IntelliJ.

Example Project #

There is an example project in the example folder. Check it out. Otherwise, keep reading to get up and running.

Usage #

Sample 1 #

import 'package:flutter/material.dart';
import 'package:stretchy_header/stretchy_header.dart';

class SampleStretchy1 extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return SafeArea(
      child: Scaffold(
        body: StretchyHeader(
          headerHeight: 250.0,
          header: Image.asset(
            "images/chichen.jpg",
            fit: BoxFit.cover,
          ),
          body: ListView.builder(
            itemCount: 15,
            shrinkWrap: true,
            itemBuilder: (context, index) {
              return ListTile(
                title: Text("item $index"),
              );
            },
          ),
        ),
      ),
    );
  }
}

Sample 2 #


import 'package:flutter/material.dart';
import 'package:stretchy_header/stretchy_header.dart';

class SampleStretchy2 extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: StretchyHeader(
        headerHeight: 200.0,
        backgroundColor: Colors.black54,
        blurColor: Colors.yellow,
        header: UserAccountsDrawerHeader(
          accountName: Text("Diego"),
          accountEmail: Text("twitter @diegoveloper"),
          currentAccountPicture: CircleAvatar(
            backgroundColor: Colors.red,
            child: Text("DV"),
          ),
          margin: EdgeInsets.zero,
        ),
        body: Padding(
          padding: const EdgeInsets.all(15.0),
          child: Text(
            "Hello World!",
            style: TextStyle(fontSize: 45.0, color: Colors.white),
          ),
        ),
      ),
    );
  }
}

Sample 3 #

If you want to put a footer widget in your header that always will be visible, use headerFooter


import 'package:flutter/material.dart';
import 'package:stretchy_header/stretchy_header.dart';

class SampleStretchy3 extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: StretchyHeader(
        headerHeight: 250.0,
        header: Image.asset(
          "images/machu.jpg",
          fit: BoxFit.cover,
        ),
        highlightHeaderAlignment: HighlightHeaderAlignment.bottom,
        highlightHeader: Container(
          width: MediaQuery.of(context).size.width,
          decoration: BoxDecoration(
              gradient: LinearGradient(
            colors: [
              Colors.black54,
              Colors.black54,
              Colors.black26,
              Colors.black12,
              Colors.black12,
            ],
            begin: Alignment.bottomCenter,
            end: Alignment.topCenter,
          )),
          child: Padding(
            padding: const EdgeInsets.all(15.0),
            child: Text(
              "Machu Picchu",
              style: TextStyle(color: Colors.white, fontSize: 22.0),
            ),
          ),
        ),
        body: Padding(
          padding: const EdgeInsets.all(15.0),
          child: Text("Long text here"),
        ),
      ),
    );
  }
}

You can follow me on twitter @diegoveloper

[1.0.4]

  • New option to avoid blur the content when scroll. blurContent = false

[1.0.1 - 1.0.3]

  • Fixed an issue related to the highlightHeader (now it can detects gesture events).

[1.0.0]

  • First release.

example/README.md

example #

A new Flutter project.

Getting Started #

This project is a starting point for a Flutter application.

A few resources to get you started if this is your first Flutter project:

For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

Use this package as a library

1. Depend on it

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


dependencies:
  stretchy_header: ^1.0.4

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter packages get

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

3. Import it

Now in your Dart code, you can use:


import 'package:stretchy_header/stretchy_header.dart';
  
Version Uploaded Documentation Archive
1.0.4 Mar 7, 2019 Go to the documentation of stretchy_header 1.0.4 Download stretchy_header 1.0.4 archive
1.0.3 Jan 22, 2019 Go to the documentation of stretchy_header 1.0.3 Download stretchy_header 1.0.3 archive
1.0.2 Jan 22, 2019 Go to the documentation of stretchy_header 1.0.2 Download stretchy_header 1.0.2 archive
1.0.1 Jan 21, 2019 Go to the documentation of stretchy_header 1.0.1 Download stretchy_header 1.0.1 archive
1.0.0 Dec 27, 2018 Go to the documentation of stretchy_header 1.0.0 Download stretchy_header 1.0.0 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
62
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
81
Learn more about scoring.

We analyzed this package on Apr 16, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.2.0
  • pana: 0.12.14
  • Flutter: 1.4.7

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.68.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11
meta 1.1.6 1.1.7
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test