public TextStyle(Color color = null,
     float? fontSize = null,
     FontWeight fontWeight = null,
     FontStyle? fontStyle = null,
     float? letterSpacing = null,
     float? wordSpacing = null,
     TextBaseline? textBaseline = null,
     float? height = null,
     TextDecoration decoration = null,
     TextDecorationStyle? decorationStyle = null,
     Color decorationColor = null,
     string fontFamily = null,
     Paint foreground = null,
     Paint background = null,
     List<BoxShadow> shadows = null
 ) {
     this.color = color ?? this.color;
     this.fontSize = fontSize ?? this.fontSize;
     this.fontWeight = fontWeight ?? this.fontWeight;
     this.fontStyle = fontStyle ?? this.fontStyle;
     this.letterSpacing = letterSpacing ?? this.letterSpacing;
     this.wordSpacing = wordSpacing ?? this.wordSpacing;
     this.fontSize = fontSize ?? this.fontSize;
     this.textBaseline = textBaseline ?? this.textBaseline;
     this.height = height ?? this.height;
     this.decoration = decoration ?? this.decoration;
     this.decorationStyle = decorationStyle ?? this.decorationStyle;
     this.decorationColor = decorationColor ?? this.decorationColor;
     this.fontFamily = fontFamily ?? this.fontFamily;
     this.foreground = foreground ?? this.foreground;
     this.background = background ?? this.background;
     this.shadows = shadows ?? this.shadows;
 }
Exemple #2
0
        public TextStyle copyWith(
            bool?inherit                        = null,
            Color color                         = null,
            Color backgroundColor               = null,
            string fontFamily                   = null,
            List <string> fontFamilyFallback    = null,
            float?fontSize                      = null,
            FontWeight fontWeight               = null,
            FontStyle?fontStyle                 = null,
            float?letterSpacing                 = null,
            float?wordSpacing                   = null,
            TextBaseline?textBaseline           = null,
            float?height                        = null,
            Paint foreground                    = null,
            Paint background                    = null,
            TextDecoration decoration           = null,
            Color decorationColor               = null,
            TextDecorationStyle?decorationStyle = null,
            float?decorationThickness           = null,
            List <Shadow> shadows               = null,
            List <FontFeature> fontFeatures     = null,
            string debugLabel                   = null)
        {
            D.assert(color == null || foreground == null, () => _kColorForegroundWarning);
            D.assert(backgroundColor == null || background == null, () => _kColorBackgroundWarning);
            string newDebugLabel = null;

            D.assert(() => {
                if (this.debugLabel != null)
                {
                    newDebugLabel = debugLabel ?? $"({this.debugLabel}).copyWith";
                }

                return(true);
            });

            return(new TextStyle(
                       inherit ?? this.inherit,
                       this.foreground == null && foreground == null ? color ?? this.color : null,
                       this.background == null && background == null ? backgroundColor ?? this.backgroundColor : null,
                       fontFamily: fontFamily ?? this.fontFamily,
                       fontFamilyFallback: fontFamilyFallback ?? this.fontFamilyFallback,
                       fontSize: fontSize ?? this.fontSize,
                       fontWeight: fontWeight ?? this.fontWeight,
                       fontStyle: fontStyle ?? this.fontStyle,
                       letterSpacing: letterSpacing ?? this.letterSpacing,
                       wordSpacing: wordSpacing ?? this.wordSpacing,
                       textBaseline: textBaseline ?? this.textBaseline,
                       height: height ?? this.height,
                       decoration: decoration ?? this.decoration,
                       decorationColor: decorationColor ?? this.decorationColor,
                       decorationStyle: decorationStyle ?? this.decorationStyle,
                       decorationThickness: decorationThickness ?? this.decorationThickness,
                       foreground: foreground ?? this.foreground,
                       background: background ?? this.background,
                       shadows: shadows ?? this.shadows,
                       fontFeatures: fontFeatures ?? this.fontFeatures,
                       debugLabel: newDebugLabel
                       ));
        }
