-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Labels
P3Issues that are less important to the Flutter projectIssues that are less important to the Flutter projecta: error messageError messages from the Flutter frameworkError messages from the Flutter frameworka: qualityA truly polished experienceA truly polished experiencef: material designflutter/packages/flutter/material repository.flutter/packages/flutter/material repository.frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.good first issueRelatively approachable for first-time contributorsRelatively approachable for first-time contributorsr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer versionteam-designOwned by Design Languages teamOwned by Design Languages teamtriaged-designTriaged by Design Languages teamTriaged by Design Languages team
Description
Disclaimer - this issue was picked for an entertaining-new-contributors educational project inside Yandex mobile schools. Please contact @nt4f04uNd that you are willing to work on it.
Running this code sample
import 'package:flutter/material.dart';
void main() {
runApp(Container(
decoration: BoxDecoration(
border: Border.all(),
borderRadius: BorderRadiusDirectional.all(Radius.circular(1.0)),
),
));
}Gives this as output
Gives this as output
════════ Exception caught by rendering library ═════════════════════════════════
The following assertion was thrown during paint():
'package:flutter/src/painting/border_radius.dart': Failed assertion: line 727 pos 12: 'direction != null': is not true.
2
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
Container Container:file:///C:/dev/projects/issues/lib/main.dart:10:12
When the exception was thrown, this was the stack
#2 BorderRadiusDirectional.resolve
package:flutter/…/painting/border_radius.dart:727
#3 _BoxDecorationPainter.paint
package:flutter/…/painting/box_decoration.dart:488
#4 RenderDecoratedBox.paint
package:flutter/…/rendering/proxy_box.dart:2162
#5 RenderObject._paintWithContext
package:flutter/…/rendering/object.dart:2409
#6 PaintingContext.paintChild
package:flutter/…/rendering/object.dart:189
#7 RenderView.paint
package:flutter/…/rendering/view.dart:209
#8 RenderObject._paintWithContext
package:flutter/…/rendering/object.dart:2409
#9 PaintingContext._repaintCompositedChild
package:flutter/…/rendering/object.dart:141
#10 PaintingContext.repaintCompositedChild
package:flutter/…/rendering/object.dart:100
#11 PipelineOwner.flushPaint
package:flutter/…/rendering/object.dart:979
#12 RendererBinding.drawFrame
package:flutter/…/rendering/binding.dart:455
#13 WidgetsBinding.drawFrame
package:flutter/…/widgets/binding.dart:883
#14 RendererBinding._handlePersistentFrameCallback
package:flutter/…/rendering/binding.dart:319
#15 SchedulerBinding._invokeFrameCallback
package:flutter/…/scheduler/binding.dart:1143
#16 SchedulerBinding.handleDrawFrame
package:flutter/…/scheduler/binding.dart:1080
#17 SchedulerBinding.scheduleWarmUpFrame.<anonymous closure>
package:flutter/…/scheduler/binding.dart:863
(elided 13 frames from class _AssertionError, class _RawReceivePortImpl, class _Timer, dart:async, and dart:async-patch)
The following RenderObject was being processed when the exception was fired: RenderDecoratedBox#ef365
RenderObject: RenderDecoratedBox#ef365
parentData: <none>
constraints: BoxConstraints(w=392.7, h=759.3)
size: Size(392.7, 759.3)
decoration: BoxDecoration
border: Border.all(BorderSide(Color(0xff000000), 1.0, BorderStyle.solid))
borderRadius: BorderRadiusDirectional.circular(1.0)
configuration: ImageConfiguration(bundle: PlatformAssetBundle#6a1dc(), devicePixelRatio: 1.0, platform: android)
child: RenderPadding#0d2c7 NEEDS-PAINT
parentData: <none> (can use size)
constraints: BoxConstraints(w=392.7, h=759.3)
size: Size(392.7, 759.3)
padding: EdgeInsets.all(1.0)
child: RenderLimitedBox#7356c NEEDS-PAINT
parentData: offset=Offset(1.0, 1.0) (can use size)
constraints: BoxConstraints(w=390.7, h=757.3)
size: Size(390.7, 757.3)
maxWidth: 0.0
maxHeight: 0.0
child: RenderConstrainedBox#fdce1 NEEDS-PAINT
parentData: <none> (can use size)
constraints: BoxConstraints(w=390.7, h=757.3)
size: Size(390.7, 757.3)
additionalConstraints: BoxConstraints(biggest)
════════════════════════════════════════════════════════════════════════════════
It would be nice if that would be catched and rethrown with a better error message instructing what I have to do to fix that - similar to the assertion here
flutter/packages/flutter/lib/src/widgets/debug.dart
Lines 270 to 296 in 5575bf3
| bool debugCheckHasDirectionality(BuildContext context, { String? why, String? hint, String? alternative }) { | |
| assert(() { | |
| if (context.widget is! Directionality && context.getElementForInheritedWidgetOfExactType<Directionality>() == null) { | |
| why = why == null ? '' : ' $why'; | |
| throw FlutterError.fromParts(<DiagnosticsNode>[ | |
| ErrorSummary('No Directionality widget found.'), | |
| ErrorDescription('${context.widget.runtimeType} widgets require a Directionality widget ancestor$why.\n'), | |
| if (hint != null) | |
| ErrorHint(hint), | |
| context.describeWidget('The specific widget that could not find a Directionality ancestor was'), | |
| context.describeOwnershipChain('The ownership chain for the affected widget is'), | |
| ErrorHint( | |
| 'Typically, the Directionality widget is introduced by the MaterialApp ' | |
| 'or WidgetsApp widget at the top of your application widget tree. It ' | |
| 'determines the ambient reading direction and is used, for example, to ' | |
| 'determine how to lay out text, how to interpret "start" and "end" ' | |
| 'values, and to resolve EdgeInsetsDirectional, ' | |
| 'AlignmentDirectional, and other *Directional objects.', | |
| ), | |
| if (alternative != null) | |
| ErrorHint(alternative), | |
| ]); | |
| } | |
| return true; | |
| }()); | |
| return true; | |
| } |
Metadata
Metadata
Assignees
Labels
P3Issues that are less important to the Flutter projectIssues that are less important to the Flutter projecta: error messageError messages from the Flutter frameworkError messages from the Flutter frameworka: qualityA truly polished experienceA truly polished experiencef: material designflutter/packages/flutter/material repository.flutter/packages/flutter/material repository.frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.good first issueRelatively approachable for first-time contributorsRelatively approachable for first-time contributorsr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer versionteam-designOwned by Design Languages teamOwned by Design Languages teamtriaged-designTriaged by Design Languages teamTriaged by Design Languages team