Selaa lähdekoodia

feat: expand row

appflowy 3 vuotta sitten
vanhempi
commit
40443ced80

+ 10 - 7
frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/cell/checkbox_cell.dart

@@ -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,
+              ),
             ),
           );
         },

+ 2 - 1
frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/cell/selection_cell/selection_cell.dart

@@ -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;

+ 15 - 12
frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/cell/text_cell.dart

@@ -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,
+              ),
             ),
           );
         },

+ 13 - 17
frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/row/grid_row.dart

@@ -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);
           },
         ),
       ),
@@ -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,
@@ -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),
-        );
+        ));
       },
     );
   }