flutter_list_drag_and_drop 0.1.3

  • README.md
  • Example
  • Installing
  • Versions
  • 89

flutter_list_drag_and_drop

A new Flutter package which handles all aspects of drag and drop inside a listView.

In your pubspec.yaml

dependencies:
  flutter_list_drag_and_drop: "^0.1.2"

Note

The code is currently going thorugh some changes and a cleanup

Demo

Demo 1

More gifs coming soon..

Features

  • When dragging an item to the top/ bottom the list scroll accordingly
  • Works with different sized items
  • material like behaviour

How to use

Coming soon..

What's coming next

  • Smoother animations
  • Support for horizontal lists

If you encounter feel free to open an issue. Pull request are also welcome.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:flutter_list_drag_and_drop/drag_and_drop_list.dart';

void main() {
  runApp(new TestApp());
}

class TestApp extends StatelessWidget {
  TestApp({Key key});

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return new MaterialApp(
      title: 'Flutter Demo',
      theme: new ThemeData(
          primarySwatch: Colors.blue, primaryColor: new Color(0xffd05c6b)),
      home: new MyHomePage(
        title: 'Flutter Demo Home Page',
        key: key,
      ),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);
  final String title;

  @override
  MyHomePageState createState() => new MyHomePageState();
}

class MyHomePageState extends State<MyHomePage> {
  List<String> items = [
    '0',
    '1',
    '2',
    '3',
    '4',
    '5',
    '6',
    '7',
    '8',
    '9',
    '10',
    '11',
    '12',
    '13',
    '14',
    '15',
  ];
  @override
  Widget build(BuildContext context) {
    return new Scaffold(
      appBar: new AppBar(
        title: new Text(widget.title),
      ),
      body: new DragAndDropList<String>(
        items,
        itemBuilder: (BuildContext context, item) {
          return new SizedBox(
            child: new Card(
              child: new ListTile(
                title: new Text(item),
              ),
            ),
          );
        },
        onDragFinish: (before, after) {
          String data = items[before];
          items.removeAt(before);
          items.insert(after, data);
        },
        canBeDraggedTo: (one, two) => true,
        dragElevation: 8.0,
      ),
    );
  }
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  flutter_list_drag_and_drop: "^0.1.3"

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter packages get

Alternatively, your editor might support flutter packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


      import 'package:flutter_list_drag_and_drop/drag_and_drop_list.dart';

      import 'package:flutter_list_drag_and_drop/my_draggable.dart';
  
Version Uploaded Documentation Archive
0.1.3 May 7, 2018 Go to the documentation of flutter_list_drag_and_drop 0.1.3 Download flutter_list_drag_and_drop 0.1.3 archive
0.1.2 May 1, 2018 Go to the documentation of flutter_list_drag_and_drop 0.1.2 Download flutter_list_drag_and_drop 0.1.2 archive
0.1.1 Apr 26, 2018 Go to the documentation of flutter_list_drag_and_drop 0.1.1 Download flutter_list_drag_and_drop 0.1.1 archive
0.1.0 Apr 26, 2018 Go to the documentation of flutter_list_drag_and_drop 0.1.0 Download flutter_list_drag_and_drop 0.1.0 archive

Analysis

We analyzed this package on Jul 13, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0-dev.63.0
  • pana: 0.11.3
  • Flutter: 0.5.4

Scores

Popularity:
Describes how popular the package is relative to other packages. [more]
85 / 100
Health:
Code health derived from static analysis. [more]
99 / 100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
80 / 100
Overall score:
Weighted score of the above. [more]
89
Learn more about scoring.

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Suggestions

  • Maintain CHANGELOG.md.

    Changelog entries help clients to follow the progress in your code.

  • Package is pre-v1 release.

    While there is nothing inherently wrong with versions of 0.*.*, it usually means that the author is still experimenting with the general direction API.

  • Fix analysis and formatting issues.

    Analysis or formatting checks reported 5 hints.

    Run flutter format to format lib/drag_and_drop_list.dart.

    Run flutter format to format lib/my_draggable.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.8.0 <2.0.0
cupertino_icons ^0.1.0 0.1.2
flutter 0.0.0
meta ^1.1.2 1.1.5
Transitive dependencies
collection 1.14.6 1.14.10
sky_engine 0.0.99
typed_data 1.1.5
vector_math 2.0.6 2.0.7
Dev dependencies
flutter_test