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.

fix: #509 enable select on tag

appflowy546b1d22f437
diff --git a/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/cell/select_option_cell/extension.dart b/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/cell/select_option_cell/extension.dart
index 6f8212106a..24817087c7 100644
--- a/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/cell/select_option_cell/extension.dart
+++ b/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/cell/select_option_cell/extension.dart
@@ -1,6 +1,7 @@
import 'package:flowy_infra/theme.dart';
import 'package:flowy_infra_ui/style_widget/hover.dart';
import 'package:flowy_infra_ui/style_widget/text.dart';
+import 'package:flowy_infra_ui/widget/spacing.dart';
import 'package:flowy_sdk/protobuf/flowy-grid/selection_type_option.pb.dart';
import 'package:flutter/material.dart';
import 'package:easy_localization/easy_localization.dart';
@@ -64,9 +65,11 @@ class SelectOptionTag extends StatelessWidget {
final String name;
final Color color;
final bool isSelected;
+ final VoidCallback? onSelected;
const SelectOptionTag({
required this.name,
required this.color,
+ this.onSelected,
this.isSelected = false,
Key? key,
}) : super(key: key);
@@ -74,12 +77,14 @@ class SelectOptionTag extends StatelessWidget {
factory SelectOptionTag.fromSelectOption({
required BuildContext context,
required SelectOption option,
+ VoidCallback? onSelected,
bool isSelected = false,
}) {
return SelectOptionTag(
name: option.name,
color: option.color.make(context),
isSelected: isSelected,
+ onSelected: onSelected,
);
}
@@ -92,19 +97,12 @@ class SelectOptionTag extends StatelessWidget {
backgroundColor: color,
labelPadding: const EdgeInsets.symmetric(horizontal: 6),
selected: true,
- onSelected: (_) {},
+ onSelected: (_) {
+ if (onSelected != null) {
+ onSelected!();
+ }
+ },
);
-
- // return Container(
- // decoration: BoxDecoration(
- // color: option.color.make(context),
- // shape: BoxShape.rectangle,
- // borderRadius: BorderRadius.circular(8.0),
- // ),
- // child: Center(child: FlowyText.medium(option.name, fontSize: 12)),
- // margin: const EdgeInsets.symmetric(horizontal: 3.0),
- // padding: const EdgeInsets.symmetric(horizontal: 6.0),
- // );
}
}
@@ -136,7 +134,11 @@ class SelectOptionTagCell extends StatelessWidget {
Flexible(
fit: FlexFit.loose,
flex: 2,
- child: SelectOptionTag.fromSelectOption(context: context, option: option),
+ child: SelectOptionTag.fromSelectOption(
+ context: context,
+ option: option,
+ onSelected: () => onSelected(option),
+ ),
),
const Spacer(),
...children,
diff --git a/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/cell/select_option_cell/select_option_editor.dart b/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/cell/select_option_cell/select_option_editor.dart
index 01972eb41a..1829157f51 100644
--- a/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/cell/select_option_cell/select_option_editor.dart
+++ b/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/cell/select_option_cell/select_option_editor.dart
@@ -233,7 +233,11 @@ class _SelectOptionCell extends StatelessWidget {
context.read<SelectOptionCellEditorBloc>().add(SelectOptionEditorEvent.selectOption(option.id));
},
children: [
- if (isSelected) svgWidget("grid/checkmark"),
+ if (isSelected)
+ Padding(
+ padding: const EdgeInsets.only(right: 6),
+ child: svgWidget("grid/checkmark"),
+ ),
],
),
),