chore: fix some bugs

This commit is contained in:
appflowy 2022-08-16 20:34:12 +08:00 committed by Lucas.Xu
parent c5e24cc346
commit 99e408e2d7
11 changed files with 58 additions and 31 deletions

View File

@ -253,5 +253,7 @@ class GroupControllerDelegateImpl extends GroupControllerDelegate {
}
@override
void updateRow(String groupId, RowPB row) {}
void updateRow(String groupId, RowPB row) {
//
}
}

View File

@ -42,7 +42,13 @@ class _BoardSelectOptionCellState extends State<BoardSelectOptionCell> {
.toList();
return Align(
alignment: Alignment.centerLeft,
child: Wrap(children: children, spacing: 4, runSpacing: 2),
child: AbsorbPointer(
child: Wrap(
children: children,
spacing: 4,
runSpacing: 2,
),
),
);
},
),

View File

@ -37,10 +37,15 @@ class _BoardTextCellState extends State<BoardTextCell> {
} else {
return Align(
alignment: Alignment.centerLeft,
child: ConstrainedBox(
constraints: BoxConstraints.loose(
const Size(double.infinity, 100),
),
child: FlowyText.regular(
state.content,
fontSize: 14,
),
),
);
}
},

View File

@ -35,7 +35,12 @@ class _BoardUrlCellState extends State<BoardUrlCell> {
value: _cellBloc,
child: BlocBuilder<BoardURLCellBloc, BoardURLCellState>(
builder: (context, state) {
final richText = RichText(
if (state.content.isEmpty) {
return const SizedBox();
} else {
return Align(
alignment: Alignment.centerLeft,
child: RichText(
textAlign: TextAlign.left,
text: TextSpan(
text: state.content,
@ -45,12 +50,9 @@ class _BoardUrlCellState extends State<BoardUrlCell> {
decoration: TextDecoration.underline,
),
),
),
);
return Align(
alignment: Alignment.centerLeft,
child: richText,
);
}
},
),
);

View File

@ -73,7 +73,7 @@ class _BoardCardState extends State<BoardCard> {
(cellId) {
final child = widget.cellBuilder.buildCell(cellId);
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 4),
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 5),
child: child,
);
},

View File

@ -242,7 +242,7 @@ class IGridCellController<T, D> extends Equatable {
.getFieldTypeOptionData(fieldType: fieldType)
.then((result) {
return result.fold(
(data) => parser.fromBuffer(data.typeOptionData),
(data) => left(parser.fromBuffer(data.typeOptionData)),
(err) => right(err),
);
});

View File

@ -15,7 +15,6 @@ import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:table_calendar/table_calendar.dart';
import 'package:app_flowy/plugins/grid/application/prelude.dart';
import '../../../layout/sizes.dart';
import '../../header/type_option/date.dart';
@ -39,6 +38,7 @@ class DateCellEditor with FlowyOverlayDelegate {
final result =
await cellController.getFieldTypeOption(DateTypeOptionDataParser());
result.fold(
(dateTypeOptionPB) {
final calendar = _CellCalendarWidget(

View File

@ -49,8 +49,10 @@ class _NumberCellState extends GridFocusNodeCellState<GridNumberCell> {
controller: _controller,
focusNode: focusNode,
onEditingComplete: () => focusNode.unfocus(),
maxLines: null,
onSubmitted: (_) => focusNode.unfocus(),
maxLines: 1,
style: const TextStyle(fontSize: 14, fontWeight: FontWeight.w500),
textInputAction: TextInputAction.done,
decoration: const InputDecoration(
contentPadding: EdgeInsets.zero,
border: InputBorder.none,
@ -63,8 +65,6 @@ class _NumberCellState extends GridFocusNodeCellState<GridNumberCell> {
@override
Future<void> dispose() async {
_delayOperation?.cancel();
_cellBloc.close();
super.dispose();
}
@ -76,6 +76,11 @@ class _NumberCellState extends GridFocusNodeCellState<GridNumberCell> {
if (_cellBloc.isClosed == false &&
_controller.text != contentFromState(_cellBloc.state)) {
_cellBloc.add(NumberCellEvent.updateCell(_controller.text));
if (!mounted) {
_delayOperation = null;
_cellBloc.close();
}
}
});
}

View File

@ -287,7 +287,7 @@ impl GridRevisionEditor {
pub async fn create_row(&self, params: CreateRowParams) -> FlowyResult<RowPB> {
let mut row_rev = self.create_row_rev().await?;
self.view_manager.update_row(&mut row_rev, &params).await;
self.view_manager.fill_row(&mut row_rev, &params).await;
let row_pb = self.create_row_pb(row_rev, params.start_row_id.clone()).await?;
@ -314,7 +314,10 @@ impl GridRevisionEditor {
}
pub async fn update_row(&self, changeset: RowMetaChangeset) -> FlowyResult<()> {
self.block_manager.update_row(changeset, make_row_from_row_rev).await
let row_id = changeset.row_id.clone();
let _ = self.block_manager.update_row(changeset, make_row_from_row_rev).await?;
self.view_manager.did_update_row(&row_id).await;
Ok(())
}
pub async fn get_rows(&self, block_id: &str) -> FlowyResult<RepeatedRowPB> {

View File

@ -76,7 +76,7 @@ impl GridViewRevisionEditor {
})
}
pub(crate) async fn update_row(&self, row_rev: &mut RowRevision, params: &CreateRowParams) {
pub(crate) async fn fill_row(&self, row_rev: &mut RowRevision, params: &CreateRowParams) {
match params.layout {
GridLayout::Table => {
// Table can be grouped too

View File

@ -47,12 +47,16 @@ impl GridViewManager {
})
}
pub(crate) async fn update_row(&self, row_rev: &mut RowRevision, params: &CreateRowParams) {
pub(crate) async fn fill_row(&self, row_rev: &mut RowRevision, params: &CreateRowParams) {
for view_editor in self.view_editors.iter() {
view_editor.update_row(row_rev, params).await;
view_editor.fill_row(row_rev, params).await;
}
}
pub(crate) async fn did_update_row(&self, row_id: &str) {
let row = self.block_manager.get_row_rev(row_id).await;
}
pub(crate) async fn did_create_row(&self, row_pb: &RowPB, params: &CreateRowParams) {
for view_editor in self.view_editors.iter() {
view_editor.did_create_row(row_pb, params).await;