basic_image_editor 1.0.0
basic_image_editor: ^1.0.0 copied to clipboard
A simple image editor that offers preset-based color filters, manual color adjustments,image rotation, and scaling features. Ideal for lightweight image editing needs.
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:image_picker/image_picker.dart';
import 'edit_photo_screen.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Basic Image Editor Demo',
theme: ThemeData.dark(),
home: const HomeScreen(),
debugShowCheckedModeBanner: false,
);
}
}
class HomeScreen extends StatefulWidget {
const HomeScreen({super.key});
@override
State<HomeScreen> createState() => _HomeScreenState();
}
class _HomeScreenState extends State<HomeScreen> {
final ImagePicker _picker = ImagePicker();
File? editedFile;
Future<void> _pickImage() async {
final XFile? pickedFile = await _picker.pickImage(
source: ImageSource.camera,
);
if (pickedFile != null) {
editedFile = await Navigator.push(
context,
MaterialPageRoute(
builder: (context) => EditPhotoScreen(imageFile: pickedFile.path),
),
);
if (editedFile != null) {
setState(() {
editedFile;
});
}
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
appBar: AppBar(title: const Text('Basic Image Editor')),
body: Center(
child: Column(
children: [
editedFile != null ? Image.file(editedFile!) : SizedBox(height: 10),
SizedBox(height: 10),
ElevatedButton.icon(
onPressed: _pickImage,
icon: const Icon(Icons.photo),
label: const Text('Capture Image to Edit'),
),
],
),
),
);
}
}