Exemple #3
0
        public TextStyle apply(
            Color color = null,
            TextDecoration decoration           = null,
            Color decorationColor               = null,
            TextDecorationStyle?decorationStyle = null,
            string fontFamily          = null,
            double fontSizeFactor      = 1.0,
            double fontSizeDelta       = 0.0,
            int fontWeightDelta        = 0,
            double letterSpacingFactor = 1.0,
            double letterSpacingDelta  = 0.0,
            double wordSpacingFactor   = 1.0,
            double wordSpacingDelta    = 0.0,
            double heightFactor        = 1.0,
            double heightDelta         = 0.0
            )
        {
            D.assert(this.fontSize != null || (fontSizeFactor == 1.0 && fontSizeDelta == 0.0));
            D.assert(this.fontWeight != null || fontWeightDelta == 0.0);
            D.assert(this.letterSpacing != null || (letterSpacingFactor == 1.0 && letterSpacingDelta == 0.0));
            D.assert(this.wordSpacing != null || (wordSpacingFactor == 1.0 && wordSpacingDelta == 0.0));
            D.assert(this.height != null || (heightFactor == 1.0 && heightDelta == 0.0));

            string modifiedDebugLabel = "";

            D.assert(() => {
                if (this.debugLabel != null)
                {
                    modifiedDebugLabel = this.debugLabel + ".apply";
                }

                return(true);
            });

            return(new TextStyle(
                       inherit: this.inherit,
                       color: color ?? this.color,
                       fontFamily: fontFamily ?? this.fontFamily,
                       fontSize: this.fontSize == null ? null : this.fontSize * fontSizeFactor + fontSizeDelta,
                       fontWeight: this.fontWeight == null ? null : this.fontWeight,
                       fontStyle: this.fontStyle,
                       letterSpacing: this.letterSpacing == null
                    ? null
                    : this.letterSpacing * letterSpacingFactor + letterSpacingDelta,
                       wordSpacing: this.wordSpacing == null ? null : this.wordSpacing * wordSpacingFactor + wordSpacingDelta,
                       textBaseline: this.textBaseline,
                       height: this.height == null ? null : this.height * heightFactor + heightDelta,
                       background: this.background,
                       decoration: decoration ?? this.decoration,
                       decorationColor: decorationColor ?? this.decorationColor,
                       decorationStyle: decorationStyle ?? this.decorationStyle,
                       debugLabel: modifiedDebugLabel
                       ));
        }
Exemple #4
0
 public TextStyle(bool inherit                        = true,
                  Color color                         = null,
                  Color backgroundColor               = null,
                  float?fontSize                      = null,
                  FontWeight fontWeight               = null,
                  FontStyle?fontStyle                 = null,
                  float?letterSpacing                 = null,
                  float?wordSpacing                   = null,
                  TextBaseline?textBaseline           = null,
                  float?height                        = null,
                  Paint foreground                    = null,
                  Paint background                    = null,
                  TextDecoration decoration           = null,
                  Color decorationColor               = null,
                  TextDecorationStyle?decorationStyle = null,
                  float?decorationThickness           = null,
                  string fontFamily                   = null,
                  List <string> fontFamilyFallback    = null,
                  List <Shadow> shadows               = null,
                  List <FontFeature> fontFeatures     = null,
                  string debugLabel                   = null)
 {
     D.assert(color == null || foreground == null, () => _kColorForegroundWarning);
     D.assert(backgroundColor == null || background == null, () => _kColorBackgroundWarning);
     this.inherit             = inherit;
     this.color               = color;
     this.backgroundColor     = backgroundColor;
     this.fontSize            = fontSize;
     this.fontWeight          = fontWeight;
     this.fontStyle           = fontStyle;
     this.letterSpacing       = letterSpacing;
     this.wordSpacing         = wordSpacing;
     this.textBaseline        = textBaseline;
     this.height              = height;
     this.decoration          = decoration;
     this.decorationColor     = decorationColor;
     this.decorationStyle     = decorationStyle;
     this.decorationThickness = decorationThickness;
     this.fontFamily          = fontFamily;
     this.fontFamilyFallback  = fontFamilyFallback;
     this.debugLabel          = debugLabel;
     this.foreground          = foreground;
     this.background          = background;
     this.shadows             = shadows;
     this.fontFeatures        = fontFeatures;
 }
