Beispiel #1
0
 public Checkbox(
     Key key       = null,
     bool?value    = false,
     bool tristate = false,
     ValueChanged <bool?> onChanged = null,
     Color activeColor = null,
     Color checkColor  = null,
     Color focusColor  = null,
     Color hoverColor  = null,
     MaterialTapTargetSize?materialTapTargetSize = null,
     VisualDensity visualDensity = null,
     FocusNode focusNode         = null,
     bool autofocus = false
     ) : base(key: key)
 {
     D.assert(tristate || value != null);
     this.value                 = value;
     this.onChanged             = onChanged;
     this.activeColor           = activeColor;
     this.checkColor            = checkColor;
     this.focusColor            = focusColor;
     this.hoverColor            = hoverColor;
     this.tristate              = tristate;
     this.materialTapTargetSize = materialTapTargetSize;
     this.visualDensity         = visualDensity;
     this.focusNode             = focusNode;
     this.autofocus             = autofocus;
 }
Beispiel #2
0
 public Radio(
     Key key      = null,
     T value      = default,
     T groupValue = default,
     ValueChanged <T> onChanged = null,
     bool toggleable            = false,
     Color activeColor          = null,
     Color focusColor           = null,
     Color hoverColor           = null,
     MaterialTapTargetSize?materialTapTargetSize = null,
     VisualDensity visualDensity = null,
     FocusNode focusNode         = null,
     bool autofocus = false
     ) : base(key: key)
 {
     D.assert(value != null);
     D.assert(groupValue != null);
     this.value                 = value;
     this.groupValue            = groupValue;
     this.onChanged             = onChanged;
     this.toggleable            = toggleable;
     this.activeColor           = activeColor;
     this.focusColor            = focusColor;
     this.hoverColor            = hoverColor;
     this.materialTapTargetSize = materialTapTargetSize;
     this.visualDensity         = visualDensity;
     this.focusNode             = focusNode;
     this.autofocus             = autofocus;
 }
 public static OutlineButton icon(
     Key key = null,
     VoidCallback onPressed    = null,
     VoidCallback onLongPress  = null,
     ButtonTextTheme?textTheme = null,
     Color textColor           = null,
     Color disabledTextColor   = null,
     Color color                  = null,
     Color focusColor             = null,
     Color hoverColor             = null,
     Color highlightColor         = null,
     Color splashColor            = null,
     float?highlightElevation     = null,
     Color highlightedBorderColor = null,
     Color disabledBorderColor    = null,
     BorderSide borderSide        = null,
     EdgeInsetsGeometry padding   = null,
     VisualDensity visualDensity  = null,
     ShapeBorder shape            = null,
     Clip clipBehavior            = Clip.none,
     Widget icon                  = null,
     FocusNode focusNode          = null,
     bool autofocus               = false,
     Widget label                 = null
     )
 {
     return(new _OutlineButtonWithIcon(
                key: key,
                onPressed: onPressed,
                onLongPress: onLongPress,
                textTheme: textTheme,
                textColor: textColor,
                disabledTextColor: disabledTextColor,
                color: color,
                focusColor: focusColor,
                hoverColor: hoverColor,
                highlightColor: highlightColor,
                splashColor: splashColor,
                highlightElevation: highlightElevation,
                highlightedBorderColor: highlightedBorderColor,
                disabledBorderColor: disabledBorderColor,
                borderSide: borderSide,
                padding: padding,
                visualDensity: visualDensity,
                shape: shape,
                clipBehavior: clipBehavior,
                focusNode: focusNode,
                autofocus: autofocus,
                icon: icon,
                label: label
                ));
 }
 public _OutlineButton(
     Key key = null,
     VoidCallback onPressed    = null,
     VoidCallback onLongPress  = null,
     Brightness?brightness     = null,
     ButtonTextTheme?textTheme = null,
     Color textColor           = null,
     Color disabledTextColor   = null,
     Color color                  = null,
     Color focusColor             = null,
     Color hoverColor             = null,
     Color highlightColor         = null,
     Color splashColor            = null,
     float?highlightElevation     = null,
     BorderSide borderSide        = null,
     Color disabledBorderColor    = null,
     Color highlightedBorderColor = null,
     EdgeInsetsGeometry padding   = null,
     VisualDensity visualDensity  = null,
     ShapeBorder shape            = null,
     Clip?clipBehavior            = Clip.none,
     FocusNode focusNode          = null,
     bool autofocus               = false,
     Widget child                 = null
     ) : base(key: key)
 {
     D.assert(highlightElevation != null && highlightElevation >= 0.0f);
     D.assert(highlightedBorderColor != null);
     this.onPressed              = onPressed;
     this.onLongPress            = onLongPress;
     this.brightness             = brightness;
     this.textTheme              = textTheme;
     this.textColor              = textColor;
     this.disabledTextColor      = disabledTextColor;
     this.color                  = color;
     this.focusColor             = focusColor;
     this.hoverColor             = hoverColor;
     this.highlightColor         = highlightColor;
     this.splashColor            = splashColor;
     this.highlightElevation     = highlightElevation;
     this.borderSide             = borderSide;
     this.disabledBorderColor    = disabledBorderColor;
     this.highlightedBorderColor = highlightedBorderColor;
     this.padding                = padding;
     this.visualDensity          = visualDensity;
     this.shape                  = shape;
     this.clipBehavior           = clipBehavior;
     this.focusNode              = focusNode;
     this.autofocus              = autofocus;
     this.child                  = child;
 }
 public OutlineButton(
     Key key = null,
     VoidCallback onPressed    = null,
     VoidCallback onLongPress  = null,
     ButtonTextTheme?textTheme = null,
     Color textColor           = null,
     Color disabledTextColor   = null,
     Color color                  = null,
     Color focusColor             = null,
     Color hoverColor             = null,
     Color highlightColor         = null,
     Color splashColor            = null,
     float?highlightElevation     = null,
     BorderSide borderSide        = null,
     Color disabledBorderColor    = null,
     Color highlightedBorderColor = null,
     EdgeInsetsGeometry padding   = null,
     VisualDensity visualDensity  = null,
     ShapeBorder shape            = null,
     Clip clipBehavior            = Clip.none,
     FocusNode focusNode          = null,
     bool autofocus               = false,
     Widget child                 = null
     ) :
     base(
         key: key,
         onPressed: onPressed,
         onLongPress: onLongPress,
         textTheme: textTheme,
         textColor: textColor,
         disabledTextColor: disabledTextColor,
         color: color,
         focusColor: focusColor,
         hoverColor: hoverColor,
         highlightColor: highlightColor,
         splashColor: splashColor,
         highlightElevation: highlightElevation,
         padding: padding,
         visualDensity: visualDensity,
         shape: shape,
         clipBehavior: clipBehavior,
         focusNode: focusNode,
         autofocus: autofocus,
         child: child
         )
 {
     D.assert(highlightElevation == null || highlightElevation >= 0.0f);
     this.highlightedBorderColor = highlightedBorderColor;
     this.disabledBorderColor    = disabledBorderColor;
     this.borderSide             = borderSide;
 }
