mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
Merge pull request #983 from AppFlowy-IO/feat/disable_unsupport_group_field
chore: disable group field that does not support grouping
This commit is contained in:
commit
c97cb7c194
@ -290,5 +290,26 @@ class GridFieldContext {
|
||||
|
||||
bool get isGroupField => _isGroupField;
|
||||
|
||||
bool get canGroup {
|
||||
switch (_field.fieldType) {
|
||||
case FieldType.Checkbox:
|
||||
return true;
|
||||
case FieldType.DateTime:
|
||||
return false;
|
||||
case FieldType.MultiSelect:
|
||||
return true;
|
||||
case FieldType.Number:
|
||||
return false;
|
||||
case FieldType.RichText:
|
||||
return false;
|
||||
case FieldType.SingleSelect:
|
||||
return true;
|
||||
case FieldType.URL:
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
GridFieldContext({required FieldPB field}) : _field = field;
|
||||
}
|
||||
|
@ -31,10 +31,15 @@ class GridGroupList extends StatelessWidget {
|
||||
child: BlocBuilder<GridGroupBloc, GridGroupState>(
|
||||
builder: (context, state) {
|
||||
final cells = state.fieldContexts.map((fieldContext) {
|
||||
return _GridGroupCell(
|
||||
Widget cell = _GridGroupCell(
|
||||
fieldContext: fieldContext,
|
||||
key: ValueKey(fieldContext.id),
|
||||
);
|
||||
|
||||
if (!fieldContext.canGroup) {
|
||||
cell = IgnorePointer(child: Opacity(opacity: 0.3, child: cell));
|
||||
}
|
||||
return cell;
|
||||
}).toList();
|
||||
|
||||
return ListView.separated(
|
||||
|
@ -35,7 +35,7 @@ packages:
|
||||
path: "packages/appflowy_editor"
|
||||
relative: true
|
||||
source: path
|
||||
version: "0.0.3"
|
||||
version: "0.0.4"
|
||||
args:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
Loading…
Reference in New Issue
Block a user