Photofilters library for flutter

Photo Filters package for flutter

Photo Filters package for flutter

A flutter package for iOS and Android for applying filter to an image. A set of preset filters are also available. You can create your own filters too.

Installation

First, add photofilters and image as a dependency in your pubspec.yaml file.

iOS

No configuration required – the plugin should work out of the box.

Android

No configuration required – the plugin should work out of the box.

Example

import 'package:flutter/material.dart';
import 'package:path/path.dart';
import 'package:photofilters/photofilters.dart';
import 'package:image/image.dart' as imageLib;
import 'package:image_picker/image_picker.dart';

void main() => runApp(new MaterialApp(home: MyApp()));

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

class _MyAppState extends State<MyApp> {
  imageLib.Image _image;
  String fileName;
  Filter _filter;
  List<Filter> filters = presetFitersList;

  Future getImage() async {
    var imageFile = await ImagePicker.pickImage(source: ImageSource.gallery);
    fileName = basename(imageFile.path);
    var image = imageLib.decodeImage(imageFile.readAsBytesSync());
    image = imageLib.copyResize(image, 600);
    setState(() {
      _image = image;
    });
  }

  @override
  Widget build(BuildContext context) {
    return new Scaffold(
      appBar: new AppBar(
        title: new Text('Photo Filter Example'),
      ),
      body: new Container(
        alignment: Alignment(0.0, 0.0),
        child: _image == null
            ? new Text('No image selected.')
            : new PhotoFilterSelector(
                image: _image,
                filters: presetFitersList,
                filename: fileName,
                loader: Center(child: CircularProgressIndicator()),
              ),
      ),
      floatingActionButton: new FloatingActionButton(
        onPressed: getImage,
        tooltip: 'Pick Image',
        child: new Icon(Icons.add_a_photo),
      ),
    );
  }
}

 

UI Screen Shots

Sample Images of Filters

     
No FilterNo Filter AddictiveBlueAddictiveBlue AddictiveRedAddictiveRed
AmaroAmaro AshbyAshby BrannanBrannan
CharmesCharmes ClarendonClarendon CremaCrema
EarlybirdEarlybird 19771977 GinghamGingham
HefeHefe HelenaHelena HudsonHudson
JunoJuno KelvinKelvin LarkLark
LudwigLudwig MavenMaven MayfairMayfair
NashvilleNashville PerpetuaPerpetua ReyesReyes
SierraSierra SkylineSkyline SlumberSlumber
SutroSutro ToasterToaster ValenciaValencia
WaldenWalden WillowWillow X-Pro IIX-Pro II

 

Credit (github url) : https://github.com/skkallayath/photofilters

Next Article : https://flutterappdev.com/2019/01/26/a-flutter-plugin-for-integrating-razorpay-payment-gateway/

Leave a Comment

Your email address will not be published. Required fields are marked *