39 lines
1.1 KiB
Dart
39 lines
1.1 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:google_fonts/google_fonts.dart';
|
|
|
|
class TextWidget extends StatelessWidget {
|
|
final String text;
|
|
final double? size;
|
|
final double? opacity;
|
|
final bool? bold;
|
|
final bool? title;
|
|
final bool? underlined;
|
|
final Color? color;
|
|
|
|
const TextWidget({
|
|
super.key,
|
|
required this.text,
|
|
this.size,
|
|
this.opacity,
|
|
this.bold,
|
|
this.title,
|
|
this.underlined,
|
|
this.color,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final textStyle = TextStyle(
|
|
color: color ?? Color.fromRGBO(255, 255, 255, opacity ?? 1),
|
|
fontSize: size ?? 28,
|
|
fontWeight: bold == true ? FontWeight.bold : FontWeight.normal,
|
|
decoration: underlined == true ? TextDecoration.underline : TextDecoration.none,
|
|
decorationColor: color ?? const Color.fromRGBO(255, 255, 255, 1),
|
|
decorationThickness: 1,
|
|
);
|
|
|
|
return title == true
|
|
? Text(text, style: GoogleFonts.outfit(textStyle: textStyle))
|
|
: Text(text, style: GoogleFonts.roboto(textStyle: textStyle));
|
|
}
|
|
}
|