Giter VIP home page Giter VIP logo

reorderables's People

Contributors

89jd avatar casabian avatar danreynolds avatar diegotori avatar g123k avatar georgeherby avatar hanshengchiu avatar impure avatar jonasn5 avatar larssn avatar lidemin avatar luccasclezar avatar mig35 avatar nyarian avatar pcvdheuvel avatar pxsanghyo avatar qaison avatar qwert2603 avatar ryanramchandar avatar shichaohui avatar tombursch avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

reorderables's Issues

Error while adding library.

I am getting the below error.

Version :
reorderables: ^0.2.12

Compiler message:
../../../.pub-cache/hosted/pub.dartlang.org/reorderables-0.2.12/lib/src/widgets/reorderable_flex.dart:727:18: Error: The argument type 'Null Function(Key)' can't be assigned to the parameter type 'void Function(Object)'.

  • 'Key' is from 'package:flutter/src/foundation/key.dart' ('../../../flutter-sdk/packages/flutter/lib/src/foundation/key.dart').
  • 'Object' is from 'dart:core'.
    onLeave: (Key leaving) {},
    ^
    ../../../.pub-cache/hosted/pub.dartlang.org/reorderables-0.2.12/lib/src/widgets/reorderable_wrap.dart:951:18: Error: The argument type 'Null Function(int)' can't be assigned to the parameter type 'void Function(Object)'.
  • 'Object' is from 'dart:core'.
    onLeave: (int leaving) {},
    ^
    ../../../.pub-cache/hosted/pub.dartlang.org/reorderables-0.2.12/lib/src/widgets/reorderable_wrap.dart:957:18: Error: The argument type 'Null Function(int)' can't be assigned to the parameter type 'void Function(Object)'.
  • 'Object' is from 'dart:core'.
    onLeave: (int leaving) {},
    ^
    ../../../.pub-cache/hosted/pub.dartlang.org/reorderables-0.2.12/lib/src/widgets/reorderable_sliver.dart:842:18: Error: The argument type 'Null Function(int)' can't be assigned to the parameter type 'void Function(Object)'.
  • 'Object' is from 'dart:core'.
    onLeave: (int leaving) {},
    ^
    Target kernel_snapshot failed: Exception: Errors during snapshot creation: null
    build failed.

FAILURE: Build failed with an exception.

Support Header Click& Sort

I suggest 2 new features:

  1. grant the title header to receive click action
  2. add sort functions(i.e. compare function)

Staggered wrap

Hello, is there any way to layout children in a staggered manner? Because, if children has different height, it looks not very good.

NOW

BETTER

Support for Cupernito

Hello,

The plugin doesn't work if isn't a MaterialApp.

Maybe you can add a support for Cupernito or a trick ?

Thanks

Allow to choose which row can be ordered

In my Flutter app, i have a functionality which let the user order activities in days, the problem is the package doesn't have any functionality to prevent ordering such a row (in this case it's Days rows).

Example:
--- Day 1 ---
--Activity 1--
--Activity 2--
--Activity 3--
--- Day 2 ---
--Activity 4--
--Activity 5--
--Activity 6--

Can we have a workaround for this one?

Thanks.

Option to drag item outside of list to an external component to perform an action

I'm new to Flutter and to this project, but Id like to look into adding an optional feature to this library. It would be useful to the user to drag items outside of the list to perform some action on them, such as dragging them to a "trash can" or something.

I'll clone this library and start playing around with it, but it would be nice if someone could point me in the right direction to start exploring. Any suggestions off of the top of your head where to look to add this feature?

Callback for start reordering

Hello!
Is there a way to detect start of reordering? Maybe it would be useful to add a callback function for this?
Thanks in advance

ReorderableRow: padding not working

I am using the ReorderableRow like this:

ReorderableRow(
padding: EdgeInsets.only(left: 10),
mainAxisAlignment: MainAxisAlignment.start,
needsLongPressDraggable: true,
scrollController: ScrollController(),
onReorder: _onReorder,
children: ...........,
.................................)

There is no difference with using padding: EdgeInsets.only(left: 10) or using padding: EdgeInsets.only(left: 50), or using nothing....the children inside the row keep being drawn one next to each other without any spacing in between.

Am I using that property correctly?

[grid] Constraints on elements size

I would like to have the same mechanism of reorderable elements but I need different elements size :
By exemple:
A 3x3 grid with different reorderable elements:
-1x3
-2x2
-1x1

if I'm correct, he demo only implements 1x1 case

Is it possible with your framework ?

Add option to specify itemExtent in ReorderableSliverList

I have a requirement in my app to display a prescrolled reorderable list and it takes unreasonable time to display it. It builds and measures height of all widgets all the way down to the needed ones which is pointless because all of them have fixed height.

I tried replacing SliverList with SliverFixedExtentList in package code and everything went fine except reordering itself. Which caused some pixel overflows and broke few asserts.

I would be really happy if you could support itemExtent specification or at least give some hints on how it can be implemented.

