Skip to content

Commit 3cceb05

Browse files
authored
Format coin (#274)
* Add coin and coin history model * Add preview coin * Add coin history bloc * Add coin history listing * Complete coin history ui and logic * Format coin
1 parent 5c7bf9f commit 3cceb05

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

lib/profile/widget/coin_history_widget.dart

+4-3
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@ class CoinHistoryWidget extends StatelessWidget {
88
@override
99
Widget build(BuildContext context) {
1010
final primaryColor = coinHistory.change > 0 ? TColors.green : TColors.red;
11-
final coinAsText = coinHistory.change > 0
12-
? '+${coinHistory.change} coins'
13-
: '${coinHistory.change} coins';
11+
final coinAsString = formatMoney(coinHistory.coin.toDouble());
12+
final coinAsText = coinHistory.coin > 0
13+
? '+$coinAsString coins'
14+
: '$coinAsString coins';
1415
return Container(
1516
height: 105,
1617
decoration: BoxDecoration(

petisland_core/lib/domain/coin_history.dart

+2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ class CoinHistory extends BaseModel {
55
String description;
66
int change;
77

8+
int get coin => change ?? 0;
9+
810
CoinHistory(
911
{String id,
1012
DateTime createAt,

0 commit comments

Comments
 (0)