photo filters
a photo filters package is 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 filter | addictiveblue | addictivered |
amaro | ashby | brannan |
charmes | clarendon | crema |
earlybird | 1977 | gingham |
hefe | helena | hudson |
juno | kelvin | lark |
ludwig | maven | mayfair |
nashville | perpetua | reyes |
sierra | skyline | slumber |
sutro | toaster | valencia |
walden | willow | x-pro ii |
Comments are closed.