mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
fix: remove default group for checkbox
This commit is contained in:
parent
29e7e01146
commit
0c45e3ce95
@ -83,6 +83,7 @@ class _BoardContentState extends State<BoardContent> {
|
||||
buildWhen: (previous, current) => previous.groupIds != current.groupIds,
|
||||
builder: (context, state) {
|
||||
final column = Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [const _ToolbarBlocAdaptor(), _buildBoard(context)],
|
||||
);
|
||||
|
||||
|
@ -8,7 +8,9 @@ pub trait GroupAction: Send + Sync {
|
||||
fn default_cell_rev(&self) -> Option<CellRevision> {
|
||||
None
|
||||
}
|
||||
|
||||
fn use_default_group(&self) -> bool {
|
||||
true
|
||||
}
|
||||
fn can_group(&self, content: &str, cell_data: &Self::CellDataType) -> bool;
|
||||
fn add_row_if_match(&mut self, row_rev: &RowRevision, cell_data: &Self::CellDataType) -> Vec<GroupChangesetPB>;
|
||||
fn remove_row_if_match(&mut self, row_rev: &RowRevision, cell_data: &Self::CellDataType) -> Vec<GroupChangesetPB>;
|
||||
|
@ -97,11 +97,8 @@ where
|
||||
self.groups_map.values().collect()
|
||||
}
|
||||
|
||||
/// Returns the all the groups that contain the default group.
|
||||
pub(crate) fn clone_groups(&self) -> Vec<Group> {
|
||||
let mut groups: Vec<Group> = self.groups_map.values().cloned().collect();
|
||||
groups.push(self.default_group.clone());
|
||||
groups
|
||||
pub(crate) fn default_group(&self) -> &Group {
|
||||
&self.default_group
|
||||
}
|
||||
|
||||
/// Iterate mut the groups. The default group will be the last one that get mutated.
|
||||
|
@ -182,7 +182,13 @@ where
|
||||
}
|
||||
|
||||
fn groups(&self) -> Vec<Group> {
|
||||
self.group_ctx.clone_groups()
|
||||
if self.use_default_group() {
|
||||
let mut groups: Vec<Group> = self.group_ctx.concrete_groups().into_iter().cloned().collect();
|
||||
groups.push(self.group_ctx.default_group().clone());
|
||||
groups
|
||||
} else {
|
||||
self.group_ctx.concrete_groups().into_iter().cloned().collect()
|
||||
}
|
||||
}
|
||||
|
||||
fn get_group(&self, group_id: &str) -> Option<(usize, Group)> {
|
||||
|
@ -27,6 +27,10 @@ impl GroupAction for CheckboxGroupController {
|
||||
Some(CellRevision::new(UNCHECK.to_string()))
|
||||
}
|
||||
|
||||
fn use_default_group(&self) -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
fn can_group(&self, content: &str, cell_data: &Self::CellDataType) -> bool {
|
||||
if cell_data.is_check() {
|
||||
content == CHECK
|
||||
|
Loading…
Reference in New Issue
Block a user