Updated TextWithBold to accept font sizes.

master
Rafael 2024-06-20 03:44:53 +02:00
parent 6f56fa3878
commit 89924242f4
1 changed files with 21 additions and 5 deletions

View File

@ -4,21 +4,37 @@ class TextWithBold extends StatelessWidget {
final String? leadingText; final String? leadingText;
final String boldText; final String boldText;
final String? trailingText; final String? trailingText;
final double? leadingSize;
final double? boldSize;
final double? trailingSize;
const TextWithBold( const TextWithBold({
{super.key, this.leadingText, required this.boldText, this.trailingText}); super.key,
this.leadingText,
required this.boldText,
this.trailingText,
this.leadingSize,
this.boldSize,
this.trailingSize,
});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Text.rich( return Text.rich(
TextSpan( TextSpan(
children: [ children: [
TextSpan(text: leadingText), TextSpan(
text: leadingText,
style: TextStyle(fontSize: leadingSize),
),
TextSpan( TextSpan(
text: boldText, text: boldText,
style: const TextStyle(fontWeight: FontWeight.bold), style: TextStyle(fontWeight: FontWeight.bold, fontSize: boldSize),
),
TextSpan(
text: trailingText,
style: TextStyle(fontSize: trailingSize),
), ),
TextSpan(text: trailingText),
], ],
), ),
); );