textStyle function
TextStyle
textStyle({
- double? size,
- double? wordSpacing,
- double? letterSpacing,
- Color? color,
- String? fontFamily,
- FontWeightEnum? weight,
- FontWeight? fontWeight,
- bool? softWrap,
- TextOverflow? overflow,
Implementation
TextStyle textStyle({
double? size,
double? wordSpacing,
double? letterSpacing,
Color? color,
String? fontFamily,
FontWeightEnum? weight,
FontWeight? fontWeight,
bool? softWrap,
TextOverflow? overflow,
}) {
assert(() {
if (weight != null && fontWeight != null) {
throw FlutterError(
'weight and fontWeight can only be passed between the two, and cannot exist at the same time',
);
}
return true;
}());
// get common font weight
if (weight != null && fontWeight == null) {
fontWeight = getFontWeight(weight);
}
return TextStyle(
fontSize: size,
color: color,
fontFamily: fontFamily,
fontWeight: fontWeight,
wordSpacing: wordSpacing,
letterSpacing: letterSpacing,
);
}