Skip to content

Bring projects, wikis, and teams together with AI. AppFlowy is the AI collaborative workspace where you achieve more without losing control of your data. The leading open source Notion alternative.

chore: disable group field that does not support grouping

appflowy4de0008e443f
diff --git a/frontend/app_flowy/lib/plugins/grid/application/field/field_controller.dart b/frontend/app_flowy/lib/plugins/grid/application/field/field_controller.dart
index 7eb20a8a06..73127ed6df 100644
--- a/frontend/app_flowy/lib/plugins/grid/application/field/field_controller.dart
+++ b/frontend/app_flowy/lib/plugins/grid/application/field/field_controller.dart
@@ -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;
}
diff --git a/frontend/app_flowy/lib/plugins/grid/presentation/widgets/toolbar/grid_group.dart b/frontend/app_flowy/lib/plugins/grid/presentation/widgets/toolbar/grid_group.dart
index 0a82eef4bb..b400cda0fe 100644
--- a/frontend/app_flowy/lib/plugins/grid/presentation/widgets/toolbar/grid_group.dart
+++ b/frontend/app_flowy/lib/plugins/grid/presentation/widgets/toolbar/grid_group.dart
@@ -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(
diff --git a/frontend/app_flowy/pubspec.lock b/frontend/app_flowy/pubspec.lock
index bb8391eee9..8b8b9cfb05 100644
--- a/frontend/app_flowy/pubspec.lock
+++ b/frontend/app_flowy/pubspec.lock
@@ -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: