count format

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-05-25 15:54:08 +08:00
parent b674d102e3
commit 18f8831b7e
4 changed files with 6 additions and 5 deletions

View File

@@ -163,7 +163,8 @@ class _ArticleListPageState extends State<ArticleListPage> {
Text.rich( Text.rich(
TextSpan( TextSpan(
children: [ children: [
TextSpan(text: '${item.articlesCount}篇专栏'), TextSpan(
text: '${Utils.numFormat(item.articlesCount)}篇专栏'),
divider, divider,
TextSpan(text: '${Utils.numFormat(item.words)}个字'), TextSpan(text: '${Utils.numFormat(item.words)}个字'),
divider, divider,

View File

@@ -119,9 +119,9 @@ Widget videoSeasonWidget(
), ),
const SizedBox(width: 6), const SizedBox(width: 6),
], ],
Text('${itemContent.stat?.play}次围观'), Text('${Utils.numFormat(itemContent.stat?.play)}次围观'),
const SizedBox(width: 6), const SizedBox(width: 6),
Text('${itemContent.stat?.danmu}条弹幕'), Text('${Utils.numFormat(itemContent.stat?.danmu)}条弹幕'),
const Spacer(), const Spacer(),
Image.asset( Image.asset(
'assets/images/play.png', 'assets/images/play.png',

View File

@@ -374,7 +374,7 @@ class _PgcReviewChildPageState extends State<PgcReviewChildPage>
() => _controller.count.value == null () => _controller.count.value == null
? const SizedBox.shrink() ? const SizedBox.shrink()
: Text( : Text(
'${_controller.count.value}条点评', '${Utils.numFormat(_controller.count.value)}条点评',
style: const TextStyle(fontSize: 13), style: const TextStyle(fontSize: 13),
), ),
), ),

View File

@@ -214,7 +214,7 @@ class Utils {
static String numFormat(dynamic number) { static String numFormat(dynamic number) {
if (number == null) { if (number == null) {
return '00:00'; return '0';
} }
if (number is String) { if (number is String) {
number = int.tryParse(number) ?? number; number = int.tryParse(number) ?? number;