Skip to content

Commit

Permalink
Merge pull request #19 from richardshiue/insert-group
Browse files Browse the repository at this point in the history
feat: allow inserting a new group at given index
  • Loading branch information
appflowy authored Nov 13, 2023
2 parents 50df6fc + 3d876e3 commit 2de4fe0
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions lib/src/widgets/board_data.dart
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,19 @@ class AppFlowyBoardController extends ChangeNotifier
if (notify) notifyListeners();
}

/// Inserts a new group at the given index
///
/// If you don't want to notify the listener after inserting the new group, the
/// [notify] should set to false. Default value is true.
void insertGroup(int index, AppFlowyGroupData groupData, {bool notify = true}) {
if (_groupControllers[groupData.id] != null) return;

final controller = AppFlowyGroupController(groupData: groupData);
_groupDatas.insert(index, groupData);
_groupControllers[groupData.id] = controller;
if (notify) notifyListeners();
}

/// Adds a list of groups to the end of the current group list.
///
/// If you don't want to notify the listener after adding the groups, the
Expand Down

0 comments on commit 2de4fe0

Please sign in to comment.