fix: provider view model agreement redeem and product

This commit is contained in:
2024-02-22 14:43:40 +07:00
parent a3148d8210
commit 176261923d
16 changed files with 501 additions and 287 deletions

View File

@@ -152,8 +152,8 @@ class _PortofolioViewState extends State<PortofolioView> {
const SizedBox(
height: 12,
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 12),
const Padding(
padding: EdgeInsets.symmetric(horizontal: 24, vertical: 12),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
@@ -162,7 +162,7 @@ class _PortofolioViewState extends State<PortofolioView> {
children: [
Icon(Icons.add, size: 18, color: ColorPalette.primary),
SizedBox(width: 4),
Text('Create',
const Text('Create',
style: TextStyle(
color: ColorPalette.primary,
fontWeight: FontWeight.w600
@@ -173,7 +173,7 @@ class _PortofolioViewState extends State<PortofolioView> {
],
),
),
...listColumnPortofolio(),
// ...listColumnPortofolio(),
cardPortfolio()
],
),
@@ -388,11 +388,11 @@ class _PortofolioViewState extends State<PortofolioView> {
Widget cardPortfolio() {
return GestureDetector(
onTap: () {
routePush(context, page: PortfolioDetailView());
routePush(context, page: const PortfolioDetailView());
},
child: Container(
margin: EdgeInsets.symmetric(horizontal: 24),
padding: EdgeInsets.all(16),
margin: const EdgeInsets.symmetric(horizontal: 24),
padding: const EdgeInsets.all(16),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
border: Border.all(color: ColorPalette.slate200)
@@ -402,7 +402,7 @@ class _PortofolioViewState extends State<PortofolioView> {
Row(
children: [
Container(
padding: EdgeInsets.all(4),
padding: const EdgeInsets.all(4),
decoration: BoxDecoration(
color: ColorPalette.blue200.withOpacity(0.5),
borderRadius: BorderRadius.circular(8)
@@ -412,8 +412,8 @@ class _PortofolioViewState extends State<PortofolioView> {
width: SizeConfig.width * 0.07
)
),
SizedBox(width: 8),
Column(
const SizedBox(width: 8),
const Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
TextTitle(title: 'Education', fontSize: 16,),
@@ -427,11 +427,11 @@ class _PortofolioViewState extends State<PortofolioView> {
),
],
),
Padding(
padding: const EdgeInsets.symmetric(vertical: 8),
const Padding(
padding: EdgeInsets.symmetric(vertical: 8),
child: Divider(height: 1, color: ColorPalette.slate200),
),
Row(
const Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Column(

View File

@@ -1,7 +1,10 @@
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/radio_agreement.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_model/redeem_product_view_model.dart';
import 'package:flutter/material.dart';
@@ -24,7 +27,7 @@ class TotalRedeem extends StatelessWidget {
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text('Investment Funds that You Cash Out',
const Text('Investment Funds that You Cash Out',
style: TextStyle(
fontWeight: FontWeight.w600,
color: ColorPalette.slate800,
@@ -33,18 +36,18 @@ class TotalRedeem extends StatelessWidget {
),
GestureDetector(
onTap: () => Navigator.pop(context),
child: Icon(Icons.close_rounded, color: ColorPalette.slate800,)
child: const Icon(Icons.close_rounded, color: ColorPalette.slate800,)
)
],
),
),
Divider(height: 1, color: ColorPalette.slate200,),
const Divider(height: 1, color: ColorPalette.slate200,),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 16),
child: cardProduct(provider.getCurrentProduct, provider.getUnit!),
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 24),
const Padding(
padding: EdgeInsets.symmetric(horizontal: 24),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
@@ -64,9 +67,9 @@ class TotalRedeem extends StatelessWidget {
],
),
),
SizedBox(height: 16),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 24),
const SizedBox(height: 16),
const Padding(
padding: EdgeInsets.symmetric(horizontal: 24),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
@@ -86,8 +89,59 @@ class TotalRedeem extends StatelessWidget {
],
),
),
SizedBox(height: 16,),
const SizedBox(height: 16,),
Container(
padding: EdgeInsets.symmetric(horizontal: 24, vertical: 16),
color: ColorPalette.slate200.withOpacity(0.5),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expanded(
child: TextTitle(
title: 'Estimated Funds Disbursed',
color: ColorPalette.slate500,
fontSize: 16,
)
),
Expanded(
child: Text(
NumberFormatter.numberCurrency((provider.getCurrentProduct.priceUnit! * provider.getUnit!).toInt(), 'Rp ', 'id_ID', decimalDigits: 0),
textAlign: TextAlign.end,
style: TextStyle(
color: ColorPalette.slate800,
fontWeight: FontWeight.w700,
fontSize: 18
),
)
)
],
),
),
RadioAgreement(
isAgree: provider.isAgree,
desc: 'I agree to the sale of the mutual funds listed on this page. I understand that the total funds disbursed are approximate. The amount received may change according to the closing price of the mutual fund on the day of sale.',
onTap: provider.setAgree
),
const SizedBox(height: 24),
ButtonView(
disabled: !provider.isAgree,
name: 'Redeem',
textSize: 20,
marginVertical: 0,
disabledBgColor: ColorPalette.slate200.withOpacity(0.5),
textColor: !provider.isAgree ? ColorPalette.slate400 : Colors.white,
onPressed: () {
Navigator.pop(context);
showModalBottomSheet(
context: context,
isScrollControlled: true,
builder: (context) {
return TotalRedeem();
},
);
},
),
const SizedBox(height: 24)
],
);
}

View File

@@ -35,6 +35,8 @@ class RedeemProductViewModel extends ChangeNotifier {
double? get getAmount => amount;
double? get getUnit => unit;
bool isAgree = false;
void setCurrentAcc(Account account) {
currentAccount = account;
notifyListeners();
@@ -61,4 +63,9 @@ class RedeemProductViewModel extends ChangeNotifier {
currentProduct = product;
notifyListeners();
}
void setAgree() {
isAgree = !isAgree;
notifyListeners();
}
}