Skip to content

Commit

Permalink
Merge pull request #94 from saileshbro/master
Browse files Browse the repository at this point in the history
feat: add key to `DragAndDropItem` and `DragAndDropList`
  • Loading branch information
philip-brink authored Jun 12, 2024
2 parents cb96762 + a08f621 commit 39fa614
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion lib/drag_and_drop_item.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@ class DragAndDropItem implements DragAndDropInterface {
/// Set to true if it can be reordered.
/// Set to false if it must remain fixed.
final bool canDrag;

final Key? key;
DragAndDropItem({
required this.child,
this.feedbackWidget,
this.canDrag = true,
this.key,
});
}
5 changes: 4 additions & 1 deletion lib/drag_and_drop_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,10 @@ class DragAndDropList implements DragAndDropListInterface {
/// Set to true if it can be reordered.
/// Set to false if it must remain fixed.
final bool canDrag;

final Key? key;
DragAndDropList({
required this.children,
this.key,
this.header,
this.footer,
this.leftSide,
Expand Down Expand Up @@ -95,6 +96,7 @@ class DragAndDropList implements DragAndDropListInterface {
}

return Container(
key: key,
width: params.axis == Axis.vertical
? double.infinity
: params.listWidth - params.listPadding!.horizontal,
Expand Down Expand Up @@ -122,6 +124,7 @@ class DragAndDropList implements DragAndDropListInterface {
}
for (int i = 0; i < children.length; i++) {
allChildren.add(DragAndDropItemWrapper(
key: children[i].key,
child: children[i],
parameters: parameters,
));
Expand Down
1 change: 0 additions & 1 deletion lib/drag_and_drop_list_interface.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ abstract class DragAndDropListInterface implements DragAndDropInterface {
/// Set to true if it can be reordered.
/// Set to false if it must remain fixed.
bool get canDrag;

Widget generateWidget(DragAndDropBuilderParameters params);
}

Expand Down

0 comments on commit 39fa614

Please sign in to comment.