Пример #1
0
        public override Widget build(BuildContext context)
        {
            BottomAppBarTheme    babTheme     = BottomAppBarTheme.of(context);
            NotchedShape         notchedShape = widget.shape ?? babTheme?.shape;
            CustomClipper <Path> clipper      = notchedShape != null
                ? (CustomClipper <Path>) new _BottomAppBarClipper(
                geometry: geometryListenable,
                shape: notchedShape,
                notchMargin: widget.notchMargin
                )
                : new ShapeBorderClipper(shape: new RoundedRectangleBorder());

            float elevation      = widget.elevation ?? babTheme?.elevation ?? _defaultElevation;
            Color color          = widget.color ?? babTheme?.color ?? Theme.of(context).bottomAppBarColor;
            Color effectiveColor = ElevationOverlay.applyOverlay(context, color, elevation);

            return(new PhysicalShape(
                       clipper: clipper,
                       elevation: elevation,
                       color: effectiveColor,
                       clipBehavior: widget.clipBehavior,
                       child: new Material(
                           type: MaterialType.transparency,
                           child: widget.child == null
                        ? null
                        : new SafeArea(child: widget.child)
                           )
                       ));
        }
Пример #2
0
        public override Widget build(BuildContext context)
        {
            ShapeBorder shape     = _border.evaluate(animation);
            float       elevation = _elevation.evaluate(animation);

            return(new PhysicalShape(
                       child: new _ShapeBorderPaint(
                           child: widget.child,
                           shape: shape,
                           borderOnForeground: widget.borderOnForeground),
                       clipper: new ShapeBorderClipper(
                           shape: shape),
                       clipBehavior: widget.clipBehavior,
                       elevation: _elevation.evaluate(animation),
                       color: ElevationOverlay.applyOverlay(context, widget.color, elevation),
                       shadowColor: _shadowColor.evaluate(animation)
                       ));
        }
Пример #3
0
        public override Widget build(BuildContext context)
        {
            Color backgroundColor = _getBackgroundColor(context);

            D.assert(backgroundColor != null || 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 = widget.child;

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

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

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

            ShapeBorder shape = _getShape();

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

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