getPresentationWidgetsTextWidgetTemplate function
String
getPresentationWidgetsTextWidgetTemplate(
- String projectName
)
Implementation
String getPresentationWidgetsTextWidgetTemplate(String projectName) {
return '''
import 'package:flutter/material.dart';
import 'package:${projectName}/core/constants/app_strings.dart';
class TextWidget extends StatelessWidget {
const TextWidget({
super.key,
required this.text,
this.textSize = 14,
this.padding = const EdgeInsets.all(0.0),
this.color = Colors.black,
this.decorationColor = Colors.transparent,
this.fontWeight,
this.backgroundColor = Colors.transparent,
this.textAlign = TextAlign.start,
this.fontFamily,
this.textDecoration = TextDecoration.none,
this.maxLines,
this.overflow,
this.lineSpace,
this.onTap,
this.fontStyle,
this.softwrap = true,
this.isTitle = false,
this.maxLength,
});
final String text;
final double textSize;
final double? lineSpace;
final EdgeInsets padding;
final Color color;
final Color backgroundColor;
final Color decorationColor;
final FontWeight? fontWeight;
final TextAlign textAlign;
final String? fontFamily;
final int? maxLines;
final int? maxLength;
final TextOverflow? overflow;
final TextDecoration textDecoration;
final Function()? onTap;
final FontStyle? fontStyle;
final bool? softwrap;
final bool isTitle;
@override
Widget build(BuildContext context) {
return InkWell(
splashColor: Colors.transparent,
highlightColor: Colors.transparent,
onTap: onTap,
child: Container(
color: backgroundColor,
padding: padding,
child: Text(
text,
maxLines: maxLines,
overflow: overflow,
softWrap: softwrap ?? false,
style: TextStyle(
decoration: textDecoration,
decorationColor: decorationColor,
fontSize: textSize,
color: color,
fontWeight: fontWeight,
overflow: overflow,
height: lineSpace ?? 1.4,
fontFamily: AppStrings.appFont,
fontStyle: fontStyle ?? FontStyle.normal,
),
textAlign: textAlign,
),
),
);
}
}
''';
}