feat: state time machine product view
This commit is contained in:
parent
e1cabe0a09
commit
96c676ac4c
BIN
assets/images/img-product.png
Normal file
BIN
assets/images/img-product.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.5 KiB |
|
@ -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';
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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,12 +152,18 @@ class _InvestTypeViewState extends State<InvestTypeView> {
|
|||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Text(
|
||||
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<InvestTypeView> {
|
|||
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<InvestTypeView> {
|
|||
Row(
|
||||
children: [
|
||||
Text(
|
||||
product.funds.toString(),
|
||||
NumberFormatter.compactCurrency(product.funds, 'Rp ', 'id_ID'),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w600
|
||||
),
|
||||
|
|
|
@ -71,7 +71,7 @@ class _ProductViewState extends State<ProductView> {
|
|||
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<ProductView> {
|
|||
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<ProductView> {
|
|||
],
|
||||
),
|
||||
),
|
||||
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<ProductView> {
|
|||
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<ProductView> {
|
|||
height: 24,
|
||||
),
|
||||
cardInformation('Document', documentProduct()),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 24),
|
||||
child: ButtonView(
|
||||
name: 'Buy',
|
||||
onPressed: () {
|
||||
|
||||
},
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
|
|
Loading…
Reference in New Issue
Block a user