Skip to content

Commit 546b1d2

Browse files
committed
fix: #509 enable select on tag
1 parent 5da8144 commit 546b1d2

File tree

2 files changed

+20
-14
lines changed

2 files changed

+20
-14
lines changed

frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/cell/select_option_cell/extension.dart

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import 'package:flowy_infra/theme.dart';
22
import 'package:flowy_infra_ui/style_widget/hover.dart';
33
import 'package:flowy_infra_ui/style_widget/text.dart';
4+
import 'package:flowy_infra_ui/widget/spacing.dart';
45
import 'package:flowy_sdk/protobuf/flowy-grid/selection_type_option.pb.dart';
56
import 'package:flutter/material.dart';
67
import 'package:easy_localization/easy_localization.dart';
@@ -64,22 +65,26 @@ class SelectOptionTag extends StatelessWidget {
6465
final String name;
6566
final Color color;
6667
final bool isSelected;
68+
final VoidCallback? onSelected;
6769
const SelectOptionTag({
6870
required this.name,
6971
required this.color,
72+
this.onSelected,
7073
this.isSelected = false,
7174
Key? key,
7275
}) : super(key: key);
7376

7477
factory SelectOptionTag.fromSelectOption({
7578
required BuildContext context,
7679
required SelectOption option,
80+
VoidCallback? onSelected,
7781
bool isSelected = false,
7882
}) {
7983
return SelectOptionTag(
8084
name: option.name,
8185
color: option.color.make(context),
8286
isSelected: isSelected,
87+
onSelected: onSelected,
8388
);
8489
}
8590

@@ -92,19 +97,12 @@ class SelectOptionTag extends StatelessWidget {
9297
backgroundColor: color,
9398
labelPadding: const EdgeInsets.symmetric(horizontal: 6),
9499
selected: true,
95-
onSelected: (_) {},
100+
onSelected: (_) {
101+
if (onSelected != null) {
102+
onSelected!();
103+
}
104+
},
96105
);
97-
98-
// return Container(
99-
// decoration: BoxDecoration(
100-
// color: option.color.make(context),
101-
// shape: BoxShape.rectangle,
102-
// borderRadius: BorderRadius.circular(8.0),
103-
// ),
104-
// child: Center(child: FlowyText.medium(option.name, fontSize: 12)),
105-
// margin: const EdgeInsets.symmetric(horizontal: 3.0),
106-
// padding: const EdgeInsets.symmetric(horizontal: 6.0),
107-
// );
108106
}
109107
}
110108

@@ -136,7 +134,11 @@ class SelectOptionTagCell extends StatelessWidget {
136134
Flexible(
137135
fit: FlexFit.loose,
138136
flex: 2,
139-
child: SelectOptionTag.fromSelectOption(context: context, option: option),
137+
child: SelectOptionTag.fromSelectOption(
138+
context: context,
139+
option: option,
140+
onSelected: () => onSelected(option),
141+
),
140142
),
141143
const Spacer(),
142144
...children,

frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/cell/select_option_cell/select_option_editor.dart

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,11 @@ class _SelectOptionCell extends StatelessWidget {
233233
context.read<SelectOptionCellEditorBloc>().add(SelectOptionEditorEvent.selectOption(option.id));
234234
},
235235
children: [
236-
if (isSelected) svgWidget("grid/checkmark"),
236+
if (isSelected)
237+
Padding(
238+
padding: const EdgeInsets.only(right: 6),
239+
child: svgWidget("grid/checkmark"),
240+
),
237241
],
238242
),
239243
),

0 commit comments

Comments
 (0)