You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
66 lines
1.8 KiB
Dart
66 lines
1.8 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:google_fonts/google_fonts.dart';
|
|
|
|
import '../res/app_colors.dart';
|
|
import '../res/app_dimensions.dart';
|
|
import '../res/app_theme.dart';
|
|
|
|
|
|
class CustomText extends StatelessWidget {
|
|
final String text;
|
|
final EdgeInsets margin;
|
|
final EdgeInsets padding;
|
|
final Color labelColor;
|
|
final bool underLineColor;
|
|
final double fontSize;
|
|
final bool underline;
|
|
final TextStyle? style;
|
|
final FontWeight fontWeight;
|
|
final bool fontFamily;
|
|
final TextAlign textAlign;
|
|
final TextOverflow? overflow;
|
|
|
|
const CustomText(
|
|
this.text, {
|
|
super.key,
|
|
this.margin = EdgeInsets.zero,
|
|
this.style = const TextStyle(),
|
|
this.padding = EdgeInsets.zero,
|
|
this.labelColor = AppThemeData.textFieldsColor,
|
|
this.underLineColor = false,
|
|
this.fontSize = -1,
|
|
this.underline = false,
|
|
this.fontWeight = FontWeight.w400,
|
|
this.fontFamily = false,
|
|
this.textAlign = TextAlign.start,
|
|
this.overflow,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Container(
|
|
margin: margin,
|
|
padding: padding,
|
|
child: Text(
|
|
text,
|
|
textAlign: textAlign,
|
|
overflow: overflow ?? TextOverflow.clip,
|
|
style: style ??
|
|
Theme.of(context).textTheme.labelMedium?.copyWith(
|
|
color: labelColor,
|
|
fontFamily: fontFamily ? GoogleFonts.inter().toString() : "",
|
|
fontSize:
|
|
fontSize == -1 ? AppDimensions.customTextSize : fontSize,
|
|
fontWeight: fontWeight,
|
|
decoration: underline
|
|
? TextDecoration.underline
|
|
: TextDecoration.none,
|
|
decorationColor: underLineColor
|
|
? AppColors.titleColor
|
|
: Colors.transparent,
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|