Repository: flutter
Issue: Failed assertion of debugNeedsLayout caused by dynamically updating title and subtitle of the ListTile
Labels: framework,f: material design,a: error message,has reproducible steps,found in release: 2.2,found in release: 2.6,team-design,triaged-design

## Steps to Reproduce

1. Run `flutter create bug`.
2. Update the `main.dart` to as follows: 
```dart
import 'package:flutter/material.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      home: MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key? key, required this.title}) : super(key: key);

  final String title;

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  bool _do = true;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            SwitchListTile(
              title: Text("Toggle"),
              onChanged: (val) => setState(() => _do = val),
              value: _do,
            ),
            ListTile(
              title: _do ? Icon(Icons.sentiment_satisfied) : Icon(Icons.sentiment_dissatisfied),
              subtitle: _do ? Text("true") : null,
            ),
          ],
        ),
      ),
    );
  }
}

```
3. Toggle the switch

**Expected results:** 
No exception

**Actual results:** <!-- what did you see? -->
EXCEPTION CAUGHT BY RENDERING LIBRARY (more detail in the log)

This is a simplified version to trigger the exception. In our original application the page contains multiple widgets like
ExpansionTile and BottomSheet. After the exception happened, the whole page became blank and unaccessible.
Possibly the side effect of the exception and the incorrect layout?

<details>
  <summary>Logs</summary>

<!--
      Run your application with `flutter run --verbose` and attach all the
      log output below between the lines with the backticks. If there is an
      exception, please see if the error message includes enough information
      to explain how to solve the issue.
-->

```
                    ══╡ EXCEPTION CAUGHT BY RENDERING LIBRARY ╞═════════════════════════════════════════════════════════
                    The following assertion was thrown during performLayout():
                    'package:flutter/src/rendering/shifted_box.dart': Failed assertion: line 64 pos 14:
                    '!debugNeedsLayout': is not true.

                    Either the assertion indicates an error in the framework itself, or we should provide substantially
                    more information in this error message to help you determine and fix the underlying cause.
                    In either case, please report this assertion by filing a bug on GitHub:
                      https://github.com/flutter/flutter/issues/new?template=2_bug.md

                    The relevant error-causing widget was:
                      ListTile file:///Users/cchepin/AndroidStudioProjects/bug/lib/main.dart:44:13

                    When the exception was thrown, this was the stack:
                    #2      RenderShiftedBox.computeDistanceToActualBaseline (package:flutter/src/rendering/shifted_box.dart:64:14)
                    #3      RenderBox.getDistanceToActualBaseline.<anonymous closure> (package:flutter/src/rendering/box.dart:2127:51)
                    #4      _LinkedHashMapMixin.putIfAbsent (dart:collection-patch/compact_hash.dart:311:23)
                    #5      RenderBox.getDistanceToActualBaseline (package:flutter/src/rendering/box.dart:2127:23)
                    #6      RenderProxyBoxMixin.computeDistanceToActualBaseline (package:flutter/src/rendering/proxy_box.dart:101:21)
                    #7      RenderBox.getDistanceToActualBaseline.<anonymous closure> (package:flutter/src/rendering/box.dart:2127:51)
                    #8      _LinkedHashMapMixin.putIfAbsent (dart:collection-patch/compact_hash.dart:311:23)
                    #9      RenderBox.getDistanceToActualBaseline (package:flutter/src/rendering/box.dart:2127:23)
                    #10     RenderProxyBoxMixin.computeDistanceToActualBaseline (package:flutter/src/rendering/proxy_box.dart:101:21)
                    #11     RenderBox.getDistanceToActualBaseline.<anonymous closure> (package:flutter/src/rendering/box.dart:2127:51)
                    #12     _LinkedHashMapMixin.putIfAbsent (dart:collection-patch/compact_hash.dart:311:23)
                    #13     RenderBox.getDistanceToActualBaseline (package:flutter/src/rendering/box.dart:2127:23)
                    #14     RenderProxyBoxMixin.computeDistanceToActualBaseline (package:flutter/src/rendering/proxy_box.dart:101:21)
                    #15     RenderBox.getDistanceToActualBaseline.<anonymous closure> (package:flutter/src/rendering/box.dart:2127:51)
                    #16     _LinkedHashMapMixin.putIfAbsent (dart:collection-patch/compact_hash.dart:311:23)
                    #17     RenderBox.getDistanceToActualBaseline (package:flutter/src/rendering/box.dart:2127:23)
                    #18     RenderBox.getDistanceToBaseline (package:flutter/src/rendering/box.dart:2110:28)
                    #19     _RenderListTile._boxBaseline (package:flutter/src/material/list_tile.dart:1672:16)
                    #20     _RenderListTile.performLayout (package:flutter/src/material/list_tile.dart:1768:33)
                    #21     RenderObject.layout (package:flutter/src/rendering/object.dart:1779:7)
                    #22     RenderPadding.performLayout (package:flutter/src/rendering/shifted_box.dart:233:12)
                    #23     RenderObject.layout (package:flutter/src/rendering/object.dart:1779:7)
                    #24     RenderPadding.performLayout (package:flutter/src/rendering/shifted_box.dart:233:12)
                    #25     RenderObject.layout (package:flutter/src/rendering/object.dart:1779:7)
                    #26     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)
                    #27     RenderObject.layout (package:flutter/src/rendering/object.dart:1779:7)
                    #28     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)
                    #29     RenderObject.layout (package:flutter/src/rendering/object.dart:1779:7)
                    #30     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)
                    #31     RenderObject.layout (package:flutter/src/rendering/object.dart:1779:7)
                    #32     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)
                    #33     RenderObject.layout (package:flutter/src/rendering/object.dart:1779:7)
                    #34     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)
                    #35     RenderObject.layout (package:flutter/src/rendering/object.dart:1779:7)
                    #36     ChildLayoutHelper.layoutChild (package:flutter/src/rendering/layout_helper.dart:54:11)
                    #37     RenderFlex._computeSizes (package:flutter/src/rendering/flex.dart:829:43)
                    #38     RenderFlex.performLayout (package:flutter/src/rendering/flex.dart:931:32)
                    #39     RenderObject.layout (package:flutter/src/rendering/object.dart:1779:7)
                    #40     RenderPositionedBox.performLayout (package:flutter/src/rendering/shifted_box.dart:437:14)
                    #41     RenderObject.layout (package:flutter/src/rendering/object.dart:1779:7)
                    #42     MultiChildLayoutDelegate.layoutChild (package:flutter/src/rendering/custom_layout.dart:171:12)
                    #43     _ScaffoldLayout.performLayout (package:flutter/src/material/scaffold.dart:937:7)
                    #44     MultiChildLayoutDelegate._callPerformLayout (package:flutter/src/rendering/custom_layout.dart:240:7)
                    #45     RenderCustomMultiChildLayoutBox.performLayout (package:flutter/src/rendering/custom_layout.dart:404:14)
                    #46     RenderObject._layoutWithoutResize (package:flutter/src/rendering/object.dart:1636:7)
                    #47     PipelineOwner.flushLayout (package:flutter/src/rendering/object.dart:881:18)
                    #48     RendererBinding.drawFrame (package:flutter/src/rendering/binding.dart:462:19)
                    #49     WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:876:13)
                    #50     RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:328:5)
                    #51     SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1144:15)
                    #52     SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1082:9)
                    #53     SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:998:5)
                    #57     _invoke (dart:ui/hooks.dart:163:10)
                    #58     PlatformDispatcher._drawFrame (dart:ui/platform_dispatcher.dart:259:5)
                    #59     _drawFrame (dart:ui/hooks.dart:126:31)
                    (elided 5 frames from class _AssertionError and dart:async)

                    The following RenderObject was being processed when the exception was fired: _RenderListTile#da481 relayoutBoundary=up10
NEEDS-LAYOUT
                    NEEDS-COMPOSITING-BITS-UPDATE:
                      creator: _ListTile ← MediaQuery ← Padding ← SafeArea ← Builder ← Padding-[GlobalKey#804bc] ← Ink ←
                        Semantics ← Listener ← RawGestureDetector ← GestureDetector ← Semantics ← ⋯
                      parentData: offset=Offset(16.0, 0.0) (can use size)
                      constraints: BoxConstraints(0.0<=w<=379.4, 0.0<=h<=Infinity)
                      size: Size(379.4, 56.0)
                    This RenderObject had the following descendants (showing up to depth 5):
                        title: RenderSemanticsAnnotations#f2aee relayoutBoundary=up11
                          child: RenderExcludeSemantics#717b5 relayoutBoundary=up12
                            child: RenderConstrainedBox#7d216 relayoutBoundary=up13
                              child: RenderPositionedBox#93bcd NEEDS-LAYOUT
                                child: RenderParagraph#b71fb relayoutBoundary=up1 NEEDS-LAYOUT
                        subtitle: RenderParagraph#b2263 relayoutBoundary=up11 NEEDS-PAINT
                          text: TextSpan
                    ════════════════════════════════════════════════════════════════════════════════════════════════════
```

