Skip to content

Commit

Permalink
Format coin (#274)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
tvc12 committed Jun 26, 2020
1 parent 5c7bf9f commit 3cceb05
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/profile/widget/coin_history_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ class CoinHistoryWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
final primaryColor = coinHistory.change > 0 ? TColors.green : TColors.red;
final coinAsText = coinHistory.change > 0
? '+${coinHistory.change} coins'
: '${coinHistory.change} coins';
final coinAsString = formatMoney(coinHistory.coin.toDouble());
final coinAsText = coinHistory.coin > 0
? '+$coinAsString coins'
: '$coinAsString coins';
return Container(
height: 105,
decoration: BoxDecoration(
Expand Down
2 changes: 2 additions & 0 deletions petisland_core/lib/domain/coin_history.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ class CoinHistory extends BaseModel {
String description;
int change;

int get coin => change ?? 0;

CoinHistory(
{String id,
DateTime createAt,
Expand Down

0 comments on commit 3cceb05

Please sign in to comment.