catalog_grid 1.0.2

  • Readme
  • Changelog
  • Example
  • Installing
  • 72

LOGIN_SCREEN #

This package provides a common template for Catalog Grids, using cards and other Flutter widgets.

This project should be incremented as I personally feel the need to. If you have a common usecase and feel like creating a template for it, please send me a PR.

Usage #

To use this package, add catalog_grid as a dependency in your pubspec.yaml file.

Example #

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

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  List<Widget> images;
  List<Widget> contents;
  List<List<Widget>> options;

  @override
  Widget build(BuildContext context) {
    images ??= List.generate(
      8,
      (index) => Container(
        color: Colors.green,
        child: FlutterLogo(),
      ),
    );
    contents ??= List.generate(
      8,
      (index) => Text(
        'This is the example of a card content. '
        'Usually, a Text is used here. This is item $index content example.',
        textAlign: TextAlign.justify,
      ),
    );
    options = List.generate(
        8,
        (index) => index != 5
            ? [
                SizedBox(
                  width: 120,
                  child: RaisedButton.icon(
                    icon: Icon(Icons.delete),
                    label: Text("Remove"),
                    color: Colors.red,
                    textColor: Colors.white,
                    onPressed: () => print('Pressed delete'),
                  ),
                ),
                SizedBox(
                  width: 120,
                  child: RaisedButton.icon(
                    icon: Icon(Icons.edit),
                    label: Text("Edit"),
                    color: Colors.blue,
                    textColor: Colors.white,
                    onPressed: () => print('Pressed delete'),
                  ),
                ),
              ]
            : null);
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
        visualDensity: VisualDensity.adaptivePlatformDensity,
      ),
      home: Scaffold(
        appBar: AppBar(
          centerTitle: true,
          title: Text("Grid Catalog Example"),
        ),
        body: SafeArea(
          minimum: EdgeInsets.all(8.0),
          child: CatalogGrid(
            images: images,
            contents: contents,
            cardOptions: options,
            itemCount: 8,
            aspectRatio: 0.8,
            horizontalCount: 2,
          ),
        ),
      ),
    );
  }
}

Status #

This package is in it's initial stages and help from other devs would be much appreciated.

[1.0.0] - Published to pub.dev #

[1.0.1] - Fixed example #

[1.0.2] - Added AUTHORS file #

example/lib/main.dart

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

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  List<Widget> images;
  List<Widget> contents;
  List<List<Widget>> options;

  @override
  Widget build(BuildContext context) {
    images ??= List.generate(
      8,
      (index) => Container(
        color: Colors.green,
        child: FlutterLogo(),
      ),
    );
    contents ??= List.generate(
      8,
      (index) => Text(
        'This is the example of a card content. '
        'Usually, a Text is used here. This is item $index content example.',
        textAlign: TextAlign.justify,
      ),
    );
    options = List.generate(
        8,
        (index) => index != 5
            ? [
                SizedBox(
                  width: 120,
                  child: RaisedButton.icon(
                    icon: Icon(Icons.delete),
                    label: Text("Remove"),
                    color: Colors.red,
                    textColor: Colors.white,
                    onPressed: () => print('Pressed delete'),
                  ),
                ),
                SizedBox(
                  width: 120,
                  child: RaisedButton.icon(
                    icon: Icon(Icons.edit),
                    label: Text("Edit"),
                    color: Colors.blue,
                    textColor: Colors.white,
                    onPressed: () => print('Pressed delete'),
                  ),
                ),
              ]
            : null);
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
        visualDensity: VisualDensity.adaptivePlatformDensity,
      ),
      home: Scaffold(
        appBar: AppBar(
          centerTitle: true,
          title: Text("Grid Catalog Example"),
        ),
        body: SafeArea(
          minimum: EdgeInsets.all(8.0),
          child: CatalogGrid(
            images: images,
            contents: contents,
            cardOptions: options,
            itemCount: 8,
            aspectRatio: 0.8,
            horizontalCount: 2,
          ),
        ),
      ),
    );
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  catalog_grid: ^1.0.2

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:catalog_grid/catalog_grid.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
44
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]
72
Learn more about scoring.

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

  • Dart: 2.8.4
  • pana: 0.13.14
  • Flutter: 1.17.5

Analysis suggestions

Package not compatible with SDK dart

Because:

  • catalog_grid that is a package requiring null.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.7.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.12 1.14.13
meta 1.1.8 1.2.2
sky_engine 0.0.99
typed_data 1.1.6 1.2.0
vector_math 2.0.8 2.1.0-nullsafety
Dev dependencies
flutter_test