From 1073d82008761ccd88792e321002dad93ef05bc6 Mon Sep 17 00:00:00 2001 From: bggRGjQaUbCoE Date: Wed, 1 Jan 2025 18:07:10 +0800 Subject: [PATCH] opt: dynamic state num related #85 Signed-off-by: bggRGjQaUbCoE --- lib/pages/dynamics/widgets/action_panel.dart | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/lib/pages/dynamics/widgets/action_panel.dart b/lib/pages/dynamics/widgets/action_panel.dart index 3dfc9b04..68940889 100644 --- a/lib/pages/dynamics/widgets/action_panel.dart +++ b/lib/pages/dynamics/widgets/action_panel.dart @@ -4,6 +4,7 @@ import 'package:PiliPalaX/common/widgets/network_img_layer.dart'; import 'package:PiliPalaX/http/msg.dart'; import 'package:PiliPalaX/utils/extension.dart'; import 'package:PiliPalaX/utils/storage.dart'; +import 'package:PiliPalaX/utils/utils.dart'; import 'package:flutter/material.dart'; import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; @@ -111,7 +112,12 @@ class _ActionPanelState extends State { padding: const EdgeInsets.fromLTRB(15, 0, 15, 0), foregroundColor: Theme.of(context).colorScheme.outline, ), - label: Text(widget.item!.modules.moduleStat.forward!.count ?? '转发'), + label: Text( + widget.item!.modules.moduleStat.forward!.count != null + ? Utils.numFormat( + widget.item!.modules.moduleStat.forward!.count) + : '转发', + ), ), ), Expanded( @@ -129,7 +135,12 @@ class _ActionPanelState extends State { padding: const EdgeInsets.fromLTRB(15, 0, 15, 0), foregroundColor: Theme.of(context).colorScheme.outline, ), - label: Text(widget.item!.modules.moduleStat.comment!.count ?? '评论'), + label: Text( + widget.item!.modules.moduleStat.comment!.count != null + ? Utils.numFormat( + widget.item!.modules.moduleStat.comment!.count) + : '评论', + ), ), ), Expanded( @@ -157,7 +168,10 @@ class _ActionPanelState extends State { return ScaleTransition(scale: animation, child: child); }, child: Text( - widget.item!.modules.moduleStat.like!.count ?? '点赞', + widget.item!.modules.moduleStat.like!.count != null + ? Utils.numFormat( + widget.item!.modules.moduleStat.like!.count) + : '点赞', key: ValueKey( widget.item!.modules.moduleStat.like!.count ?? '点赞'), style: TextStyle(