flutter_widget_gallery 0.1.2+1

flutter_widget_gallery #

Widget Gallery Viewer.

It's a gallery, where you can pass all the children you'd like to show. It includes a bottom drawer to show the list of the children that are visible.

Implementation heavily relies on Flutter Gallery Demo / Gridview and Fluttery Cards

Installing #

1. Edit your pubspec.yaml file:

  flutter_widget_gallery: ^0.1.2

2. Install the packages

3. Import the Gallery Widget

import 'package:flutter/material.dart';
import 'package:flutter_widget_gallery/gallery/gallery.dart';

class PhotoViewer extends StatelessWidget {
  final List<Widget> pictures;

  const PhotoViewer({Key key, this.pictures}) : super(key: key);
  Widget build(BuildContext context) {
    return Scaffold(
      body: Gallery(
        children: pictures,
        activeItemColor: Theme.of(context).primaryColor,
        carouselBackgroundColor: Color(0xCCEAEAEA),
        carouselBackgroundItemColor: Color(0xFF000000),
        onChildTap: (index) => print('tapped on $index'),
        onChildLongPress: (index) => print('long press on $index'),

Example 2 #

import 'package:flutter/material.dart';

import 'gallery/gallery.dart';

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

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  Widget build(BuildContext context) {
    return new MaterialApp(
      title: 'Flutter Demo',
      theme: new ThemeData(
        // This is the theme of your application.
        // Try running your application with "flutter run". You'll see the
        // application has a blue toolbar. Then, without quitting the app, try
        // changing the primarySwatch below to Colors.green and then invoke
        // "hot reload" (press "r" in the console where you ran "flutter run",
        // or press Run > Flutter Hot Reload in IntelliJ). Notice that the
        // counter didn't reset back to zero; the application is not restarted.
        primarySwatch: Colors.blue,
      home: new MyHomePage(),

class MyHomePage extends StatelessWidget {
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        elevation: 0.0,
      body: Gallery(
        activeItemColor: Color(0xFF6A0AEA),
        backgroundColor: Color(0xFFF3F3F3),
        carouselBackgroundColor: Color(0xAAE3E3E3),
        children: List.generate<Widget>(
          (index) => Image.network(
                fit: BoxFit.cover,
        onChildTap: (index) => print('tapped on $index'),
        onChildLongPress: (index) => print('long press on $index'),

0.1.2+1 #

  • Migrated repo to GitHub
  • Updated README on root
  • Added a more clear example of how to use it

0.1.2 #

  • Added carouselItemBackground color

0.1.1 #

  • Updated file names to comply with Dart naming standards (only letters, underscores, etc.)

0.1.0 #

  • Initial Release

Use this package as a library

1. Depend on it

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

  flutter_widget_gallery: ^0.1.2+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:flutter_widget_gallery/gallery/gallery.dart';
import 'package:flutter_widget_gallery/gallery/widgets/thumbnail_item.dart';
import 'package:flutter_widget_gallery/gallery/widgets/thumbnails_carousel.dart';
import 'package:flutter_widget_gallery/gallery/widgets/thumbnails_drawer.dart';
import 'package:flutter_widget_gallery/gallery/widgets/viewer.dart';
import 'package:flutter_widget_gallery/gallery/widgets/viewer_child.dart';
import 'package:flutter_widget_gallery/gallery/widgets/widgets.dart';
import 'package:flutter_widget_gallery/main.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 Feb 21, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.1
  • pana: 0.13.5
  • Flutter: 1.12.13+hotfix.7

Health issues and suggestions

Fix lib/main.dart. (-25 points)

Analysis of lib/main.dart failed with 1 error:

line 40 col 32: The constructor 'List.generate' doesn't have type parameters.

Fix lib/gallery/gallery.dart. (-1 points)

Analysis of lib/gallery/gallery.dart reported 2 hints:

line 65 col 74: Avoid using unnecessary statements.

line 70 col 19: Avoid using unnecessary statements.

Fix lib/gallery/widgets/thumbnails_drawer.dart. (-0.50 points)

Analysis of lib/gallery/widgets/thumbnails_drawer.dart reported 1 hint:

line 49 col 17: Avoid using unnecessary statements.

Fix lib/gallery/widgets/viewer.dart. (-0.50 points)

Analysis of lib/gallery/widgets/viewer.dart reported 1 hint:

line 71 col 17: Avoid using unnecessary statements.

Format lib/gallery/widgets/widgets.dart.

Run flutter format to format lib/gallery/widgets/widgets.dart.

Maintenance suggestions

Package is getting outdated. (-57.26 points)

The package was last published 82 weeks ago.

The package description is too short. (-20 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.

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package.

Common filename patterns include main.dart, example.dart, and flutter_widget_gallery.dart. Packages with multiple examples should provide example/README.md.

For more information see the pub package layout conventions.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.20.1 <3.0.0
cupertino_icons ^0.1.2 0.1.3
flutter 0.0.0
Transitive dependencies
collection 1.14.11 1.14.12
meta 1.1.8
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies