FLUTTER ECOSYSTEM

Mindinventory/flutter_draggable_gridview

이 패키지는 다중 플랫폼용 GridView.builder 내부에서 위젯을 드래그 앤 드롭하는 것을 지원합니다. GridView.builder에 사용 가능한 모든 속성을 제공하며, 몇 줄의 코드로 쉽게 구현할 수 있습니다.

flutter_draggable_gridview 프로젝트 이미지
Stars
103
Forks
22
최근 푸시(UTC)
2025. 12. 11.
프로젝트 상태
활성
MindInventory GitHub avatar
GITHUB Organization

MindInventory ↗

MindInventory, a leading digital transformation company redefines digital experiences for businesses to thrive in the ever-changing digital landscape.

언어DartRubyHTMLSwiftKotlinObjective-C

기술 주제

이 저장소가 배포한 패키지

사용 중인 의존성

의존성 목록 3 개
  • flutter{"sdk":"flutter"}
  • flutter_test개발 의존성{"sdk":"flutter"}
  • flutter_lints개발 의존성^3.0.1

원본 README

아래는 영문 원문 스냅샷입니다. 최신 내용은 GitHub에서 확인하세요.

README 펼치기 / 접기

flutter_draggable_gridview

flutter_draggable_gridview version flutter_draggable_gridview Git Stars https://img.shields.io/badge/platform-android-blue https://img.shields.io/badge/platform-iOS-blue https://img.shields.io/badge/platform-Linux-blue https://img.shields.io/badge/platform-Mac-blue https://img.shields.io/badge/platform-web-blue https://img.shields.io/badge/platform-Windows-blue MIT License

This package supports drag & drop widgets inside the GridView.builder for multiplatform. It provides all the properties which are available in Gridview.builder and easy to implement with the few lines of code.

Draggable GridView.

Draggable GridView

Usage

Example
      DraggableGridViewBuilder(
        gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
          crossAxisCount: 2,
          childAspectRatio: MediaQuery.of(context).size.width / (MediaQuery.of(context).size.height / 3),
        ),
        children: _listOfDraggableGridItem,
        isOnlyLongPress: false,
        dragCompletion: (List<DraggableGridItem> list, int beforeIndex, int afterIndex) {
          print( 'onDragAccept: $beforeIndex -> $afterIndex');
        },
        dragFeedback: (List<DraggableGridItem> list, int index) {
          return Container(
            child: list[index].child,
            width: 200,
            height: 150,
          );
        },
        dragPlaceHolder: (List<DraggableGridItem> list, int index) {
          return PlaceHolderWidget(
            child: Container(
              color: Colors.white,
            ),
          );
        },
      );
Required parameters
gridDelegate:

A delegate that controls the layout of the children within the GridView.

children:

This property contains list of [DraggableGridItem] and it is use to show the widget inside the GridView.builder to provide the drag & drop functionality. Also, it contains isDraggable parameter which manages enable/disable the drag & drop functionality.

dragCompletion:

This callback provides updated list and old and new indexes.

Optional parameters
isOnlyLongPress:

This property contains bool value. If this property is false then it works with simple press draggable or else it works with long press. default value is 'true'.

dragFeedback:

With this callback, you have to return a Widget and we will use this widget in feedback. Learn more about feedback from Draggable class.

dragPlaceHolder:

TWith this callback, you have to return a PlaceHolderWidget and we will use this widget in place holder.

dragChildWhenDragging:

With this callback, you have to return a Widget and we will display this widget instead of child when drags are under way. Learn more about childWhenDragging from Draggable class.

Last But Not Least :heart_eyes:
You can use all the GridView.builder properties with DraggableGridViewBuilder class.

Note:

The result returns in List. so it can be lost later, you are responsible for storing it somewhere permanent (if needed).

Guideline for contributors

Contribution towards our repository is always welcome, we request contributors to create a pull request to the develop branch only.

Guideline to report an issue/feature request

It would be great for us if the reporter can share the below things to understand the root cause of the issue.

  • Library version
  • Code snippet
  • Logs if applicable
  • Device specification like (Manufacturer, OS version, etc)
  • Screenshot/video with steps to reproduce the issue

LICENSE!

Flutter Draggable GridView is MIT-licensed.

Let us know!

We’d be really happy if you send us links to your projects where you use our component. Just send an email to sales@mindinventory.com And do let us know if you have any questions or suggestion regarding our work.