diff --git a/lib/application/component/custom_app_bar/custom_app_bar.dart b/lib/application/component/custom_app_bar/custom_app_bar.dart index 727455e..a119939 100644 --- a/lib/application/component/custom_app_bar/custom_app_bar.dart +++ b/lib/application/component/custom_app_bar/custom_app_bar.dart @@ -11,9 +11,9 @@ class CustomAppBar extends StatelessWidget implements PreferredSizeWidget { const CustomAppBar({ Key? key, required this.height, - this.leading, required this.title, this.trailing, + this.leading, }) : super(key: key); @override diff --git a/lib/application/component/radio_agreement.dart b/lib/application/component/radio_agreement.dart new file mode 100644 index 0000000..cecd678 --- /dev/null +++ b/lib/application/component/radio_agreement.dart @@ -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), + )) + ], + )) + ], + ), + ); + } +} diff --git a/lib/application/component/subscribe/goal_investing_view.dart b/lib/application/component/subscribe/goal_investing_view.dart index 80c3e53..7c047fd 100644 --- a/lib/application/component/subscribe/goal_investing_view.dart +++ b/lib/application/component/subscribe/goal_investing_view.dart @@ -36,8 +36,8 @@ class GoalInvestingView extends StatelessWidget { routePush( context, page: OtherPlanView( - selectedPlan: (value) { - onListSelected(e.value.title); + selectedPlan: (val) { + onListSelected(val); }, ) ); diff --git a/lib/application/component/subscribe/input_investment_view.dart b/lib/application/component/subscribe/input_investment_view.dart index 846a057..1dd8a22 100644 --- a/lib/application/component/subscribe/input_investment_view.dart +++ b/lib/application/component/subscribe/input_investment_view.dart @@ -54,7 +54,6 @@ class _InputInvestmentViewState extends State { style: TextStyle( fontSize: 20, fontWeight: FontWeight.w700, - ), ), Row( diff --git a/lib/application/component/subscribe/other_plan_view.dart b/lib/application/component/subscribe/other_plan_view.dart index 60bff7a..55204b5 100644 --- a/lib/application/component/subscribe/other_plan_view.dart +++ b/lib/application/component/subscribe/other_plan_view.dart @@ -1,3 +1,5 @@ +import 'dart:math'; + 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/custom_app_bar/custom_app_bar.dart'; @@ -72,6 +74,8 @@ class _OtherPlanViewState extends State { disabled: !(selectedPlan.img != ''), onPressed: () { Navigator.pop(context); + print('haloo'); + print(selectedPlan.name); widget.selectedPlan(selectedPlan.name); }, heightWrapContent: true, @@ -91,6 +95,7 @@ class _OtherPlanViewState extends State { if(plan.name == 'Create Plan'){ showModalBottomSheet( context: context, + isDismissible: false, builder: (context) => modalCreatePlan(), ); } @@ -150,6 +155,9 @@ class _OtherPlanViewState extends State { GestureDetector( onTap: () { Navigator.pop(context); + setState(() { + selectedPlan = Plan('', ''); + }); }, child: Icon(Icons.close_rounded), ) @@ -161,12 +169,12 @@ class _OtherPlanViewState extends State { ), SizedBox(height: 24), ButtonView( - name: 'Select', + name: 'Next', marginVertical: 0, disabled: !(createController.text != ''), onPressed: () { Navigator.of(context)..pop()..pop(); - widget.selectedPlan(selectedPlan.name); + widget.selectedPlan(createController.text); }, heightWrapContent: true, width: SizeConfig.width, diff --git a/lib/application/component/subscribe/total_payment_view.dart b/lib/application/component/subscribe/total_payment_view.dart index 0befdd5..a8ae096 100644 --- a/lib/application/component/subscribe/total_payment_view.dart +++ b/lib/application/component/subscribe/total_payment_view.dart @@ -1,4 +1,5 @@ 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/core/route/route.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:flutter/material.dart'; -class TotalPaymentView extends StatefulWidget { +class TotalPaymentView extends StatelessWidget { final int totalInvest; final List listProduct; + final bool isAgree; + final void Function() onTapAgree; const TotalPaymentView({ super.key, required this.listProduct, required this.totalInvest, + required this.isAgree, + required this.onTapAgree, }); - @override - State createState() => _TotalPaymentViewState(); -} - -class _TotalPaymentViewState extends State { - bool isAgreement = false; - @override Widget build(BuildContext context) { return SingleChildScrollView( @@ -49,7 +47,7 @@ class _TotalPaymentViewState extends State { ], ), ), - ...widget.listProduct.asMap().entries.map((e) { + ...listProduct.asMap().entries.map((e) { return Container( padding: const EdgeInsets.only( left: 16, right: 24, bottom: 16, top: 16), @@ -75,7 +73,7 @@ class _TotalPaymentViewState extends State { flex: 7, child: Text( NumberFormatter.numberCurrency( - widget.totalInvest * e.value.totalPercent!, + totalInvest * e.value.totalPercent!, 'Rp ', 'id_ID'), textAlign: TextAlign.end, @@ -129,7 +127,7 @@ class _TotalPaymentViewState extends State { ), Text( NumberFormatter.numberCurrency( - widget.totalInvest, 'Rp ', 'id_ID'), + totalInvest, 'Rp ', 'id_ID'), textAlign: TextAlign.end, style: const TextStyle( fontWeight: FontWeight.w700, @@ -139,7 +137,14 @@ class _TotalPaymentViewState extends State { ], ), ), - 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( padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 16), child: Row( @@ -154,7 +159,7 @@ class _TotalPaymentViewState extends State { ), Text( NumberFormatter.numberCurrency( - widget.totalInvest, 'Rp ', 'id_ID'), + totalInvest, 'Rp ', 'id_ID'), textAlign: TextAlign.end, style: const TextStyle( fontWeight: FontWeight.w700, @@ -165,16 +170,16 @@ class _TotalPaymentViewState extends State { ), ), ButtonView( - disabled: !isAgreement, + disabled: !isAgree, name: 'Subscribe Now', onPressed: () { routePush(context, page: PaymentMethodView( - totalInvest: widget.totalInvest, + totalInvest: totalInvest, )); }, disabledBgColor: ColorPalette.slate200.withOpacity(0.5), - textColor: isAgreement ? Colors.white : ColorPalette.slate400, + textColor: isAgree ? Colors.white : ColorPalette.slate400, textWeight: FontWeight.w700, textSize: 20, backgroundColor: ColorPalette.primary, @@ -185,71 +190,67 @@ class _TotalPaymentViewState extends State { ); } - Widget buttonAgreement() { - bool isAgree = isAgreement; - return Padding( - padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 16), - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - GestureDetector( - onTap: () { - setState(() { - isAgreement = !isAgreement; - }); - }, - 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: [ - const Text( - '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.', - 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), - )) - ], - )) - ], - ), - ); - } + // Widget buttonAgreement() { + // return Padding( + // padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 16), + // child: Row( + // crossAxisAlignment: CrossAxisAlignment.start, + // children: [ + // GestureDetector( + // 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: [ + // const Text( + // '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.', + // 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), + // )) + // ], + // )) + // ], + // ), + // ); + // } } diff --git a/lib/features/dashboard/dashboard_account/view/plan/view/plan_view.dart b/lib/features/dashboard/dashboard_account/view/plan/view/plan_view.dart index 664a044..b373824 100644 --- a/lib/features/dashboard/dashboard_account/view/plan/view/plan_view.dart +++ b/lib/features/dashboard/dashboard_account/view/plan/view/plan_view.dart @@ -40,42 +40,50 @@ class _PlanViewState extends State { @override Widget build(BuildContext context) { - return Scaffold( - appBar: CustomAppBar(height: 70, title: 'Investment Plan'), - body: SingleChildScrollView( - padding: EdgeInsets.all(24), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - RiskProfile( - totalScore: 26, - rowSuitableProduct: true - ), - SizedBox( - height: 32, - ), - Text('Your Goal in Investing', - style: TextStyle( - fontWeight: FontWeight.w700, - color: ColorPalette.slate800, - fontSize: 18 + return ChangeNotifierProvider( + create: (context) => PlanViewModel(), + child: Scaffold( + appBar: CustomAppBar( + height: SizeConfig.height * 0.08, + title: 'Investment Plan', + leading: SizedBox(), + ), + body: SingleChildScrollView( + padding: EdgeInsets.all(24), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + RiskProfile( + totalScore: 26, + rowSuitableProduct: true ), - ), - SizedBox( - height: 24, - ), - GoalInvestingView( - onListSelected: (p0) { - showModalBottomSheet( - context: context, - isScrollControlled: true, - builder: (context) { - return modalInvest(context, p0); - }, - ); - }, - ) - ], + SizedBox( + height: 32, + ), + Text('Your Goal in Investing', + style: TextStyle( + fontWeight: FontWeight.w700, + color: ColorPalette.slate800, + fontSize: 18 + ), + ), + SizedBox( + height: 24, + ), + GoalInvestingView( + onListSelected: (p0) { + print(p0); + showModalBottomSheet( + context: context, + isScrollControlled: true, + builder: (context) { + return modalInvest(context, p0); + }, + ); + }, + ) + ], + ), ), ), ); diff --git a/lib/features/dashboard/dashboard_account/view/plan/view/step_invest_plan/result_options_product.dart b/lib/features/dashboard/dashboard_account/view/plan/view/step_invest_plan/result_options_product.dart index d7d7d14..04deffc 100644 --- a/lib/features/dashboard/dashboard_account/view/plan/view/step_invest_plan/result_options_product.dart +++ b/lib/features/dashboard/dashboard_account/view/plan/view/step_invest_plan/result_options_product.dart @@ -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/core/route/route.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_model/product_view_model.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; class ResultOptionsProduct extends StatelessWidget { final int totalInvest; @@ -21,135 +24,169 @@ class ResultOptionsProduct extends StatelessWidget { Product(name: 'Gemilang Kas 2 Kelas A', type: 'Shares', totalPercent: 0.1) ]; - return Container( - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(16) - ), - padding: const EdgeInsets.all(24), - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - const Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Icon(Icons.arrow_back, color: ColorPalette.slate500), - Text('Results from your risk profile', - style: TextStyle( - fontWeight: FontWeight.w600, - fontSize: 18, - color: ColorPalette.slate800 - ), - ), - Icon(Icons.close_rounded, color: ColorPalette.slate400) - ], - ), - const SizedBox(height: 32), - SingleChildScrollView( + return ChangeNotifierProvider( + create: (context) => PlanViewModel(), + child: Consumer( + builder: (context, provider, child) { + return Container( + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(16) + ), + padding: const EdgeInsets.all(24), child: Column( - children: listProduct.asMap().entries.map((e) { - return Container( - margin: const EdgeInsets.only(bottom: 16), - padding: const EdgeInsets.all(16), - decoration: BoxDecoration( - color: Colors.white, - border: Border.all(color: ColorPalette.slate200), - borderRadius: BorderRadius.circular(12), - boxShadow: const [ - BoxShadow( - color: Color(0XFF1E293B0A) - ) - ] - ), + mainAxisSize: MainAxisSize.min, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + 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', + style: TextStyle( + fontWeight: FontWeight.w600, + fontSize: 18, + color: ColorPalette.slate800 + ), + ), + GestureDetector( + onTap: () { + Navigator.pop(context); + + }, + child: Icon(Icons.close_rounded, color: ColorPalette.slate400) + ) + ], + ), + const SizedBox(height: 32), + SingleChildScrollView( child: Column( - children: [ - Row( - children: [ - const ImageView(image: PathAssets.iconGoogle, width: 30,), - const SizedBox( - width: 12, - ), - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, + children: listProduct.asMap().entries.map((e) { + return Container( + margin: const EdgeInsets.only(bottom: 16), + padding: const EdgeInsets.all(16), + decoration: BoxDecoration( + color: Colors.white, + border: Border.all(color: ColorPalette.slate200), + borderRadius: BorderRadius.circular(12), + boxShadow: const [ + BoxShadow( + color: Color(0XFF1E293B0A) + ) + ] + ), + child: Column( + children: [ + Row( children: [ - Text(e.value.name ?? '', - style: const TextStyle( - fontWeight: FontWeight.w700, - color: ColorPalette.slate800, + const ImageView(image: PathAssets.iconGoogle, width: 30,), + const SizedBox( + width: 12, + ), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text(e.value.name ?? '', + style: const TextStyle( + fontWeight: FontWeight.w700, + color: ColorPalette.slate800, + ), + ), + const SizedBox(height: 4,), + Container( + padding: const EdgeInsets.symmetric(vertical: 6, horizontal: 12), + decoration: BoxDecoration( + border: Border.all(color: ColorPalette.investTypeColor[e.value.type]!), + color: ColorPalette.investTypeBgColor[e.value.type], + borderRadius: BorderRadius.circular(40) + ), + child: Text(e.value.type ?? '', + style: TextStyle( + color: ColorPalette.investTypeColor[e.value.type], + fontWeight: FontWeight.w600, + fontSize: 12 + ), + ), + ) + ], ), ), - const SizedBox(height: 4,), - Container( - padding: const EdgeInsets.symmetric(vertical: 6, horizontal: 12), - decoration: BoxDecoration( - border: Border.all(color: ColorPalette.investTypeColor[e.value.type]!), - color: ColorPalette.investTypeBgColor[e.value.type], - borderRadius: BorderRadius.circular(40) - ), - child: Text(e.value.type ?? '', - style: TextStyle( - color: ColorPalette.investTypeColor[e.value.type], - fontWeight: FontWeight.w600, - fontSize: 12 - ), + Text('${(e.value.totalPercent! * 100).toInt()} %', + style: const TextStyle( + fontWeight: FontWeight.w700, + fontSize: 16, + color: ColorPalette.slate800 ), ) ], ), - ), - Text('${(e.value.totalPercent! * 100).toInt()} %', - style: const TextStyle( - fontWeight: FontWeight.w700, - fontSize: 16, - color: ColorPalette.slate800 + const Padding( + padding: EdgeInsets.symmetric(vertical: 16), + child: Divider(height: 1, color: ColorPalette.slate200), ), - ) - ], - ), - const Padding( - padding: EdgeInsets.symmetric(vertical: 16), - child: Divider(height: 1, color: ColorPalette.slate200), - ), - GestureDetector( - onTap: () { - routePush(context, page: ProductView(selectedProduct: e.value, seeMore: true)); - }, - child: const Text('See More', - style: TextStyle( - color: ColorPalette.slate500, - fontWeight: FontWeight.w600, - ), + GestureDetector( + onTap: () { + routePush(context, page: ProductView(selectedProduct: e.value, seeMore: true)); + }, + child: const Text('See More', + style: TextStyle( + color: ColorPalette.slate500, + fontWeight: FontWeight.w600, + ), + ), + ) + ], ), - ) - ], + ); + }).toList(), ), - ); - }).toList(), + ), + const SizedBox( + height: 16, + ), + ButtonView( + name: 'Next', + onPressed: () { + Navigator.pop(context); + showModalBottomSheet( + context: context, + isScrollControlled: true, + builder: (context) => + ChangeNotifierProvider( + create: (context) => PlanViewModel(), + child: Consumer( + builder: (context, planProvider, _) { + return TotalPaymentView( + listProduct: listProduct, + totalInvest: totalInvest, + isAgree: planProvider.isAgree, + onTapAgree: planProvider.setAgree, + ); + } + ), + ) + ); + }, + width: SizeConfig.width, + heightWrapContent: true, + contentPadding: const EdgeInsets.symmetric(vertical: 16), + marginVertical: 0, + ) + ], ), - ), - const SizedBox( - height: 16, - ), - ButtonView( - name: 'Next', - onPressed: () { - showModalBottomSheet( - context: context, - isScrollControlled: true, - builder: (context) => - TotalPaymentView( - listProduct: listProduct, - totalInvest: totalInvest, - ) - ); - }, - width: SizeConfig.width, - heightWrapContent: true, - contentPadding: const EdgeInsets.symmetric(vertical: 16), - marginVertical: 0, - ) - ], + ); + } ), ); } diff --git a/lib/features/dashboard/dashboard_account/view/plan/view_model/plan_view_model.dart b/lib/features/dashboard/dashboard_account/view/plan/view_model/plan_view_model.dart index 2409e63..1da05fe 100644 --- a/lib/features/dashboard/dashboard_account/view/plan/view_model/plan_view_model.dart +++ b/lib/features/dashboard/dashboard_account/view/plan/view_model/plan_view_model.dart @@ -3,4 +3,10 @@ import 'package:flutter/material.dart'; class PlanViewModel extends ChangeNotifier { List listProduct = []; + bool isAgree = false; + + void setAgree() { + isAgree = !isAgree; + notifyListeners(); + } } \ No newline at end of file diff --git a/lib/features/dashboard/dashboard_account/view/portfolio/portfolio_view.dart b/lib/features/dashboard/dashboard_account/view/portfolio/portfolio_view.dart index 2e5c504..4d14252 100644 --- a/lib/features/dashboard/dashboard_account/view/portfolio/portfolio_view.dart +++ b/lib/features/dashboard/dashboard_account/view/portfolio/portfolio_view.dart @@ -152,8 +152,8 @@ class _PortofolioViewState extends State { 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 { 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 { ], ), ), - ...listColumnPortofolio(), + // ...listColumnPortofolio(), cardPortfolio() ], ), @@ -388,11 +388,11 @@ class _PortofolioViewState extends State { 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 { 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 { 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 { ), ], ), - 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( diff --git a/lib/features/dashboard/dashboard_account/view/portfolio/redeem_product/view/total_redeem.dart b/lib/features/dashboard/dashboard_account/view/portfolio/redeem_product/view/total_redeem.dart index bfbae8e..33e6e8f 100644 --- a/lib/features/dashboard/dashboard_account/view/portfolio/redeem_product/view/total_redeem.dart +++ b/lib/features/dashboard/dashboard_account/view/portfolio/redeem_product/view/total_redeem.dart @@ -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) ], ); } diff --git a/lib/features/dashboard/dashboard_account/view/portfolio/redeem_product/view_model/redeem_product_view_model.dart b/lib/features/dashboard/dashboard_account/view/portfolio/redeem_product/view_model/redeem_product_view_model.dart index 77147d6..e150e1e 100644 --- a/lib/features/dashboard/dashboard_account/view/portfolio/redeem_product/view_model/redeem_product_view_model.dart +++ b/lib/features/dashboard/dashboard_account/view/portfolio/redeem_product/view_model/redeem_product_view_model.dart @@ -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(); + } } \ No newline at end of file diff --git a/lib/features/dashboard/dashboard_account/view/product/view/step_subscribe/select_goal_investing.dart b/lib/features/dashboard/dashboard_account/view/product/view/step_subscribe/select_goal_investing.dart index 5b3d081..f21532f 100644 --- a/lib/features/dashboard/dashboard_account/view/product/view/step_subscribe/select_goal_investing.dart +++ b/lib/features/dashboard/dashboard_account/view/product/view/step_subscribe/select_goal_investing.dart @@ -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/total_payment_view.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:flutter/material.dart'; import 'package:provider/provider.dart'; @@ -11,10 +12,9 @@ class SelectGoalInvesting extends StatelessWidget { @override Widget build(BuildContext context) { - return MultiProvider( - providers: [ - ChangeNotifierProvider(create: (context) => ProductViewModel(),) - ], + + return ChangeNotifierProvider( + create: (context) => ProductViewModel(), child: Consumer( builder: (context, provider, child) { return Container( @@ -51,23 +51,39 @@ class SelectGoalInvesting extends StatelessWidget { context: context, isScrollControlled: true, builder: (context) { - return InputInvestmentView( - selectedPlan: p0, - nextMove: (value) { - Navigator.pop(context); - int formatIntParse = int.parse(value.replaceAll('Rp ', '').replaceAll(',', '')); - showModalBottomSheet( - context: context, - isScrollControlled: true, - builder: (context) => - TotalPaymentView( - listProduct: [ - provider.getSelectedProduct - ], - totalInvest: formatIntParse, - ) - ); - }, + return ChangeNotifierProvider( + create: (context) => ProductViewModel(), + child: Consumer( + 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( + builder: (context, provider, child) { + return TotalPaymentView( + listProduct: [ + provider.getSelectedProduct + ], + totalInvest: formatIntParse, + isAgree: provider.isAgree, + onTapAgree: provider.setAgree, + ); + } + ), + ) + ); + }, + ); + } + ), ); }, ); diff --git a/lib/features/dashboard/dashboard_account/view/product/view_model/product_view_model.dart b/lib/features/dashboard/dashboard_account/view/product/view_model/product_view_model.dart index e7fddea..7835916 100644 --- a/lib/features/dashboard/dashboard_account/view/product/view_model/product_view_model.dart +++ b/lib/features/dashboard/dashboard_account/view/product/view_model/product_view_model.dart @@ -14,6 +14,7 @@ class ProductViewModel extends ChangeNotifier { Product get getSelectedProduct => selectedProduct; double totalInvestment = 0; + bool isAgree = false; void setSelectedProduct(Product product) { selectedProduct = product; @@ -24,4 +25,9 @@ class ProductViewModel extends ChangeNotifier { totalInvestment = value; notifyListeners(); } + + void setAgree() { + isAgree = !isAgree; + notifyListeners(); + } } \ No newline at end of file diff --git a/lib/features/profile/view/profile_view.dart b/lib/features/profile/view/profile_view.dart index a62fc59..fac17ac 100644 --- a/lib/features/profile/view/profile_view.dart +++ b/lib/features/profile/view/profile_view.dart @@ -8,7 +8,7 @@ class ProfileView extends StatelessWidget { @override Widget build(BuildContext context) { return Scaffold( - appBar: CustomAppBar(height: SizeConfig.height * .1, title: 'Profile'), + appBar: CustomAppBar(height: SizeConfig.height * .08, title: 'Profile'), ); } } diff --git a/lib/features/transaction/view/transaction_view.dart b/lib/features/transaction/view/transaction_view.dart index 1059f1d..8a9b14b 100644 --- a/lib/features/transaction/view/transaction_view.dart +++ b/lib/features/transaction/view/transaction_view.dart @@ -8,8 +8,7 @@ class TransactionView extends StatelessWidget { @override Widget build(BuildContext context) { return Scaffold( - appBar: - CustomAppBar(height: SizeConfig.height * .1, title: 'Transaction'), + appBar: CustomAppBar(height: SizeConfig.height * 0.08, title: 'Transaction'), ); } }