Camera with Filters Plugin for Flutter
A Flutter plugin for capturing photos and videos with advanced digital filters. This package provides a seamless interface for applying real-time effects to your camera feed and capturing moments with style and creativity.
Features
- Capture photos and videos with advanced real-time filters.
- Apply a variety of pre-defined or custom digital effects programmatically.
- Adjustable camera configurations: brightness.
- Support for front and rear cameras.
- Highly customizable and easy to integrate into your Flutter project.
Features | Android | iOS |
---|---|---|
Ask permissions | ✅ | ❌ |
Enable/disable audio | ✅ | ❌ |
Take photos | ✅ | ❌ |
Photo live filters | ✅ | ❌ |
Exposure level | ✅ | ❌ |
Device flash support | ✅ | ❌ |
Live switching camera | ✅ | ❌ |
Installation and usage
Add the package to your pubspec.yaml
dependencies:
my_filter_camera: ^latest_version
Set up platform
- Android
Add permission to your
AndroidManifest.xml
:
<uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
Import the package to your project
import 'package:my_filter_camera/my_filter_camera.dart';
And then, you can use camera function.
Initialize camera
final CameraViewController controller= CameraViewController();
- Display camera preview widget
CameraView(
autoDispose: false,
controller: controller,
onDetect: (data, args) {
setState(() {});
},
),
- To start camera, use
controller.start()
function, and usecontroller.stop
to stop camera. controller.switch()
change front and rear camera direction
Filter types
- Update filter type:
await controller.updateFilter(filterType: PluginFilterEnum.values[index].code,);
- You can find all filter list in
PluginFilterEnum
Capture Image
- To capture realtime image, use:
final xFile = await controller.capture();
Exposure level
- To adjust Camera lever:
controller.adjustBrightness(value: value.toInt());
Important note!!!!
Remember stop or dispose camera when not using camera anymore to avoid increase ram memory
@override
void dispose() {
controller.dispose();
super.dispose();
}
//or
controller.stop();