giphy_picker 0.0.2

giphy_picker #

A plugin that allows you to pick animated GIF images from Giphy.

Gif

Getting Started #

First, you need to register an app at the Giphy Developers Portal in order to retrieve an API key.

Pick a GIF:

import 'package:giphy_picker/giphy_picker.dart';

final gif = await GiphyPicker.pickGif(
                  context: context, 
                  apiKey: '[YOUR GIPHY APIKEY]');

Display a GIF using the GiphyImage widget. The following snippet demonstrates how to render a GIF in its original format:

Widget build(BuildContext context) {
  return GiphyImage.original(gif: gif);
}

Alternatively, load and display the GIF image using the Image widget:

Widget build(BuildContext context) {
  return Image.network(
      gif.images.original.url, 
      headers: {'accept': 'image/*'}))
}

Acknowledgements #

This plugin depends on the giphy_client.

0.0.1 - 2019-03-09 #

  • Initial release

0.0.2 - 2019-03-09 #

  • Fixes example reference

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:giphy_client/giphy_client.dart';
import 'package:giphy_picker/giphy_picker.dart';

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

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Giphy Picker Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: MyHomePage(),
    );
  }
}

class MyHomePage extends StatefulWidget {
  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  GiphyGif _gif;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          title: Text(_gif?.title ?? 'Giphy Picker Demo'),
        ),
        body: SafeArea(
            child: Center(
                child: _gif == null
                    ? Text('Pick a gif..')
                    : GiphyImage.original(gif: _gif))),
        floatingActionButton: FloatingActionButton(
            child: Icon(Icons.search),
            onPressed: () async {
              // request your Giphy API key at https://developers.giphy.com/
              final gif = await GiphyPicker.pickGif(
                  context: context, apiKey: '[YOUR GIPHY APIKEY]');

              if (gif != null) {
                setState(() => _gif = gif);
              }
            }));
  }
}

Use this package as a library

1. Depend on it

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


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

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

  • Dart: 2.4.0
  • pana: 0.12.19
  • Flutter: 1.7.8+hotfix.3

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health suggestions

Fix lib/src/widgets/giphy_search_view.dart. (-0.50 points)

Analysis of lib/src/widgets/giphy_search_view.dart reported 1 hint:

line 61 col 43: This function has a return type of 'bool', but doesn't end with a return statement.

Maintenance issues and suggestions

Support latest dependencies. (-20 points)

The version constraint in pubspec.yaml does not support the latest published versions for 2 dependencies (giphy_client, http).

Package is pre-v0.1 release. (-10 points)

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

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
giphy_client ^0.0.1 0.0.1 0.2.0
http ^0.11.0+1 0.11.3+17 0.12.0+2
Transitive dependencies
async 2.3.0
charcode 1.1.2
collection 1.14.11
http_parser 3.1.3
json_annotation 0.2.9+1 2.4.0
meta 1.1.6 1.1.7
path 1.6.2
sky_engine 0.0.99
source_span 1.5.5
string_scanner 1.0.4
term_glyph 1.1.0
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test

Admin