Exemple #5
0
        public TextStyle copyWith(Color color                         = null,
                                  string fontFamily                   = null,
                                  double?fontSize                     = null,
                                  FontWeight?fontWeight               = null,
                                  FontStyle?fontStyle                 = null,
                                  double?letterSpacing                = null,
                                  double?wordSpacing                  = null,
                                  TextBaseline?textBaseline           = null,
                                  double?height                       = null,
                                  Paint background                    = null,
                                  TextDecoration decoration           = null,
                                  Color decorationColor               = null,
                                  TextDecorationStyle?decorationStyle = null,
                                  string debugLabel                   = null)
        {
            string newDebugLabel = null;

            D.assert(() => {
                if (this.debugLabel != null)
                {
                    newDebugLabel = debugLabel ?? $"({this.debugLabel}).copyWith";
                }

                return(true);
            });

            return(new TextStyle(
                       inherit: this.inherit,
                       color: color ?? this.color,
                       fontFamily: fontFamily ?? this.fontFamily,
                       fontSize: fontSize ?? this.fontSize,
                       fontWeight: fontWeight ?? this.fontWeight,
                       fontStyle: fontStyle ?? this.fontStyle,
                       letterSpacing: letterSpacing ?? this.letterSpacing,
                       wordSpacing: wordSpacing ?? this.wordSpacing,
                       textBaseline: textBaseline ?? this.textBaseline,
                       height: height ?? this.height,
                       decoration: decoration ?? this.decoration,
                       decorationColor: decorationColor ?? this.decorationColor,
                       decorationStyle: decorationStyle ?? this.decorationStyle,
                       background: background ?? this.background,
                       debugLabel: newDebugLabel
                       ));
        }
Exemple #6
0
 public TextStyle(bool inherit = true, Color color = null, float? fontSize = null,
     FontWeight fontWeight = null,
     FontStyle? fontStyle = null, float? letterSpacing = null, float? wordSpacing = null,
     TextBaseline? textBaseline = null, float? height = null, Paint background = null,
     TextDecoration decoration = null,
     Color decorationColor = null, TextDecorationStyle? decorationStyle = null,
     string fontFamily = null, string debugLabel = null) {
     this.inherit = inherit;
     this.color = color;
     this.fontSize = fontSize;
     this.fontWeight = fontWeight;
     this.fontStyle = fontStyle;
     this.letterSpacing = letterSpacing;
     this.wordSpacing = wordSpacing;
     this.textBaseline = textBaseline;
     this.height = height;
     this.decoration = decoration;
     this.decorationColor = decorationColor;
     this.decorationStyle = decorationStyle;
     this.fontFamily = fontFamily;
     this.debugLabel = debugLabel;
     this.background = background;
 }
Exemple #7
0
 public TextStyle(Color color               = null, double?fontSize = null,
                  FontWeight?fontWeight     = null, FontStyle?fontStyle       = null, double?letterSpacing = null,
                  double?wordSpacing        = null, TextBaseline?textBaseline = null, double?height        = null,
                  TextDecoration decoration = null, TextDecorationStyle?decorationStyle = null, Color decorationColor = null,
                  string fontFamily         = null,
                  Paint background          = null
                  )
 {
     this.color           = color ?? this.color;
     this.fontSize        = fontSize ?? this.fontSize;
     this.fontWeight      = fontWeight ?? this.fontWeight;
     this.fontStyle       = fontStyle ?? this.fontStyle;
     this.letterSpacing   = letterSpacing ?? this.letterSpacing;
     this.wordSpacing     = wordSpacing ?? this.wordSpacing;
     this.fontSize        = fontSize ?? this.fontSize;
     this.textBaseline    = textBaseline ?? this.textBaseline;
     this.height          = height ?? this.height;
     this.decoration      = decoration ?? this.decoration;
     this.decorationStyle = decorationStyle ?? this.decorationStyle;
     this.decorationColor = decorationColor ?? this.decorationColor;
     this.fontFamily      = fontFamily ?? this.fontFamily;
     this.background      = background ?? this.background;
 }