<!--
     Run `flutter analyze` and attach any output of that command below.
     If there are any analysis errors, try resolving them before filing this issue.
-->

```
10:58 $ flutter analyze
Analyzing bug...
No issues found! (ran in 2.1s)
```

<!-- Finally, paste the output of running `flutter doctor -v` here. -->

```
[✓] Flutter (Channel stable, 2.2.3, on macOS 11.2.3 20D91 darwin-x64, locale en-CA)
    • Flutter version 2.2.3 at /Users/cchepin/flutter
    • Framework revision f4abaa0735 (8 weeks ago), 2021-07-01 12:46:11 -0700
    • Engine revision 241c87ad80
    • Dart version 2.13.4

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
    • Android SDK at /Users/cchepin/Library/Android/sdk
    • Platform android-30, build-tools 30.0.2
    • Java binary at: /Library/Java/JavaVirtualMachines/jdk-15.0.1.jdk/Contents/Home/bin/java
    • Java version Java(TM) SE Runtime Environment (build 15.0.1+9-18)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.5.1, Build version 12E507
    • CocoaPods version 1.10.1

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[!] Android Studio (version 2020.3)
    • Android Studio at /Applications/Android Studio.app/Contents
    • 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
    ✗ Unable to find bundled Java version.
    • Try updating or re-installing Android Studio.

[✓] Connected device (2 available)
    • Android SDK built for x86 (mobile) • emulator-5554 • android-x86    • Android 10 (API 29) (emulator)
    • Chrome (web)                       • chrome        • web-javascript • Google Chrome 92.0.4515.159
```

</details>