mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
chore: make select option cell selectable
This commit is contained in:
parent
8894e9c784
commit
9bc2bc82be
@ -56,23 +56,23 @@ class _BoardSelectOptionCellState extends State<BoardSelectOptionCell> {
|
||||
(option) => SelectOptionTag.fromOption(
|
||||
context: context,
|
||||
option: option,
|
||||
onSelected: () {
|
||||
SelectOptionCellEditor.show(
|
||||
context: context,
|
||||
cellController: widget.cellControllerBuilder.build()
|
||||
as GridSelectOptionCellController,
|
||||
);
|
||||
},
|
||||
),
|
||||
)
|
||||
.toList();
|
||||
|
||||
return IntrinsicHeight(
|
||||
child: Stack(
|
||||
alignment: AlignmentDirectional.center,
|
||||
fit: StackFit.expand,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 6),
|
||||
child: Wrap(spacing: 4, runSpacing: 2, children: children),
|
||||
),
|
||||
_SelectOptionDialog(
|
||||
controller: widget.cellControllerBuilder.build(),
|
||||
),
|
||||
],
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 6),
|
||||
child: SizedBox.expand(
|
||||
child: Wrap(spacing: 4, runSpacing: 2, children: children),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
@ -98,12 +98,13 @@ class _SelectOptionDialog extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return InkWell(onTap: () {
|
||||
SelectOptionCellEditor.show(
|
||||
context,
|
||||
_controller,
|
||||
() {},
|
||||
);
|
||||
});
|
||||
return SizedBox(
|
||||
child: InkWell(onTap: () {
|
||||
SelectOptionCellEditor.show(
|
||||
context: context,
|
||||
cellController: _controller,
|
||||
);
|
||||
}),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -183,9 +183,10 @@ class SelectOptionWrap extends StatelessWidget {
|
||||
InkWell(onTap: () {
|
||||
onFocus?.call(true);
|
||||
SelectOptionCellEditor.show(
|
||||
context,
|
||||
cellControllerBuilder.build() as GridSelectOptionCellController,
|
||||
() => onFocus?.call(false),
|
||||
context: context,
|
||||
cellController:
|
||||
cellControllerBuilder.build() as GridSelectOptionCellController,
|
||||
onDismissed: () => onFocus?.call(false),
|
||||
);
|
||||
}),
|
||||
],
|
||||
|
@ -26,11 +26,11 @@ const double _editorPannelWidth = 300;
|
||||
|
||||
class SelectOptionCellEditor extends StatelessWidget with FlowyOverlayDelegate {
|
||||
final GridSelectOptionCellController cellController;
|
||||
final VoidCallback onDismissed;
|
||||
final VoidCallback? onDismissed;
|
||||
|
||||
const SelectOptionCellEditor({
|
||||
required this.cellController,
|
||||
required this.onDismissed,
|
||||
this.onDismissed,
|
||||
Key? key,
|
||||
}) : super(key: key);
|
||||
|
||||
@ -58,14 +58,14 @@ class SelectOptionCellEditor extends StatelessWidget with FlowyOverlayDelegate {
|
||||
);
|
||||
}
|
||||
|
||||
static void show(
|
||||
BuildContext context,
|
||||
GridSelectOptionCellController cellContext,
|
||||
VoidCallback onDismissed,
|
||||
) {
|
||||
static void show({
|
||||
required BuildContext context,
|
||||
required GridSelectOptionCellController cellController,
|
||||
VoidCallback? onDismissed,
|
||||
}) {
|
||||
SelectOptionCellEditor.remove(context);
|
||||
final editor = SelectOptionCellEditor(
|
||||
cellController: cellContext,
|
||||
cellController: cellController,
|
||||
onDismissed: onDismissed,
|
||||
);
|
||||
|
||||
@ -94,7 +94,7 @@ class SelectOptionCellEditor extends StatelessWidget with FlowyOverlayDelegate {
|
||||
bool asBarrier() => true;
|
||||
|
||||
@override
|
||||
void didRemove() => onDismissed();
|
||||
void didRemove() => onDismissed?.call();
|
||||
}
|
||||
|
||||
class _OptionList extends StatelessWidget {
|
||||
|
Loading…
Reference in New Issue
Block a user