Exemple #8
0
        public TextStyle apply(
            Color color                         = null,
            Color backgroundColor               = null,
            TextDecoration decoration           = null,
            Color decorationColor               = null,
            TextDecorationStyle?decorationStyle = null,
            float decorationThicknessFactor     = 1.0f,
            float decorationThicknessDelta      = 0.0f,
            string fontFamily                   = null,
            List <string> fontFamilyFallback    = null,
            List <Shadow> shadows               = null,
            float fontSizeFactor                = 1.0f,
            float fontSizeDelta                 = 0.0f,
            int fontWeightDelta                 = 0,
            float letterSpacingFactor           = 1.0f,
            float letterSpacingDelta            = 0.0f,
            float wordSpacingFactor             = 1.0f,
            float wordSpacingDelta              = 0.0f,
            float heightFactor                  = 1.0f,
            float heightDelta                   = 0.0f
            )
        {
            D.assert(fontSize != null || fontSizeFactor == 1.0f && fontSizeDelta == 0.0f);
            D.assert(fontWeight != null || fontWeightDelta == 0.0f);
            D.assert(letterSpacing != null || letterSpacingFactor == 1.0f && letterSpacingDelta == 0.0f);
            D.assert(wordSpacing != null || wordSpacingFactor == 1.0f && wordSpacingDelta == 0.0f);
            D.assert(height != null || heightFactor == 1.0f && heightDelta == 0.0f);
            D.assert(decorationThickness != null ||
                     decorationThicknessFactor == 1.0f && decorationThicknessDelta == 0.0f);

            var modifiedDebugLabel = "";

            D.assert(() => {
                if (debugLabel != null)
                {
                    modifiedDebugLabel = debugLabel + ".apply";
                }

                return(true);
            });

            return(new TextStyle(
                       inherit: inherit,
                       foreground == null ? color ?? this.color : null,
                       background == null ? backgroundColor ?? this.backgroundColor : null,
                       fontFamily: fontFamily ?? this.fontFamily,
                       fontFamilyFallback: fontFamilyFallback ?? this.fontFamilyFallback,
                       fontSize: fontSize == null ? null : fontSize * fontSizeFactor + fontSizeDelta,
                       fontWeight: fontWeight == null ? null : fontWeight,
                       fontStyle: fontStyle,
                       letterSpacing: letterSpacing == null
                    ? null
                    : letterSpacing * letterSpacingFactor + letterSpacingDelta,
                       wordSpacing: wordSpacing == null ? null : wordSpacing * wordSpacingFactor + wordSpacingDelta,
                       textBaseline: textBaseline,
                       height: height == null ? null : height * heightFactor + heightDelta,
                       foreground: foreground,
                       background: background,
                       decoration: decoration ?? this.decoration,
                       decorationColor: decorationColor ?? this.decorationColor,
                       decorationStyle: decorationStyle ?? this.decorationStyle,
                       decorationThickness: decorationThickness == null
                    ? null
                    : decorationThickness * decorationThicknessFactor + decorationThicknessDelta,
                       shadows: shadows ?? this.shadows,
                       fontFeatures: fontFeatures,
                       debugLabel: modifiedDebugLabel
                       ));
        }
