From d92fec2110e883530ecf2511aa381dcef05f7bee Mon Sep 17 00:00:00 2001 From: Moe Date: Fri, 29 Apr 2022 20:42:05 +0700 Subject: [PATCH] Add currency formatter to price in product page --- lib/components/product_detail.dart | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/components/product_detail.dart b/lib/components/product_detail.dart index a3a646b..388c5f0 100644 --- a/lib/components/product_detail.dart +++ b/lib/components/product_detail.dart @@ -1,4 +1,5 @@ import 'package:cached_network_image/cached_network_image.dart'; +import 'package:intl/intl.dart'; import 'package:flutter/material.dart'; import 'package:nekoya_flutter/api/api.dart'; @@ -60,7 +61,7 @@ Widget productDetail(context, id) { const SizedBox(height: 15.0), Text(data[0]['DESCRIPTION'], style: const TextStyle(color: Colors.white, fontSize: 18.0),), const SizedBox(height: 15.0), - Text('Price : ' + data[0]['PRICE'].toString(), style: const TextStyle(color: Colors.white, fontSize: 18.0, fontWeight: FontWeight.w500),), + Text('Price : Rp ' + NumberFormat('#,##0.00', 'ID').format(data[0]['PRICE']), style: const TextStyle(color: Colors.white, fontSize: 18.0, fontWeight: FontWeight.w500),), Text('Stock : ' + data[0]['STOCK'].toString(), style: const TextStyle(color: Colors.white, fontSize: 18.0, fontWeight: FontWeight.w500),), Text('Size : ' + data[0]['SIZE'], style: const TextStyle(color: Colors.white, fontSize: 18.0, fontWeight: FontWeight.w500),), const SizedBox(height: 30.0),