regular method
Widget
regular(
- BuildContext context,
- String? text, {
- int? maxLines,
- TextAlign? textAlign,
- bool? bold = false,
- Color? color,
- double? height,
- String? highlightText,
- TextDecoration? decoration,
Implementation
Widget regular(BuildContext context, String? text,
{int? maxLines,
TextAlign? textAlign,
bool? bold = false,
Color? color,
double? height,
String? highlightText,
TextDecoration? decoration}) {
if (highlightText != null) {
TextStyle selectedTextStyle = TextStyle(
fontSize: DUI.text.regularText,
height: DUI.text.textHeight,
fontWeight: DUI.text.boldWeight,
fontFamily: Theme.of(context).textTheme.bodyMedium!.fontFamily,
color: Theme.of(context).textTheme.bodyMedium!.color,
);
TextStyle unselectedTextStyle = TextStyle(
fontSize: DUI.text.regularText,
height: DUI.text.textHeight,
fontWeight: DUI.text.semiBoldWeight,
fontFamily: Theme.of(context).textTheme.bodyMedium!.fontFamily,
color: highlightText.isNotEmpty
? Theme.of(context).textTheme.bodyMedium!.color!.withOpacity(0.85)
: Theme.of(context).textTheme.bodyMedium!.color,
);
return SubstringHighlight(
text: text ?? '',
term: highlightText,
textStyle: unselectedTextStyle,
textStyleHighlight: selectedTextStyle,
);
}
return Text(
text ?? '',
textAlign: textAlign ?? TextAlign.start,
maxLines: maxLines,
overflow: maxLines != null ? TextOverflow.ellipsis : null,
style: regularTextStyle(context,
bold: bold, color: color, height: height, decoration: decoration),
);
}