Exemple #9
0
 public TextTheme apply(
     string fontFamily                   = null,
     float fontSizeFactor                = 1.0f,
     float fontSizeDelta                 = 0.0f,
     Color displayColor                  = null,
     Color bodyColor                     = null,
     TextDecoration decoration           = null,
     Color decorationColor               = null,
     TextDecorationStyle?decorationStyle = null
     )
 {
     return(new TextTheme(
                display4: this.display4?.apply(
                    color: displayColor,
                    decoration: decoration,
                    decorationColor: decorationColor,
                    decorationStyle: decorationStyle,
                    fontFamily: fontFamily,
                    fontSizeFactor: fontSizeFactor,
                    fontSizeDelta: fontSizeDelta
                    ),
                display3: this.display3?.apply(
                    color: displayColor,
                    decoration: decoration,
                    decorationColor: decorationColor,
                    decorationStyle: decorationStyle,
                    fontFamily: fontFamily,
                    fontSizeFactor: fontSizeFactor,
                    fontSizeDelta: fontSizeDelta
                    ),
                display2: this.display2?.apply(
                    color: displayColor,
                    decoration: decoration,
                    decorationColor: decorationColor,
                    decorationStyle: decorationStyle,
                    fontFamily: fontFamily,
                    fontSizeFactor: fontSizeFactor,
                    fontSizeDelta: fontSizeDelta
                    ),
                display1: this.display1?.apply(
                    color: displayColor,
                    decoration: decoration,
                    decorationColor: decorationColor,
                    decorationStyle: decorationStyle,
                    fontFamily: fontFamily,
                    fontSizeFactor: fontSizeFactor,
                    fontSizeDelta: fontSizeDelta
                    ),
                headline: this.headline?.apply(
                    color: bodyColor,
                    decoration: decoration,
                    decorationColor: decorationColor,
                    decorationStyle: decorationStyle,
                    fontFamily: fontFamily,
                    fontSizeFactor: fontSizeFactor,
                    fontSizeDelta: fontSizeDelta
                    ),
                title: this.title?.apply(
                    color: bodyColor,
                    decoration: decoration,
                    decorationColor: decorationColor,
                    decorationStyle: decorationStyle,
                    fontFamily: fontFamily,
                    fontSizeFactor: fontSizeFactor,
                    fontSizeDelta: fontSizeDelta
                    ),
                subhead: this.subhead?.apply(
                    color: bodyColor,
                    decoration: decoration,
                    decorationColor: decorationColor,
                    decorationStyle: decorationStyle,
                    fontFamily: fontFamily,
                    fontSizeFactor: fontSizeFactor,
                    fontSizeDelta: fontSizeDelta
                    ),
                body2: this.body2?.apply(
                    color: bodyColor,
                    decoration: decoration,
                    decorationColor: decorationColor,
                    decorationStyle: decorationStyle,
                    fontFamily: fontFamily,
                    fontSizeFactor: fontSizeFactor,
                    fontSizeDelta: fontSizeDelta
                    ),
                body1: this.body1?.apply(
                    color: bodyColor,
                    decoration: decoration,
                    decorationColor: decorationColor,
                    decorationStyle: decorationStyle,
                    fontFamily: fontFamily,
                    fontSizeFactor: fontSizeFactor,
                    fontSizeDelta: fontSizeDelta
                    ),
                caption: this.caption?.apply(
                    color: displayColor,
                    decoration: decoration,
                    decorationColor: decorationColor,
                    decorationStyle: decorationStyle,
                    fontFamily: fontFamily,
                    fontSizeFactor: fontSizeFactor,
                    fontSizeDelta: fontSizeDelta
                    ),
                button: this.button?.apply(
                    color: bodyColor,
                    decoration: decoration,
                    decorationColor: decorationColor,
                    decorationStyle: decorationStyle,
                    fontFamily: fontFamily,
                    fontSizeFactor: fontSizeFactor,
                    fontSizeDelta: fontSizeDelta
                    ),
                subtitle: this.subtitle?.apply(
                    color: bodyColor,
                    decoration: decoration,
                    decorationColor: decorationColor,
                    decorationStyle: decorationStyle,
                    fontFamily: fontFamily,
                    fontSizeFactor: fontSizeFactor,
                    fontSizeDelta: fontSizeDelta
                    ),
                overline: this.overline?.apply(
                    color: bodyColor,
                    decoration: decoration,
                    decorationColor: decorationColor,
                    decorationStyle: decorationStyle,
                    fontFamily: fontFamily,
                    fontSizeFactor: fontSizeFactor,
                    fontSizeDelta: fontSizeDelta
                    )
                ));
 }
