mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-05-31 08:08:19 +08:00
opt: reply/like num
Closes #85 Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
import 'package:PiliPalaX/utils/extension.dart';
|
import 'package:PiliPalaX/utils/extension.dart';
|
||||||
|
import 'package:PiliPalaX/utils/utils.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||||
@@ -134,7 +135,7 @@ class _ZanButtonState extends State<ZanButton> {
|
|||||||
return ScaleTransition(scale: animation, child: child);
|
return ScaleTransition(scale: animation, child: child);
|
||||||
},
|
},
|
||||||
child: Text(
|
child: Text(
|
||||||
widget.replyItem!.like.toString(),
|
Utils.numFormat(widget.replyItem!.like),
|
||||||
key: ValueKey<int>(widget.replyItem!.like!),
|
key: ValueKey<int>(widget.replyItem!.like!),
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: widget.replyItem!.action == 1 ? primary : color,
|
color: widget.replyItem!.action == 1 ? primary : color,
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import 'package:PiliPalaX/grpc/app/main/community/reply/v1/reply.pb.dart';
|
import 'package:PiliPalaX/grpc/app/main/community/reply/v1/reply.pb.dart';
|
||||||
import 'package:PiliPalaX/utils/extension.dart';
|
import 'package:PiliPalaX/utils/extension.dart';
|
||||||
|
import 'package:PiliPalaX/utils/utils.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||||
@@ -161,8 +162,7 @@ class _ZanButtonGrpcState extends State<ZanButtonGrpc> {
|
|||||||
return ScaleTransition(scale: animation, child: child);
|
return ScaleTransition(scale: animation, child: child);
|
||||||
},
|
},
|
||||||
child: Text(
|
child: Text(
|
||||||
widget.replyItem.like.toString(),
|
Utils.numFormat(widget.replyItem.like.toInt()),
|
||||||
// key: ValueKey<int>(widget.replyItem!.like!),
|
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: widget.replyItem.replyControl.action.toInt() == 1
|
color: widget.replyItem.replyControl.action.toInt() == 1
|
||||||
? primary
|
? primary
|
||||||
|
|||||||
@@ -1236,7 +1236,7 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
if (text == '评论') {
|
if (text == '评论') {
|
||||||
return Tab(
|
return Tab(
|
||||||
text:
|
text:
|
||||||
'评论${_videoReplyController.count.value == -1 ? '' : ' ${_videoReplyController.count.value}'}',
|
'评论${_videoReplyController.count.value == -1 ? '' : ' ${Utils.numFormat(_videoReplyController.count.value)}'}',
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
return Tab(text: text);
|
return Tab(text: text);
|
||||||
|
|||||||
@@ -482,16 +482,21 @@ class Utils {
|
|||||||
return number;
|
return number;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (number >= 100000000) {
|
|
||||||
return '${(number / 100000000).toStringAsFixed(1)}亿';
|
String format(first, second) {
|
||||||
} else if (number > 10000) {
|
double result = number / first;
|
||||||
double result = number / 10000;
|
|
||||||
String format = result.toStringAsFixed(1);
|
String format = result.toStringAsFixed(1);
|
||||||
if (format.endsWith('.0')) {
|
if (format.endsWith('.0')) {
|
||||||
return '${result.toInt()}万';
|
return '${result.toInt()}$second';
|
||||||
} else {
|
} else {
|
||||||
return '$format万';
|
return '$format$second';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (number >= 100000000) {
|
||||||
|
return format(100000000, '亿');
|
||||||
|
} else if (number >= 10000) {
|
||||||
|
return format(10000, '万');
|
||||||
} else {
|
} else {
|
||||||
return number.toString();
|
return number.toString();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user