/flutter_image_add_drag_sort

Flutter Image add drag sort, Image add drag sort, support click event, delete, add, long press drag sort.

Primary LanguageDartMIT LicenseMIT

flutter_image_add_drag_sort

pub package GitHub GitHub stars

Flutter Image add drag sort, Image add drag sort, support click event, delete, add, long press drag sort, support video fixed as the first.

Supported Platforms

  • Android
  • IOS

image

LICENSE

MIT License

How to Use

# add this line to your dependencies
flutter_picker:
  git: git://github.com/yangyxd/flutter_image_add_drag_sort.git
import 'package:flutter_image_add_drag_sort/flutter_image_add_drag_sort.dart';

example

  • Examples App - Demonstrates how to use the flutter_image_add_drag_sort plugin.
  List<ImageDataItem> imageList = [];

  ...

  ImageAddDragContainer(
      key: _key,  // GlobalKey()
      data: imageList,
      maxCount: 9,
      readOnly: false,
      draggableMode: false,
      itemSize: Size(imgSize, imgSize),
      addWidget: Icon(Icons.add, size: 24, color: Colors.black38),
      onAddImage: (onBegin) async {
        // add image 
        return await doAddImage(onBegin);
      },
      onChanged: (items) async {
        imageList = items;
      },
      onTapItem: (item, index) {
        Scaffold.of(context).showSnackBar(SnackBar(content: Text("click item: $index, ${item.key}")));
      },
      builderItem: (context, key, url, type) {
        // custom builder item
        return Container(
          color: Colors.yellow,
          child: url == null || url.isEmpty ? null : Image.file(File(url)),
        );
      },
  )