fix: provider view model agreement redeem and product
This commit is contained in:
@@ -40,42 +40,50 @@ class _PlanViewState extends State<PlanView> {
|
||||
@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);
|
||||
},
|
||||
);
|
||||
},
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -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<PlanViewModel>(
|
||||
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<PlanViewModel>(
|
||||
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,
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -3,4 +3,10 @@ import 'package:flutter/material.dart';
|
||||
|
||||
class PlanViewModel extends ChangeNotifier {
|
||||
List<Product> listProduct = [];
|
||||
bool isAgree = false;
|
||||
|
||||
void setAgree() {
|
||||
isAgree = !isAgree;
|
||||
notifyListeners();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user