super_image_selector 1.0.0
super_image_selector: ^1.0.0 copied to clipboard
A lightweight and easy-to-use image selector package for Flutter (gallery, camera, multiple).
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:super_image_selector/super_image_selector.dart';
void main() {
runApp(const ExampleApp());
}
class ExampleApp extends StatefulWidget {
const ExampleApp({super.key});
@override
State<ExampleApp> createState() => _ExampleAppState();
}
class _ExampleAppState extends State<ExampleApp> {
File? _image;
List<File> _images = [];
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(title: const Text('super_image_selector Example')),
body: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
children: [
if (_image != null) Image.file(_image!, width: 200, height: 200),
const SizedBox(height: 12),
Wrap(
spacing: 8,
runSpacing: 8,
children: _images.map((f) => Image.file(f, width: 80, height: 80)).toList(),
),
const SizedBox(height: 12),
ElevatedButton(
onPressed: () async {
final file = await SuperImageSelector.pickFromGallery();
if (file != null) setState(() => _image = file);
},
child: const Text('Pick single from gallery'),
),
ElevatedButton(
onPressed: () async {
final file = await SuperImageSelector.pickFromCamera();
if (file != null) setState(() => _image = file);
},
child: const Text('Pick single from camera'),
),
ElevatedButton(
onPressed: () async {
final files = await SuperImageSelector.pickMultipleImages();
setState(() => _images = files);
},
child: const Text('Pick multiple images'),
),
],
),
),
),
);
}
}