image_list 0.1.3+2

  • Readme
  • Changelog
  • Example
  • Installing
  • 78

image_list #

A new Flutter plugin.

Getting Started #

This project is a starting point for a Flutter plug-in package, a specialized package that includes platform-specific implementation code for Android and/or iOS.

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

0.1.3+2 #

  • iOS bugs fixed

0.1.3+1 #

  • iOS bugs fixed

0.1.3 #

  • Adjust and tested on iOS

0.1.2+2 #

  • Adding function on controller to select max image

0.1.2+1 #

  • Single / multiple bug for Android fixed

0.1.2 #

  • Added single / multiple mode for Android

0.1.1 #

  • Selections argument added to preselect certain images

0.1.0+1 #

  • Uri to ImageData bug fixed

0.1.0 #

  • Added method reloadImage, getSelectedImages, supports both Android and iOS

0.0.1 #

  • Initial Release, supports only Android

example/lib/main.dart

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

import 'package:flutter/services.dart';
import 'package:image_list/plugin.dart';
import 'package:image_list/image_list.dart';

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

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  List<Album> albums;
  ImageListController controller;
  Album currentAlbum;
  List<ImageData> _selections;
  bool multipleMode = false;

  @override
  void initState() {
    super.initState();
    ImageListPlugin.getAlbums().then((albums) {
      setState(() {
        this.albums = albums;
        this.currentAlbum = albums.first;
      });
    });
//    initPlatformState();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: albums == null
            ? Center(child: CircularProgressIndicator())
            : Column(
                children: [
                  DropdownButton<Album>(
                    value: currentAlbum,
                    onChanged: (Album newAlbum) {
                      this.currentAlbum = newAlbum;
                      setState(() {
                        this.controller.reloadAlbum(currentAlbum.identifier);
                      });
                    },
                    items: albums.map<DropdownMenuItem<Album>>((Album value) {
                      return DropdownMenuItem<Album>(
                        value: value,
                        child: Text(value.name),
                      );
                    }).toList(),
                  ),
                  FlatButton(
                    child: Text(multipleMode ? "Set Single" : "Set Multiple"),
                    onPressed: () {
                      setState(() {
                        multipleMode = !multipleMode;
                        if (this.controller != null) this.controller.setMaxImage(multipleMode ? null : 1);
                      });
                    },
                  ),
                  Expanded(
                    child: InkWell(
                      child: ImageList(
                        maxImages: 1,
                        albumId: currentAlbum?.identifier,
                        onImageTapped: (count) {
                          print("onImageTapped => $count");
                        },
                        onListCreated: (controller) {
                          this.controller = controller;
                        },
                        selections: _selections,
                      ),
                      onTap: () {
                        print("aduh di tap");
                      },
                    ),
                  ),
                  Padding(
                    child: FlatButton(
                      child: Text("Submit"),
                      onPressed: () {
                        this.controller.getSelectedImage().then((res) {
                          print("res => ${res.runtimeType}");
//                          _selections = res.map((map) {
//                            return ImageData.fromJson(map);
//                          }).toList();
                        });
                      },
                    ),
                    padding: EdgeInsets.all(16.0),
                  )
                ],
              ),
      ),
    );
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  image_list: ^0.1.3+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:image_list/image_list.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
63
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
80
Overall:
Weighted score of the above. [more]
78
Learn more about scoring.

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

  • Dart: 2.7.1
  • pana: 0.13.6
  • Flutter: 1.12.13+hotfix.8

Health suggestions

Fix lib/image_list.dart. (-0.50 points)

Analysis of lib/image_list.dart reported 1 hint:

line 32 col 10: This function has a return type of 'Widget', but doesn't end with a return statement.

Format lib/controller.dart.

Run flutter format to format lib/controller.dart.

Format lib/plugin.dart.

Run flutter format to format lib/plugin.dart.

Maintenance suggestions

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.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
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
flutter_test