God bless you for this awesome package anyway.

Disable reorder operations (enable property)

I use this in a page in which an editMode can be toggled on/off.
When editMode is true, I use ReorderableColumn, when it is off, I rebuild the page with a normal list.
Is works ok, but as it is not the same list widget, all the inner state is lost (like scroll position, and child widget state too), which is quite sad.
It would be perfect if the ReorderableColumn (and the others Widget of your package) has a "enable" property, which will be true by default, but could be set to false to disable all drag and drop operations.

Add callbacks for didNotReorder

I would love to be able to tell if the LongPress Action was triggered but not used for a reorder. Maybe you could add a Callback to be called if no reorder happened.

Thanks a lot :)

Dragging On Short Press for ReorderableSliverList

Hi hanshengchiu, through user trials, I've found that the default time to drag for ReorderableSliverList is too long.

I forked your code for my application and replaced LongPressDraggable with Draggable on line 739 as it provide for better user feedback. Users were not sure how to use the re-ordering otherwise.

Add elevation (shadow) option while dragging

Hi, my name is Ado, and I am using your package to develop an app.

First of all, thanks for this great plugin! This plugin has solved my problem with making a reorderable list in a sliver list.

However, I encountered a problem when I want to change the elevation when the object is dragged. It'll be great if you can provide the option to change the elevation/shadow.

I am looking forward to hearing from you.

Best regards,
Ado

Don't support border attribute in ReorderableTable?

I try render border to ReorderableTable but, It not render border.

return ReorderableTable(
  border: TableBorder.all(),
  onReorder: updateAndRefresh,
  children: data.map((subject) => ReorderableTableRow(
    key: ObjectKey(subject.key),
    children: <Widget>[
      _textWithPadding('${subject.name}2'),
      _textWithPadding('${subject.name}2')
    ],
  )).toList(),
);

Is it not support yet?

Disabling disabling order/drag for certain tiles.

I'm using this to allow the ordering of photographs in my app. I have a 3x2 grid of photo tiles, I'm using the ReorderableWrap widget. I fill the empty photo tiles with a tile with tile that contains a + icon, when tapped starts the upload new photo workflow. I would like it so these empty tiles cannot be reordered. It's would be only possible to reorder the tiles that are populated with photographs. Is there anyway I could achieve this?

One possible implementation: Tiles could all have a DraggableWidget parent which has a child property and an enabled property?

This request is similar yet not quite the same as: #39

I've also tried your suggestion #31 of using the footer/header but this doesn't work as I have numerous items I want to none-draggable.

The getter 'width' was called on null

Hello, I got this issue when I used ReorderableColumn inside the Stepper widget.
Stepper > Step > Form > Column > ReorderableColumn.
Whenever I long press the UI for dragging it produces this error:

flutter: The following assertion was thrown while handling a gesture:
flutter: ScrollController attached to multiple scroll views.
flutter: 'package:flutter/src/widgets/scroll_controller.dart':
flutter: Failed assertion: line 111 pos 12: '_positions.length == 1'
flutter:
flutter: Either the assertion indicates an error in the framework itself, or we should provide substantially
flutter: more information in this error message to help you determine and fix the underlying cause.
flutter: In either case, please report this assertion by filing a bug on GitHub:
flutter:   https://github.com/flutter/flutter/issues/new?template=BUG.md
flutter:
flutter: When the exception was thrown, this was the stack:
flutter: #2      ScrollController.position (package:flutter/src/widgets/scroll_controller.dart:111:12)
flutter: #3      ScrollController.offset (package:flutter/src/widgets/scroll_controller.dart:118:24)
flutter: #4      _ReorderableFlexContentState._scrollTo (package:reorderables/src/widgets/reorderable_flex.dart:353:51)
flutter: #5      _ReorderableFlexContentState._wrap.<anonymous closure>.<anonymous closure> (package:reorderables/src/widgets/reorderable_flex.dart:722:11)
flutter: #6      _DragTargetState.didEnter (package:flutter/src/widgets/drag_target.dart)
flutter: #7      _DragAvatar.updateDrag.<anonymous closure> (package:flutter/src/widgets/drag_target.dart:658:23)
flutter: #8      _ListBase&Object&ListMixin.firstWhere (dart:collection/list.dart:137:15)
flutter: #9      _DragAvatar.updateDrag (package:flutter/src/widgets/drag_target.dart:655:51)
flutter: #10     new _DragAvatar (package:flutter/src/widgets/drag_target.dart:591:5)
flutter: #11     _DraggableState._startDrag (package:flutter/src/widgets/drag_target.dart:381:35)
flutter: #12     LongPressDraggable.createRecognizer.<anonymous closure> (package:flutter/src/widgets/drag_target.dart:319:36)
flutter: #13     MultiDragGestureRecognizer._startDrag.<anonymous closure> (package:flutter/src/gestures/multidrag.dart:266:52)
flutter: #14     GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:181:24)
flutter: #15     MultiDragGestureRecognizer._startDrag (package:flutter/src/gestures/multidrag.dart:266:14)
flutter: #16     MultiDragGestureRecognizer.acceptGesture.<anonymous closure> (package:flutter/src/gestures/multidrag.dart:256:48)
flutter: #17     _DelayedPointerState.accepted (package:flutter/src/gestures/multidrag.dart:485:14)
flutter: #18     MultiDragGestureRecognizer.acceptGesture (package:flutter/src/gestures/multidrag.dart:256:11)
flutter: #19     GestureArenaManager._resolveInFavorOf (package:flutter/src/gestures/arena.dart:263:12)
flutter: #20     GestureArenaManager._resolve (package:flutter/src/gestures/arena.dart:222:9)
flutter: #21     GestureArenaEntry.resolve (package:flutter/src/gestures/arena.dart:52:12)
flutter: #22     MultiDragPointerState.resolve (package:flutter/src/gestures/multidrag.dart:62:17)
flutter: #23     _DelayedPointerState._delayPassed (package:flutter/src/gestures/multidrag.dart:471:7)
flutter: #32     _Timer._runTimers (dart:isolate-patch/timer_impl.dart:382:19)
flutter: #33     _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:416:5)
flutter: #34     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:171:12)
flutter: (elided 10 frames from class _AssertionError, package dart:async, and package dart:async-patch)
flutter:
flutter: Handler: "onStart"
flutter: Recognizer:
flutter:   DelayedMultiDragGestureRecognizer#0bd37
flutter: ════════════════════════════════════════════════════════════════════════════════════════════════════
flutter: Another exception was thrown: NoSuchMethodError: The getter 'width' was called on null.
flutter: Another exception was thrown: NoSuchMethodError: The getter 'width' was called on null.

