fix: display cell data after switching to text field

This commit is contained in:
appflowy
2022-09-27 17:26:22 +08:00
parent b578067092
commit 155cf3dca5
12 changed files with 193 additions and 39 deletions

View File

@ -97,7 +97,6 @@ class GridURLCell extends GridCellWidget {
class _GridURLCellState extends GridCellState<GridURLCell> {
final _popoverController = PopoverController();
GridURLCellController? _cellContext;
late URLCellBloc _cellBloc;
@override
@ -132,6 +131,7 @@ class _GridURLCellState extends GridCellState<GridURLCell> {
controller: _popoverController,
constraints: BoxConstraints.loose(const Size(300, 160)),
direction: PopoverDirection.bottomWithLeftAligned,
triggerActions: PopoverTriggerFlags.none,
offset: const Offset(0, 20),
child: SizedBox.expand(
child: GestureDetector(
@ -144,7 +144,8 @@ class _GridURLCellState extends GridCellState<GridURLCell> {
),
popupBuilder: (BuildContext popoverContext) {
return URLEditorPopover(
cellController: _cellContext!,
cellController: widget.cellControllerBuilder.build()
as GridURLCellController,
);
},
onClose: () {
@ -166,17 +167,13 @@ class _GridURLCellState extends GridCellState<GridURLCell> {
final uri = Uri.parse(url);
if (url.isNotEmpty && await canLaunchUrl(uri)) {
await launchUrl(uri);
} else {
_cellContext =
widget.cellControllerBuilder.build() as GridURLCellController;
widget.onCellEditing.value = true;
_popoverController.show();
}
}
@override
void requestBeginFocus() {
_openUrlOrEdit(_cellBloc.state.url);
widget.onCellEditing.value = true;
_popoverController.show();
}
@override