コード例 #1
0
        public override void debugFillProperties(DiagnosticPropertiesBuilder properties)
        {
            base.debugFillProperties(properties);
            ThemeData     defaultTheme = ThemeData.fallback();
            ChipThemeData defaultData  = fromDefaults(
                secondaryColor: defaultTheme.primaryColor,
                brightness: defaultTheme.brightness,
                labelStyle: defaultTheme.textTheme.body2
                );

            properties.add(new DiagnosticsProperty <Color>("backgroundColor", this.backgroundColor,
                                                           defaultValue: defaultData.backgroundColor));
            properties.add(new DiagnosticsProperty <Color>("deleteIconColor", this.deleteIconColor,
                                                           defaultValue: defaultData.deleteIconColor));
            properties.add(new DiagnosticsProperty <Color>("disabledColor", this.disabledColor,
                                                           defaultValue: defaultData.disabledColor));
            properties.add(new DiagnosticsProperty <Color>("selectedColor", this.selectedColor,
                                                           defaultValue: defaultData.selectedColor));
            properties.add(new DiagnosticsProperty <Color>("secondarySelectedColor", this.secondarySelectedColor,
                                                           defaultValue: defaultData.secondarySelectedColor));
            properties.add(new DiagnosticsProperty <EdgeInsets>("labelPadding", this.labelPadding,
                                                                defaultValue: defaultData.labelPadding));
            properties.add(
                new DiagnosticsProperty <EdgeInsets>("padding", this.padding, defaultValue: defaultData.padding));
            properties.add(new DiagnosticsProperty <ShapeBorder>("shape", this.shape, defaultValue: defaultData.shape));
            properties.add(new DiagnosticsProperty <TextStyle>("labelStyle", this.labelStyle,
                                                               defaultValue: defaultData.labelStyle));
            properties.add(new DiagnosticsProperty <TextStyle>("secondaryLabelStyle", this.secondaryLabelStyle,
                                                               defaultValue: defaultData.secondaryLabelStyle));
            properties.add(new EnumProperty <Brightness?>("brightness", this.brightness,
                                                          defaultValue: defaultData.brightness));
            properties.add(new FloatProperty("elevation", this.elevation, defaultValue: defaultData.elevation));
            properties.add(new FloatProperty("pressElevation", this.pressElevation,
                                             defaultValue: defaultData.pressElevation));
        }
コード例 #2
0
        public static ChipThemeData lerp(ChipThemeData a, ChipThemeData b, float t)
        {
            if (a == null && b == null)
            {
                return(null);
            }

            return(new ChipThemeData(
                       backgroundColor: Color.lerp(a?.backgroundColor, b?.backgroundColor, t),
                       deleteIconColor: Color.lerp(a?.deleteIconColor, b?.deleteIconColor, t),
                       disabledColor: Color.lerp(a?.disabledColor, b?.disabledColor, t),
                       selectedColor: Color.lerp(a?.selectedColor, b?.selectedColor, t),
                       secondarySelectedColor: Color.lerp(a?.secondarySelectedColor, b?.secondarySelectedColor, t),
                       shadowColor: Color.lerp(a?.shadowColor, b?.shadowColor, t),
                       selectedShadowColor: Color.lerp(a?.selectedShadowColor, b?.selectedShadowColor, t),
                       labelPadding: EdgeInsets.lerp(a?.labelPadding, b?.labelPadding, t),
                       padding: EdgeInsets.lerp(a?.padding, b?.padding, t),
                       shape: ShapeBorder.lerp(a?.shape, b?.shape, t),
                       labelStyle: TextStyle.lerp(a?.labelStyle, b?.labelStyle, t),
                       secondaryLabelStyle: TextStyle.lerp(a?.secondaryLabelStyle, b?.secondaryLabelStyle, t),
                       brightness: t < 0.5f ? a?.brightness ?? Brightness.light : b?.brightness ?? Brightness.light,
                       elevation: MathUtils.lerpFloat(a?.elevation ?? 0.0f, b?.elevation ?? 0.0f, t),
                       pressElevation: MathUtils.lerpFloat(a?.pressElevation ?? 0.0f, b?.pressElevation ?? 0.0f, t)
                       ));
        }
コード例 #3
0
 public ChipTheme(
     Key key            = null,
     ChipThemeData data = null,
     Widget child       = null
     ) : base(key: key, child: child)
 {
     D.assert(child != null);
     D.assert(data != null);
     this.data = data;
 }
コード例 #4
0
 public bool Equals(ChipThemeData other)
 {
     return(other.backgroundColor == this.backgroundColor &&
            other.deleteIconColor == this.deleteIconColor &&
            other.disabledColor == this.disabledColor &&
            other.selectedColor == this.selectedColor &&
            other.secondarySelectedColor == this.secondarySelectedColor &&
            other.labelPadding == this.labelPadding &&
            other.padding == this.padding &&
            other.shape == this.shape &&
            other.labelStyle == this.labelStyle &&
            other.secondaryLabelStyle == this.secondaryLabelStyle &&
            other.brightness == this.brightness &&
            other.elevation == this.elevation &&
            other.pressElevation == this.pressElevation);
 }
コード例 #5
0
 public bool Equals(ChipThemeData other)
 {
     return(other.backgroundColor == backgroundColor &&
            other.deleteIconColor == deleteIconColor &&
            other.disabledColor == disabledColor &&
            other.selectedColor == selectedColor &&
            other.secondarySelectedColor == secondarySelectedColor &&
            other.shadowColor == shadowColor &&
            other.selectedShadowColor == selectedShadowColor &&
            other.checkmarkColor == checkmarkColor &&
            other.labelPadding == labelPadding &&
            other.padding == padding &&
            other.shape == shape &&
            other.labelStyle == labelStyle &&
            other.secondaryLabelStyle == secondaryLabelStyle &&
            other.brightness == brightness &&
            other.elevation == elevation &&
            other.pressElevation == pressElevation);
 }