fix: provider view model agreement redeem and product

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

View File

@ -11,9 +11,9 @@ class CustomAppBar extends StatelessWidget implements PreferredSizeWidget {
const CustomAppBar({ const CustomAppBar({
Key? key, Key? key,
required this.height, required this.height,
this.leading,
required this.title, required this.title,
this.trailing, this.trailing,
this.leading,
}) : super(key: key); }) : super(key: key);
@override @override

View File

@ -0,0 +1,73 @@
import 'package:cims_apps/application/theme/color_palette.dart';
import 'package:flutter/material.dart';
class RadioAgreement extends StatelessWidget {
final void Function() onTap;
final bool isAgree;
final String desc;
const RadioAgreement({super.key, required this.isAgree, required this.desc, required this.onTap,});
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 16),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
GestureDetector(
onTap: onTap,
child: AnimatedContainer(
margin: const EdgeInsets.only(top: 4),
duration: const Duration(milliseconds: 200),
height: 16,
width: 16,
padding: const EdgeInsets.all(1),
alignment: Alignment.center,
decoration: BoxDecoration(
shape: BoxShape.circle,
border: Border.all(
color: isAgree
? ColorPalette.primary
: ColorPalette.slate200)),
child: AnimatedContainer(
duration: const Duration(milliseconds: 200),
child: Container(
decoration: BoxDecoration(
color:
isAgree ? ColorPalette.primary : ColorPalette.white,
shape: BoxShape.circle),
),
),
),
),
const SizedBox(
width: 12,
),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
desc,
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w600,
color: ColorPalette.slate400),
),
GestureDetector(
onTap: () {},
child: const Text(
'Read More',
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w600,
decoration: TextDecoration.underline,
color: ColorPalette.primary),
))
],
))
],
),
);
}
}

View File

