reorderables icon indicating copy to clipboard operation
reorderables copied to clipboard

ReorderableColumn : The getter 'width' was called on null.

Open nibo opened this issue 4 years ago • 4 comments

I am using the "ReorderableColumn" but get stuck sometimes in a NoSuchMethodError Exception.

    The following NoSuchMethodError was thrown building Builder(dirty):
    The getter 'width' was called on null.
    Receiver: null
    Tried calling: width

It happend when the "buildDragTarget" get called in :

   BoxConstraints contentSizeConstraints = BoxConstraints.loose(_draggingFeedbackSize);

At this point the _draggingFeedbackSize is null and will never be set to a valid size. The only code-snipper i found where this size is set is in :

void onDragStarted() {
  setState(() {
    _draggingWidget = toWrap;
    _dragging = toWrap.key;
    _dragStartIndex = index;
    _ghostIndex = index;
    _currentIndex = index;
    _entranceController.value = 1.0;
    _draggingFeedbackSize = keyIndexGlobalKey.currentContext.size;
  });
}

An I am pretty sure that the onDragStarted method is not called before the buildDragTarget is called.

nibo avatar Jul 27 '20 13:07 nibo

quick fix by myself : #80

nibo avatar Jul 28 '20 05:07 nibo

quick fix by myself : #80

still doesn't work. Now items are poped to small grey points (

andrros3030 avatar Jul 30 '20 09:07 andrros3030

quick fix by myself : #80

still doesn't work. Now items are poped to small grey points (

Here is my widget implementation -> still working!

Material( color: Colors.transparent, child: Padding( padding: DefaultInsets.insetsBottom8, child: SingleChildScrollView( physics: physics, padding: childInsets, child: Container( width: double.infinity, child: ReorderableColumn( scrollController: controller, needsLongPressDraggable: false, onReorder: onReorder, children: children .map( (child) => ReorderableWidget( reorderable: sorting, key: Key(children.indexOf(child).toString()), child: child, ), ) .toList(growable: false), ), ), ), ), )

nibo avatar Jul 30 '20 10:07 nibo

quick fix by myself : #80

still doesn't work. Now items are poped to small grey points (

Works for me too! You have to add ScrollController for ReorderableRow

DenchikBY avatar Oct 21 '20 14:10 DenchikBY