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(
|
(option) => SelectOptionTag.fromOption(
|
||||||
context: context,
|
context: context,
|
||||||
option: option,
|
option: option,
|
||||||
|
onSelected: () {
|
||||||
|
SelectOptionCellEditor.show(
|
||||||
|
context: context,
|
||||||
|
cellController: widget.cellControllerBuilder.build()
|
||||||
|
as GridSelectOptionCellController,
|
||||||
|
);
|
||||||
|
},
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.toList();
|
.toList();
|
||||||
|
|
||||||
return IntrinsicHeight(
|
return IntrinsicHeight(
|
||||||
child: Stack(
|
child: Padding(
|
||||||
alignment: AlignmentDirectional.center,
|
padding: const EdgeInsets.symmetric(vertical: 6),
|
||||||
fit: StackFit.expand,
|
child: SizedBox.expand(
|
||||||
children: [
|
child: Wrap(spacing: 4, runSpacing: 2, children: children),
|
||||||
Padding(
|
),
|
||||||
padding: const EdgeInsets.symmetric(vertical: 6),
|
|
||||||
child: Wrap(spacing: 4, runSpacing: 2, children: children),
|
|
||||||
),
|
|
||||||
_SelectOptionDialog(
|
|
||||||
controller: widget.cellControllerBuilder.build(),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -98,12 +98,13 @@ class _SelectOptionDialog extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return InkWell(onTap: () {
|
return SizedBox(
|
||||||
SelectOptionCellEditor.show(
|
child: InkWell(onTap: () {
|
||||||
context,
|
SelectOptionCellEditor.show(
|
||||||
_controller,
|
context: context,
|
||||||
() {},
|
cellController: _controller,
|
||||||
);
|
);
|
||||||
});
|
}),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -183,9 +183,10 @@ class SelectOptionWrap extends StatelessWidget {
|
|||||||
InkWell(onTap: () {
|
InkWell(onTap: () {
|
||||||
onFocus?.call(true);
|
onFocus?.call(true);
|
||||||
SelectOptionCellEditor.show(
|
SelectOptionCellEditor.show(
|
||||||
context,
|
context: context,
|
||||||
cellControllerBuilder.build() as GridSelectOptionCellController,
|
cellController:
|
||||||
() => onFocus?.call(false),
|
cellControllerBuilder.build() as GridSelectOptionCellController,
|
||||||
|
onDismissed: () => onFocus?.call(false),
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
|
@ -26,11 +26,11 @@ const double _editorPannelWidth = 300;
|
|||||||
|
|
||||||
class SelectOptionCellEditor extends StatelessWidget with FlowyOverlayDelegate {
|
class SelectOptionCellEditor extends StatelessWidget with FlowyOverlayDelegate {
|
||||||
final GridSelectOptionCellController cellController;
|
final GridSelectOptionCellController cellController;
|
||||||
final VoidCallback onDismissed;
|
final VoidCallback? onDismissed;
|
||||||
|
|
||||||
const SelectOptionCellEditor({
|
const SelectOptionCellEditor({
|
||||||
required this.cellController,
|
required this.cellController,
|
||||||
required this.onDismissed,
|
this.onDismissed,
|
||||||
Key? key,
|
Key? key,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
@ -58,14 +58,14 @@ class SelectOptionCellEditor extends StatelessWidget with FlowyOverlayDelegate {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void show(
|
static void show({
|
||||||
BuildContext context,
|
required BuildContext context,
|
||||||
GridSelectOptionCellController cellContext,
|
required GridSelectOptionCellController cellController,
|
||||||
VoidCallback onDismissed,
|
VoidCallback? onDismissed,
|
||||||
) {
|
}) {
|
||||||
SelectOptionCellEditor.remove(context);
|
SelectOptionCellEditor.remove(context);
|
||||||
final editor = SelectOptionCellEditor(
|
final editor = SelectOptionCellEditor(
|
||||||
cellController: cellContext,
|
cellController: cellController,
|
||||||
onDismissed: onDismissed,
|
onDismissed: onDismissed,
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -94,7 +94,7 @@ class SelectOptionCellEditor extends StatelessWidget with FlowyOverlayDelegate {
|
|||||||
bool asBarrier() => true;
|
bool asBarrier() => true;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void didRemove() => onDismissed();
|
void didRemove() => onDismissed?.call();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _OptionList extends StatelessWidget {
|
class _OptionList extends StatelessWidget {
|
||||||
|
Loading…
Reference in New Issue
Block a user