Repository: flutter
Issue: AppBar bottom throws in Stack -> Positioned
Labels: c: crash,framework,f: material design,has reproducible steps,found in release: 2.0,found in release: 2.1,team-design,triaged-design

I used this layout before `extendBodyBehindAppBar` was introduced to extend the body behind the AppBar.

Turns out adding `bottom` breaks it.

<details>
<summary>code sample</summary>

```dart
import 'package:flutter/material.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'App',
      home: Scaffold(
        body: Stack(
          children: [
            Positioned(
              top: 0.0,
              left: 0.0,
              right: 0.0,
              child: PreferredSize(
                preferredSize: Size.fromHeight(60),
                child: AppBar(
                  bottom: PreferredSize( // <----- adding bottom throws
                    preferredSize: Size.fromHeight(20),
                    child: Text('Numbers 2'),
                  ),
                )
              )
            ),
          ],
        ),
      ),
    );
  }
}

```
</details>

<details>
<summary>log</summary>

```
══╡ EXCEPTION CAUGHT BY RENDERING LIBRARY ╞═════════════════════════════════════════════════════════
The following assertion was thrown during performLayout():
RenderFlex children have non-zero flex but incoming height constraints are unbounded.
When a column is in a parent that does not provide a finite height constraint, for example if it is
in a vertical scrollable, it will try to shrink-wrap its children along the vertical axis. Setting a
flex on a child (e.g. using Expanded) indicates that the child is to expand to fill the remaining
space in the vertical direction.
These two directives are mutually exclusive. If a parent is to shrink-wrap its child, the child
cannot simultaneously expand to fit its parent.
Consider setting mainAxisSize to MainAxisSize.min and using FlexFit.loose fits for the flexible
children (using Flexible rather than Expanded). This will allow the flexible children to size
themselves to less than the infinite remaining space they would otherwise be forced to take, and
then will cause the RenderFlex to shrink-wrap the children rather than expanding to fit the maximum
constraints provided by the parent.
If this message did not help you determine the problem, consider using debugDumpRenderTree():
  https://flutter.dev/debugging/#rendering-layer
  http://api.flutter.dev/flutter/rendering/debugDumpRenderTree.html
The affected RenderFlex is:
  RenderFlex#e8b46 relayoutBoundary=up9 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE(creator: Column ←
  MediaQuery ← Padding ← SafeArea ← Align ← Semantics ← DefaultTextStyle ← AnimatedDefaultTextStyle ←
  _InkFeatures-[GlobalKey#de889 ink renderer] ← NotificationListener<LayoutChangedNotification> ← PhysicalModel ←
  AnimatedPhysicalModel ← ⋯, parentData: offset=Offset(0.0, 0.0) (can use size), constraints:
  BoxConstraints(0.0<=w<=392.7, 0.0<=h<=Infinity), size: MISSING, direction: vertical, mainAxisAlignment: spaceBetween,
  mainAxisSize: max, crossAxisAlignment: center, verticalDirection: down)
The creator information is set to:
  Column ← MediaQuery ← Padding ← SafeArea ← Align ← Semantics ← DefaultTextStyle ←
  AnimatedDefaultTextStyle ← _InkFeatures-[GlobalKey#de889 ink renderer] ←
  NotificationListener<LayoutChangedNotification> ← PhysicalModel ← AnimatedPhysicalModel ← ⋯
The nearest ancestor providing an unbounded width constraint is: RenderStack#a0547 relayoutBoundary=up1 NEEDS-LAYOUT
NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE:
  creator: Stack ← _BodyBuilder ← MediaQuery ← LayoutId-[<_ScaffoldSlot.body>] ←
    CustomMultiChildLayout ← AnimatedBuilder ← DefaultTextStyle ← AnimatedDefaultTextStyle ←
    _InkFeatures-[GlobalKey#bec35 ink renderer] ← NotificationListener<LayoutChangedNotification> ←
    PhysicalModel ← AnimatedPhysicalModel ← ⋯
  parentData: offset=Offset(0.0, 0.0); id=_ScaffoldSlot.body (can use size)
  constraints: BoxConstraints(0.0<=w<=392.7, 0.0<=h<=759.3)
  size: Size(392.7, 759.3)
  alignment: AlignmentDirectional.topStart
  textDirection: ltr
  fit: loose
See also: https://flutter.dev/layout/
If none of the above helps enough to fix this problem, please don't hesitate to file a bug:
  https://github.com/flutter/flutter/issues/new?template=2_bug.md

The relevant error-causing widget was:
  AppBar file:///C:/dev/projects/native/app/lib/main.dart:21:24

When the exception was thrown, this was the stack:
#0      RenderFlex.performLayout.<anonymous closure> (package:flutter/src/rendering/flex.dart:927:9)
#1      RenderFlex.performLayout (package:flutter/src/rendering/flex.dart:930:6)
#2      RenderObject.layout (package:flutter/src/rendering/object.dart:1783:7)
#3      RenderPadding.performLayout (package:flutter/src/rendering/shifted_box.dart:226:12)
#4      RenderObject.layout (package:flutter/src/rendering/object.dart:1783:7)
#5      RenderPositionedBox.performLayout (package:flutter/src/rendering/shifted_box.dart:430:14)
#6      RenderObject.layout (package:flutter/src/rendering/object.dart:1783:7)
#7      RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:117:14)
#8      RenderObject.layout (package:flutter/src/rendering/object.dart:1783:7)
#9      RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:117:14)
#10     RenderObject.layout (package:flutter/src/rendering/object.dart:1783:7)
#11     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:117:14)
#12     _RenderCustomClip.performLayout (package:flutter/src/rendering/proxy_box.dart:1370:11)
#13     RenderObject.layout (package:flutter/src/rendering/object.dart:1783:7)
#14     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:117:14)
#15     RenderObject.layout (package:flutter/src/rendering/object.dart:1783:7)
#16     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:117:14)
#17     RenderObject.layout (package:flutter/src/rendering/object.dart:1783:7)
#18     RenderStack.layoutPositionedChild (package:flutter/src/rendering/stack.dart:497:11)
#19     RenderStack.performLayout (package:flutter/src/rendering/stack.dart:610:30)
#20     RenderObject.layout (package:flutter/src/rendering/object.dart:1783:7)
#21     MultiChildLayoutDelegate.layoutChild (package:flutter/src/rendering/custom_layout.dart:171:12)
#22     _ScaffoldLayout.performLayout (package:flutter/src/material/scaffold.dart:935:7)
#23     MultiChildLayoutDelegate._callPerformLayout (package:flutter/src/rendering/custom_layout.dart:240:7)
#24     RenderCustomMultiChildLayoutBox.performLayout (package:flutter/src/rendering/custom_layout.dart:404:14)
#25     RenderObject.layout (package:flutter/src/rendering/object.dart:1783:7)
#26     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:117:14)
#27     RenderObject.layout (package:flutter/src/rendering/object.dart:1783:7)
#28     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:117:14)
#29     _RenderCustomClip.performLayout (package:flutter/src/rendering/proxy_box.dart:1370:11)
#30     RenderObject.layout (package:flutter/src/rendering/object.dart:1783:7)
#31     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:117:14)
#32     RenderObject.layout (package:flutter/src/rendering/object.dart:1783:7)
#33     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:117:14)
#34     RenderObject.layout (package:flutter/src/rendering/object.dart:1783:7)
#35     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:117:14)
#36     RenderObject.layout (package:flutter/src/rendering/object.dart:1783:7)
#37     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:117:14)
#38     RenderObject.layout (package:flutter/src/rendering/object.dart:1783:7)
#39     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:117:14)
#40     RenderObject.layout (package:flutter/src/rendering/object.dart:1783:7)
#41     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:117:14)
#42     RenderObject.layout (package:flutter/src/rendering/object.dart:1783:7)
#43     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:117:14)
#44     RenderObject.layout (package:flutter/src/rendering/object.dart:1783:7)
#45     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:117:14)
#46     RenderOffstage.performLayout (package:flutter/src/rendering/proxy_box.dart:3358:13)
#47     RenderObject.layout (package:flutter/src/rendering/object.dart:1783:7)
#48     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:117:14)
#49     RenderObject.layout (package:flutter/src/rendering/object.dart:1783:7)
#50     _RenderTheatre.performLayout (package:flutter/src/widgets/overlay.dart:743:15)
#51     RenderObject.layout (package:flutter/src/rendering/object.dart:1783:7)
#52     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:117:14)
#53     RenderObject.layout (package:flutter/src/rendering/object.dart:1783:7)
#54     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:117:14)
#55     RenderObject.layout (package:flutter/src/rendering/object.dart:1783:7)
#56     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:117:14)
#57     RenderObject.layout (package:flutter/src/rendering/object.dart:1783:7)
#58     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:117:14)
#59     RenderCustomPaint.performLayout (package:flutter/src/rendering/custom_paint.dart:545:11)
#60     RenderObject.layout (package:flutter/src/rendering/object.dart:1783:7)
#61     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:117:14)
#62     RenderObject.layout (package:flutter/src/rendering/object.dart:1783:7)
#63     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:117:14)
#64     RenderObject.layout (package:flutter/src/rendering/object.dart:1783:7)
#65     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:117:14)
#66     RenderObject.layout (package:flutter/src/rendering/object.dart:1783:7)
#67     RenderView.performLayout (package:flutter/src/rendering/view.dart:153:14)
#68     RenderObject._layoutWithoutResize (package:flutter/src/rendering/object.dart:1640:7)
#69     PipelineOwner.flushLayout (package:flutter/src/rendering/object.dart:883:18)
#70     RendererBinding.drawFrame (package:flutter/src/rendering/binding.dart:463:19)
#71     WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:876:13)
#72     RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:329:5)
#73     SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1144:15)
#74     SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1082:9)
#75     SchedulerBinding.scheduleWarmUpFrame.<anonymous closure> (package:flutter/src/scheduler/binding.dart:865:7)
(elided 11 frames from class _RawReceivePortImpl, class _Timer, dart:async, and dart:async-patch)

The following RenderObject was being processed when the exception was fired: RenderFlex#e8b46 relayoutBoundary=up9
NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE:
  creator: Column ← MediaQuery ← Padding ← SafeArea ← Align ← Semantics ← DefaultTextStyle ←
    AnimatedDefaultTextStyle ← _InkFeatures-[GlobalKey#de889 ink renderer] ←
    NotificationListener<LayoutChangedNotification> ← PhysicalModel ← AnimatedPhysicalModel ← ⋯
  parentData: offset=Offset(0.0, 0.0) (can use size)
  constraints: BoxConstraints(0.0<=w<=392.7, 0.0<=h<=Infinity)
  size: MISSING
  direction: vertical
  mainAxisAlignment: spaceBetween
  mainAxisSize: max
  crossAxisAlignment: center
  verticalDirection: down
This RenderObject had the following descendants (showing up to depth 5):
    child 1: RenderConstrainedBox#b504f NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
      child: RenderClipRect#10636 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
        child: RenderCustomSingleChildLayoutBox#89888 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
          child: RenderCustomMultiChildLayoutBox#0d637 NEEDS-LAYOUT NEEDS-PAINT
    child 2: RenderParagraph#b5b7d NEEDS-LAYOUT NEEDS-PAINT
      text: TextSpan
════════════════════════════════════════════════════════════════════════════════════════════════════

Another exception was thrown: RenderBox was not laid out: RenderFlex#e8b46 relayoutBoundary=up9 NEEDS-PAINT
NEEDS-COMPOSITING-BITS-UPDATE

Another exception was thrown: RenderBox was not laid out: RenderPadding#3777a relayoutBoundary=up8 NEEDS-PAINT
NEEDS-COMPOSITING-BITS-UPDATE

Another exception was thrown: RenderBox was not laid out: RenderPositionedBox#32c52 relayoutBoundary=up7 NEEDS-PAINT
NEEDS-COMPOSITING-BITS-UPDATE

Another exception was thrown: RenderBox was not laid out: RenderSemanticsAnnotations#8537b relayoutBoundary=up6
NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE

Another exception was thrown: RenderBox was not laid out: _RenderInkFeatures#71746 relayoutBoundary=up5 NEEDS-PAINT
NEEDS-COMPOSITING-BITS-UPDATE

Another exception was thrown: RenderBox was not laid out: RenderPhysicalModel#6515a relayoutBoundary=up4 NEEDS-PAINT
NEEDS-COMPOSITING-BITS-UPDATE

Another exception was thrown: RenderBox was not laid out: RenderAnnotatedRegion<SystemUiOverlayStyle>#9156a
relayoutBoundary=up3 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE

Another exception was thrown: RenderBox was not laid out: RenderSemanticsAnnotations#ad5e3 relayoutBoundary=up2
NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
```
</details>



