Skip to content
A Flutter plugin for IOS and Android providing a simple way to get multiple pictures and videos.
Swift Java Dart Ruby Objective-C
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.idea
android Migrate to androidX Sep 11, 2019
example Migrate to androidX Sep 11, 2019
ios change to swift 4.0 language Sep 28, 2018
lib Remove unused codes and improve description Sep 18, 2019
.gitignore Initial commit Jun 8, 2018
CHANGELOG.md Remove unused codes and improve description Sep 18, 2019
LICENSE Update LICENSE Jun 8, 2018
README.md Remove unused code on readme and remove meta dependency Sep 11, 2019
analysis_options.yaml Remove unused codes and improve description Sep 18, 2019
medias_picker.iml first commit Jun 8, 2018
medias_picker_android.iml first commit Jun 8, 2018
pubspec.yaml Remove unused codes and improve description Sep 18, 2019

README.md

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!

You can’t perform that action at this time.