Skip to content

Improve documentation and assert for Stack.textDirection; also, API docs for Localizations should admit to adding a Directionality #13013

Description

@ErikUggeldahl

Steps to Reproduce

The following empty Stack layout trips an assertion.

import 'package:flutter/widgets.dart';

void main() {
  runApp(new MyApp());
}

class MyApp extends StatelessWidget {
  MyApp() {
  }

  @override
  Widget build(BuildContext context) {
    return new Stack();
  }
}

Logs

I/flutter (24950): ══╡ EXCEPTION CAUGHT BY RENDERING LIBRARY ╞═════════════════════════════════════════════════════════
I/flutter (24950): The following assertion was thrown during performLayout():
I/flutter (24950): 'package:flutter/src/painting/alignment.dart': Failed assertion: line 513 pos 12: 'direction !=
I/flutter (24950): null': is not true.
I/flutter (24950): 
I/flutter (24950): Either the assertion indicates an error in the framework itself, or we should provide substantially
I/flutter (24950): more information in this error message to help you determine and fix the underlying cause.
I/flutter (24950): In either case, please report this assertion by filing a bug on GitHub:
I/flutter (24950):   https://github.com/flutter/flutter/issues/new
I/flutter (24950): 
I/flutter (24950): When the exception was thrown, this was the stack:
I/flutter (24950): #2      AlignmentDirectional.resolve (package:flutter/src/painting/alignment.dart:513:12)
I/flutter (24950): #3      RenderStack._resolve (package:flutter/src/rendering/stack.dart:327:36)
I/flutter (24950): #4      RenderStack.performLayout (package:flutter/src/rendering/stack.dart:436:5)
I/flutter (24950): #5      RenderObject.layout (package:flutter/src/rendering/object.dart:1962:7)
I/flutter (24950): #6      RenderView.performLayout (package:flutter/src/rendering/view.dart:142:13)
I/flutter (24950): #7      RenderObject._layoutWithoutResize (package:flutter/src/rendering/object.dart:1837:7)
I/flutter (24950): #8      PipelineOwner.flushLayout (package:flutter/src/rendering/object.dart:1126:18)
I/flutter (24950): #9      BindingBase&SchedulerBinding&GestureBinding&ServicesBinding&RendererBinding.drawFrame (package:flutter/src/rendering/binding.dart:262:19)
I/flutter (24950): #10     BindingBase&SchedulerBinding&GestureBinding&ServicesBinding&RendererBinding&WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:581:22)
I/flutter (24950): #11     BindingBase&SchedulerBinding&GestureBinding&ServicesBinding&RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:200:5)
I/flutter (24950): #12     BindingBase&SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:713:15)
I/flutter (24950): #13     BindingBase&SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:649:9)
I/flutter (24950): #14     BindingBase&SchedulerBinding&GestureBinding&ServicesBinding&RendererBinding.scheduleWarmUpFrame.<anonymous closure> (package:flutter/src/rendering/binding.dart:286:20)
I/flutter (24950): #16     _Timer._runTimers (dart:isolate-patch/dart:isolate/timer_impl.dart:367)
I/flutter (24950): #17     _Timer._handleMessage (dart:isolate-patch/dart:isolate/timer_impl.dart:401)
I/flutter (24950): #18     _RawReceivePortImpl._handleMessage (dart:isolate-patch/dart:isolate/isolate_patch.dart:163)
I/flutter (24950): (elided 3 frames from class _AssertionError and package dart:async-patch)
I/flutter (24950): 
I/flutter (24950): The following RenderObject was being processed when the exception was fired:
I/flutter (24950):   RenderStack#46ac0 NEEDS-LAYOUT NEEDS-PAINT
I/flutter (24950):   creator: Stack ← MyApp ← [root]
I/flutter (24950):   parentData: <none>
I/flutter (24950):   constraints: BoxConstraints(w=1024.0, h=768.0)
I/flutter (24950):   size: MISSING
I/flutter (24950):   alignment: AlignmentDirectional.topStart
I/flutter (24950):   textDirection: null
I/flutter (24950):   fit: loose
I/flutter (24950):   overflow: clip
I/flutter (24950): This RenderObject has no descendants.
I/flutter (24950): ════════════════════════════════════════════════════════════════════════════════════════════════════

Flutter Doctor

[✓] Flutter (on Mac OS X 10.13.1 17B48, locale en-CA, channel alpha)
    • Flutter at /Users//flutter/flutter
    • Framework revision e8aa40eddd (4 weeks ago), 2017-10-17 15:42:40 -0700
    • Engine revision 7c4142808c
    • Tools Dart version 1.25.0-dev.11.0

[✓] Android toolchain - develop for Android devices (Android SDK 25.0.3)
    • Android SDK at /Users//Library/Android/sdk
    • Platform android-25, build-tools 25.0.3
    • ANDROID_HOME = /Users//Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_112-release-b06)

[✓] iOS toolchain - develop for iOS devices (Xcode 9.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 9.1, Build version 9B55
    • ios-deploy 1.9.2
    • CocoaPods version 1.3.1

[✓] Android Studio (version 2.3)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Java version OpenJDK Runtime Environment (build 1.8.0_112-release-b06)

[✓] IntelliJ IDEA Community Edition (version 2017.2.5)
    • Flutter plugin version 18.2
    • Dart plugin version 172.4155.35

[✓] Connected devices
    • SM T810 • 33003b44d0cd3317 • android-arm • Android 7.0 (API 24) (emulator)

Metadata

Metadata

Assignees

Labels

P2Important issues not at the top of the work lista: error messageError messages from the Flutter frameworkc: crashStack traces logged to the consoled: api docsIssues with https://api.flutter.dev/frameworkflutter/packages/flutter repository. See also f: labels.waiting for PR to land (fixed)A fix is in flight

Type

No type
No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions