diff --git a/assets/images/img-product.png b/assets/images/img-product.png new file mode 100644 index 0000000..c058b1c Binary files /dev/null and b/assets/images/img-product.png differ diff --git a/lib/application/assets/path_assets.dart b/lib/application/assets/path_assets.dart index 2f398e7..ca1c713 100644 --- a/lib/application/assets/path_assets.dart +++ b/lib/application/assets/path_assets.dart @@ -30,4 +30,5 @@ class PathAssets { static const String imgDashboardAccount = 'assets/images/img-dashboard-account.png'; static const String imgCarousel = 'assets/images/img-carousel.png'; static const String imgArticles = 'assets/images/img-articles.png'; + static const String imgProduct = 'assets/images/img-product.png'; } diff --git a/lib/core/utils/number_formatter.dart b/lib/core/utils/number_formatter.dart index ee0e22c..2965417 100644 --- a/lib/core/utils/number_formatter.dart +++ b/lib/core/utils/number_formatter.dart @@ -3,7 +3,7 @@ import 'package:intl/intl.dart'; class NumberFormatter { NumberFormatter._(); - static String numberCurrency(dynamic value, String symbol, String locale, {int? decimalDigits = 0}) { + static String numberCurrency(dynamic value, String symbol, String locale, {int? decimalDigits = 2}) { NumberFormat numberFormat = NumberFormat.currency(locale: locale, symbol: symbol, decimalDigits: decimalDigits); String formatValue = numberFormat.format(value); diff --git a/lib/features/dashboard/dashboard_account/view/invest_type/invest_type_view.dart b/lib/features/dashboard/dashboard_account/view/invest_type/invest_type_view.dart index f146c96..4238af1 100644 --- a/lib/features/dashboard/dashboard_account/view/invest_type/invest_type_view.dart +++ b/lib/features/dashboard/dashboard_account/view/invest_type/invest_type_view.dart @@ -4,6 +4,7 @@ import 'package:cims_apps/application/component/image/image_view.dart'; import 'package:cims_apps/application/component/text_title/text_title.dart'; import 'package:cims_apps/application/theme/color_palette.dart'; import 'package:cims_apps/core/route/route.dart'; +import 'package:cims_apps/core/utils/number_formatter.dart'; import 'package:cims_apps/core/utils/size_config.dart'; import 'package:cims_apps/features/dashboard/dashboard_account/view/product/product_view.dart'; import 'package:flutter/material.dart'; @@ -151,11 +152,17 @@ class _InvestTypeViewState extends State { children: [ Row( children: [ - Text( - product.name, - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 18 + ImageView(image: PathAssets.imgProduct, width: SizeConfig.width * .12,), + SizedBox( + width: 8, + ), + Expanded( + child: Text( + product.name, + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 18 + ), ), ) ], @@ -190,16 +197,16 @@ class _InvestTypeViewState extends State { Text('Price/unit', style: TextStyle(color: ColorPalette.slate400, fontWeight: FontWeight.w600),), Row( children: [ + Icon(Icons.trending_up_outlined, size: 18, color: ColorPalette.green400,), + SizedBox( + width: 2, + ), Text( - 'Rp${product.priceUnit.toString()}', + NumberFormatter.numberCurrency(product.priceUnit, 'Rp', 'id_ID'), style: TextStyle( fontWeight: FontWeight.w600 ), ), - SizedBox( - width: 2, - ), - Icon(Icons.trending_up_outlined, size: 18, color: ColorPalette.green400,) ], ) ], @@ -210,7 +217,7 @@ class _InvestTypeViewState extends State { Row( children: [ Text( - product.funds.toString(), + NumberFormatter.compactCurrency(product.funds, 'Rp ', 'id_ID'), style: TextStyle( fontWeight: FontWeight.w600 ), diff --git a/lib/features/dashboard/dashboard_account/view/product/product_view.dart b/lib/features/dashboard/dashboard_account/view/product/product_view.dart index 0b003c2..c1042d8 100644 --- a/lib/features/dashboard/dashboard_account/view/product/product_view.dart +++ b/lib/features/dashboard/dashboard_account/view/product/product_view.dart @@ -71,7 +71,7 @@ class _ProductViewState extends State { double parseValue = double.parse(machineController.text.replaceAll('Rp ', '').replaceAll('.', '')); int machineType = selectedMachineType == 0 ? 12 : 1; setState(() { - estimatedValue = (machineType * (listMachineTime[selectedMachineTime].value) * (parseValue * 10/100)) + parseValue; + estimatedValue = (machineType * (listMachineTime[selectedMachineTime].value) * ((parseValue * machineType) * 10/100)) + parseValue; }); } @@ -87,6 +87,14 @@ class _ProductViewState extends State { super.initState(); } + @override + void dispose() { + machineController.dispose(); + machineGroupButtonController.dispose(); + // TODO: implement dispose + super.dispose(); + } + @override Widget build(BuildContext context) { return Scaffold( @@ -133,6 +141,17 @@ class _ProductViewState extends State { ], ), ), + bottomNavigationBar: Padding( + padding: const EdgeInsets.symmetric(horizontal: 24), + child: ButtonView( + name: 'Buy', + onPressed: () { + + }, + height: SizeConfig.height * 0.06, + marginVertical: 16, + ), + ), ); } @@ -142,12 +161,16 @@ class _ProductViewState extends State { child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - const Expanded( + Expanded( child: Row( children: [ + ImageView(image: PathAssets.imgProduct, width: SizeConfig.width * .12,), + SizedBox(width: 8), Expanded( child: Text( 'Gemilang Dana Kas Maxima', + maxLines: 2, + overflow: TextOverflow.ellipsis, style: TextStyle( color: Colors.white, fontWeight: FontWeight.w700, @@ -255,15 +278,6 @@ class _ProductViewState extends State { height: 24, ), cardInformation('Document', documentProduct()), - Padding( - padding: const EdgeInsets.symmetric(horizontal: 24), - child: ButtonView( - name: 'Buy', - onPressed: () { - - }, - ), - ) ], ), ),