Exemple #10
0
 public TextTheme apply(
     string fontFamily                   = null,
     float fontSizeFactor                = 1.0f,
     float fontSizeDelta                 = 0.0f,
     Color displayColor                  = null,
     Color bodyColor                     = null,
     TextDecoration decoration           = null,
     Color decorationColor               = null,
     TextDecorationStyle?decorationStyle = null
     )
 {
     return(new TextTheme(
                headline1: headline1?.apply(
                    color: displayColor,
                    decoration: decoration,
                    decorationColor: decorationColor,
                    decorationStyle: decorationStyle,
                    fontFamily: fontFamily,
                    fontSizeFactor: fontSizeFactor,
                    fontSizeDelta: fontSizeDelta
                    ),
                headline2: headline2?.apply(
                    color: displayColor,
                    decoration: decoration,
                    decorationColor: decorationColor,
                    decorationStyle: decorationStyle,
                    fontFamily: fontFamily,
                    fontSizeFactor: fontSizeFactor,
                    fontSizeDelta: fontSizeDelta
                    ),
                headline3: headline3?.apply(
                    color: displayColor,
                    decoration: decoration,
                    decorationColor: decorationColor,
                    decorationStyle: decorationStyle,
                    fontFamily: fontFamily,
                    fontSizeFactor: fontSizeFactor,
                    fontSizeDelta: fontSizeDelta
                    ),
                headline4: headline4?.apply(
                    color: displayColor,
                    decoration: decoration,
                    decorationColor: decorationColor,
                    decorationStyle: decorationStyle,
                    fontFamily: fontFamily,
                    fontSizeFactor: fontSizeFactor,
                    fontSizeDelta: fontSizeDelta
                    ),
                headline5: headline5?.apply(
                    color: bodyColor,
                    decoration: decoration,
                    decorationColor: decorationColor,
                    decorationStyle: decorationStyle,
                    fontFamily: fontFamily,
                    fontSizeFactor: fontSizeFactor,
                    fontSizeDelta: fontSizeDelta
                    ),
                headline6: headline6?.apply(
                    color: bodyColor,
                    decoration: decoration,
                    decorationColor: decorationColor,
                    decorationStyle: decorationStyle,
                    fontFamily: fontFamily,
                    fontSizeFactor: fontSizeFactor,
                    fontSizeDelta: fontSizeDelta
                    ),
                subtitle1: subtitle1?.apply(
                    color: bodyColor,
                    decoration: decoration,
                    decorationColor: decorationColor,
                    decorationStyle: decorationStyle,
                    fontFamily: fontFamily,
                    fontSizeFactor: fontSizeFactor,
                    fontSizeDelta: fontSizeDelta
                    ),
                subtitle2: subtitle2?.apply(
                    color: bodyColor,
                    decoration: decoration,
                    decorationColor: decorationColor,
                    decorationStyle: decorationStyle,
                    fontFamily: fontFamily,
                    fontSizeFactor: fontSizeFactor,
                    fontSizeDelta: fontSizeDelta
                    ),
                bodyText1: bodyText1?.apply(
                    color: bodyColor,
                    decoration: decoration,
                    decorationColor: decorationColor,
                    decorationStyle: decorationStyle,
                    fontFamily: fontFamily,
                    fontSizeFactor: fontSizeFactor,
                    fontSizeDelta: fontSizeDelta
                    ),
                bodyText2: bodyText2?.apply(
                    color: bodyColor,
                    decoration: decoration,
                    decorationColor: decorationColor,
                    decorationStyle: decorationStyle,
                    fontFamily: fontFamily,
                    fontSizeFactor: fontSizeFactor,
                    fontSizeDelta: fontSizeDelta
                    ),
                caption: caption?.apply(
                    color: displayColor,
                    decoration: decoration,
                    decorationColor: decorationColor,
                    decorationStyle: decorationStyle,
                    fontFamily: fontFamily,
                    fontSizeFactor: fontSizeFactor,
                    fontSizeDelta: fontSizeDelta
                    ),
                button: button?.apply(
                    color: bodyColor,
                    decoration: decoration,
                    decorationColor: decorationColor,
                    decorationStyle: decorationStyle,
                    fontFamily: fontFamily,
                    fontSizeFactor: fontSizeFactor,
                    fontSizeDelta: fontSizeDelta
                    ),
                overline: overline?.apply(
                    color: bodyColor,
                    decoration: decoration,
                    decorationColor: decorationColor,
                    decorationStyle: decorationStyle,
                    fontFamily: fontFamily,
                    fontSizeFactor: fontSizeFactor,
                    fontSizeDelta: fontSizeDelta
                    )
                ));
 }