fix: validation questioner risk profile
This commit is contained in:
parent
de1782c2c2
commit
6e03fa5fa7
|
@ -56,8 +56,12 @@ class _QuestionViewState extends State<QuestionView> {
|
|||
bottomNavigationBar: SizedBox(
|
||||
height: 84,
|
||||
child: ButtonView(
|
||||
disabled: provider.listScore[currentPage] == 0,
|
||||
name: 'Next',
|
||||
marginVertical: 16,
|
||||
disabledBgColor: ColorPalette.slate200,
|
||||
textColor: provider.listScore[currentPage] == 0 ? ColorPalette.slate500 : Colors.white,
|
||||
backgroundColor: ColorPalette.primary,
|
||||
onPressed: () {
|
||||
if (currentPage > 3) {
|
||||
int totalScore = provider.listScore
|
||||
|
@ -65,8 +69,11 @@ class _QuestionViewState extends State<QuestionView> {
|
|||
provider.setTypeResult(totalScore);
|
||||
routePush(context,
|
||||
page: ResultsView(
|
||||
totalScore: totalScore.toString(),
|
||||
typeResult: provider.typeResult));
|
||||
totalScore: totalScore,
|
||||
typeResult: provider.typeResult
|
||||
),
|
||||
routeType: RouteType.pushReplace
|
||||
);
|
||||
} else {
|
||||
setState(() {
|
||||
currentPage += 1;
|
||||
|
|
|
@ -1,14 +1,17 @@
|
|||
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/risk_profile.dart';
|
||||
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/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/terms_and_condition/terms_and_condition_view.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class ResultsView extends StatelessWidget {
|
||||
final String totalScore;
|
||||
final int totalScore;
|
||||
final RiskProfileResult typeResult;
|
||||
const ResultsView(
|
||||
{super.key, required this.typeResult, required this.totalScore});
|
||||
|
@ -37,115 +40,15 @@ class ResultsView extends StatelessWidget {
|
|||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
ClipRRect(
|
||||
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(),
|
||||
),
|
||||
RiskProfile(totalScore: totalScore, rowSuitableProduct: false),
|
||||
const SizedBox(
|
||||
height: 32,
|
||||
),
|
||||
ButtonView(
|
||||
name: 'Re-test',
|
||||
onPressed: () {},
|
||||
onPressed: () {
|
||||
routePush(context, page: QuestionView(), routeType: RouteType.pushReplace);
|
||||
},
|
||||
marginVertical: 0,
|
||||
backgroundColor: ColorPalette.white,
|
||||
textColor: ColorPalette.primary,
|
||||
|
|
Loading…
Reference in New Issue
Block a user