{"id":19273085,"url":"https://github.com/fluttercandies/flutter_draggable_container","last_synced_at":"2025-10-23T00:42:59.622Z","repository":{"id":56828230,"uuid":"215986972","full_name":"fluttercandies/flutter_draggable_container","owner":"fluttercandies","description":"A Draggable Widget Container","archived":false,"fork":false,"pushed_at":"2021-04-03T20:23:15.000Z","size":11271,"stargazers_count":26,"open_issues_count":0,"forks_count":5,"subscribers_count":3,"default_branch":"master","last_synced_at":"2023-08-20T21:49:19.677Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fluttercandies.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-10-18T09:18:34.000Z","updated_at":"2023-06-09T07:57:20.000Z","dependencies_parsed_at":"2022-08-29T02:40:42.823Z","dependency_job_id":null,"html_url":"https://github.com/fluttercandies/flutter_draggable_container","commit_stats":null,"previous_names":[],"tags_count":0,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fluttercandies%2Fflutter_draggable_container","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fluttercandies%2Fflutter_draggable_container/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fluttercandies%2Fflutter_draggable_container/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fluttercandies%2Fflutter_draggable_container/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fluttercandies","download_url":"https://codeload.github.com/fluttercandies/flutter_draggable_container/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223881795,"owners_count":17219268,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-09T20:40:54.763Z","updated_at":"2025-10-23T00:42:59.268Z","avatar_url":"https://github.com/fluttercandies.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 可以拖动子部件的容器部件\n# A Draggable Widget Container \n\n## 可拖动子部件，可删除子部件，可以固定子部件位置\n## Each children is draggable, deletable, fixable.\n\n## 截图 / Screenshots\n\n[\u003cimg src=\"https://github.com/gzlock/images/raw/master/flutter_draggable_container/1.gif\" width=\"200\"\u003e](https://github.com/gzlock/images/raw/master/flutter_draggable_container/1.gif)\n\n### 模式 / Mode\n\n- 正常模式 / Normal Mode:\n    - 不拦截子部件的手势事件\n    - Do not intercept the GestureDetector events of the child widget\n    - 不能拖动和删除子部件\n    - Can't drag and delete the children widget\n    \n- 编辑模式 / Edit mode:\n    - 长按子部件进入编辑模式\n    - Long press the children widget to enter the edit mode\n    - 进入编辑模式后，不再需要长按来拖动子部件，直接拖动就可以了\n    - In the edit mode, you can just drag the tile directly.\n    - 在可删除子部件上显示删除按钮\n    - Show the delete button on the deletable child widget\n    - 拦截所有子部件的手势事件\n    - Intercept the child widget gesture event.\n    - 可以拖动和删除子部件\n    - the children widget can drag and delete.\n    \n\n- DraggableContainer的构造函数参数 / The DraggableContainer Constructor parameters\n    - required List\\\u003cT extends DraggableItem\\\u003e items\n    - required Widget? NullableItemBuilder\\\u003cT extends DraggableItem\\\u003e(BuildContext context, T? item) itemBuilder\n        - 子项widget的构建器。\n        - Item widget builder.\n    - required SliverGirdDelegate gridDelegate\n        - 布局依赖于gridDelegate。\n        - The layout depends on the gridDelegate.\n    - bool? shrinkWrap\n        - 紧缩水平宽度大小，方便水平居中，默认为false。\n        - Shrink the horizontal size, default is false.\n    - Widget? NullableItemBuilder\\\u003cT extends DraggableItem\\\u003e(BuildContext context, T? item) deleteButtonBuilder\n        - 子项删除按钮的构建器。\n        - The delete button builder for the item.\n    - Widget? NullableItemBuilder\\\u003cT extends DraggableItem\\\u003e(BuildContext context, T? item) slotBuilder\n        - 槽位组件的构建器。\n        - The slot widget builder.\n    - BoxDecoration? draggingDecoration, default is a shadow style.\n        - 当拖动子项时，包裹在子项外部的样式，默认为阴影效果。\n        - When dragging the item widget, the style wrapped the item widget.\n    - Duration? animationDuration, default 200ms.\n        - 子项widget位移的动画时间。\n        - The animation time of the child widget displacement.\n    - bool? tapOutSideExitEditMode, default true.\n        - 当点击了DraggableContainer外部后，退出编辑模式。\n        - When tap outside of the draggable container, exit the edit mode.\n    - onChanged(List\\\u003cT extends DraggableItem\\\u003e items)\n        - 当子项目改变时触发(拖动过后，删除后)\n        - Trigger when the items changed(dragged, deleted)\n    - onEditModeChanged(bool mode)\n        - mode为true则进入了编辑模式，为false则退出了编辑模式.\n        - When mode is true then in the draggable mode. If false it mean exited the draggable mode.\n    - Future\\\u003cbool\\\u003e beforeRemove(T? item, int slotIndex)\n        - 删除item的确认事件，返回true删除，返回false不删除\n        - The event for confirm to delete a item, if return true then delete, if false then no action.\n    - Future\\\u003cbool\\\u003e beforeDrop({T? fromItem, int fromSlotIndex, T? toItem, int toSlotIndex})\n        - 将一个item从A点移到B点后的确认事件，返回true为允许放下，返回false不允许放下，\n\n            会覆盖toItem.fixed属性。\n        - The confirmation event after moving an item from point A to point B. Returns true to allow dropping, returns false to not allow dropping.\n\n            will override the toItem.fixed property.\n\n- DraggableContainerState的方法 / The DraggableContainerState methods:\n    - getter / setter bool editMode\n        - 读取或设置编辑模式。\n        - get or set the edit mode.\n\n    - List\\\u003cT extends DraggableItem\\\u003e items\n        - 项目列表。\n        - Item list.\n\n    - Future\\\u003cvoid\\\u003e addSlot(\\\u003cT extends DraggableItem\\\u003e? item)\n        - 添加一个新的槽。        \n        - Add a new slot.\n    - Future\\\u003cT extends DraggableItem\\\u003e removeSlot(int index)\n        - 删除一个槽位，返回item。\n        - Remove the slot of index and return the item.\n\n    - removeItem(\\\u003cT extends DraggableItem\\\u003e item)\n    - removeItemAt(int index)\n        - 删除item。\n        - Delete item.\n\n    - replaceItem(int index, \\\u003cT extends DraggableItem\\\u003e? item)\n        - 替换item。\n        - Replace item.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffluttercandies%2Fflutter_draggable_container","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffluttercandies%2Fflutter_draggable_container","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffluttercandies%2Fflutter_draggable_container/lists"}