Beispiel #6
0
 public FlatButton(
     Key key = null,
     VoidCallback onPressed = null,
     ValueChanged <bool> onHighlightChanged = null,
     VoidCallback onLongPress  = null,
     ButtonTextTheme?textTheme = null,
     Color textColor           = null,
     Color disabledTextColor   = null,
     Color color                 = null,
     Color disabledColor         = null,
     Color focusColor            = null,
     Color hoverColor            = null,
     Color highlightColor        = null,
     Color splashColor           = null,
     Brightness?colorBrightness  = null,
     EdgeInsetsGeometry padding  = null,
     VisualDensity visualDensity = null,
     ShapeBorder shape           = null,
     Clip clipBehavior           = Clip.none,
     FocusNode focusNode         = null,
     bool autofocus              = false,
     MaterialTapTargetSize?materialTapTargetSize = null,
     Widget child = null) : base(
         key: key,
         onPressed: onPressed,
         onLongPress: onLongPress,
         onHighlightChanged: onHighlightChanged,
         textTheme: textTheme,
         textColor: textColor,
         disabledTextColor: disabledTextColor,
         focusColor: focusColor,
         hoverColor: hoverColor,
         color: color,
         disabledColor: disabledColor,
         highlightColor: highlightColor,
         splashColor: splashColor,
         colorBrightness: colorBrightness,
         padding: padding,
         visualDensity: visualDensity,
         shape: shape,
         clipBehavior: clipBehavior,
         focusNode: focusNode,
         autofocus: autofocus,
         materialTapTargetSize: materialTapTargetSize,
         child: child)
 {
 }
