feat: expand row

This commit is contained in:
appflowy 2022-04-29 10:46:35 +08:00
parent fa3a28e850
commit 40443ced80
4 changed files with 40 additions and 37 deletions

View File

@ -35,7 +35,9 @@ class _CheckboxCellState extends State<CheckboxCell> {
child: BlocBuilder<CheckboxCellBloc, CheckboxCellState>( child: BlocBuilder<CheckboxCellBloc, CheckboxCellState>(
builder: (context, state) { builder: (context, state) {
final icon = state.isSelected ? svgWidget('editor/editor_check') : svgWidget('editor/editor_uncheck'); final icon = state.isSelected ? svgWidget('editor/editor_check') : svgWidget('editor/editor_uncheck');
return Align( return SizedBox(
height: 42,
child: Align(
alignment: Alignment.centerLeft, alignment: Alignment.centerLeft,
child: FlowyIconButton( child: FlowyIconButton(
onPressed: () => context.read<CheckboxCellBloc>().add(const CheckboxCellEvent.select()), onPressed: () => context.read<CheckboxCellBloc>().add(const CheckboxCellEvent.select()),
@ -43,6 +45,7 @@ class _CheckboxCellState extends State<CheckboxCell> {
icon: icon, icon: icon,
width: 23, width: 23,
), ),
),
); );
}, },
), ),

View File

@ -64,7 +64,8 @@ class _SingleSelectCellState extends State<SingleSelectCell> {
if (children.isEmpty && widget.cellStyle != null) { if (children.isEmpty && widget.cellStyle != null) {
children.add(FlowyText.medium(widget.cellStyle!.placeholder, fontSize: 14, color: theme.shader3)); children.add(FlowyText.medium(widget.cellStyle!.placeholder, fontSize: 14, color: theme.shader3));
} }
return SizedBox.expand( return SizedBox(
height: 69,
child: InkWell( child: InkWell(
onTap: () { onTap: () {
widget.onFocus.value = true; widget.onFocus.value = true;

View File

@ -68,7 +68,9 @@ class _GridTextCellState extends State<GridTextCell> {
}, },
buildWhen: (previous, current) => previous.content != current.content, buildWhen: (previous, current) => previous.content != current.content,
builder: (context, state) { builder: (context, state) {
return TextField( return SizedBox(
height: 42,
child: TextField(
controller: _controller, controller: _controller,
focusNode: _focusNode, focusNode: _focusNode,
onChanged: (value) => focusChanged(), onChanged: (value) => focusChanged(),
@ -81,6 +83,7 @@ class _GridTextCellState extends State<GridTextCell> {
hintText: widget.cellStyle?.placeholder, hintText: widget.cellStyle?.placeholder,
isDense: true, isDense: true,
), ),
),
); );
}, },
), ),

View File

@ -48,19 +48,13 @@ class _GridRowWidgetState extends State<GridRowWidget> {
child: BlocBuilder<RowBloc, RowState>( child: BlocBuilder<RowBloc, RowState>(
buildWhen: (p, c) => p.rowData.height != c.rowData.height, buildWhen: (p, c) => p.rowData.height != c.rowData.height,
builder: (context, state) { builder: (context, state) {
final children = [ return Row(
children: [
const _RowLeading(), const _RowLeading(),
_RowCells(cellCache: widget.cellCache, onExpand: () => onExpandCell(context)), Expanded(child: _RowCells(cellCache: widget.cellCache, onExpand: () => _expandRow(context))),
const _RowTrailing(), const _RowTrailing(),
]; ],
final child = Row(
mainAxisSize: MainAxisSize.max,
crossAxisAlignment: CrossAxisAlignment.center,
children: children,
); );
return SizedBox(height: 42, child: child);
}, },
), ),
), ),
@ -73,7 +67,7 @@ class _GridRowWidgetState extends State<GridRowWidget> {
super.dispose(); super.dispose();
} }
void onExpandCell(BuildContext context) { void _expandRow(BuildContext context) {
final page = RowDetailPage( final page = RowDetailPage(
rowData: widget.rowData, rowData: widget.rowData,
rowCache: widget.rowCache, rowCache: widget.rowCache,
@ -161,11 +155,13 @@ class _RowCells extends StatelessWidget {
return BlocBuilder<RowBloc, RowState>( return BlocBuilder<RowBloc, RowState>(
buildWhen: (previous, current) => previous.cellDataMap.length != current.cellDataMap.length, buildWhen: (previous, current) => previous.cellDataMap.length != current.cellDataMap.length,
builder: (context, state) { builder: (context, state) {
return Row( return IntrinsicHeight(
mainAxisSize: MainAxisSize.min, child: Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: _makeCells(context, state.cellDataMap), children: _makeCells(context, state.cellDataMap),
); ));
}, },
); );
} }