carousel_image_editor 0.0.6 carousel_image_editor: ^0.0.6 copied to clipboard
Carousel Image Editor Plugin with filters, drawing, text and emoji like stories.
import 'package:carousel_image_editor/custom_image_editor.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
void main() {
runApp(const MaterialApp(home: ImageEditorExample()));
}
class ImageEditorExample extends StatefulWidget {
const ImageEditorExample({
super.key,
});
@override
createState() => _ImageEditorExampleState();
}
class _ImageEditorExampleState extends State<ImageEditorExample> {
Uint8List? imageData;
@override
void initState() {
super.initState();
loadAsset("image.jpg");
}
void loadAsset(String name) async {
var data = await rootBundle.load('assets/$name');
setState(() => imageData = data.buffer.asUint8List());
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text("ImageEditor Example"),
centerTitle: true,
),
body: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
if (imageData != null) Image.memory(imageData!),
const SizedBox(height: 16),
ElevatedButton(
child: const Text("Multiple image editor"),
onPressed: () async {
if (imageData != null) {
var editedImage = await Navigator.push(
context,
MaterialPageRoute(
builder: (context) => ImageEditor(
images: [imageData!, imageData!],
),
),
);
// replace with edited image
if (editedImage != null) {
imageData = editedImage;
setState(() {});
}
}
},
),
],
),
);
}
}