Beispiel #7
0
 public IconButton(
     Key key        = null,
     float iconSize = 24.0f,
     VisualDensity visualDensity = null,
     EdgeInsetsGeometry padding  = null,
     AlignmentGeometry alignment = null,
     Widget icon                = null,
     Color color                = null,
     Color focusColor           = null,
     Color hoverColor           = null,
     Color highlightColor       = null,
     Color splashColor          = null,
     Color disabledColor        = null,
     VoidCallback onPressed     = null,
     FocusNode focusNode        = null,
     bool autofocus             = false,
     string tooltip             = null,
     bool?enableFeedback        = true,
     BoxConstraints constraints = null
     ) : base(key: key)
 {
     D.assert(icon != null);
     this.iconSize       = iconSize;
     this.visualDensity  = visualDensity;
     this.padding        = padding ?? EdgeInsets.all(8.0f);
     this.alignment      = alignment ?? Alignment.center;
     this.icon           = icon;
     this.color          = color;
     this.focusColor     = focusColor;
     this.hoverColor     = hoverColor;
     this.highlightColor = highlightColor;
     this.splashColor    = splashColor;
     this.disabledColor  = disabledColor;
     this.onPressed      = onPressed;
     this.focusNode      = focusNode;
     this.autofocus      = autofocus;
     this.tooltip        = tooltip;
     this.enableFeedback = enableFeedback;
     this.constraints    = constraints;
 }
Beispiel #8
0
 public GalleryVisualDensityValue(VisualDensity visualDensity, string label)
 {
     this.visualDensity = visualDensity;
     this.label         = label;
 }
 public _OutlineButtonWithIcon(
     Key key = null,
     VoidCallback onPressed    = null,
     VoidCallback onLongPress  = null,
     ButtonTextTheme?textTheme = null,
     Color textColor           = null,
     Color disabledTextColor   = null,
     Color color                  = null,
     Color focusColor             = null,
     Color hoverColor             = null,
     Color highlightColor         = null,
     Color splashColor            = null,
     float?highlightElevation     = null,
     Color highlightedBorderColor = null,
     Color disabledBorderColor    = null,
     BorderSide borderSide        = null,
     EdgeInsetsGeometry padding   = null,
     VisualDensity visualDensity  = null,
     ShapeBorder shape            = null,
     Clip clipBehavior            = Clip.none,
     FocusNode focusNode          = null,
     bool autofocus               = false,
     Widget icon                  = null,
     Widget label                 = null
     ) :
     base(
         key: key,
         onPressed: onPressed,
         onLongPress: onLongPress,
         textTheme: textTheme,
         textColor: textColor,
         disabledTextColor: disabledTextColor,
         color: color,
         focusColor: focusColor,
         hoverColor: hoverColor,
         highlightColor: highlightColor,
         splashColor: splashColor,
         highlightElevation: highlightElevation,
         disabledBorderColor: disabledBorderColor,
         highlightedBorderColor: highlightedBorderColor,
         borderSide: borderSide,
         padding: padding,
         visualDensity: visualDensity,
         shape: shape,
         clipBehavior: clipBehavior,
         focusNode: focusNode,
         autofocus: autofocus,
         child: new Row(
             mainAxisSize: MainAxisSize.min,
             children: new List <Widget> {
     icon,
     new SizedBox(width: 8.0f),
     label
 }
             )
         )
 {
     D.assert(highlightElevation == null || highlightElevation >= 0.0f);
     D.assert(icon != null);
     D.assert(label != null);
 }
