ios_image_editor 0.0.4 copy "ios_image_editor: ^0.0.4" to clipboard
ios_image_editor: ^0.0.4 copied to clipboard

A Flutter plugin that opens the native iOS markup editor for editing images.

example/lib/main.dart

import 'dart:io';

import 'package:flutter/material.dart';
import 'package:image_picker/image_picker.dart';
import 'package:ios_image_editor/ios_image_editor.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(home: ImageEditorExample());
  }
}

class ImageEditorExample extends StatefulWidget {
  const ImageEditorExample({super.key});

  @override
  State<ImageEditorExample> createState() => _ImageEditorExampleState();
}

class _ImageEditorExampleState extends State<ImageEditorExample> {
  String? imagePath;

  final picker = ImagePicker();

  Future<void> pickAndEdit() async {
    final XFile? file = await picker.pickImage(source: ImageSource.gallery);

    if (file == null) return;

    final editedPath = await IOSImageEditor.editImage(file.path);
    await Future.delayed(Duration(seconds: 2));
    if (editedPath != null) {
      setState(() {
        imagePath = editedPath;
      });
    }
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text("iOS Image Editor Example")),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            if (imagePath != null)
              Padding(
                padding: const EdgeInsets.all(20),
                child: Image.file(File(imagePath!), height: 300),
              ),

            ElevatedButton(
              onPressed: pickAndEdit,
              child: const Text("Pick & Edit Image"),
            ),
          ],
        ),
      ),
    );
  }
}
0
likes
0
points
153
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter plugin that opens the native iOS markup editor for editing images.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter

More

Packages that depend on ios_image_editor

Packages that implement ios_image_editor