image_picker_adapter 0.0.6 copy "image_picker_adapter: ^0.0.6" to clipboard
image_picker_adapter: ^0.0.6 copied to clipboard

A modular and customizable image picker adapter for Flutter. Supports image cropping, compression, source selection, and Cubit-based state management. Built with SOLID principles and clean architecture.

example/main.dart

import 'dart:io';

import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:image_picker_adapter/image_picker_adapter.dart';

void main() {
  WidgetsFlutterBinding.ensureInitialized();

  // Register dependencies for the adapter package
  registerImagePickerAdapterDependencies();

  runApp(const ExampleApp());
}

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

  @override
  Widget build(BuildContext context) {
    return MultiBlocProvider(
      providers: [
        BlocProvider<ImagePickerCubit>(create: (_) => sl<ImagePickerCubit>()),
      ],
      child: MaterialApp(
        title: 'Image Picker Adapter Demo',
        home: const HomeScreen(),
      ),
    );
  }
}

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

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('Image Picker Adapter Demo')),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            // Using AppImagePicker with a custom builder
            AppImagePicker(
              crop: true,
              compress: true,
              imageQuality: 80,
              onChanged: (file) {
                debugPrint('Picked file path: ${file?.path}');
              },
              builder: (file) {
                if (file == null) {
                  return const Icon(Icons.image, size: 100, color: Colors.grey);
                }
                return Image.file(
                  File(file.path),
                  width: 150,
                  height: 150,
                  fit: BoxFit.cover,
                );
              },
            ),

            const SizedBox(height: 30),

            // Using AvatarImagePicker for profile image selection
            AvatarImagePicker(
              radius: 50,
              crop: true,
              compress: true,
              onChanged: (file) {
                debugPrint('Avatar picked: ${file?.path}');
              },
            ),
          ],
        ),
      ),
    );
  }
}
0
likes
130
points
13
downloads

Publisher

unverified uploader

Weekly Downloads

A modular and customizable image picker adapter for Flutter. Supports image cropping, compression, source selection, and Cubit-based state management. Built with SOLID principles and clean architecture.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

bloc, equatable, flutter, flutter_bloc, flutter_image_compress, get_it_di_global_variable, image, image_cropper, image_picker, path, permission_handler, provider, reusable_image_widget

More

Packages that depend on image_picker_adapter