merge conflict

This commit is contained in:
2024-02-26 00:23:54 +07:00
12 changed files with 437 additions and 272 deletions

View File

@@ -1,12 +1,8 @@
import 'package:cims_apps/application/component/button/button_view.dart';
import 'package:cims_apps/application/component/custom_app_bar/custom_app_bar.dart';
import 'package:cims_apps/application/component/subscribe/goal_investing_view.dart';
import 'package:cims_apps/application/component/subscribe/input_investment_view.dart';
import 'package:cims_apps/application/component/numeric_pad/numeric_pad.dart';
import 'package:cims_apps/application/component/risk_profile.dart';
import 'package:cims_apps/application/component/text_form/text_form_view.dart';
import 'package:cims_apps/application/theme/color_palette.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/plan/view/step_invest_plan/options_starting_invest.dart';
import 'package:cims_apps/features/dashboard/dashboard_account/view/plan/view_model/plan_view_model.dart';
@@ -46,33 +42,32 @@ class _PlanViewState extends State<PlanView> {
appBar: CustomAppBar(
height: SizeConfig.height * 0.08,
title: 'Investment Plan',
leading: SizedBox(),
leading: const SizedBox(),
),
body: SingleChildScrollView(
padding: EdgeInsets.all(24),
padding: const EdgeInsets.all(24),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
RiskProfile(
const RiskProfile(
totalScore: 26,
rowSuitableProduct: true
),
SizedBox(
const SizedBox(
height: 32,
),
Text('Your Goal in Investing',
const Text('Your Goal in Investing',
style: TextStyle(
fontWeight: FontWeight.w700,
color: ColorPalette.slate800,
fontSize: 18
),
),
SizedBox(
const SizedBox(
height: 24,
),
GoalInvestingView(
onListSelected: (p0) {
print(p0);
showModalBottomSheet(
context: context,
isScrollControlled: true,
@@ -103,7 +98,7 @@ class _PlanViewState extends State<PlanView> {
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text("It's time to invest",
const Text("It's time to invest",
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w600
@@ -113,17 +108,20 @@ class _PlanViewState extends State<PlanView> {
onTap: () {
Navigator.pop(context);
},
child: Icon(Icons.close_rounded)
child: const Icon(Icons.close_rounded)
)
],
),
),
Divider(color: ColorPalette.slate200, height: 1),
const Divider(color: ColorPalette.slate200, height: 1),
InputInvestmentView(
selectedPlan: text,
currentPlan: text,
changePlan: () {
Navigator.pop(context);
},
nextMove: (value) {
Navigator.pop(context);
int formatIntParse = int.parse(value.replaceAll('Rp ', '').replaceAll(',', ''));
int formatIntParse = int.parse(value.replaceAll('Rp ', '').replaceAll('.', ''));
showModalBottomSheet(context: context, builder: (context) => OptionsStartingInvest(totalInvest: formatIntParse));
},
),

View File

@@ -4,6 +4,7 @@ import 'package:cims_apps/application/component/button/button_view.dart';
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/utils/number_formatter.dart';
import 'package:cims_apps/core/utils/size_config.dart';
import 'package:cims_apps/features/dashboard/dashboard_account/view/portfolio/redeem_product/view/redeem_product.dart';
import 'package:cims_apps/features/dashboard/dashboard_account/view/portfolio/redeem_product/view_model/redeem_product_view_model.dart';
@@ -18,29 +19,33 @@ class PortfolioDetailView extends StatelessWidget {
List<PortfolioProduct> listProduct = [
PortfolioProduct(
name: 'Gemilang Dana Kas Maxima',
type: '',
type: 'Money Market',
yield: 8.17,
priceUnit: 2600.79,
funds: 6300000),
funds: 6300000,
totalUnit: 14520
),
PortfolioProduct(
name: 'Gemilang Dana Likuid',
type: '',
type: 'Sharia',
yield: 6.42,
priceUnit: 1600.79,
funds: 2340000),
funds: 2340000,
totalUnit: 232,
),
PortfolioProduct(
name: 'Gemilang Income Fund',
type: '',
type: 'Bonds',
yield: 8.17,
priceUnit: 2600.79,
funds: 6300000)
funds: 6300000,
totalUnit: 2450,
)
];
return MultiProvider(
providers: [
ChangeNotifierProvider(create: (context) => RedeemProductViewModel())
],
return ChangeNotifierProvider(
create: (context) => RedeemProductViewModel(),
child: Scaffold(
backgroundColor: Colors.white,
body: SizedBox(
@@ -100,19 +105,20 @@ class PortfolioDetailView extends StatelessWidget {
),
const SizedBox(height: 24,),
Expanded(
child: ClipRRect(
borderRadius: BorderRadius.circular(0),
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
color: Colors.white,
),
child: ListView(
padding: const EdgeInsets.all(24),
children: [
cardPortfolio(context)
],
),
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
color: Colors.white,
),
child: Consumer<RedeemProductViewModel>(
builder: (context, provider, child) {
return ListView(
padding: const EdgeInsets.all(24),
children: listProduct.asMap().entries.map((e) {
return cardPortfolio(context, e.value);
}).toList(),
);
}
),
)
)
@@ -125,7 +131,7 @@ class PortfolioDetailView extends StatelessWidget {
);
}
Widget cardPortfolio(context) {
Widget cardPortfolio(context, PortfolioProduct product) {
return Container(
padding: const EdgeInsets.all(16),
decoration: BoxDecoration(
@@ -155,19 +161,19 @@ class PortfolioDetailView extends StatelessWidget {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const TextTitle(title: 'Gemilang Dana Kas Maxima', fontSize: 16,),
TextTitle(title: product.name ?? '', fontSize: 16,),
const SizedBox(height: 4),
Container(
padding: const EdgeInsets.all(6),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(40),
color: ColorPalette.investTypeBgColor['Money Market']?.withOpacity(0.5) ?? Colors.white,
border: Border.all(width: 2, color: ColorPalette.investTypeColor['Money Market']?.withOpacity(0.4) ?? Colors.white)
color: ColorPalette.investTypeBgColor[product.type!]?.withOpacity(0.5) ?? Colors.white,
border: Border.all(width: 2, color: ColorPalette.investTypeColor[product.type!]?.withOpacity(0.4) ?? Colors.white)
),
child: Text(
'Money Market' ?? '',
product.type ?? '',
style: TextStyle(
color: ColorPalette.investTypeColor['Money Market'],
color: ColorPalette.investTypeColor[product.type!],
fontWeight: FontWeight.w600
),
),
@@ -187,8 +193,8 @@ class PortfolioDetailView extends StatelessWidget {
rowDescription('Present Value', 'Rp2.660.706', fontWeight: FontWeight.w700),
rowDescription('Investment Capital', 'Rp2.660.706'),
rowDescription('Advantages', 'Rp2.660.706'),
rowDescription('Purchase Price', 'Rp1.500,57'),
rowDescription('Number of Units', '14.002'),
rowDescription('Purchase Price', NumberFormatter.numberCurrency(product.priceUnit, 'Rp ', 'id_ID')),
rowDescription('Number of Units', '${product.totalUnit ?? 0}'),
],
),
const SizedBox(height: 16,),
@@ -206,6 +212,7 @@ class PortfolioDetailView extends StatelessWidget {
borderColor: ColorPalette.red600,
textColor: ColorPalette.red600,
onPressed: () {
Provider.of<RedeemProductViewModel>(context, listen: false).setProduct(product);
showModalBottomSheet(
context: context,
isScrollControlled: true,

View File

@@ -4,6 +4,7 @@ import 'package:cims_apps/application/assets/path_assets.dart';
import 'package:cims_apps/application/component/button/button_view.dart';
import 'package:cims_apps/application/component/image/image_view.dart';
import 'package:cims_apps/application/component/numeric_pad/numeric_pad.dart';
import 'package:cims_apps/application/component/subscribe/input_investment_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/utils/number_formatter.dart';
@@ -82,98 +83,33 @@ class _ChangeAmountState extends State<ChangeAmount> {
),
),
const Divider(height: 1, color: ColorPalette.slate200,),
Padding(
padding: EdgeInsets.all(24),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
cardProduct(),
SizedBox(height: 24),
TextField(
controller: amountController,
textAlign: TextAlign.center,
style: const TextStyle(
fontSize: 28,
fontWeight: FontWeight.w600,
color: ColorPalette.slate800
),
keyboardType: TextInputType.number,
onChanged: (value) {
value = value.replaceAll('Rp ', '').replaceAll('.', '');
double parseValue = double.parse(value);
if(value.isNotEmpty){
amountController.text = NumberFormatter.numberCurrency(parseValue, 'Rp ', 'id_ID', decimalDigits: 0);
}else{
amountController.text = NumberFormatter.numberCurrency(0, 'Rp ', 'id_ID', decimalDigits: 0);
}
},
decoration: const InputDecoration(
enabledBorder: UnderlineInputBorder(
borderSide: BorderSide(
color: ColorPalette.primary,
width: 2
),
)
),
),
SizedBox(height: 12),
Text(
'Min Redeem: ${(NumberFormatter.numberCurrency(10000, 'Rp ', 'id_ID', decimalDigits: 0))}',
style: TextStyle(
color: ColorPalette.slate400,
fontWeight: FontWeight.w600,
),
),
Text(
'Max Redeem: ${(NumberFormatter.numberCurrency((provider.getCurrentProduct.priceUnit! * provider.getCurrentProduct.totalUnit!).toInt(), 'Rp ', 'id_ID', decimalDigits: 0))}',
style: TextStyle(
color: ColorPalette.slate400,
fontWeight: FontWeight.w600,
),
),
const SizedBox(height: 24),
NumericPad(onNumberSelected: (p0) {
String checkIsZeroInput = amountController.text.replaceAll('Rp ', '').replaceAll('.', '');
String getNumeric = p0;
if(p0.isNotEmpty){
if(checkIsZeroInput != '0'){
getNumeric = checkIsZeroInput + getNumeric;
}
}else{
getNumeric = checkIsZeroInput.substring(0, checkIsZeroInput.length - 1);
}
if(getNumeric.isEmpty){
getNumeric = '0';
}
if(double.parse(getNumeric) >= provider.getCurrentProduct.priceUnit! * provider.getCurrentProduct.totalUnit!){
getNumeric = (provider.getCurrentProduct.priceUnit! * provider.getCurrentProduct.totalUnit!).toString();
}
String formatNumeric = NumberFormatter.numberCurrency(
double.parse(getNumeric).toInt(), 'Rp ', 'id_ID', decimalDigits: 0);
amountController.text = formatNumeric;
}),
const SizedBox(height: 24),
ButtonView(
name: 'Confirm',
textSize: 20,
marginVertical: 0,
onPressed: () {
String formatValueInput = amountController.text.replaceAll('Rp ', '').replaceAll('.', '');
provider.setAmount(double.parse(formatValueInput));
Navigator.pop(context);
showModalBottomSheet(
context: context,
isScrollControlled: true,
builder: (context) {
return const RedeemProduct();
},
);
},
)
],
),
)
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: EdgeInsets.all(24),
child: cardProduct()
),
InputInvestmentView(
minimumPrice: (provider.getCurrentProduct.priceUnit! * 1).toInt(),
maximumPrice: (provider.getCurrentProduct.priceUnit! * provider.getCurrentProduct.totalUnit!).toInt(),
currentPrice: provider.getAmount!.toInt(),
nextMove: (value) {
String formatValueInput = value.replaceAll('Rp ', '').replaceAll('.', '');
provider.setAmount(double.parse(formatValueInput));
Navigator.pop(context);
showModalBottomSheet(
context: context,
isScrollControlled: true,
builder: (context) {
return const RedeemProduct();
},
);
},
)
],
),
SizedBox(height: 16,)
],
);
}

View File

@@ -42,8 +42,7 @@ class _RedeemProductState extends State<RedeemProduct> {
create: (context) => RedeemProductViewModel(),
child: Consumer<RedeemProductViewModel>(
builder: (context, provider, child) {
double amount = provider.getAmount ?? provider.getCurrentProduct.priceUnit! * provider.getCurrentProduct.totalUnit!;
amountController.text = NumberFormatter.numberCurrency(amount.toInt(), 'Rp ', 'id_ID', decimalDigits: 0);
amountController.text = NumberFormatter.numberCurrency(provider.getAmount!.toInt(), 'Rp ', 'id_ID', decimalDigits: 0);
return Column(
mainAxisSize: MainAxisSize.min,
children: [
@@ -76,8 +75,8 @@ class _RedeemProductState extends State<RedeemProduct> {
const SizedBox(height: 16),
segmentAmount(
context,
provider.getAmount ?? provider.getCurrentProduct.priceUnit! * (provider.getCurrentProduct.totalUnit! / 2.0),
provider.getUnit ?? provider.getCurrentProduct.totalUnit! / 2.0,
provider.getAmount!,
provider.getUnit!,
(value) {
provider.setUnit(value);
},

View File

@@ -61,6 +61,8 @@ class RedeemProductViewModel extends ChangeNotifier {
void setProduct(PortfolioProduct product) {
currentProduct = product;
amount = product.priceUnit! * (product.totalUnit! / 2.0);
unit = (product.totalUnit! / 2.0);
notifyListeners();
}

View File

@@ -55,32 +55,43 @@ class SelectGoalInvesting extends StatelessWidget {
create: (context) => ProductViewModel(),
child: Consumer<ProductViewModel>(
builder: (context, provider, child) {
return InputInvestmentView(
selectedPlan: p0,
nextMove: (value) {
Navigator.pop(context);
int formatIntParse = int.parse(value.replaceAll('Rp ', '').replaceAll(',', ''));
showModalBottomSheet(
context: context,
isScrollControlled: true,
builder: (context) =>
ChangeNotifierProvider(
create: (context) => ProductViewModel(),
child: Consumer<ProductViewModel>(
builder: (context, provider, child) {
return TotalPaymentView(
listProduct: [
provider.getSelectedProduct
],
totalInvest: formatIntParse,
isAgree: provider.isAgree,
onTapAgree: provider.setAgree,
);
}
),
)
);
},
return Padding(
padding: EdgeInsets.symmetric(vertical: 16),
child: InputInvestmentView(
currentPlan: p0,
changePlan: () {
Navigator.pop(context);
showModalBottomSheet(
context: context,
isScrollControlled: true,
builder: (context) => SelectGoalInvesting(),
);
},
nextMove: (value) {
Navigator.pop(context);
int formatIntParse = int.parse(value.replaceAll('Rp ', '').replaceAll('.', ''));
showModalBottomSheet(
context: context,
isScrollControlled: true,
builder: (context) =>
ChangeNotifierProvider(
create: (context) => ProductViewModel(),
child: Consumer<ProductViewModel>(
builder: (context, provider, child) {
return TotalPaymentView(
listProduct: [
provider.getSelectedProduct
],
totalInvest: formatIntParse,
isAgree: provider.isAgree,
onTapAgree: provider.setAgree,
);
}
),
)
);
},
),
);
}
),