scaling_header 1.1.1

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

scaling_header #

Scale your header according to scroll position.

Puts your overlapContent onto center of flexibleSpace's bottom. Its width will expand and border radius will decrease while flexibleSpace is shrinking to standard AppBar which opacity will change from 0 to 1.

Okey If I confuse you enough,

Look at the GIF, it explains it better =)

Credits #

Inspired by ScalingLayout

[1.1.1] - 01/17/2019

  • Fix position of flexibleSpace

[1.1.0] - 01/17/2019

[1.0.0] - 12/29/2018

  • Initial release.

example/lib/main.dart

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

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      title: 'ScalingHeader Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      routes: {
        '/': (context) => HomePage(),
        '/profile_page': (context) => ProfilePage(),
      },
    );
  }
}

class HomePage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text('HomePage')),
      body: Center(
          child: RaisedButton(
        child: Text('Open Profile'),
        onPressed: () {
          Navigator.pushNamed(context, '/profile_page');
        },
      )),
    );
  }
}

class ProfilePage extends StatefulWidget {
  @override
  _ProfilePageState createState() {
    return _ProfilePageState();
  }
}

class _ProfilePageState extends State<ProfilePage> {
  final double overlapContentHeight = 50;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Colors.blueGrey,
      body: CustomScrollView(
        slivers: <Widget>[
          ScalingHeader(
            backgroundColor: Colors.red,
            title: Text(
              'James Dean',
            ),
            flexibleSpace: Image.asset(
              'assets/james.jpg',
              fit: BoxFit.cover,
              color: Colors.black.withOpacity(0.3),
              colorBlendMode: BlendMode.srcATop,
            ),
            overlapContentBackgroundColor: Colors.redAccent,
            overlapContent: Row(
              mainAxisAlignment: MainAxisAlignment.spaceEvenly,
              children: <Widget>[
                Expanded(
                  child: GestureDetector(
                    onTap: () {
                      print('Tap Bio');
                    },
                    child: Row(
                      mainAxisAlignment: MainAxisAlignment.center,
                      children: <Widget>[
                        Icon(
                          Icons.chrome_reader_mode,
                          color: Colors.white,
                        ),
                        SizedBox(width: 8.0),
                        Text(
                          'Read Bio',
                          style: TextStyle(color: Colors.white),
                        )
                      ],
                    ),
                  ),
                ),
                Expanded(
                  child: GestureDetector(
                    onTap: () {
                      print('Tap Movies');
                    },
                    child: Row(
                      mainAxisAlignment: MainAxisAlignment.center,
                      children: <Widget>[
                        Icon(
                          Icons.devices,
                          color: Colors.white,
                        ),
                        SizedBox(width: 8.0),
                        Text('See Movies',
                            style: TextStyle(color: Colors.white))
                      ],
                    ),
                  ),
                )
              ],
            ),
          ),
          SliverToBoxAdapter(
            child: Padding(
              padding:
                  EdgeInsets.only(top: 16, right: 16, left: 16, bottom: 16),
              child: Text(
                'James Dean was born on February 8, 1931, in Marion, Indiana. '
                    'He starred in the film adaptation of the John Steinbeck novel '
                    'East of Eden, for which he received a posthumous Oscar '
                    'nomination. Dean\'s next starring role as an emotionally '
                    'tortured teen in Rebel Without a Cause made him into the '
                    'embodiment his generation. In early autumn 1955, Dean was killed '
                    'in a car crash, quickly becoming an enduring film icon whose '
                    'legacy has endured for decades. His final film Giant, was also '
                    'released posthumously.\n\n' *
                    50,
                style: TextStyle(color: Colors.white),
              ),
            ),
          )
        ],
      ),
    );
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  scaling_header: ^1.1.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:scaling_header/scaling_header.dart';
  
Version Uploaded Documentation Archive
1.1.1 Jan 17, 2019 Go to the documentation of scaling_header 1.1.1 Download scaling_header 1.1.1 archive
1.1.0 Jan 17, 2019 Go to the documentation of scaling_header 1.1.0 Download scaling_header 1.1.0 archive
1.0.0 Dec 28, 2018 Go to the documentation of scaling_header 1.0.0 Download scaling_header 1.0.0 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
48
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
87
Overall:
Weighted score of the above. [more]
71
Learn more about scoring.

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

  • Dart: 2.3.1
  • pana: 0.12.16
  • Flutter: 1.5.4-hotfix.2

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Maintenance suggestions

The package description is too short. (-13 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

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