Beispiel #10
0
        public RawMaterialButton(
            Key key = null,
            VoidCallback onPressed = null,
            GestureLongPressCallback onLongPress   = null,
            ValueChanged <bool> onHighlightChanged = null,
            TextStyle textStyle         = null,
            Color fillColor             = null,
            Color focusColor            = null,
            Color hoverColor            = null,
            Color highlightColor        = null,
            Color splashColor           = null,
            float elevation             = 2.0f,
            float focusElevation        = 4.0f,
            float hoverElevation        = 4.0f,
            float highlightElevation    = 8.0f,
            float disabledElevation     = 0.0f,
            EdgeInsetsGeometry padding  = null,
            VisualDensity visualDensity = null,
            BoxConstraints constraints  = null,
            ShapeBorder shape           = null,
            TimeSpan?animationDuration  = null,
            Clip clipBehavior           = Clip.none,
            FocusNode focusNode         = null,
            bool autofocus = false,
            MaterialTapTargetSize?materialTapTargetSize = null,
            Widget child        = null,
            bool enableFeedback = true) : base(key: key)
        {
            D.assert(elevation >= 0.0f);
            D.assert(focusElevation >= 0.0f);
            D.assert(focusElevation >= 0.0f);
            D.assert(highlightElevation >= 0.0f);
            D.assert(disabledElevation >= 0.0f);

            MaterialTapTargetSize _materialTapTargetSize = materialTapTargetSize ?? MaterialTapTargetSize.padded;

            shape         = shape ?? new RoundedRectangleBorder();
            visualDensity = visualDensity ?? new VisualDensity();
            padding       = padding ?? EdgeInsets.zero;
            constraints   = constraints ?? new BoxConstraints(minWidth: 88.0f, minHeight: 36.0f);
            TimeSpan _animationDuration = animationDuration ?? material_.kThemeChangeDuration;

            this.onPressed          = onPressed;
            this.onLongPress        = onLongPress;
            this.onHighlightChanged = onHighlightChanged;
            this.textStyle          = textStyle;
            this.fillColor          = fillColor;
            this.focusColor         = focusColor;
            this.hoverColor         = hoverColor;
            this.highlightColor     = highlightColor;
            this.splashColor        = splashColor;
            this.elevation          = elevation;
            this.focusElevation     = focusElevation;
            this.hoverElevation     = hoverElevation;
            this.highlightElevation = highlightElevation;
            this.disabledElevation  = disabledElevation;
            this.padding            = padding;
            this.visualDensity      = visualDensity;
            this.constraints        = constraints;
            this.shape                 = shape;
            this.animationDuration     = _animationDuration;
            this.clipBehavior          = clipBehavior;
            this.focusNode             = focusNode;
            this.autofocus             = autofocus;
            this.enableFeedback        = enableFeedback;
            this.materialTapTargetSize = _materialTapTargetSize;
            this.child                 = child;
        }
Beispiel #11
0
 public MaterialButton(
     Key key = null,
     VoidCallback onPressed   = null,
     VoidCallback onLongPress = null,
     ValueChanged <bool> onHighlightChanged = null,
     ButtonTextTheme?textTheme = null,
     Color textColor           = null,
     Color disabledTextColor   = null,
     Color color                 = null,
     Color disabledColor         = null,
     Color focusColor            = null,
     Color hoverColor            = null,
     Color highlightColor        = null,
     Color splashColor           = null,
     Brightness?colorBrightness  = null,
     float?elevation             = null,
     float?focusElevation        = null,
     float?hoverElevation        = null,
     float?highlightElevation    = null,
     float?disabledElevation     = null,
     EdgeInsetsGeometry padding  = null,
     VisualDensity visualDensity = null,
     ShapeBorder shape           = null,
     Clip?clipBehavior           = Clip.none,
     FocusNode focusNode         = null,
     bool?autofocus              = false,
     MaterialTapTargetSize?materialTapTargetSize = null,
     TimeSpan?animationDuration = null,
     float?minWidth             = null,
     float?height        = null,
     bool?enableFeedback = true,
     Widget child        = null
     ) : base(key: key)
 {
     D.assert(clipBehavior != null);
     D.assert(autofocus != null);
     D.assert(elevation == null || elevation >= 0.0f);
     D.assert(focusElevation == null || focusElevation >= 0.0f);
     D.assert(hoverElevation == null || hoverElevation >= 0.0f);
     D.assert(highlightElevation == null || highlightElevation >= 0.0f);
     D.assert(disabledElevation == null || disabledElevation >= 0.0f);
     this.onPressed          = onPressed;
     this.onLongPress        = onLongPress;
     this.onHighlightChanged = onHighlightChanged;
     this.textTheme          = textTheme;
     this.textColor          = textColor;
     this.disabledTextColor  = disabledTextColor;
     this.color                 = color;
     this.disabledColor         = disabledColor;
     this.focusColor            = focusColor;
     this.hoverColor            = hoverColor;
     this.highlightColor        = highlightColor;
     this.splashColor           = splashColor;
     this.colorBrightness       = colorBrightness;
     this.elevation             = elevation;
     this.focusElevation        = focusElevation;
     this.hoverElevation        = hoverElevation;
     this.highlightElevation    = highlightElevation;
     this.disabledElevation     = disabledElevation;
     this.padding               = padding;
     this.visualDensity         = visualDensity;
     this.shape                 = shape;
     this.clipBehavior          = clipBehavior;
     this.focusNode             = focusNode;
     this.materialTapTargetSize = materialTapTargetSize;
     this.animationDuration     = animationDuration;
     this.minWidth              = minWidth;
     this.height                = height;
     this.enableFeedback        = enableFeedback;
     this.child                 = child;
     this.autofocus             = autofocus;
 }
