Repository: flutter
Issue: [two_dimensional_scrollables] Row with Merge Cells do not retain when scrolling horizontally
Labels: package,team-ecosystem,has reproducible steps,P2,triaged-ecosystem,p: two_dimensional_scrollables,found in release: 3.27,found in release: 3.28

### What package does this bug report belong to?

two_dimensional_scrollables

### What target platforms are you seeing this bug on?

Windows

### Have you already upgraded your packages?

Yes

### Dependency versions

<details><summary>pubspec.lock</summary>

```lock
[Paste file content here]
```

</details>


### Steps to reproduce

Create a `TableView.builder` with a whole row of single merged cell.

### Expected results

The Merged Row should retain its merge when scrolled or out of frame

### Actual results

Merged Row isn't retaining its merge when scrolled out of frame.

### Code sample

<details open><summary>Code sample</summary>

```dart
class CustomDataTable extends StatelessWidget {
  const CustomDataTable({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Custom Data Table'),
      ),
      body: const SingleChildScrollView(
        padding: EdgeInsets.all(16),
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: [
            Text('General Ledger Detail'),
            Text('Demo Company (Global)'),
            SizedBox(height: 32),
            AspectRatio(aspectRatio: 1, child: _MergedTableCell()),
          ],
        ),
      ),
    );
  }
}

class _MergedTableCell extends StatelessWidget {
  const _MergedTableCell({super.key});

  @override
  Widget build(BuildContext context) {
    return TableView.builder(
      columnBuilder: _buildColumnSpan,
      rowBuilder: _buildRowSpan,
      cellBuilder: _buildCell,
      columnCount: 10,
      rowCount: 10,
      verticalDetails: const ScrollableDetails.vertical(physics: NeverScrollableScrollPhysics()),
    );
  }

  TableSpan _buildColumnSpan(int index) {
    return TableSpan(
      extent: FixedTableSpanExtent(index == 0 ? 220 : 180),
      foregroundDecoration: const TableSpanDecoration(border: SpanBorder(leading: BorderSide())),
    );
  }

  TableSpan _buildRowSpan(int index) {
    return TableSpan(
      extent: const FixedSpanExtent(80),
      foregroundDecoration: TableSpanDecoration(
          border: SpanBorder(leading: const BorderSide(), trailing: index == 9 ? const BorderSide() : BorderSide.none)),
    );
  }

  TableViewCell _buildCell(BuildContext context, TableVicinity vicinity) {
    return TableViewCell(
      addRepaintBoundaries: false,
      columnMergeStart: vicinity.row == 1 && vicinity.column == 0 ? 0 : null,
      columnMergeSpan: vicinity.row == 1 && vicinity.column == 0 ? 10 : null,
      child: vicinity.row == 1
          ? vicinity.column == 0
              ? const Text(
                  'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Lorem ipsum dolor sit amet, consectetur adipiscing elit.')
              : const SizedBox.shrink()
          : Text('Cell ${vicinity.row} ${vicinity.column}'),
    );
  }
}
```

</details>


### Screenshots or Videos

<details open>
<summary>Screenshots / Video demonstration</summary>

https://github.com/user-attachments/assets/bf00a2f6-a8fc-424e-a0de-f12b28bf2547


</details>


### Logs

<details open><summary>Logs</summary>

```console
[Paste your logs here]
```

</details>


### Flutter Doctor output

<details open><summary>Doctor output</summary>

```console
[√] Flutter (Channel stable, 3.27.0, on Microsoft Windows [Version 10.0.22621.4317], locale en-AU)
    • Flutter version 3.27.0 on channel stable at C:\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 8495dee1fd (13 days ago), 2024-12-10 14:23:39 -0800
    • Engine revision 83bacfc525
    • Dart version 3.6.0
    • DevTools version 2.40.2

[√] Windows Version (Installed version of Windows is version 10 or higher)

[√] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at C:\Users\Nitro\AppData\Local\Android\sdk
    • Platform android-34, build-tools 34.0.0
    • Java binary at: C:\Program Files\Android\Android Studio\jbr\bin\java
    • Java version OpenJDK Runtime Environment (build 17.0.9+0--11185874)
    • All Android licenses accepted.

[X] Chrome - develop for the web (Cannot find Chrome executable at .\Google\Chrome\Application\chrome.exe)
    ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.

[√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.8.4)
    • Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
    • Visual Studio Community 2022 version 17.8.34408.163
    • Windows 10 SDK version 10.0.22621.0

[√] Android Studio (version 2023.2)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.9+0--11185874)

[√] VS Code, 64-bit edition (version 1.96.2)
    • VS Code at C:\Program Files\Microsoft VS Code
    • Flutter extension version 3.102.0

[√] Connected device (2 available)
    • Windows (desktop) • windows • windows-x64    • Microsoft Windows [Version 10.0.22621.4317]
    • Edge (web)        • edge    • web-javascript • Microsoft Edge 131.0.2903.112

[√] Network resources
    • All expected network resources are available.

! Doctor found issues in 1 category.
```

</details>