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 imgDashboardAccount = 'assets/images/img-dashboard-account.png';
|
||||||
static const String imgCarousel = 'assets/images/img-carousel.png';
|
static const String imgCarousel = 'assets/images/img-carousel.png';
|
||||||
static const String imgArticles = 'assets/images/img-articles.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 {
|
class NumberFormatter {
|
||||||
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);
|
NumberFormat numberFormat = NumberFormat.currency(locale: locale, symbol: symbol, decimalDigits: decimalDigits);
|
||||||
String formatValue = numberFormat.format(value);
|
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/component/text_title/text_title.dart';
|
||||||
import 'package:cims_apps/application/theme/color_palette.dart';
|
import 'package:cims_apps/application/theme/color_palette.dart';
|
||||||
import 'package:cims_apps/core/route/route.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/core/utils/size_config.dart';
|
||||||
import 'package:cims_apps/features/dashboard/dashboard_account/view/product/product_view.dart';
|
import 'package:cims_apps/features/dashboard/dashboard_account/view/product/product_view.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
@ -151,11 +152,17 @@ class _InvestTypeViewState extends State<InvestTypeView> {
|
||||||
children: [
|
children: [
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
Text(
|
ImageView(image: PathAssets.imgProduct, width: SizeConfig.width * .12,),
|
||||||
product.name,
|
SizedBox(
|
||||||
style: TextStyle(
|
width: 8,
|
||||||
fontWeight: FontWeight.bold,
|
),
|
||||||
fontSize: 18
|
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),),
|
Text('Price/unit', style: TextStyle(color: ColorPalette.slate400, fontWeight: FontWeight.w600),),
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
|
Icon(Icons.trending_up_outlined, size: 18, color: ColorPalette.green400,),
|
||||||
|
SizedBox(
|
||||||
|
width: 2,
|
||||||
|
),
|
||||||
Text(
|
Text(
|
||||||
'Rp${product.priceUnit.toString()}',
|
NumberFormatter.numberCurrency(product.priceUnit, 'Rp', 'id_ID'),
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontWeight: FontWeight.w600
|
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(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
product.funds.toString(),
|
NumberFormatter.compactCurrency(product.funds, 'Rp ', 'id_ID'),
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontWeight: FontWeight.w600
|
fontWeight: FontWeight.w600
|
||||||
),
|
),
|
||||||
|
|
|
@ -71,7 +71,7 @@ class _ProductViewState extends State<ProductView> {
|
||||||
double parseValue = double.parse(machineController.text.replaceAll('Rp ', '').replaceAll('.', ''));
|
double parseValue = double.parse(machineController.text.replaceAll('Rp ', '').replaceAll('.', ''));
|
||||||
int machineType = selectedMachineType == 0 ? 12 : 1;
|
int machineType = selectedMachineType == 0 ? 12 : 1;
|
||||||
setState(() {
|
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();
|
super.initState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
machineController.dispose();
|
||||||
|
machineGroupButtonController.dispose();
|
||||||
|
// TODO: implement dispose
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
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(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
const Expanded(
|
Expanded(
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
|
ImageView(image: PathAssets.imgProduct, width: SizeConfig.width * .12,),
|
||||||
|
SizedBox(width: 8),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Text(
|
child: Text(
|
||||||
'Gemilang Dana Kas Maxima',
|
'Gemilang Dana Kas Maxima',
|
||||||
|
maxLines: 2,
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
fontWeight: FontWeight.w700,
|
fontWeight: FontWeight.w700,
|
||||||
|
@ -255,15 +278,6 @@ class _ProductViewState extends State<ProductView> {
|
||||||
height: 24,
|
height: 24,
|
||||||
),
|
),
|
||||||
cardInformation('Document', documentProduct()),
|
cardInformation('Document', documentProduct()),
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 24),
|
|
||||||
child: ButtonView(
|
|
||||||
name: 'Buy',
|
|
||||||
onPressed: () {
|
|
||||||
|
|
||||||
},
|
|
||||||
),
|
|
||||||
)
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
Loading…
Reference in New Issue
Block a user