Code Monkey home page Code Monkey logo

insta_assets_picker's Introduction

Instagram Assets Picker

Pub

An image picker based on Instagram picker UI. It is using the powerful flutter_wechat_assets_picker package to handle the picker and a custom version of image_crop for crop.

๐Ÿš€ Features

  • โœ… Instagram layout
    • Scroll behaviors, animation
    • Preview, select, unselect action logic
  • โœ… Theme and language customization
  • โœ… Multiple images pick (with maximum limit)
  • โœ… Restore state of picker after pop
  • โœ… Select aspect ratios to crop all images with (default to 1:1 & 4:5)
  • โœ… Crop all images at once and receive a stream with a progress value
  • โœ… Prepend or append a custom item in the assets list
  • โŒ Videos are not supported

๐Ÿ“ธ Screenshots

Layout and scroll Crop

๐Ÿ“– Installation

Add this package to the pubspec.yaml

insta_assets_picker: ^1.5.0

โ€ผ๏ธ DO NOT SKIP THIS PART

Since this package is a custom delegate of flutter_wechat_assets_picker you MUST follow this package setup recommendation : installation guide.

๐Ÿ‘€ Usage

For more details check out the example.

Future<List<AssetEntity>?> callPicker() => InstaAssetPicker.pickAssets(
    context,
    title: 'Select images',
    maxAssets: 10,
    onCompleted: (Stream<InstaAssetsExportDetails> stream) {
        // TODO : handle crop stream result
        // i.e : display it using a StreamBuilder
        // - in the same page (closeOnComplete=true)
        // - send it to another page (closeOnComplete=false)
        // or use `stream.listen` to handle the data manually in your state manager
        // - ...
    },
);

Fields in InstaAssetsExportDetails:

Name Type Description
croppedFiles List<File> List of all cropped files
selectedAssets List<AssetEntity> Selected assets without crop
aspectRatio double Selected aspect ratio (1 or 4/5)
progress double Progress indicator of the exportation (between 0 and 1)

Picker configuration

Please follow flutter_wechat_assets_picker documentation : AssetPickerConfig

Localizations

Please follow flutter_wechat_assets_picker documentation : Localizations

Theme customization

Most of the components of the picker can be customized using theme.

// set picker theme based on app theme primary color
final theme = InstaAssetPicker.themeData(Theme.of(context).primaryColor);
InstaAssetPicker.pickAssets(
    context,
    pickerTheme: theme.copyWith(
      canvasColor: Colors.black, // body background color
      splashColor: Color.grey, // ontap splash color
      colorScheme: theme.colorScheme.copyWith(
        background: Colors.black87, // albums list background color
      ),
      appBarTheme: theme.appBarTheme.copyWith(
        backgroundColor: Colors.black, // app bar background color
        titleTextStyle: Theme.of(context)
            .appBarTheme
            .titleTextStyle
            ?.copyWith(color: Colors.white), // change app bar title text style to be like app theme
      ),
    ),
    onCompleted: (_) {},
);

Crop customization

You can set the list of crop aspect ratios available. You can also set the preferred size, for the cropped images.

InstaAssetPicker.pickAssets(
    context,
    cropDelegate: InstaAssetCropDelegate(
      // allows you to set the preferred size used when cropping the image.
      // the final size will depends on the scale used when cropping.
      preferredSize: 1080,
      cropRatios: [
      // - allow you to set the list of aspect ratios selectable,
      // the default values are [1/1, 4/5] like instagram.
      // - if you want to disable cropping, you can set only one parameter,
      // in this case, the "crop" button will not be displayed (#10).
      // - if the value of cropRatios is different than the default value,
      // the "crop" button will display the selected crop value (i.e.: 1.:1)
      // instead of unfold arrows.
    ]),
    onCompleted: (_) {},
);

โœจ Credit

This package is based on flutter_wechat_assets_picker by AlexV525 and image_crop by lykhonis.

insta_assets_picker's People

Contributors

1n50mn14 avatar legoffmael avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.