scrollController not working

When I add a scrollController, I get RenderFlex overflowed which doesn't happen without scrollController and when I try to do something with controller I get this error:
"Unhandled Exception: 'package:flutter/src/widgets/scroll_controller.dart': Failed assertion: line 110 pos 12: '_positions.isNotEmpty': ScrollController not attached to any scroll views."

Focus cannot be kept on textfield in a ReorderableColumn

There are quite a few ways to cause the issue

  1. requestFocus() on a TextField right after it is built that exists in a ReorderableColumn, then tap the submit in the keyboard to dismiss the keyboard and unfocus the text field. After doing this, tapping the text field will cause the keyboard to flash and immediately disappear, and the text field does not gain focus. However, tapping it at 2nd time will finally bring the keyboard up and give focus to the TextField.
  2. Have two TextFields in one row, and set the first one with textInputAction: TextInputAction.next and onSubmitted: (_) => FocusScope.of(context).nextFocus(). Tapping the next button in the keyboard jumps the focus to the next TextField. Now, tap the submit button in the keyboard. At this point, the keyboard is dismissed and the TextField is no longer in focus. However, tapping either TextField in that row will never bring up the keyboard permanently and restore focus to the TextField. It can only be brought back by tapping a TextField in a separate row or a TextField outside of the ReorderableColumn, and then tapping the original TextField in interest.
  3. Wrap your MaterialApp root widget in GestureDetector as follows:
GestureDetector(
      onTap: () {
        WidgetsBinding.instance.focusManager.primaryFocus?.unfocus();
      },
      child: MaterialApp( ),
    );

Using this GestureDetector allows a user to tap anywhere on the screen that is not a TextField or something similar and dismiss the keyboard and remove focus from the field.
Now, like the 1st example, requestFocus() on a TextField right after it is built. After that, tap out of the TextField. No matter what text field you tap in the ReordableColumn, you cannot regain focus on a TextField unless you tap the field that you initially performed requestFocus() on or you tap a TextField that is outside of the ReorderableColumn.

Wrapping the content in a Column instead of a ReorderableColumn fixes all of the issues described above.

Attached is some sample code that demonstrates all of the described problems.

import 'package:flutter/material.dart';
import 'package:reorderables/reorderables.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      onTap: () {
        WidgetsBinding.instance.focusManager.primaryFocus?.unfocus();
      },
      child: MaterialApp(
        title: 'BUG',
        theme: ThemeData(primarySwatch: Colors.cyan),
        home: MyHomePage(title: 'Flutter Demo Home Page'),
      ),
    );
  }
}

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

  final String title;

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  FocusNode one;

  @override
  void initState() {
    super.initState();
    one = FocusNode();
    WidgetsBinding.instance.addPostFrameCallback((_) {
      FocusScope.of(context).requestFocus(one);
    });
  }

  @override
  Widget build(BuildContext context) {
    return Material(
      child: Center(
        child: Container(
          width: 300,
          child: ReorderableColumn(
            onReorder: (_, __) {},
            mainAxisAlignment: MainAxisAlignment.center,
            children: <Widget>[
              TextField(focusNode: one, key: UniqueKey(),),
              Row(
                key: UniqueKey(),
                children: <Widget>[
                  Container(
                    width: 140,
                    child: TextField(
                      textInputAction: TextInputAction.next,
                      onSubmitted: (_) {
                        FocusScope.of(context).nextFocus();
                      },
                    ),
                  ),
                  SizedBox(width: 15),
                  Container(width: 140, child: TextField()),
                ],
              ),
            ],
          ),
        ),
      ),
    );
  }
}