Beispiel #12
0
        public override Widget build(BuildContext context)
        {
            D.assert(material_.debugCheckHasMaterial(context));
            ThemeData theme = Theme.of(context);
            Color     currentColor;

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

            VisualDensity effectiveVisualDensity = visualDensity ?? theme.visualDensity;

            BoxConstraints unadjustedConstraints = constraints ?? new BoxConstraints(
                minWidth: material_._kMinButtonSize,
                minHeight: material_._kMinButtonSize
                );
            BoxConstraints adjustedConstraints = effectiveVisualDensity.effectiveConstraints(unadjustedConstraints);


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

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

            return(new InkResponse(
                       focusNode: focusNode,
                       autofocus: autofocus,
                       canRequestFocus: onPressed != null,
                       onTap: () => {
                if (onPressed != null)
                {
                    onPressed();
                }
            },
                       enableFeedback: enableFeedback ?? false,
                       child: result,
                       focusColor: focusColor ?? Theme.of(context).focusColor,
                       hoverColor: hoverColor ?? Theme.of(context).hoverColor,
                       highlightColor: highlightColor ?? Theme.of(context).highlightColor,
                       splashColor: splashColor ?? Theme.of(context).splashColor,
                       radius: Mathf.Max(
                           Material.defaultSplashRadius,
                           (iconSize + Mathf.Min(padding.horizontal, padding.vertical)) * 0.7f)
                       ));
        }
Beispiel #13
0
 public RaisedButton(
     Key key = null,
     VoidCallback onPressed   = null,
     VoidCallback onLongPress = null,
     ValueChanged <bool> onHighlightChanged = null,
     ButtonTextTheme?textTheme = null,
     Color textColor           = null,
     Color disabledTextColor   = null,
     Color color                 = null,
     Color disabledColor         = null,
     Color focusColor            = null,
     Color hoverColor            = null,
     Color highlightColor        = null,
     Color splashColor           = null,
     Brightness?colorBrightness  = null,
     float?elevation             = null,
     float?focusElevation        = null,
     float?hoverElevation        = null,
     float?highlightElevation    = null,
     float?disabledElevation     = null,
     EdgeInsetsGeometry padding  = null,
     VisualDensity visualDensity = null,
     ShapeBorder shape           = null,
     Clip?clipBehavior           = Clip.none,
     FocusNode focusNode         = null,
     bool autofocus              = false,
     MaterialTapTargetSize?materialTapTargetSize = null,
     TimeSpan?animationDuration = null,
     Widget child = null
     ) : base(
         key: key,
         onPressed: onPressed,
         onLongPress: onLongPress,
         onHighlightChanged: onHighlightChanged,
         textTheme: textTheme,
         textColor: textColor,
         disabledTextColor: disabledTextColor,
         color: color,
         disabledColor: disabledColor,
         focusColor: focusColor,
         hoverColor: hoverColor,
         highlightColor: highlightColor,
         splashColor: splashColor,
         colorBrightness: colorBrightness,
         elevation: elevation,
         focusElevation: focusElevation,
         hoverElevation: hoverElevation,
         highlightElevation: highlightElevation,
         disabledElevation: disabledElevation,
         padding: padding,
         visualDensity: visualDensity,
         shape: shape,
         clipBehavior: clipBehavior,
         focusNode: focusNode,
         autofocus: autofocus,
         materialTapTargetSize: materialTapTargetSize,
         animationDuration: animationDuration,
         child: child)
 {
     D.assert(elevation == null || elevation >= 0.0);
     D.assert(focusElevation == null || focusElevation >= 0.0);
     D.assert(hoverElevation == null || hoverElevation >= 0.0);
     D.assert(highlightElevation == null || highlightElevation >= 0.0);
     D.assert(disabledElevation == null || disabledElevation >= 0.0);
     D.assert(clipBehavior != null);
 }