Repository: flutter
Issue: Unable to convert ListTile widget into an image.
Labels: c: crash,framework,f: material design,has reproducible steps,P3,found in release: 3.3,found in release: 3.5,team-design,triaged-design

## Steps to Reproduce

1. Execute `flutter run` on the code sample. It needs to be run locally since DartPad does not show correct error logs.
2. Tap _capture_ button in the left column to capture the `Button` widget.
3. Tap _capture_ button in the right column to capture the `ListTile` widget.

**Expected results:**
The `ListTile` widget should be captured just as the button widget is captured and 
the image should be displayed on the screen.

**Actual results:**
`Button` is captured correctly, but `ListTile` is not.

**Additional details:**
The issue occurs when capturing `ListTile` and `ExpansionTile` widgets. It seems that the issue is related to the `Ink` widget because both of these widgets use `Ink` internally.

My question here is that if I am capturing both the `Button` and `ListTile` widgets using the same method `captureWidget`, why does one of them gets captured correctly and the other one does not? 

Maybe, I am missing something in my method that is necessary to capture `Ink` related widgets. If that's the case, I would appreciate some guidance here. If not, then it is a Flutter bug.

<details>
<summary>Code sample</summary>

```dart
import 'dart:typed_data';
import 'dart:ui' as ui;

import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      title: 'MyApp Demo',
      debugShowCheckedModeBanner: false,
      home: Scaffold(
        body: HomeView(),
      ),
    );
  }
}

class HomeView extends StatefulWidget {
  const HomeView({super.key});

  @override
  State<HomeView> createState() => _HomeViewState();
}

class _HomeViewState extends State<HomeView> {
  Uint8List? widget1Bytes;
  Uint8List? widget2Bytes;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: SizedBox.expand(
        child: Center(
          child: Row(
            crossAxisAlignment: CrossAxisAlignment.center,
            children: [
              Expanded(
                child: Column(
                  mainAxisAlignment: MainAxisAlignment.center,
                  children: [
                    Text('Original'),
                    const SizedBox(height: 8),
                    buildWidget1(context),
                    const SizedBox(height: 56),
                    Text('Captured'),
                    const SizedBox(height: 8),
                    if (widget1Bytes != null)
                      ConstrainedBox(
                        constraints: BoxConstraints(maxHeight: 300),
                        child: Image.memory(widget1Bytes!),
                      ),
                    const SizedBox(height: 56),
                    ElevatedButton(
                      onPressed: captureWidget1,
                      child: Text('Capture'),
                    ),
                  ],
                ),
              ),
              VerticalDivider(),
              Expanded(
                child: Column(
                  mainAxisAlignment: MainAxisAlignment.center,
                  children: [
                    Text('Original'),
                    const SizedBox(height: 8),
                    buildWidget2(context),
                    const SizedBox(height: 56),
                    Text('Captured'),
                    const SizedBox(height: 8),
                    if (widget2Bytes != null)
                      ConstrainedBox(
                        constraints: BoxConstraints(maxHeight: 300),
                        child: Image.memory(widget2Bytes!),
                      ),
                    const SizedBox(height: 56),
                    ElevatedButton(
                      onPressed: captureWidget2,
                      child: Text('Capture'),
                    ),
                  ],
                ),
              ),
            ],
          ),
        ),
      ),
    );
  }

  Widget buildWidget1(BuildContext context) {
    return FloatingActionButton.extended(
      onPressed: () {},
      backgroundColor: Colors.red,
      foregroundColor: Colors.white,
      icon: Icon(Icons.home),
      label: Text('Button'),
    );
  }

  Widget buildWidget2(BuildContext context) {
    return SizedBox(
      width: 400,
      child: ListTile(
        title: Text('Title'),
        subtitle: Text('Subtitle'),
        leading: Icon(Icons.home),
        trailing: Icon(Icons.more_vert_rounded),
        onTap: () {},
      ),
    );
  }

  Future<void> captureWidget1() async {
    widget1Bytes = await captureWidget(buildWidget1(context));
    setState(() {});
  }

  Future<void> captureWidget2() async {
    try {
      widget2Bytes = await captureWidget(buildWidget2(context));
      setState(() {});
    } catch (error, stacktrace) {
      print(error);
      print(stacktrace);
    }
  }

  Future<Uint8List?> captureWidget(Widget widget) async {
    final RenderRepaintBoundary repaintBoundary = RenderRepaintBoundary();

    final RenderView renderView = RenderView(
      window: ui.window,
      child: RenderPositionedBox(
          alignment: Alignment.center, child: repaintBoundary),
      configuration: ViewConfiguration(
        size: Size(1000, 1000),
        devicePixelRatio: 1,
      ),
    );

    final PipelineOwner pipelineOwner = PipelineOwner();
    final BuildOwner buildOwner = BuildOwner(focusManager: FocusManager());

    pipelineOwner.rootNode = renderView;
    renderView.prepareInitialFrame();

    final RenderObjectToWidgetElement<RenderBox> rootElement =
        RenderObjectToWidgetAdapter<RenderBox>(
      container: repaintBoundary,
      child: MediaQuery(
        data: MediaQuery.of(context),
        child: Theme(
          data: Theme.of(context),
          child: Directionality(
            textDirection: ui.TextDirection.ltr,
            child: Material(
              type: MaterialType.transparency,
              child: widget,
            ),
          ),
        ),
      ),
    ).attachToRenderTree(buildOwner);

    buildOwner.buildScope(rootElement);
    buildOwner.finalizeTree();

    pipelineOwner.flushLayout();
    pipelineOwner.flushCompositingBits();
    pipelineOwner.flushPaint();

    final ui.Image image = await repaintBoundary.toImage(pixelRatio: 1);
    final ByteData? byteData =
        await image.toByteData(format: ui.ImageByteFormat.png);

    return byteData!.buffer.asUint8List();
  }
}
```

