### Draggable GridView Example Source: https://github.com/mindinventory/flutter_draggable_gridview/blob/main/README.md Demonstrates how to use the DraggableGridViewBuilder widget to create a grid with drag-and-drop functionality. It includes configurations for grid layout, drag completion, feedback, and placeholder widgets. ```dart DraggableGridViewBuilder( gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( crossAxisCount: 2, childAspectRatio: MediaQuery.of(context).size.width / (MediaQuery.of(context).size.height / 3), ), children: _listOfDraggableGridItem, isOnlyLongPress: false, dragCompletion: (List list, int beforeIndex, int afterIndex) { print( 'onDragAccept: $beforeIndex -> $afterIndex'); }, dragFeedback: (List list, int index) { return Container( child: list[index].child, width: 200, height: 150, ); }, dragPlaceHolder: (List list, int index) { return PlaceHolderWidget( child: Container( color: Colors.white, ), ); }, ); ``` -------------------------------- ### DraggableGridViewBuilder Parameters Source: https://github.com/mindinventory/flutter_draggable_gridview/blob/main/README.md Details the required and optional parameters for the DraggableGridViewBuilder widget, explaining their purpose and usage in implementing drag-and-drop grid functionality. ```APIDOC DraggableGridViewBuilder: gridDelegate: SliverGridDelegateWithFixedCrossAxisCount A delegate that controls the layout of the children within the GridView. children: List 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: (List list, int beforeIndex, int afterIndex) => void This callback provides updated list and old and new indexes. isOnlyLongPress: bool (optional, default: true) If this property is false then it works with simple press draggable or else it works with long press. dragFeedback: (List list, int index) => Widget (optional) With this callback, you have to return a Widget and we will use this widget in feedback. Learn more about feedback from [Draggable](https://api.flutter.dev/flutter/widgets/Draggable-class.html#:~:text=Draggable%20class%20Null%20safety,user's%20finger%20across%20the%20screen) class. dragPlaceHolder: (List list, int index) => PlaceHolderWidget (optional) With this callback, you have to return a PlaceHolderWidget and we will use this widget in place holder. dragChildWhenDragging: (List list, int index) => Widget (optional) 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](https://api.flutter.dev/flutter/widgets/Draggable-class.html#:~:text=Draggable%20class%20Null%20safety,user's%20finger%20across%20the%20screen) class. Note: You can use all the GridView.builder properties with DraggableGridViewBuilder class. ``` -------------------------------- ### Service Worker Registration for Flutter App Source: https://github.com/mindinventory/flutter_draggable_gridview/blob/main/example/web/index.html This JavaScript snippet demonstrates how to register a service worker for a Flutter web application. It listens for the 'flutter-first-frame' event to ensure the service worker is registered after the initial frame is rendered, which is a common practice for optimizing Flutter web performance. ```javascript if ('serviceWorker' in navigator) { window.addEventListener('flutter-first-frame', function () { navigator.serviceWorker.register('flutter_service_worker.js'); }); } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.