Importing nothing (?)

Version: 0.2.12

Unable to find modules for some sources, this is usually the result of either a
bad import, a missing dependency in a package (or possibly a dev_dependency
needs to move to a real dependency), or a build failure (if importing a
generated file).

Please check the following imports:

`import '';` from reorderables|lib/src/widgets/reorderable_flex.dart at 11:1

Failed after 6.5s
Failed to build application for the Web.

Bildschirmfoto 2020-02-27 um 10 30 24

🤔 🤔

Children must have a key, but have !

Hello, I have this error :
All children of this widget must have a key.

The Widget : (id is unique)

class ServiceWidget extends StatelessWidget {

  Service service;

  ServiceWidget(this.service);

  @override
  Widget build(BuildContext context) {

    return Container(
      decoration: BoxDecoration(
        border: Border.all(
          color: service.borderColor,
          width: 3
        ),
        color: service.backgroundColor,
        borderRadius: new BorderRadius.all(Radius.circular(10)),
      ),
      key: ValueKey(service.id),
    );

  }

}
return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
        backgroundColor: Colors.indigo[400],
      ),
      backgroundColor: Colors.indigo[50],
      body: ReorderableWrap(
          spacing: 8.0,
          runSpacing: 3.0,
          padding: const EdgeInsets.all(8),
          children: _tiles,
          onReorder: _onReorder
      )
    );

I've checked if _tiles is not empty, but still not working

Allow iOS style reordering in SliverList

Hi,

First of all, great plugin! Of all the solutions I've tried for reorderable SliverLists, this is by far the smoothest and cleanest.

It would be great to have the option to start the reorder operation in the iOS style. Instead of a long press anywhere on the sliver/tile, you would drag a handle icon to initiate the reorder. E.g. here

LongPress bubble up

Great package, thanks.

My only challenge at this point in using your package is being able to detect longPress on one of my items. I want to continue to require the user to longPress to start the drag/drop operation so I can't just turn it off using your 'needsLongPressDraggable'. Ideally what I need is for me to pass into your Wrap constructor a callback which will get called whenever you detect a longpress without movement (i.e. no dragging after longpress). Ideally you would pass my callback the index of the item which has been longPressed.

Drag&Drop reorder between two lists

Hello!

I am trying to create some sort of task manager exactly like in trello and your library solving my problem of drag&droping perfectly, but now fully. Can you please make possivle to drag&drop item of list between two and more lists.

trello

