Skip to content

Commit

Permalink
feat: expand row
Browse files Browse the repository at this point in the history
  • Loading branch information
appflowy committed Apr 29, 2022
1 parent fa3a28e commit 40443ce
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,16 @@ class _CheckboxCellState extends State<CheckboxCell> {
child: BlocBuilder<CheckboxCellBloc, CheckboxCellState>(
builder: (context, state) {
final icon = state.isSelected ? svgWidget('editor/editor_check') : svgWidget('editor/editor_uncheck');
return Align(
alignment: Alignment.centerLeft,
child: FlowyIconButton(
onPressed: () => context.read<CheckboxCellBloc>().add(const CheckboxCellEvent.select()),
iconPadding: EdgeInsets.zero,
icon: icon,
width: 23,
return SizedBox(
height: 42,
child: Align(
alignment: Alignment.centerLeft,
child: FlowyIconButton(
onPressed: () => context.read<CheckboxCellBloc>().add(const CheckboxCellEvent.select()),
iconPadding: EdgeInsets.zero,
icon: icon,
width: 23,
),
),
);
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ class _SingleSelectCellState extends State<SingleSelectCell> {
if (children.isEmpty && widget.cellStyle != null) {
children.add(FlowyText.medium(widget.cellStyle!.placeholder, fontSize: 14, color: theme.shader3));
}
return SizedBox.expand(
return SizedBox(
height: 69,
child: InkWell(
onTap: () {
widget.onFocus.value = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,18 +68,21 @@ class _GridTextCellState extends State<GridTextCell> {
},
buildWhen: (previous, current) => previous.content != current.content,
builder: (context, state) {
return TextField(
controller: _controller,
focusNode: _focusNode,
onChanged: (value) => focusChanged(),
onEditingComplete: () => _focusNode.unfocus(),
maxLines: 1,
style: const TextStyle(fontSize: 14, fontWeight: FontWeight.w500),
decoration: InputDecoration(
contentPadding: EdgeInsets.zero,
border: InputBorder.none,
hintText: widget.cellStyle?.placeholder,
isDense: true,
return SizedBox(
height: 42,
child: TextField(
controller: _controller,
focusNode: _focusNode,
onChanged: (value) => focusChanged(),
onEditingComplete: () => _focusNode.unfocus(),
maxLines: 1,
style: const TextStyle(fontSize: 14, fontWeight: FontWeight.w500),
decoration: InputDecoration(
contentPadding: EdgeInsets.zero,
border: InputBorder.none,
hintText: widget.cellStyle?.placeholder,
isDense: true,
),
),
);
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,19 +48,13 @@ class _GridRowWidgetState extends State<GridRowWidget> {
child: BlocBuilder<RowBloc, RowState>(
buildWhen: (p, c) => p.rowData.height != c.rowData.height,
builder: (context, state) {
final children = [
const _RowLeading(),
_RowCells(cellCache: widget.cellCache, onExpand: () => onExpandCell(context)),
const _RowTrailing(),
];

final child = Row(
mainAxisSize: MainAxisSize.max,
crossAxisAlignment: CrossAxisAlignment.center,
children: children,
return Row(
children: [
const _RowLeading(),
Expanded(child: _RowCells(cellCache: widget.cellCache, onExpand: () => _expandRow(context))),
const _RowTrailing(),
],
);

return SizedBox(height: 42, child: child);
},
),
),
Expand All @@ -73,7 +67,7 @@ class _GridRowWidgetState extends State<GridRowWidget> {
super.dispose();
}

void onExpandCell(BuildContext context) {
void _expandRow(BuildContext context) {
final page = RowDetailPage(
rowData: widget.rowData,
rowCache: widget.rowCache,
Expand Down Expand Up @@ -161,11 +155,13 @@ class _RowCells extends StatelessWidget {
return BlocBuilder<RowBloc, RowState>(
buildWhen: (previous, current) => previous.cellDataMap.length != current.cellDataMap.length,
builder: (context, state) {
return Row(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
return IntrinsicHeight(
child: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: _makeCells(context, state.cellDataMap),
);
));
},
);
}
Expand Down

0 comments on commit 40443ce

Please sign in to comment.