medias_picker 0.1.3+1

  • Readme
  • Changelog
  • Example
  • Installing
  • 79

Medias Picker #

pub package

A Flutter plugin for IOS and Android providing a simple way to get multiple pictures and videos.

Features: #

  • Get multiple pictures and videos.
  • Compress images.

Installation #

First, add medias_picker as a dependency in your pubspec.yaml file.

Android #

You need to add these styles to the android app (app/src/main/values/styles.xml).

  <style name="LibAppTheme" parent="Theme.AppCompat.Light.NoActionBar">
      <!-- Customize your theme here. -->
      <item name="colorPrimary">@color/colorPrimary</item>
      <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
      <item name="colorAccent">@color/colorAccent</item>
      <item name="android:colorBackground">@android:color/background_light</item>
      <item name="android:windowBackground">@android:color/white</item>
  </style>

  <style name="PickerTabLayout" parent="Widget.Design.TabLayout">
      <item name="tabBackground">@color/colorPrimary</item>
      <item name="tabGravity">fill</item>
      <item name="tabMaxWidth">0dp</item>
  </style>

  <style name="SmoothCheckBoxStyle">
      <item name="color_checked">@color/checkbox_color</item>
      <item name="color_unchecked">@android:color/white</item>
      <item name="color_unchecked_stroke">@color/checkbox_unchecked_color</item>
      <item name="color_tick">@android:color/white</item>
  </style>

And need to add the camera permisson. (android/app/src/main/AndroidManifest.xml).

<uses-permission android:name="android.permission.CAMERA"/>

iOS #

Set the minimum version to 9.0 and add if not exists one row to the ios/podfile after target runner:

platform :ios, '9.0'

...

target 'Runner' do
    use_frameworks!

...

Example #

Here is an example flutter app displaying how to use the MediasPicker.

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:medias_picker/medias_picker.dart';

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

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

class _MyAppState extends State<MyApp> {
  List<String> mediaPaths;

  void _getImages() async {
    mediaPaths = await MediasPicker.pickImages(
      quantity: 7,
      maxWidth: 1024,
      maxHeight: 1024,
      quality: 85,
    );

    if (!mounted) return;
    setState(() {});
  }
  
  void _getVideos() async {
      mediaPaths = await MediasPicker.pickVideos(quantity: 7);
  
      if (!mounted) return;
      setState(() {});
    }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: Text('Plugin example app'),
        ),
        body: Center(
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            crossAxisAlignment: CrossAxisAlignment.center,
            children: <Widget>[
              FlatButton(
                child: Text('Get images'),
                onPressed: _getImages,
              ),
              FlatButton(
                child: Text('Get videos'),
                onPressed: _getVideos,
              ),
              if (mediaPaths != null)
                Text(mediaPaths.join('\n'))
            ],
          ),
        ),
      ),
    );
  }
}

Feedback welcome and Pull Requests are most welcome!

[0.1.3+1] - 18/09/2019.

Remove unused codes and improve description

[0.1.3] - 11/09/2019.

BREAKING CHANGE: Migrate to AndroidX

[0.0.1]

  • Initial release.

example/README.md

medias_picker_example #

Demonstrates how to use the medias_picker plugin.

Getting Started #

For help getting started with Flutter, view our online documentation.

Use this package as a library

1. Depend on it

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


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

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

  • Dart: 2.6.1
  • pana: 0.12.21
  • Flutter: 1.9.1+hotfix.6

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health issues and suggestions

Document public APIs. (-1 points)

9 out of 9 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

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.7 1.1.8
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test
pedantic ^1.8.0+1