superlistapp/super_native_extensions

[super_drag_and_drop] - Opacity of Dragged Item

Opened this issue · 1 comments

Hi,

Firstly, thanks for the great package, it solved an important gap in the Flutter framework.

I hoped you could help with an issue / feature I've found.

In the main.dart file of super_Drag_and_drop/example there is the below code. This is running on Windows desktop.

I've added a width to the container, when it is above 180 the image under the cursor when dragged fades out to the sides, 180 or below the image doesn't fade out.

I've tried using dragBuilder and whilst this can change the image under the cursor it still fades at widths greater than 180.

Is it possible to stop the fading out? I've looked through the source code and tried changing various things (mainly opacity in the dart code) although no luck.

Any pointers would be much appreciated.

How I want it to look at any width:

image

How it looks with a width higher than 180:

image

Thanks!

  @override
  Widget build(BuildContext context) {
    return DragItemWidget(
      allowedOperations: () => [DropOperation.copy],
      canAddItemToExistingSession: true,
      dragItemProvider: provideDragItem,
      dragBuilder: (context, child) {
        return Container(color: Colors.black, child: child);        
      },
      child: DraggableWidget(
        child: AnimatedOpacity(
          opacity: _dragging ? 0.5 : 1,
          duration: const Duration(milliseconds: 200),
          child: Container(
            width: 180.1,
            decoration: BoxDecoration(
              color: widget.color,
              borderRadius: BorderRadius.circular(14),
            ),
            padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 14),
            child: Text(
              widget.name,
              style: const TextStyle(fontSize: 20, color: Colors.white),
              textAlign: TextAlign.center,
            ),
          ),
        ),
      ),
    );
  }
}

I have the same issue.