Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix #27

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/src/widgets/board.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class AppFlowyBoardConfig {
final EdgeInsets groupBodyPadding;
final EdgeInsets groupFooterPadding;
final bool stretchGroupHeight;

final List<BoxShadow>? boxShadow;
// card
final EdgeInsets cardMargin;

Expand All @@ -45,6 +45,7 @@ class AppFlowyBoardConfig {
this.groupFooterPadding = const EdgeInsets.symmetric(horizontal: 12),
this.stretchGroupHeight = true,
this.cardMargin = const EdgeInsets.symmetric(horizontal: 3, vertical: 4),
this.boxShadow,
});
}

Expand Down
11 changes: 11 additions & 0 deletions lib/src/widgets/board_data.dart
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,17 @@ class AppFlowyBoardController extends ChangeNotifier
getGroupController(groupId)?.replaceOrInsertItem(item);
}

void setGroupDraggability(bool groupDragging, itemDragging, List<String>? nonDraggableIDs) {
for (final groupController in _groupControllers.values) {
if (nonDraggableIDs != null && nonDraggableIDs.isNotEmpty && nonDraggableIDs.contains(groupController.groupData.id)) {
groupController.setDraggability(false, itemDragging);
} else {
groupController.setDraggability(groupDragging, itemDragging);
}
}
notifyListeners();
}

void enableGroupDragging(bool isEnable) {
for (var groupController in _groupControllers.values) {
groupController.enableDragging(isEnable);
Expand Down
5 changes: 4 additions & 1 deletion lib/src/widgets/board_group/group.dart
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ class AppFlowyBoardGroup extends StatefulWidget {

final Color backgroundColor;

final List<BoxShadow>? boxShadow;

final bool stretchGroupHeight;

final DraggingStateStorage? dragStateStorage;
Expand Down Expand Up @@ -116,6 +118,7 @@ class AppFlowyBoardGroup extends StatefulWidget {
this.margin = EdgeInsets.zero,
this.bodyPadding = EdgeInsets.zero,
this.cornerRadius = 0.0,
this.boxShadow,
this.backgroundColor = Colors.transparent,
this.stretchGroupHeight = true,
}) : config = const ReorderFlexConfig(),
Expand Down Expand Up @@ -189,7 +192,7 @@ class _AppFlowyBoardGroupState extends State<AppFlowyBoardGroup> {
clipBehavior: Clip.hardEdge,
decoration: BoxDecoration(
color: widget.backgroundColor,
borderRadius: BorderRadius.circular(widget.cornerRadius),
borderRadius: BorderRadius.circular(widget.cornerRadius), boxShadow: widget.boxShadow,
),
child: Flex(
direction: Axis.vertical,
Expand Down
10 changes: 10 additions & 0 deletions lib/src/widgets/board_group/group_data.dart
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,16 @@ class AppFlowyGroupController extends ChangeNotifier with EquatableMixin {
-1;
}

void setDraggability(bool groupDragging, itemDragging) {
groupData.draggable = groupDragging;

for (final item in groupData._items) {
item.draggable = itemDragging;
}
_notify();
}


void enableDragging(bool isEnable) {
groupData.draggable = isEnable;

Expand Down