@ -36,8 +36,8 @@ class GoalInvestingView extends StatelessWidget {
routePush( routePush(
context, context,
page: OtherPlanView( page: OtherPlanView(
selectedPlan: (value) { selectedPlan: (val) {
onListSelected(e.value.title); onListSelected(val);
}, },
) )
); );

View File

@ -54,7 +54,6 @@ class _InputInvestmentViewState extends State<InputInvestmentView> {
style: TextStyle( style: TextStyle(
fontSize: 20, fontSize: 20,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
), ),
), ),
Row( Row(

View File

@ -1,3 +1,5 @@
import 'dart:math';
import 'package:cims_apps/application/assets/path_assets.dart'; 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/button/button_view.dart';
import 'package:cims_apps/application/component/custom_app_bar/custom_app_bar.dart'; import 'package:cims_apps/application/component/custom_app_bar/custom_app_bar.dart';
@ -72,6 +74,8 @@ class _OtherPlanViewState extends State<OtherPlanView> {
disabled: !(selectedPlan.img != ''), disabled: !(selectedPlan.img != ''),
onPressed: () { onPressed: () {
Navigator.pop(context); Navigator.pop(context);
print('haloo');
print(selectedPlan.name);
widget.selectedPlan(selectedPlan.name); widget.selectedPlan(selectedPlan.name);
}, },
heightWrapContent: true, heightWrapContent: true,
@ -91,6 +95,7 @@ class _OtherPlanViewState extends State<OtherPlanView> {
if(plan.name == 'Create Plan'){ if(plan.name == 'Create Plan'){
showModalBottomSheet( showModalBottomSheet(
context: context, context: context,
isDismissible: false,
builder: (context) => modalCreatePlan(), builder: (context) => modalCreatePlan(),
); );
} }
@ -150,6 +155,9 @@ class _OtherPlanViewState extends State<OtherPlanView> {
GestureDetector( GestureDetector(
onTap: () { onTap: () {
Navigator.pop(context); Navigator.pop(context);
setState(() {
selectedPlan = Plan('', '');
});
}, },
child: Icon(Icons.close_rounded), child: Icon(Icons.close_rounded),
) )
@ -161,12 +169,12 @@ class _OtherPlanViewState extends State<OtherPlanView> {
), ),
SizedBox(height: 24), SizedBox(height: 24),
ButtonView( ButtonView(
name: 'Select', name: 'Next',
marginVertical: 0, marginVertical: 0,
disabled: !(createController.text != ''), disabled: !(createController.text != ''),
onPressed: () { onPressed: () {
Navigator.of(context)..pop()..pop(); Navigator.of(context)..pop()..pop();
widget.selectedPlan(selectedPlan.name); widget.selectedPlan(createController.text);
}, },
heightWrapContent: true, heightWrapContent: true,
width: SizeConfig.width, width: SizeConfig.width,

View File

@ -1,4 +1,5 @@
import 'package:cims_apps/application/component/button/button_view.dart'; import 'package:cims_apps/application/component/button/button_view.dart';
import 'package:cims_apps/application/component/radio_agreement.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/number_formatter.dart';
@ -6,22 +7,19 @@ import 'package:cims_apps/features/dashboard/dashboard_account/view/product/view
import 'package:cims_apps/features/dashboard/dashboard_account/view/product/view_model/product_view_model.dart'; import 'package:cims_apps/features/dashboard/dashboard_account/view/product/view_model/product_view_model.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
class TotalPaymentView extends StatefulWidget { class TotalPaymentView extends StatelessWidget {
final int totalInvest; final int totalInvest;
final List<Product> listProduct; final List<Product> listProduct;
final bool isAgree;
final void Function() onTapAgree;
const TotalPaymentView({ const TotalPaymentView({
super.key, super.key,
required this.listProduct, required this.listProduct,
required this.totalInvest, required this.totalInvest,
required this.isAgree,
required this.onTapAgree,
}); });
@override
State<TotalPaymentView> createState() => _TotalPaymentViewState();
}
class _TotalPaymentViewState extends State<TotalPaymentView> {
bool isAgreement = false;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return SingleChildScrollView( return SingleChildScrollView(
@ -49,7 +47,7 @@ class _TotalPaymentViewState extends State<TotalPaymentView> {
], ],
), ),
), ),
...widget.listProduct.asMap().entries.map((e) { ...listProduct.asMap().entries.map((e) {
return Container( return Container(
padding: const EdgeInsets.only( padding: const EdgeInsets.only(
left: 16, right: 24, bottom: 16, top: 16), left: 16, right: 24, bottom: 16, top: 16),
@ -75,7 +73,7 @@ class _TotalPaymentViewState extends State<TotalPaymentView> {
flex: 7, flex: 7,
child: Text( child: Text(
NumberFormatter.numberCurrency( NumberFormatter.numberCurrency(
widget.totalInvest * e.value.totalPercent!, totalInvest * e.value.totalPercent!,
'Rp ', 'Rp ',
'id_ID'), 'id_ID'),
textAlign: TextAlign.end, textAlign: TextAlign.end,
@ -129,7 +127,7 @@ class _TotalPaymentViewState extends State<TotalPaymentView> {
), ),
Text( Text(
NumberFormatter.numberCurrency( NumberFormatter.numberCurrency(
widget.totalInvest, 'Rp ', 'id_ID'), totalInvest, 'Rp ', 'id_ID'),
textAlign: TextAlign.end, textAlign: TextAlign.end,
style: const TextStyle( style: const TextStyle(
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
@ -139,7 +137,14 @@ class _TotalPaymentViewState extends State<TotalPaymentView> {
], ],
), ),
), ),
buttonAgreement(), RadioAgreement(
isAgree: isAgree,
desc: 'I agree to buy the mutual fund on this page and have read and agreed to all the contents of the Prospectus and summary information and understand the risks of my investment decision. Read More',
onTap: () {
print('gagaga');
onTapAgree();
},
),
Container( Container(
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 16), padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 16),
child: Row( child: Row(
@ -154,7 +159,7 @@ class _TotalPaymentViewState extends State<TotalPaymentView> {
), ),
Text( Text(
NumberFormatter.numberCurrency( NumberFormatter.numberCurrency(
widget.totalInvest, 'Rp ', 'id_ID'), totalInvest, 'Rp ', 'id_ID'),
textAlign: TextAlign.end, textAlign: TextAlign.end,
style: const TextStyle( style: const TextStyle(
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
@ -165,16 +170,16 @@ class _TotalPaymentViewState extends State<TotalPaymentView> {
), ),
), ),
ButtonView( ButtonView(
disabled: !isAgreement, disabled: !isAgree,
name: 'Subscribe Now', name: 'Subscribe Now',
onPressed: () { onPressed: () {
routePush(context, routePush(context,
page: PaymentMethodView( page: PaymentMethodView(
totalInvest: widget.totalInvest, totalInvest: totalInvest,
)); ));
}, },
disabledBgColor: ColorPalette.slate200.withOpacity(0.5), disabledBgColor: ColorPalette.slate200.withOpacity(0.5),
textColor: isAgreement ? Colors.white : ColorPalette.slate400, textColor: isAgree ? Colors.white : ColorPalette.slate400,
textWeight: FontWeight.w700, textWeight: FontWeight.w700,
textSize: 20, textSize: 20,
backgroundColor: ColorPalette.primary, backgroundColor: ColorPalette.primary,
@ -185,71 +190,67 @@ class _TotalPaymentViewState extends State<TotalPaymentView> {
); );
} }
Widget buttonAgreement() { // Widget buttonAgreement() {
bool isAgree = isAgreement; // return Padding(
return Padding( // padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 16),
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 16), // child: Row(
child: Row( // crossAxisAlignment: CrossAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start, // children: [
children: [ // GestureDetector(
GestureDetector( // onTap: () {
onTap: () { // },
setState(() { // child: AnimatedContainer(
isAgreement = !isAgreement; // margin: const EdgeInsets.only(top: 4),
}); // duration: const Duration(milliseconds: 200),
}, // height: 16,
child: AnimatedContainer( // width: 16,
margin: const EdgeInsets.only(top: 4), // padding: const EdgeInsets.all(1),
duration: const Duration(milliseconds: 200), // alignment: Alignment.center,
height: 16, // decoration: BoxDecoration(
width: 16, // shape: BoxShape.circle,
padding: const EdgeInsets.all(1), // border: Border.all(
alignment: Alignment.center, // color: isAgree
decoration: BoxDecoration( // ? ColorPalette.primary
shape: BoxShape.circle, // : ColorPalette.slate200)),
border: Border.all( // child: AnimatedContainer(
color: isAgree // duration: const Duration(milliseconds: 200),
? ColorPalette.primary // child: Container(
: ColorPalette.slate200)), // decoration: BoxDecoration(
child: AnimatedContainer( // color:
duration: const Duration(milliseconds: 200), // isAgree ? ColorPalette.primary : ColorPalette.white,
child: Container( // shape: BoxShape.circle),
decoration: BoxDecoration( // ),
color: // ),
isAgree ? ColorPalette.primary : ColorPalette.white, // ),
shape: BoxShape.circle), // ),
), // const SizedBox(
), // width: 12,
), // ),
), // Expanded(
const SizedBox( // child: Column(
width: 12, // crossAxisAlignment: CrossAxisAlignment.start,
), // children: [
Expanded( // const Text(
child: Column( // 'I agree to buy the mutual fund on this page and have read and agreed to all the contents of the Prospectus and summary information and understand the risks of my investment decision.',
crossAxisAlignment: CrossAxisAlignment.start, // style: TextStyle(
children: [ // fontSize: 16,
const Text( // fontWeight: FontWeight.w600,
'I agree to buy the mutual fund on this page and have read and agreed to all the contents of the Prospectus and summary information and understand the risks of my investment decision.', // color: ColorPalette.slate400),
style: TextStyle( // ),
fontSize: 16, // GestureDetector(
fontWeight: FontWeight.w600, // onTap: () {},
color: ColorPalette.slate400), // child: const Text(
), // 'Read More',
GestureDetector( // style: TextStyle(
onTap: () {}, // fontSize: 16,
child: const Text( // fontWeight: FontWeight.w600,
'Read More', // decoration: TextDecoration.underline,
style: TextStyle( // color: ColorPalette.primary),
fontSize: 16, // ))
fontWeight: FontWeight.w600, // ],
decoration: TextDecoration.underline, // ))
color: ColorPalette.primary), // ],
)) // ),
], // );
)) // }
],
),
);
}
} }

View File

@ -40,8 +40,14 @@ class _PlanViewState extends State<PlanView> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return ChangeNotifierProvider(
appBar: CustomAppBar(height: 70, title: 'Investment Plan'), create: (context) => PlanViewModel(),
child: Scaffold(
appBar: CustomAppBar(
height: SizeConfig.height * 0.08,
title: 'Investment Plan',
leading: SizedBox(),
),
body: SingleChildScrollView( body: SingleChildScrollView(
padding: EdgeInsets.all(24), padding: EdgeInsets.all(24),
child: Column( child: Column(
@ -66,6 +72,7 @@ class _PlanViewState extends State<PlanView> {
), ),
GoalInvestingView( GoalInvestingView(
onListSelected: (p0) { onListSelected: (p0) {
print(p0);
showModalBottomSheet( showModalBottomSheet(
context: context, context: context,
isScrollControlled: true, isScrollControlled: true,
@ -78,6 +85,7 @@ class _PlanViewState extends State<PlanView> {
], ],
), ),
), ),
),
); );
} }

View File

@ -5,9 +5,12 @@ import 'package:cims_apps/application/component/subscribe/total_payment_view.dar
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/size_config.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';
import 'package:cims_apps/features/dashboard/dashboard_account/view/product/view/product_view.dart'; import 'package:cims_apps/features/dashboard/dashboard_account/view/product/view/product_view.dart';
import 'package:cims_apps/features/dashboard/dashboard_account/view/product/view_model/product_view_model.dart'; import 'package:cims_apps/features/dashboard/dashboard_account/view/product/view_model/product_view_model.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
class ResultOptionsProduct extends StatelessWidget { class ResultOptionsProduct extends StatelessWidget {
final int totalInvest; final int totalInvest;
@ -21,6 +24,10 @@ class ResultOptionsProduct extends StatelessWidget {
Product(name: 'Gemilang Kas 2 Kelas A', type: 'Shares', totalPercent: 0.1) Product(name: 'Gemilang Kas 2 Kelas A', type: 'Shares', totalPercent: 0.1)
]; ];
return ChangeNotifierProvider(
create: (context) => PlanViewModel(),
child: Consumer<PlanViewModel>(
builder: (context, provider, child) {
return Container( return Container(
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.white, color: Colors.white,
@ -30,10 +37,21 @@ class ResultOptionsProduct extends StatelessWidget {
child: Column( child: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
const Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Icon(Icons.arrow_back, color: ColorPalette.slate500), GestureDetector(
onTap: () {
Navigator.pop(context);
showModalBottomSheet(
context: context,
builder: (context) {
return OptionsStartingInvest(totalInvest: totalInvest);
},
);
},
child: Icon(Icons.arrow_back, color: ColorPalette.slate500)
),
Text('Results from your risk profile', Text('Results from your risk profile',
style: TextStyle( style: TextStyle(
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
@ -41,7 +59,13 @@ class ResultOptionsProduct extends StatelessWidget {
color: ColorPalette.slate800 color: ColorPalette.slate800
), ),
), ),
Icon(Icons.close_rounded, color: ColorPalette.slate400) GestureDetector(
onTap: () {
Navigator.pop(context);
},
child: Icon(Icons.close_rounded, color: ColorPalette.slate400)
)
], ],
), ),
const SizedBox(height: 32), const SizedBox(height: 32),
@ -134,13 +158,23 @@ class ResultOptionsProduct extends StatelessWidget {
ButtonView( ButtonView(
name: 'Next', name: 'Next',
onPressed: () { onPressed: () {
Navigator.pop(context);
showModalBottomSheet( showModalBottomSheet(
context: context, context: context,
isScrollControlled: true, isScrollControlled: true,
builder: (context) => builder: (context) =>
TotalPaymentView( ChangeNotifierProvider(
create: (context) => PlanViewModel(),
child: Consumer<PlanViewModel>(
builder: (context, planProvider, _) {
return TotalPaymentView(
listProduct: listProduct, listProduct: listProduct,
totalInvest: totalInvest, totalInvest: totalInvest,
isAgree: planProvider.isAgree,
onTapAgree: planProvider.setAgree,
);
}
),
) )
); );
}, },
@ -153,4 +187,7 @@ class ResultOptionsProduct extends StatelessWidget {
), ),
); );
} }
),
);
}
} }

View File

@ -3,4 +3,10 @@ import 'package:flutter/material.dart';
class PlanViewModel extends ChangeNotifier { class PlanViewModel extends ChangeNotifier {
List<Product> listProduct = []; List<Product> listProduct = [];
bool isAgree = false;
void setAgree() {
isAgree = !isAgree;
notifyListeners();
}
} }

View File

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

View File

@ -1,7 +1,10 @@
import 'package:cims_apps/application/assets/path_assets.dart'; 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/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/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/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/portfolio/redeem_product/view_model/redeem_product_view_model.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'; import 'package:flutter/material.dart';
@ -24,7 +27,7 @@ class TotalRedeem extends StatelessWidget {
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Text('Investment Funds that You Cash Out', const Text('Investment Funds that You Cash Out',
style: TextStyle( style: TextStyle(
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
color: ColorPalette.slate800, color: ColorPalette.slate800,
@ -33,18 +36,18 @@ class TotalRedeem extends StatelessWidget {
), ),
GestureDetector( GestureDetector(
onTap: () => Navigator.pop(context), 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(
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 16), padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 16),
child: cardProduct(provider.getCurrentProduct, provider.getUnit!), child: cardProduct(provider.getCurrentProduct, provider.getUnit!),
), ),
Padding( const Padding(
padding: const EdgeInsets.symmetric(horizontal: 24), padding: EdgeInsets.symmetric(horizontal: 24),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
@ -64,9 +67,9 @@ class TotalRedeem extends StatelessWidget {
], ],
), ),
), ),
SizedBox(height: 16), const SizedBox(height: 16),
Padding( const Padding(
padding: const EdgeInsets.symmetric(horizontal: 24), padding: EdgeInsets.symmetric(horizontal: 24),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ 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 getAmount => amount;
double? get getUnit => unit; double? get getUnit => unit;
bool isAgree = false;
void setCurrentAcc(Account account) { void setCurrentAcc(Account account) {
currentAccount = account; currentAccount = account;
notifyListeners(); notifyListeners();
@ -61,4 +63,9 @@ class RedeemProductViewModel extends ChangeNotifier {
currentProduct = product; currentProduct = product;
notifyListeners(); notifyListeners();
} }
void setAgree() {
isAgree = !isAgree;
notifyListeners();
}
} }

View File

@ -2,6 +2,7 @@ import 'package:cims_apps/application/component/subscribe/goal_investing_view.da
import 'package:cims_apps/application/component/subscribe/input_investment_view.dart'; import 'package:cims_apps/application/component/subscribe/input_investment_view.dart';
import 'package:cims_apps/application/component/subscribe/total_payment_view.dart'; import 'package:cims_apps/application/component/subscribe/total_payment_view.dart';
import 'package:cims_apps/application/theme/color_palette.dart'; import 'package:cims_apps/application/theme/color_palette.dart';
import 'package:cims_apps/features/dashboard/dashboard_account/view/plan/view_model/plan_view_model.dart';
import 'package:cims_apps/features/dashboard/dashboard_account/view/product/view_model/product_view_model.dart'; import 'package:cims_apps/features/dashboard/dashboard_account/view/product/view_model/product_view_model.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
@ -11,10 +12,9 @@ class SelectGoalInvesting extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return MultiProvider(
providers: [ return ChangeNotifierProvider(
ChangeNotifierProvider(create: (context) => ProductViewModel(),) create: (context) => ProductViewModel(),
],
child: Consumer<ProductViewModel>( child: Consumer<ProductViewModel>(
builder: (context, provider, child) { builder: (context, provider, child) {
return Container( return Container(
@ -51,6 +51,10 @@ class SelectGoalInvesting extends StatelessWidget {
context: context, context: context,
isScrollControlled: true, isScrollControlled: true,
builder: (context) { builder: (context) {
return ChangeNotifierProvider(
create: (context) => ProductViewModel(),
child: Consumer<ProductViewModel>(
builder: (context, provider, child) {
return InputInvestmentView( return InputInvestmentView(
selectedPlan: p0, selectedPlan: p0,
nextMove: (value) { nextMove: (value) {
@ -60,15 +64,27 @@ class SelectGoalInvesting extends StatelessWidget {
context: context, context: context,
isScrollControlled: true, isScrollControlled: true,
builder: (context) => builder: (context) =>
TotalPaymentView( ChangeNotifierProvider(
create: (context) => ProductViewModel(),
child: Consumer<ProductViewModel>(
builder: (context, provider, child) {
return TotalPaymentView(
listProduct: [ listProduct: [
provider.getSelectedProduct provider.getSelectedProduct
], ],
totalInvest: formatIntParse, totalInvest: formatIntParse,
isAgree: provider.isAgree,
onTapAgree: provider.setAgree,
);
}
),
) )
); );
}, },
); );
}
),
);
}, },
); );
}, },

View File

@ -14,6 +14,7 @@ class ProductViewModel extends ChangeNotifier {
Product get getSelectedProduct => selectedProduct; Product get getSelectedProduct => selectedProduct;
double totalInvestment = 0; double totalInvestment = 0;
bool isAgree = false;
void setSelectedProduct(Product product) { void setSelectedProduct(Product product) {
selectedProduct = product; selectedProduct = product;
@ -24,4 +25,9 @@ class ProductViewModel extends ChangeNotifier {
totalInvestment = value; totalInvestment = value;
notifyListeners(); notifyListeners();
} }
void setAgree() {
isAgree = !isAgree;
notifyListeners();
}
} }

View File

@ -8,7 +8,7 @@ class ProfileView extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: CustomAppBar(height: SizeConfig.height * .1, title: 'Profile'), appBar: CustomAppBar(height: SizeConfig.height * .08, title: 'Profile'),
); );
} }
} }

View File

@ -8,8 +8,7 @@ class TransactionView extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: appBar: CustomAppBar(height: SizeConfig.height * 0.08, title: 'Transaction'),
CustomAppBar(height: SizeConfig.height * .1, title: 'Transaction'),
); );
} }
} }