<details>
<summary>flutter doctor -v</summary>

```
[✓] Flutter (Channel master, 2.1.0-13.0.pre.223, on Microsoft Windows [Version 10.0.19041.867], locale ru-RU)
    • Flutter version 2.1.0-13.0.pre.223 at c:\dev\src\flutter
    • Framework revision 891511d58f (19 hours ago), 2021-03-23 14:57:01 -0700
    • Engine revision d59a01d2d3
    • Dart version 2.13.0 (build 2.13.0-150.0.dev)

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
    • Android SDK at C:\Users\danya\AppData\Local\Android\sdk
    • Platform android-30, build-tools 30.0.2
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
    • All Android licenses accepted.

[✓] 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.7.7)
    • Windows 10 SDK version 10.0.18362.0

[✓] Android Studio (version 4.0)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin version 50.0.1
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)

[✓] VS Code (version 1.54.3)
    • VS Code at C:\Users\danya\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.20.0

[✓] Connected device (4 available)
    • sdk gphone x86 (mobile) • emulator-5554 • android-x86    • Android 11 (API 30) (emulator)
    • Windows (desktop)       • windows       • windows-x64    • Microsoft Windows [Version 10.0.19041.867]
    • Chrome (web)            • chrome        • web-javascript • Google Chrome 89.0.4389.90
    • Edge (web)              • edge          • web-javascript • Microsoft Edge 89.0.774.57

• No issues found!
```
</details>