fix: validation questioner risk profile
This commit is contained in:
		| @@ -56,8 +56,12 @@ class _QuestionViewState extends State<QuestionView> { | |||||||
|           bottomNavigationBar: SizedBox( |           bottomNavigationBar: SizedBox( | ||||||
|             height: 84, |             height: 84, | ||||||
|             child: ButtonView( |             child: ButtonView( | ||||||
|  |               disabled: provider.listScore[currentPage] == 0, | ||||||
|               name: 'Next', |               name: 'Next', | ||||||
|               marginVertical: 16, |               marginVertical: 16, | ||||||
|  |               disabledBgColor: ColorPalette.slate200, | ||||||
|  |               textColor: provider.listScore[currentPage] == 0 ? ColorPalette.slate500 : Colors.white, | ||||||
|  |               backgroundColor: ColorPalette.primary, | ||||||
|               onPressed: () { |               onPressed: () { | ||||||
|                 if (currentPage > 3) { |                 if (currentPage > 3) { | ||||||
|                   int totalScore = provider.listScore |                   int totalScore = provider.listScore | ||||||
| @@ -65,8 +69,11 @@ class _QuestionViewState extends State<QuestionView> { | |||||||
|                   provider.setTypeResult(totalScore); |                   provider.setTypeResult(totalScore); | ||||||
|                   routePush(context, |                   routePush(context, | ||||||
|                     page: ResultsView( |                     page: ResultsView( | ||||||
|                           totalScore: totalScore.toString(), |                         totalScore: totalScore, | ||||||
|                           typeResult: provider.typeResult)); |                         typeResult: provider.typeResult | ||||||
|  |                     ), | ||||||
|  |                     routeType: RouteType.pushReplace | ||||||
|  |                   ); | ||||||
|                 } else { |                 } else { | ||||||
|                   setState(() { |                   setState(() { | ||||||
|                     currentPage += 1; |                     currentPage += 1; | ||||||
|   | |||||||
| @@ -1,14 +1,17 @@ | |||||||
| import 'package:cims_apps/application/component/button/back_button_view.dart'; | import 'package:cims_apps/application/component/button/back_button_view.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/risk_profile.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/size_config.dart'; | import 'package:cims_apps/core/utils/size_config.dart'; | ||||||
|  | import 'package:cims_apps/features/auth/registration/view/submission_data/risk_profile/question_view.dart'; | ||||||
|  | import 'package:cims_apps/features/auth/registration/view/submission_data/risk_profile/risk_profile_view.dart'; | ||||||
| import 'package:cims_apps/features/auth/registration/view/submission_data/risk_profile/risk_profile_view_model/risk_profile_view_model.dart'; | import 'package:cims_apps/features/auth/registration/view/submission_data/risk_profile/risk_profile_view_model/risk_profile_view_model.dart'; | ||||||
| import 'package:cims_apps/features/auth/registration/view/submission_data/terms_and_condition/terms_and_condition_view.dart'; | import 'package:cims_apps/features/auth/registration/view/submission_data/terms_and_condition/terms_and_condition_view.dart'; | ||||||
| import 'package:flutter/material.dart'; | import 'package:flutter/material.dart'; | ||||||
|  |  | ||||||
| class ResultsView extends StatelessWidget { | class ResultsView extends StatelessWidget { | ||||||
|   final String totalScore; |   final int totalScore; | ||||||
|   final RiskProfileResult typeResult; |   final RiskProfileResult typeResult; | ||||||
|   const ResultsView( |   const ResultsView( | ||||||
|       {super.key, required this.typeResult, required this.totalScore}); |       {super.key, required this.typeResult, required this.totalScore}); | ||||||
| @@ -37,115 +40,15 @@ class ResultsView extends StatelessWidget { | |||||||
|         child: Column( |         child: Column( | ||||||
|           crossAxisAlignment: CrossAxisAlignment.start, |           crossAxisAlignment: CrossAxisAlignment.start, | ||||||
|           children: [ |           children: [ | ||||||
|             ClipRRect( |             RiskProfile(totalScore: totalScore, rowSuitableProduct: false), | ||||||
|               borderRadius: BorderRadius.circular(8), |  | ||||||
|               child: Container( |  | ||||||
|                 decoration: BoxDecoration( |  | ||||||
|                     color: typeResult.color, |  | ||||||
|                     image: DecorationImage( |  | ||||||
|                         image: AssetImage(typeResult.img), |  | ||||||
|                         alignment: Alignment.centerRight)), |  | ||||||
|                 child: Row( |  | ||||||
|                   mainAxisAlignment: MainAxisAlignment.spaceBetween, |  | ||||||
|                   children: [ |  | ||||||
|                     Container( |  | ||||||
|                       padding: const EdgeInsets.all(24), |  | ||||||
|                       child: Column( |  | ||||||
|                         crossAxisAlignment: CrossAxisAlignment.start, |  | ||||||
|                         children: [ |  | ||||||
|                           Text( |  | ||||||
|                             typeResult.type, |  | ||||||
|                             style: const TextStyle( |  | ||||||
|                                 fontWeight: FontWeight.bold, |  | ||||||
|                                 fontSize: 24, |  | ||||||
|                                 color: ColorPalette.white), |  | ||||||
|                           ), |  | ||||||
|                           const SizedBox( |  | ||||||
|                             height: 16, |  | ||||||
|                           ), |  | ||||||
|                           const Text( |  | ||||||
|                             'Total Score :', |  | ||||||
|                             style: TextStyle( |  | ||||||
|                                 fontWeight: FontWeight.bold, |  | ||||||
|                                 fontSize: 16, |  | ||||||
|                                 color: ColorPalette.white), |  | ||||||
|                           ), |  | ||||||
|                           Text( |  | ||||||
|                             totalScore, |  | ||||||
|                             style: const TextStyle( |  | ||||||
|                                 fontWeight: FontWeight.bold, |  | ||||||
|                                 fontSize: 28, |  | ||||||
|                                 color: ColorPalette.white), |  | ||||||
|                           ) |  | ||||||
|                         ], |  | ||||||
|                       ), |  | ||||||
|                     ), |  | ||||||
|                   ], |  | ||||||
|                 ), |  | ||||||
|               ), |  | ||||||
|             ), |  | ||||||
|             const SizedBox( |  | ||||||
|               height: 24, |  | ||||||
|             ), |  | ||||||
|             Text(typeResult.desc, |  | ||||||
|                 style: const TextStyle( |  | ||||||
|                     color: ColorPalette.slate500, fontSize: 16)), |  | ||||||
|             const SizedBox( |  | ||||||
|               height: 24, |  | ||||||
|             ), |  | ||||||
|             const Text( |  | ||||||
|               'Suitable Product', |  | ||||||
|               style: TextStyle( |  | ||||||
|                   color: ColorPalette.slate800, |  | ||||||
|                   fontWeight: FontWeight.bold, |  | ||||||
|                   fontSize: 16), |  | ||||||
|             ), |  | ||||||
|             const SizedBox( |  | ||||||
|               height: 16, |  | ||||||
|             ), |  | ||||||
|             Wrap( |  | ||||||
|               runSpacing: 16, |  | ||||||
|               children: typeResult.suitableProduct.map((e) { |  | ||||||
|                 return Container( |  | ||||||
|                   padding: const EdgeInsets.all(16), |  | ||||||
|                   decoration: BoxDecoration( |  | ||||||
|                     borderRadius: BorderRadius.circular(6), |  | ||||||
|                     border: Border.all(color: ColorPalette.slate200), |  | ||||||
|                   ), |  | ||||||
|                   child: Row( |  | ||||||
|                     children: [ |  | ||||||
|                       Container( |  | ||||||
|                           padding: const EdgeInsets.all(8), |  | ||||||
|                           alignment: Alignment.center, |  | ||||||
|                           decoration: BoxDecoration( |  | ||||||
|                               shape: BoxShape.circle, |  | ||||||
|                               color: typeResult.color.withOpacity(0.1)), |  | ||||||
|                           child: Image.asset(e['icon'], |  | ||||||
|                               width: SizeConfig.width * 0.07, |  | ||||||
|                               color: typeResult.color)), |  | ||||||
|                       const SizedBox( |  | ||||||
|                         width: 12, |  | ||||||
|                       ), |  | ||||||
|                       Expanded( |  | ||||||
|                         child: Text( |  | ||||||
|                           e['desc'], |  | ||||||
|                           style: const TextStyle( |  | ||||||
|                               fontSize: 16, |  | ||||||
|                               fontWeight: FontWeight.bold, |  | ||||||
|                               color: ColorPalette.slate800), |  | ||||||
|                         ), |  | ||||||
|                       ) |  | ||||||
|                     ], |  | ||||||
|                   ), |  | ||||||
|                 ); |  | ||||||
|               }).toList(), |  | ||||||
|             ), |  | ||||||
|             const SizedBox( |             const SizedBox( | ||||||
|               height: 32, |               height: 32, | ||||||
|             ), |             ), | ||||||
|             ButtonView( |             ButtonView( | ||||||
|               name: 'Re-test', |               name: 'Re-test', | ||||||
|               onPressed: () {}, |               onPressed: () { | ||||||
|  |                 routePush(context, page: QuestionView(), routeType: RouteType.pushReplace); | ||||||
|  |               }, | ||||||
|               marginVertical: 0, |               marginVertical: 0, | ||||||
|               backgroundColor: ColorPalette.white, |               backgroundColor: ColorPalette.white, | ||||||
|               textColor: ColorPalette.primary, |               textColor: ColorPalette.primary, | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user