flutter_facebook_image_picker 0.0.13

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

flutter_facebook_image_picker

Flutter plugin that allows you to display Facebook multi image picker on iOS and Android.

pub package

Flutter Facebook Image Picker

Getting started

This plugins displays a gallery with user's Facebook Albums and Photos, based on the access token provided. The plugin does not handle authorozation and login by itelf. In order to do that and provide access token you can use a plugin like flutter_facebook_login, and then just provide the access token to the gallery.

TODO

  • [ ] Improve docs
  • [x] Add screenshots
  • [ ] Min/Max option
  • [x] Image loading indicators
  • [ ] Custom background colors

License

MIT © Radoslav Vitanov

Change Log

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog and this project adheres to Semantic Versioning.

Changed (v0.0.13)

2018-09-01

Added

  • Added image loading indicators
  • Updated README.md

Changed (v0.0.12)

2018-08-30

Changed

  • Removed obsolete debounce dependecy

Changed (v0.0.11)

2018-08-30

Added

  • Initial release

example/lib/main.dart

import 'dart:async';

import 'package:flutter/material.dart';
import 'package:flutter_facebook_image_picker/model/photo.dart';
import 'package:flutter_facebook_login/flutter_facebook_login.dart';
import 'package:flutter_facebook_image_picker/flutter_facebook_image_picker.dart';

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

class MyApp extends StatefulWidget {
  // This widget is the root of your application.
  @override
  MyAppState createState() {
    return new MyAppState();
  }
}

class MyAppState extends State<MyApp> {
  @override
  Widget build(BuildContext context) {
    return new MaterialApp(
      title: 'Flutter Demo',
      theme: new ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: new MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);

  final String title;

  @override
  _MyHomePageState createState() => new _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  static final FacebookLogin facebookSignIn = new FacebookLogin();
  List<Photo> _photos = [];
  String _accessToken;
  String _error;

  Future<Null> _login() async {
    final FacebookLoginResult result =
        await facebookSignIn.logInWithReadPermissions(['user_photos']);

    switch (result.status) {
      case FacebookLoginStatus.loggedIn:
        final FacebookAccessToken accessToken = result.accessToken;
        setState(() {
          _accessToken = accessToken.token;
        });

        Navigator.of(context).push(
              MaterialPageRoute(
                builder: (_) => FacebookImagePicker(
                      _accessToken,
                      onDone: (items) {
                        Navigator.pop(context);
                        setState(() {
                          _error = null;
                          _photos = items;
                        });
                      },
                      onCancel: () => Navigator.pop(context),
                    ),
              ),
            );
        break;
      case FacebookLoginStatus.cancelledByUser:
        setState(() {
          _error = 'Login cancelled by the user.';
        });

        break;
      case FacebookLoginStatus.error:
        setState(() {
          _error = 'Something went wrong with the login process.\n'
              'Here\'s the error Facebook gave us: ${result.errorMessage}';
        });
        break;
    }
  }

  @override
  Widget build(BuildContext context) {
    return new Scaffold(
      appBar: new AppBar(
        // Here we take the value from the MyHomePage object that was created by
        // the App.build method, and use it to set our appbar title.
        title: new Text(widget.title),
      ),
      body: Column(
        mainAxisAlignment: MainAxisAlignment.center,
        children: [
          Expanded(
            child: new Center(
              // Center is a layout widget. It takes a single child and positions it
              // in the middle of the parent.
              child: MaterialButton(
                onPressed: () => _login(),
                color: Colors.blue,
                child: Text(
                  "Pick images",
                  style: TextStyle(
                    color: Colors.white,
                  ),
                ),
              ),
            ),
          ),
          _error != null ? Text(_error) : null,
          Expanded(
            child: GridView.count(
              crossAxisCount: 3,
              children: List.generate(_photos.length, (index) {
                return Image.network(_photos[index].source);
              }),
            ),
          ),
        ].where((o) => o != null).toList(),
      ),
    );
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  flutter_facebook_image_picker: ^0.0.13

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:flutter_facebook_image_picker/flutter_facebook_image_picker.dart';
  
Version Uploaded Documentation Archive
0.0.13 Sep 1, 2018 Go to the documentation of flutter_facebook_image_picker 0.0.13 Download flutter_facebook_image_picker 0.0.13 archive
0.0.12 Aug 30, 2018 Go to the documentation of flutter_facebook_image_picker 0.0.12 Download flutter_facebook_image_picker 0.0.12 archive
0.0.11 Aug 30, 2018 Go to the documentation of flutter_facebook_image_picker 0.0.11 Download flutter_facebook_image_picker 0.0.11 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
9
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
90
Overall:
Weighted score of the above. [more]
52
Learn more about scoring.

We analyzed this package on Sep 18, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0
  • pana: 0.12.3
  • Flutter: 0.8.4

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Suggestions

Package is pre-v0.1 release.

While there is nothing inherently wrong with versions of 0.0.*, it usually means that the author is still experimenting with the general direction of the API.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.28.0 <3.0.0
flutter 0.0.0
http ^0.11.3+16 0.11.3+17
Transitive dependencies
async 2.0.8
charcode 1.1.2
collection 1.14.11
http_parser 3.1.3
meta 1.1.6
path 1.6.2
sky_engine 0.0.99
source_span 1.4.1
string_scanner 1.0.4
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test