예제 #1
0
        public void _layout(ConstraintType constraints)
        {
            owner.buildScope(this, () => {
                Widget built = null;
                if (widget.builder != null)
                {
                    try {
                        built = widget.builder(this, constraints);
                        WidgetsD.debugWidgetBuilderValue(widget, built);
                    } catch (Exception e) {
                        _debugDoingBuild = false;
                        IEnumerable <DiagnosticsNode> informationCollector()
                        {
                            yield return(new DiagnosticsDebugCreator(new DebugCreator(this)));
                        }
                        built = ErrorWidget.builder(WidgetsD._debugReportException("building " + this, e, informationCollector));
                    }
                }
                try {
                    _child = updateChild(_child, built, null);
                    D.assert(_child != null);
                } catch (Exception e) {
                    _debugDoingBuild = false;

                    IEnumerable <DiagnosticsNode> informationCollector()
                    {
                        yield return(new DiagnosticsDebugCreator(new DebugCreator(this)));
                    }
                    built = ErrorWidget.builder(WidgetsD._debugReportException("building " + this, e, informationCollector));
                }
            });
        }
예제 #2
0
        void _rebuild()
        {
            try {
                _child = updateChild(_child, widget.child,
                                     _rootChildSlot);
                // allow
            }
            catch (Exception ex) {
                var details = new UIWidgetsErrorDetails(
                    exception: ex,
                    library: "widgets library",
                    context: new ErrorDescription("attaching to the render tree")
                    );
                UIWidgetsError.reportError(details);

                Widget error = ErrorWidget.builder(details);
                _child = updateChild(null, error, _rootChildSlot);
            }
        }