示例#1
0
        public override Widget build(BuildContext context)
        {
            D.assert(MaterialDebug.debugCheckHasMaterial(context));
            ThemeData theme           = Theme.of(context);
            float     statusBarHeight = MediaQuery.of(context).padding.top;

            return(new Container(
                       height: statusBarHeight + DrawerHeaderUtils._kDrawerHeaderHeight,
                       margin: this.margin,
                       decoration: new BoxDecoration(
                           border: new Border(
                               bottom: Divider.createBorderSide(context)
                               )
                           ),
                       child: new AnimatedContainer(
                           padding: this.padding.add(EdgeInsets.only(top: statusBarHeight)),
                           decoration: this.decoration,
                           duration: this.duration,
                           curve: this.curve,
                           child: this.child == null
                        ? null
                        : new DefaultTextStyle(
                               style: theme.textTheme.body2,
                               child: MediaQuery.removePadding(
                                   context: context,
                                   removeTop: true,
                                   child: this.child)
                               )
                           )
                       ));
        }
示例#2
0
        public override Widget build(BuildContext context)
        {
            D.assert(MaterialDebug.debugCheckHasMaterial(context));
            Color currentColor;

            if (this.onPressed != null)
            {
                currentColor = this.color;
            }
            else
            {
                currentColor = this.disabledColor ?? Theme.of(context).disabledColor;
            }

            Widget result = new ConstrainedBox(
                constraints: new BoxConstraints(minWidth: IconButtonUtils._kMinButtonSize,
                                                minHeight: IconButtonUtils._kMinButtonSize),
                child: new Padding(
                    padding: this.padding,
                    child: new SizedBox(
                        height: this.iconSize,
                        width: this.iconSize,
                        child: new Align(
                            alignment: this.alignment,
                            child: IconTheme.merge(
                                data: new IconThemeData(
                                    size: this.iconSize,
                                    color: currentColor),
                                child: this.icon)
                            )
                        )
                    )
                );

            if (this.tooltip != null)
            {
                result = new Tooltip(
                    message: this.tooltip,
                    child: result);
            }

            return(new InkResponse(
                       onTap: () => {
                if (this.onPressed != null)
                {
                    this.onPressed();
                }
            },
                       child: result,
                       highlightColor: this.highlightColor ?? Theme.of(context).highlightColor,
                       splashColor: this.splashColor ?? Theme.of(context).splashColor,
                       radius: Math.Max(
                           Material.defaultSplashRadius,
                           (this.iconSize + Math.Min(this.padding.horizontal, this.padding.vertical)) * 0.7)
                       ));
        }
示例#3
0
        public override Widget build(BuildContext context)
        {
            D.assert(MaterialDebug.debugCheckHasMaterial(context));
            ThemeData theme = Theme.of(context);

            return(new IconButton(
                       padding: this.widget.padding,
                       color: theme.brightness == Brightness.dark ? Colors.white54 : Colors.black54,
                       onPressed: this.widget.onPressed == null ? (VoidCallback)null : this._handlePressed,
                       icon: new RotationTransition(
                           turns: this._iconTurns,
                           child: new Icon(Icons.expand_more))
                       ));
        }
示例#4
0
        public override Widget build(BuildContext context)
        {
            D.assert(MaterialDebug.debugCheckHasMaterial(context));
            Widget result = new LayoutBuilder(
                builder: this._build
                );

            if (this.widget.width != null || this.widget.height != null)
            {
                result = new SizedBox(
                    width: this.widget.width,
                    height: this.widget.height,
                    child: result);
            }

            return(result);
        }
示例#5
0
        public override Widget build(BuildContext context)
        {
            D.assert(MaterialDebug.debugCheckHasMaterial(context));
            ThemeData     theme     = Theme.of(context);
            ListTileTheme tileTheme = ListTileTheme.of(context);

            IconThemeData iconThemeData = null;

            if (this.leading != null || this.trailing != null)
            {
                iconThemeData = new IconThemeData(color: this._iconColor(theme, tileTheme));
            }

            Widget leadingIcon = null;

            if (this.leading != null)
            {
                leadingIcon = IconTheme.merge(
                    data: iconThemeData,
                    child: this.leading);
            }

            TextStyle titleStyle = this._titleTextStyle(theme, tileTheme);
            Widget    titleText  = new AnimatedDefaultTextStyle(
                style: titleStyle,
                duration: Constants.kThemeChangeDuration,
                child: this.title ?? new SizedBox()
                );

            Widget    subtitleText  = null;
            TextStyle subtitleStyle = null;

            if (this.subtitle != null)
            {
                subtitleStyle = this._subtitleTextStyle(theme, tileTheme);
                subtitleText  = new AnimatedDefaultTextStyle(
                    style: subtitleStyle,
                    duration: Constants.kThemeChangeDuration,
                    child: this.subtitle);
            }

            Widget trailingIcon = null;

            if (this.trailing != null)
            {
                trailingIcon = IconTheme.merge(
                    data: iconThemeData,
                    child: this.trailing);
            }

            EdgeInsets _defaultContentPadding = EdgeInsets.symmetric(horizontal: 16.0f);
            EdgeInsets resolvedContentPadding =
                this.contentPadding ?? tileTheme?.contentPadding ?? _defaultContentPadding;

            return(new InkWell(
                       onTap: this.enabled ? this.onTap : null,
                       onLongPress: this.enabled ? this.onLongPress : null,
                       child: new SafeArea(
                           top: false,
                           bottom: false,
                           mininum: resolvedContentPadding,
                           child: new _ListTile(
                               leading: leadingIcon,
                               title: titleText,
                               subtitle: subtitleText,
                               trailing: trailingIcon,
                               isDense: this._isDenseLayout(tileTheme),
                               isThreeLine: this.isThreeLine,
                               titleBaselineType: titleStyle.textBaseline,
                               subtitleBaselineType: subtitleStyle?.textBaseline
                               )
                           )
                       ));
        }
示例#6
0
 public virtual bool debugCheckContext(BuildContext context)
 {
     D.assert(MaterialDebug.debugCheckHasMaterial(context));
     return(true);
 }