Пример #1
0
        public override void updateRenderObject(BuildContext context, RenderObject renderObject)
        {
            _RenderInkFeatures _renderObject = (_RenderInkFeatures)renderObject;

            _renderObject.color = this.color;
            D.assert(this.vsync == _renderObject.vsync);
        }
Пример #2
0
        public static MaterialInkController of(BuildContext context)
        {
            _RenderInkFeatures result =
                (_RenderInkFeatures)context.ancestorRenderObjectOfType(new TypeMatcher <_RenderInkFeatures>());

            return(result);
        }
Пример #3
0
        public static MaterialInkController of(BuildContext context)
        {
            _RenderInkFeatures result =
                (_RenderInkFeatures)context.findAncestorRenderObjectOfType <_RenderInkFeatures>();

            return(result);
        }
Пример #4
0
        public override Widget build(BuildContext context)
        {
            Color backgroundColor = this._getBackgroundColor(context);

            D.assert(backgroundColor != null || this.widget.type == MaterialType.transparency,
                     () => "If Material type is not MaterialType.transparency, a color must" +
                     "either be passed in through the 'color' property, or be defined " +
                     "in the theme (ex. canvasColor != null if type is set to " +
                     "MaterialType.canvas");
            Widget contents = this.widget.child;

            if (contents != null)
            {
                contents = new AnimatedDefaultTextStyle(
                    style: this.widget.textStyle ?? Theme.of(context).textTheme.body1,
                    duration: this.widget.animationDuration,
                    child: contents
                    );
            }

            contents = new NotificationListener <LayoutChangedNotification>(
                onNotification: (LayoutChangedNotification notification) => {
                _RenderInkFeatures renderer =
                    (_RenderInkFeatures)this._inkFeatureRenderer.currentContext.findRenderObject();
                renderer._didChangeLayout();
                return(true);
            },
                child: new _InkFeatures(
                    key: this._inkFeatureRenderer,
                    color: backgroundColor,
                    child: contents,
                    vsync: this
                    )
                );

            if (this.widget.type == MaterialType.canvas && this.widget.shape == null &&
                this.widget.borderRadius == null)
            {
                return(new AnimatedPhysicalModel(
                           curve: Curves.fastOutSlowIn,
                           duration: this.widget.animationDuration,
                           shape: BoxShape.rectangle,
                           clipBehavior: this.widget.clipBehavior,
                           borderRadius: BorderRadius.zero,
                           elevation: this.widget.elevation,
                           color: backgroundColor,
                           shadowColor: this.widget.shadowColor,
                           animateColor: false,
                           child: contents
                           ));
            }

            ShapeBorder shape = this._getShape();

            if (this.widget.type == MaterialType.transparency)
            {
                return(_transparentInterior(
                           context: context,
                           shape: shape,
                           clipBehavior: this.widget.clipBehavior,
                           contents: contents));
            }

            return(new _MaterialInterior(
                       curve: Curves.fastOutSlowIn,
                       duration: this.widget.animationDuration,
                       shape: shape,
                       borderOnForeground: this.widget.borderOnForeground,
                       clipBehavior: this.widget.clipBehavior,
                       elevation: this.widget.elevation,
                       color: backgroundColor,
                       shadowColor: this.widget.shadowColor,
                       child: contents
                       ));
        }