</details>

<details>
  <summary>Logs</summary>


### flutter analyze

```
Analyzing bug...                                                        
No issues found! (ran in 2.5s)
```

### flutter doctor -v

```
[√] Flutter (Channel stable, 3.3.4, on Microsoft Windows [Version 10.0.22000.978], locale en-IN)
    • Flutter version 3.3.4 on channel stable at C:\src\flutter\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision eb6d86ee27 (3 days ago), 2022-10-04 22:31:45 -0700
    • Engine revision c08d7d5efc
    • Dart version 2.18.2
    • DevTools version 2.15.0

[!] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at C:\Users\imaac\AppData\Local\Android\sdk
    X cmdline-tools component is missing
      Run `path/to/sdkmanager --install "cmdline-tools;latest"`
      See https://developer.android.com/studio/command-line for more details.
    X Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/docs/get-started/install/windows#android-setup for more details.

[√] Chrome - develop for the web
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[√] Visual Studio - develop for Windows (Visual Studio Community 2019 16.8.4)
    • Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community
    • Visual Studio Community 2019 version 16.8.30907.101
    • Windows 10 SDK version 10.0.18362.0

[√] Android Studio (version 4.1)
    • 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 1.8.0_242-release-1644-b01)

[√] VS Code (version 1.71.0)
    • VS Code at C:\Users\imaac\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.48.0

[√] Connected device (3 available)
    • Windows (desktop) • windows • windows-x64    • Microsoft Windows [Version 10.0.22000.978]
    • Chrome (web)      • chrome  • web-javascript • Google Chrome 105.0.5195.127
    • Edge (web)        • edge    • web-javascript • Microsoft Edge 105.0.1343.42

[√] HTTP Host Availability
    • All required HTTP hosts are available

! Doctor found issues in 1 category.
```

</details>


### Video Demo
Link to video: https://www.loom.com/share/bbd92af8e1b6469990eda77e284d8354