Flutter beta update break this lovely package :(

Help, my project can no longer build :(

Compiler message:
/C:/flutter_stable/flutter/.pub-cache/hosted/pub.dartlang.org/reorderables-0.2.12/lib/src/widgets/reorderable_flex.dart:727:18: Error: The argument type 'Null Function(Key)' can't be assigned to the parameter type 'void Function(Object)'.
 - 'Key' is from 'package:flutter/src/foundation/key.dart' ('/C:/flutter_stable/flutter/packages/flutter/lib/src/foundation/key.dart').
 - 'Object' is from 'dart:core'.
        onLeave: (Key leaving) {},
                 ^
/C:/flutter_stable/flutter/.pub-cache/hosted/pub.dartlang.org/reorderables-0.2.12/lib/src/widgets/reorderable_wrap.dart:951:18: Error: The argument type 'Null Function(int)' can't be assigned to the parameter type 'void Function(Object)'.
 - 'Object' is from 'dart:core'.
        onLeave: (int leaving) {},
                 ^
/C:/flutter_stable/flutter/.pub-cache/hosted/pub.dartlang.org/reorderables-0.2.12/lib/src/widgets/reorderable_wrap.dart:957:18: Error: The argument type 'Null Function(int)' can't be assigned to the parameter type 'void Function(Object)'.
 - 'Object' is from 'dart:core'.
        onLeave: (int leaving) {},
                 ^
/C:/flutter_stable/flutter/.pub-cache/hosted/pub.dartlang.org/reorderables-0.2.12/lib/src/widgets/reorderable_sliver.dart:842:18: Error: The argument type 'Null Function(int)' can't be assigned to the parameter type 'void Function(Object)'.
 - 'Object' is from 'dart:core'.
        onLeave: (int leaving) {},
[√] Flutter (Channel beta, v1.13.6, on Microsoft Windows [Version 10.0.18362.592], locale vi-VN)
    • Flutter version 1.13.6 at C:\flutter_stable\flutter
    • Framework revision 659dc8129d (3 weeks ago), 2019-12-30 09:24:47 -0800
    • Engine revision bdc9708d23
    • Dart version 2.8.0 (build 2.8.0-dev.0.0 c547f5d933)

[grid] Reordering issue

I try to move a grid element from 1 row to the next row at the end (cf. video).
It does not work, i'm still obliged to move first on next row and move to the next column

RPReplay_Final1561400603

Horizontal Sliver Reorderable inside other scrollables

I needed to use this for a horizontal scroll list with dynamically created items. I could have used the ReorderableRow but I think that probably would work similarly to the SingleChildScrollView when paired with a List.generate() method (building all of the widgets regardless of where you are in the list). So I tried to use the Sliver reorderable but noticed that it only wanted to work in the vertical axis. Upon opening up the source file I saw that you were working on a horizontal option but had commented most of that out. I uncommented the necessary code for that to work in my own version of what you built but after I did that I noticed an issue with the use of your _scrollController property. If the CustomScrollView is nested in another scrollable (which mine is) it doesn't like the .offset property since it has multiple scrollpositions and can't give the offset for all of them. My workaround for this was under the assumption that this will be the last scrollPosition added so I changed the _toScroll method to use the _scrollController.positions.last for all of the properties it needs to calculate where it should scroll. It's a little sensitive when dragging left (or "up") but it does work on the horizontal axis. I'd share the code but really all I did was uncomment your "widget.direction" portions and then made the changes for the scrollposition in the _toScroll method. Thanks for the package. I'm glad it allows lazy building of widgets unlike the other options available.

index not saved after initState

Hello, How can I save and load last position ? I want to let user customize his dashboard but if the app is reload I need that the load his dashboard combinaison. thank you

Support drag and drop with nested lists

There may be a way to do this I'm overlooking, but whenever I nest wraps inside warps (or lists) and attempt to drag and drop the copying function seems to throw duplicate global key errors when I pick up the object. The alternative is a sub-list that doesn't save state which isn't ideal. I've tried some ways around this but it looks like the uuid library I'm using is possibly duplicating values or there's something in the way the copy function works that the tree has duplicate keys when moving the items.

So in other words I have a list of tiles with sub-lists, whenever I try to move them it throws an exception.

[grid] Move item to beyond the liston the screen

When the list is longer than the screen and I try to move the note beyond the list on the screen, the screen does not scroll down.
I would like to know if this is mapped or not.
Thanks.

Version plugin: 0.2.12
OS: Whatever

Exception when try build two ReorderableWrap

════════ Exception caught by gesture library ═══════════════════════════════════
Assertion failed:
../…/widgets/drag_target.dart:536
_candidateAvatars.contains(avatar) || _rejectedAvatars.contains(avatar)
is not true

My Code:

Widget _build(BuildContext context, List<Map<int, ItemModel>> pages) {
    return Container(
      margin: const EdgeInsets.all(8.0),
      padding: const EdgeInsets.all(8.0),
      child: Card(
        child: Center(
          child: Container(
            margin: const EdgeInsets.all(8.0),
            padding: const EdgeInsets.all(8.0),
            child: Row(
              mainAxisAlignment: MainAxisAlignment.spaceEvenly,
              crossAxisAlignment: CrossAxisAlignment.stretch,
              children: <Widget>[
                _wrap(context, pages[0]),
                _wrap(context, pages[1])
              ]
            ),
          ),
        )
      ),
    );
  }

Widget _wrap(BuildContext context, Map<int, ItemModel> page) {
    return Container(
      margin: const EdgeInsets.all(8.0),
      padding: const EdgeInsets.all(8.0),
      child: ReorderableWrap(
        minMainAxisCount: 3,
        maxMainAxisCount: 3,
        onReorder: (old, newer) {
          setState(() {
            final items = page.values.toList();
            final item = items.removeAt(old);
            items.insert(newer, item);
            page.clear();
            page.addAll(items.asMap());
          });
        },
        children: page.entries.map((element) => _item(context, element)).toList(), 
      )
    );
  }

Widget _item(BuildContext context, MapEntry<int, ItemModel> entry) {
    return Container(
      width: 80,
      height: 80,
      margin: EdgeInsets.all(4),
      color: entry.value.color,
      key: ValueKey(entry.key)
    );
  }

Leaving only one call to the '_wrap' method works normally. like that:

children: <Widget>[
  _wrap(context, pages[0])
]

Allow reordering, even with onLongPress() of GestureDetector

When there is a GestureDetector given with onLongPress(), the reordering doesn't work anymore. In my case a PopupMenu opens up on the items in my ReorderableWrap and the reordering simply doesn't work. It would be optimal if it works, even if a PopupMenu pops up.

Move top position to the bottom of long list

Wonderful package! Get one issue
Use ReorderableSliverChildBuilderDelegate, if the list is big and I move the very first position (index [0]) to the bottom , so the FlexibleSpaceBar is collapsed and top of the list is not visible, after that the new index[0] is not draw on top. I have to reopen the page and it appears.

Project breaks for Flutter 1.5.9

Using the latest flutter version, the library breaks due to flutter changes on Diagnostics related features.

The error message is:

Compiler message:
file:///Users/brunocalou/Development/flutter/.pub-cache/hosted/pub.dartlang.org/reorderables-0.2.7/lib/src/widgets/reorderable_sliver.dart:76:16: Error: The argument type 'String' can't be assigned to the parameter type 'DiagnosticsNode'.

  • 'DiagnosticsNode' is from 'package:flutter/src/foundation/diagnostics.dart' ('file:///Users/brunocalou/Development/flutter/packages/flutter/lib/src/foundation/diagnostics.dart').
    Try changing the type of the parameter, or casting the argument to 'DiagnosticsNode'.
    context: 'building',
    ^
    file:///Users/brunocalou/Development/flutter/.pub-cache/hosted/pub.dartlang.org/reorderables-0.2.7/lib/src/rendering/tabluar_flex.dart:927:26: Error: The argument type 'String' can't be assigned to the parameter type 'List'.
  • 'List' is from 'dart:core'.
  • 'DiagnosticsNode' is from 'package:flutter/src/foundation/diagnostics.dart' ('file:///Users/brunocalou/Development/flutter/packages/flutter/lib/src/foundation/diagnostics.dart').
    Try changing the type of the parameter, or casting the argument to 'List'.
    overflowHints: debugOverflowHints);

Flutter doctor output

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel master, v1.5.9-pre.258, on Mac OS X 10.14.4 18E226, locale en-BR)

