dragable_flutter_list 1.0.2

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • 90

dragable_flutter_list

A flutter list view which can drag & move item to change order.

  • some codes come from flutter_list_drag_and_drop
  • fix flutter_list_drag_and_drop's dart version support
  • optimize data structure and api
  • drag and drop items in List View
  • drag and drop are optional for specific item
  • animate when draging

Usage

Pub package

import 'package:flutter/material.dart';
import 'package:dragable_flutter_list/dragable_flutter_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),
      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',
    'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.',
    '3',
    '4',
    'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.',
    '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(
        items.length,
        itemBuilder: (BuildContext context, index) {
          return new SizedBox(
            child: new Card(
              child: new ListTile(
                title: new Text(items[index]),
              ),
            ),
          );
        },
        onDragFinish: (before, after) {
          print('on drag finish $before $after');
          String data = items[before];
          items.removeAt(before);
          items.insert(after, data);
        },
        canDrag: (index) {
          print('can drag $index');
          return index != 3; //disable drag for index 3
        },
        canBeDraggedTo: (one, two) => true,
        dragElevation: 8.0,
      ),
    );
  }
}

Getting Started

For help getting started with Flutter, view our online documentation.

For help on editing package code, view the documentation.

[0.1.0] - release

[0.1.1] - update readme

[0.1.2] - add demo gif

[0.1.3] - fix key issue

[0.1.4] - fix hints

[0.1.5] - add scroll controller property

[0.1.6] - add scroll controller property

[0.1.7] - fix bug when can't drop to an index

[0.1.8] - fix dragging index bug

[0.1.9] - pub.dartlang.org bug, can't analyze, re-submit

[0.2.0] - improve performance

[0.2.1] - fix dependencies

[0.2.2] - format files

[0.2.3] - format files

[1.0.0] - release stable version

[1.0.1] - fix out of bounds issue

[1.0.2] - fix only one cell disappear when dragging issue

example/README.md

example

A new Flutter application.

Getting Started

For help getting started with Flutter, view our online documentation.

Use this package as a library

1. Depend on it

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


dependencies:
  dragable_flutter_list: ^1.0.2

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:dragable_flutter_list/dragable_flutter_list.dart';
  
Version Uploaded Documentation Archive
1.0.2 Nov 9, 2018 Go to the documentation of dragable_flutter_list 1.0.2 Download dragable_flutter_list 1.0.2 archive
1.0.1 Sep 5, 2018 Go to the documentation of dragable_flutter_list 1.0.1 Download dragable_flutter_list 1.0.1 archive
1.0.0 Sep 4, 2018 Go to the documentation of dragable_flutter_list 1.0.0 Download dragable_flutter_list 1.0.0 archive
0.2.3 Sep 4, 2018 Go to the documentation of dragable_flutter_list 0.2.3 Download dragable_flutter_list 0.2.3 archive
0.2.2 Sep 4, 2018 Go to the documentation of dragable_flutter_list 0.2.2 Download dragable_flutter_list 0.2.2 archive
0.2.1 Sep 4, 2018 Go to the documentation of dragable_flutter_list 0.2.1 Download dragable_flutter_list 0.2.1 archive
0.2.0 Sep 4, 2018 Go to the documentation of dragable_flutter_list 0.2.0 Download dragable_flutter_list 0.2.0 archive
0.1.9 Sep 4, 2018 Go to the documentation of dragable_flutter_list 0.1.9 Download dragable_flutter_list 0.1.9 archive
0.1.8 Sep 3, 2018 Go to the documentation of dragable_flutter_list 0.1.8 Download dragable_flutter_list 0.1.8 archive
0.1.7 Aug 30, 2018 Go to the documentation of dragable_flutter_list 0.1.7 Download dragable_flutter_list 0.1.7 archive

All 17 versions...

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

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

  • Dart: 2.0.0
  • pana: 0.12.6
  • Flutter: 0.11.3

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.28.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11
meta 1.1.6
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test