sliver_glue 1.1.0

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

sliver_glue.dart | 1.1.0 #

Pub

Helpers for easily mixing content in a Flutter CustomScrollView, simple as ListView & GridView.

Inspiration #

sliver_glue exists mostly for mixing different kinds of content in a CustomScrollView. For a scrolling application, this is a possible common pattern in the same view.

  • Header widgets / AppBar
  • Grid of items
  • A list of items

To use all of these in a CustomScrollView, using SliverList and SliverGrid have more boilerplate than using ListView and GridView.

sliver_glue aims to help with that problem, and goes a little beyond this too (providing dismissable-ness and dividing lines, common use-cases).

Getting Started #

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

final List<String> text = ['A', 'B'];

class MyApp extends StatelessWidget {
  Widget _itemBuilder(BuildContext context, String str, _, __, ___) =>
    Text(data.text, key: Key(str));
 
  @override
  Widget build(BuildContext context) {
    return CustomScrollView(
      slivers: <Widget>[
        SliverGlueFixedList(
          widgets: <Widget>[
            Container(
              height: 200,
              child: Placeholder()
            )
          ],
        ),
        SliverGlueList(
          data: text,
          header: Text('Our List Header'),
          builder: _itemBuilder,
          divided: true,
        ),
        SliverGlueGrid(
          data: text,
          builder: _itemBuilder,
          dismissible: true
        )
      ],
    );
  }
}

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

1.1.0 #

  • Use built-in hashCode instead of GlueKeyedData.

1.0.0 #

  • Initial release.

example/example.dart

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

final List<String> text = <String>[
  'A',
  'B'
];

class MyApp extends StatelessWidget {
  Widget _itemBuilder(BuildContext context, String data, _, __, ___) =>
    Text(data, key: Key(data.toString()));
 
  @override
  Widget build(BuildContext context) {
    return CustomScrollView(
      slivers: <Widget>[
        SliverGlueFixedList(
          widgets: <Widget>[
            Container(
              height: 200,
              child: Placeholder()
            )
          ],
        ),
        SliverGlueList(
          data: text,
          header: Text('Our List Header'),
          builder: _itemBuilder,
          divided: true,
        ),
        SliverGlueGrid(
          data: text,
          builder: _itemBuilder,
          dismissible: true
        )
      ],
    );
  }
}

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

Use this package as a library

1. Depend on it

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


dependencies:
  sliver_glue: ^1.1.0

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:sliver_glue/sliver_glue.dart';
  
Version Uploaded Documentation Archive
1.1.0 Jan 21, 2019 Go to the documentation of sliver_glue 1.1.0 Download sliver_glue 1.1.0 archive
1.0.0 Dec 23, 2018 Go to the documentation of sliver_glue 1.0.0 Download sliver_glue 1.0.0 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
70
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]
85
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.

Health suggestions

Format lib/sliver_glue.dart.

Run flutter format to format lib/sliver_glue.dart.

Format lib/src/sliver_glue_fixed_list.dart.

Run flutter format to format lib/src/sliver_glue_fixed_list.dart.

Format lib/src/sliver_glue_grid.dart.

Run flutter format to format lib/src/sliver_glue_grid.dart.

Format lib/src/sliver_glue_list.dart.

Run flutter format to format lib/src/sliver_glue_list.dart.

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