[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
[✓] iOS toolchain - develop for iOS devices (Xcode 10.1)
[✓] Android Studio (version 3.3)
[✓] IntelliJ IDEA Community Edition (version 2018.3.5)
[✓] VS Code (version 1.27.2)
[✓] Connected device (1 available)

Reordering index to 0 instead of 1 when dragging above expanded FlexibleSpaceBar

HI! Thanks again for the grat package.

I'm aving a little issue when i'm dragging items to the top with an expanded FlexibleSpaceBar:
I drag an item from any position to the top, if i stop dragging on the topmost tile, i'm correctly show the preview in the right place, and the TO index is correctly 1, but if i keep dragging on top of the Flexible bar, the preview tile animates sliding again above itselft (still appearing at the right place) but the TO index is 0

This is the result of the draggin to top, the first two i stop on the tile, the then is when i drag all the way up

I/flutter ( 6130): from: 2 -> to 1
I/flutter ( 6130): from: 2 -> to 1
I/flutter ( 6130): from: 3 -> to 0
I/flutter ( 6130): from: 2 -> to 0
I/flutter ( 6130): from: 3 -> to 0

At the moment i fixed it by setting the index back to 1 if i see 0 in my code.
I tried it only in my code, so maybe it's not a plugin problem.

Thanks!

David

Can't drag and drop new item after added to list

import 'package:flutter/material.dart';
import 'package:reorderables/reorderables.dart';

main() => runApp(MaterialApp(
      home: Home(),
    ));

class Home extends StatefulWidget {
  @override
  _HomeState createState() => _HomeState();
}

class _HomeState extends State<Home> {
  List list = [
    'Item 1',
    'Item 2',
    'Item 3',
  ];
  int item = 4;
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(),
      body: Builder(builder: (context) {
        ScrollController _scrollController =
            PrimaryScrollController.of(context) ?? ScrollController();

        return CustomScrollView(
          controller: _scrollController,
          slivers: <Widget>[
            ReorderableSliverList(
              delegate: ReorderableSliverChildBuilderDelegate((ctx, i) {
                return ListTile(
                  title: Text(list[i]),
                  onTap: () {},
                );
              }, childCount: list.length),
              onReorder: _onReorder,
            )
          ],
        );
      }),
      floatingActionButton: FloatingActionButton(
        child: Icon(Icons.add),
        onPressed: () {
          list.add('Item ${item++}');
          setState(() {});
        },
      ),
    );
  }

  _onReorder(o, n) => print('$o -> $n');
}

When pressing the FAB, an item is added, but the new item can't be dragged.

Leading widget consumes entire tile width. Please use a sized widget.

I am creating music player application. In the Queue Songs page I added reorderableSliver list. But whenever I try to drag a list item from it, it throws the blow error. Can you please check this if it is related to control level or did i construct the list in wrong way.

The error:

