flutter icon indicating copy to clipboard operation
flutter copied to clipboard

[two_dimensional_scrollables] Add the ability to build a custom row layout

Open tomasweigenast opened this issue 2 years ago • 0 comments

Use case

It should allow developers to create a custom "template" for the entire row that is being built, for example, in the buildRow method, I need to add a InkWell to the entire row, so it could be nice if I could write:

TableSpan(
      backgroundDecoration: decoration,
      cursor: SystemMouseCursors.click,
      extent: rowSpanExtent,
     builder: (context, layout) => Ink(
         child: InkWell(
               onTap: () => print("tap!"),
               child: layout,
         )     
       ),
      recognizerFactories: <Type, GestureRecognizerFactory>{
        TapGestureRecognizer: GestureRecognizerFactoryWithHandlers<TapGestureRecognizer>(
          () => TapGestureRecognizer(),
          (TapGestureRecognizer t) => t.onTap = () => debugPrint('Tap row $index'),
        ),
      },
    )

Proposal

The same could be done for column builders. I tried to modify it by myself, but the only code that renders something I could find is cell.layout() in the table.dart file:

final BoxConstraints cellConstraints = BoxConstraints.tightFor(
            width: mergedColumnWidth ?? standardColumnWidth,
            height: mergedRowHeight ?? standardRowHeight,
          );
          cell.layout(cellConstraints);

Someone can guide me where to modify it?

tomasweigenast avatar Mar 23 '24 19:03 tomasweigenast