Ejemplo n.º 1
0
        public override Widget build(BuildContext context)
        {
            Widget current = this.child;

            if (this.child == null && (this.constraints == null || !this.constraints.isTight))
            {
                current = new LimitedBox(
                    maxWidth: 0.0,
                    maxHeight: 0.0,
                    child: new ConstrainedBox(constraints: BoxConstraints.expand())
                    );
            }

            if (this.alignment != null)
            {
                current = new Align(alignment: this.alignment, child: current);
            }

            EdgeInsets effetivePadding = this._paddingIncludingDecoration;

            if (effetivePadding != null)
            {
                current = new Padding(padding: effetivePadding, child: current);
            }

            if (this.decoration != null)
            {
                current = new DecoratedBox(decoration: this.decoration, child: current);
            }

            if (this.foregroundDecoration != null)
            {
                current = new DecoratedBox(
                    decoration: this.foregroundDecoration,
                    position: DecorationPosition.foreground,
                    child: current
                    );
            }

            if (this.constraints != null)
            {
                current = new ConstrainedBox(constraints: this.constraints, child: current);
            }

            if (this.margin != null)
            {
                current = new Padding(padding: this.margin, child: current);
            }

            if (this.transform != null)
            {
                current = new Transform(transform: new Matrix3(this.transform), child: current);
            }

            return(current);
        }
Ejemplo n.º 2
0
        public override Widget build(BuildContext context)
        {
            Widget current = child;

            if (child == null && (constraints == null || !constraints.isTight))
            {
                current = new LimitedBox(
                    maxWidth: 0.0f,
                    maxHeight: 0.0f,
                    child: new ConstrainedBox(constraints: BoxConstraints.expand())
                    );
            }

            if (alignment != null)
            {
                current = new Align(alignment: alignment, child: current);
            }

            EdgeInsetsGeometry effetivePadding = _paddingIncludingDecoration;

            if (effetivePadding != null)
            {
                current = new Padding(padding: effetivePadding, child: current);
            }

            if (color != null)
            {
                current = new ColoredBox(color: color, child: current);
            }

            if (decoration != null)
            {
                current = new DecoratedBox(decoration: decoration, child: current);
            }

            if (foregroundDecoration != null)
            {
                current = new DecoratedBox(
                    decoration: foregroundDecoration,
                    position: DecorationPosition.foreground,
                    child: current
                    );
            }

            if (constraints != null)
            {
                current = new ConstrainedBox(constraints: constraints, child: current);
            }

            if (margin != null)
            {
                current = new Padding(padding: margin, child: current);
            }

            if (transform != null)
            {
                current = new Transform(transform: new Matrix4(transform), child: current);
            }

            if (clipBehavior != Clip.none)
            {
                current = new ClipPath(
                    clipper: new _DecorationClipper(
                        textDirection: Directionality.of(context),
                        decoration: decoration
                        ),
                    clipBehavior: clipBehavior,
                    child: current
                    );
            }

            return(current);
        }