I/flutter (27359): ══╡ EXCEPTION CAUGHT BY RENDERING LIBRARY ╞═════════════════════════════════════════════════════════
I/flutter (27359): The following assertion was thrown during performLayout():
I/flutter (27359): Leading widget consumes entire tile width. Please use a sized widget.
I/flutter (27359): 'package:flutter/src/material/list_tile.dart':
I/flutter (27359): Failed assertion: line 1334 pos 7: 'tileWidth != leadingSize.width'
I/flutter (27359):
I/flutter (27359): Either the assertion indicates an error in the framework itself, or we should provide substantially
I/flutter (27359): more information in this error message to help you determine and fix the underlying cause.
I/flutter (27359): In either case, please report this assertion by filing a bug on GitHub:
I/flutter (27359): https://github.com/flutter/flutter/issues/new?template=BUG.md
I/flutter (27359):
I/flutter (27359): User-created ancestor of the error-causing widget was:
�[38;5;248mI/flutter (27359): ListTile-[#e87ff]�[39;49m
I/flutter (27359):
I/flutter (27359): When the exception was thrown, this was the stack:
�[38;5;244mI/flutter (27359): #2 _RenderListTile.performLayout�[39;49m
�[38;5;244mI/flutter (27359): #3 RenderObject.layout�[39;49m
�[38;5;244mI/flutter (27359): #4 RenderPadding.performLayout�[39;49m
�[38;5;244mI/flutter (27359): #5 RenderObject.layout�[39;49m
�[38;5;244mI/flutter (27359): #6 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout�[39;49m
�[38;5;244mI/flutter (27359): #7 RenderObject.layout�[39;49m
�[38;5;244mI/flutter (27359): #8 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout�[39;49m
�[38;5;244mI/flutter (27359): #9 RenderObject.layout�[39;49m
�[38;5;244mI/flutter (27359): #10 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout�[39;49m
�[38;5;244mI/flutter (27359): #11 RenderObject.layout�[39;49m
�[38;5;244mI/flutter (27359): #12 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout�[39;49m
�[38;5;244mI/flutter (27359): #13 RenderObject.layout�[39;49m
�[38;5;244mI/flutter (27359): #14 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout�[39;49m
�[38;5;244mI/flutter (27359): #15 RenderObject.layout�[39;49m
�[38;5;244mI/flutter (27359): #16 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout�[39;49m
�[38;5;244mI/flutter (27359): #17 RenderObject.layout�[39;49m
�[38;5;244mI/flutter (27359): #18 RenderConstrainedBox.performLayout�[39;49m
�[38;5;244mI/flutter (27359): #19 RenderObject.layout�[39;49m
�[38;5;244mI/flutter (27359): #20 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout�[39;49m
�[38;5;244mI/flutter (27359): #21 RenderObject.layout�[39;49m
�[38;5;244mI/flutter (27359): #22 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout�[39;49m
�[38;5;244mI/flutter (27359): #23 RenderObject.layout�[39;49m
�[38;5;244mI/flutter (27359): #24 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout�[39;49m
�[38;5;244mI/flutter (27359): #25 RenderObject.layout�[39;49m
�[38;5;244mI/flutter (27359): #26 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout�[39;49m
�[38;5;244mI/flutter (27359): #27 RenderObject.layout�[39;49m
�[38;5;244mI/flutter (27359): #28 RenderFlex.performLayout�[39;49m
�[38;5;244mI/flutter (27359): #29 RenderObject.layout�[39;49m
�[38;5;244mI/flutter (27359): #30 RenderSliverList.performLayout.advance�[39;49m
�[38;5;244mI/flutter (27359): #31 RenderSliverList.performLayout�[39;49m
�[38;5;244mI/flutter (27359): #32 RenderObject.layout�[39;49m
�[38;5;244mI/flutter (27359): #33 RenderViewportBase.layoutChildSequence�[39;49m
�[38;5;244mI/flutter (27359): #34 RenderViewport._attemptLayout�[39;49m
�[38;5;244mI/flutter (27359): #35 RenderViewport.performLayout�[39;49m
�[38;5;244mI/flutter (27359): #36 RenderObject._layoutWithoutResize�[39;49m
�[38;5;244mI/flutter (27359): #37 PipelineOwner.flushLayout�[39;49m
�[38;5;244mI/flutter (27359): #38 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&SemanticsBinding&RendererBinding.drawFrame�[39;49m
�[38;5;244mI/flutter (27359): #39 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&SemanticsBinding&RendererBinding&WidgetsBinding.drawFrame�[39;49m
�[38;5;244mI/flutter (27359): #40 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&SemanticsBinding&RendererBinding._handlePersistentFrameCallback�[39;49m
�[38;5;244mI/flutter (27359): #41 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding._invokeFrameCallback�[39;49m
�[38;5;244mI/flutter (27359): #42 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding.handleDrawFrame�[39;49m
�[38;5;244mI/flutter (27359): #43 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding._handleDrawFrame�[39;49m
�[38;5;244mI/flutter (27359): #47 _invoke (dart:ui/hooks.dart:238:10)�[39;49m
�[38;5;244mI/flutter (27359): #48 _drawFrame (dart:ui/hooks.dart:196:3)�[39;49m
I/flutter (27359): (elided 5 frames from class _AssertionError and package dart:async)
I/flutter (27359):
I/flutter (27359): The following RenderObject was being processed when the exception was fired: _RenderListTile#e13f0 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE:
I/flutter (27359): creator: _ListTile ← MediaQuery ← Padding ← SafeArea ← Semantics ← _PointerListener ← Listener ←
I/flutter (27359): _GestureSemantics ← RawGestureDetector ← GestureDetector ← MouseRegion ← InkWell ← ⋯
I/flutter (27359): parentData: offset=Offset(0.0, 0.0) (can use size)
I/flutter (27359): constraints: BoxConstraints(w=0.0, h=0.0)
I/flutter (27359): size: MISSING
I/flutter (27359): This RenderObject had the following descendants (showing up to depth 5):
I/flutter (27359): leading: RenderConstrainedBox#7780c NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
I/flutter (27359): child: RenderPositionedBox#c4f06 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
I/flutter (27359): child: RenderSemanticsAnnotations#d3155 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
I/flutter (27359): child: RenderExcludeSemantics#b5a12 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
I/flutter (27359): child: RenderConstrainedBox#48444 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
I/flutter (27359): title: RenderParagraph#b4ae2 NEEDS-LAYOUT NEEDS-PAINT
I/flutter (27359): text: TextSpan
I/flutter (27359): subtitle: RenderParagraph#98e48 NEEDS-LAYOUT NEEDS-PAINT
I/flutter (27359): text: TextSpan
I/flutter (27359): ════════════════════════════════════════════════════════════════════════════════════════════════════

The Code:

`
return Scaffold(
ScrollController _scrollController =
PrimaryScrollController.of(context) ?? ScrollController();
final _listTiles = playerUtil.songQueue
.map(
(song) => ListTile(
key: UniqueKey(),
title: Text(song.title),
subtitle: Text(song.album),
isThreeLine: false,
leading: SizedBox(
width: 40, // can be whatever value you want
child: Container(
child: Icon(Icons.reorder),
alignment: Alignment.center,
),
),
),
)
.toList();

  appBar: AppBar(
    title: Text(
      'Queue Songs',
    ),
    // backgroundColor: Colors.transparent,
    elevation: 0,
    leading: IconButton(
      icon: Icon(Icons.arrow_back_ios),
      onPressed: () {
        Navigator.pop(context);
        Navigator.push(
          context,
          MaterialPageRoute(builder: (BuildContext context) {
            return NowPlaying();
          }),
        );
      },
    ),
  ),
  body: CustomScrollView(
    controller: _scrollController,
    slivers: [
      ReorderableSliverList(
        delegate: ReorderableSliverChildListDelegate(_listTiles),
        onReorder: listReorder,
      ),
    ],
  ),
);

`

Drag customization of list items

Hi!

It's possible to have a class or a mixin to wrap list items which gives the ability of drag behaviour customization like:

  1. enable / disable drag (already asked #43)
  2. define which widget of the list item is the draggable element (the whole item itself or a child drag handle for example)

Thanks

Does not work after upgrading to flutter v1.13.3

Getting the following error:

Compiler message:                                                       
../../../.pub-cache/hosted/pub.dartlang.org/reorderables-0.2.12/lib/src/widgets/reorderable_flex.dart:727:18: Error: The argument type 'Null Function(Key)' can't be assigned to the parameter type 'void Function(Object)'.
 - 'Key' is from 'package:flutter/src/foundation/key.dart' ('../../../flutter-sdk/packages/flutter/lib/src/foundation/key.dart').
 - 'Object' is from 'dart:core'.                                        
        onLeave: (Key leaving) {},                                      
                 ^                                                      
../../../.pub-cache/hosted/pub.dartlang.org/reorderables-0.2.12/lib/src/widgets/reorderable_wrap.dart:951:18: Error: The argument type 'Null Function(int)' can't be assigned to the parameter type 'void Function(Object)'.
 - 'Object' is from 'dart:core'.                                        
        onLeave: (int leaving) {},                                      
                 ^                                                      
../../../.pub-cache/hosted/pub.dartlang.org/reorderables-0.2.12/lib/src/widgets/reorderable_wrap.dart:957:18: Error: The argument type 'Null Function(int)' can't be assigned to the parameter type 'void Function(Object)'.
 - 'Object' is from 'dart:core'.                                        
        onLeave: (int leaving) {},                                      
                 ^                                                      
../../../.pub-cache/hosted/pub.dartlang.org/reorderables-0.2.12/lib/src/widgets/reorderable_sliver.dart:842:18: Error: The argument type 'Null Function(int)' can't be assigned to the parameter type 'void Function(Object)'.
 - 'Object' is from 'dart:core'.                                        
        onLeave: (int leaving) {},                                      
                 ^                                                      
Target kernel_snapshot failed: Exception: Errors during snapshot creation: null
build failed.                                                           
                                                                        
FAILURE: Build failed with an exception.                                
                                                                        
* Where:                                                                
Script '/Users/jimmyff/flutter-sdk/packages/flutter_tools/gradle/flutter.gradle' line: 801
                                                                        
* What went wrong:                                                      
Execution failed for task ':app:compileFlutterBuildDebug'.              
> Process 'command '/Users/jimmyff/flutter-sdk/bin/flutter'' finished with non-zero exit value 1
                                                                        
* Try:                                                                  
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
                                                                        
* Get more help at https://help.gradle.org       

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.