feat: Tagline V3 (#5350)

* New JSON

* Tagline V3

* Refresh the tagline on language change

* Fix Lint errors

* Revert `SmoothScaffold` changes

* Filter news with startDate/endDate
This commit is contained in:
Edouard Marquez
2024-06-10 15:19:24 +02:00
committed by GitHub
parent 39c9c434b9
commit 41abf730fe
20 changed files with 1675 additions and 513 deletions

View File

@ -1,4 +1,4 @@
import 'package:flutter/painting.dart';
import 'package:flutter/material.dart';
extension StringExtensions on String {
/// Returns a list containing all positions of a [charCode]
@ -93,3 +93,41 @@ class TextHelper {
return parts;
}
}
class FormattedText extends StatelessWidget {
const FormattedText({
required this.text,
this.textStyle,
this.textAlign,
});
final String text;
final TextStyle? textStyle;
final TextAlign? textAlign;
@override
Widget build(BuildContext context) {
final TextStyle defaultTextStyle = textStyle ?? const TextStyle();
return RichText(
text: TextSpan(
style: DefaultTextStyle.of(context).style,
children: TextHelper.getPartsBetweenSymbol(
text: text,
symbol: r'\*\*',
symbolLength: 2,
defaultStyle: defaultTextStyle,
highlightedStyle: const TextStyle(fontWeight: FontWeight.bold))
.map(
((String, TextStyle?) part) {
return TextSpan(
text: part.$1,
style: defaultTextStyle.merge(part.$2),
);
},
).toList(growable: false),
),
textAlign: textAlign ?? TextAlign.start,
);
}
}