parameter added in survey.

development_sikander
Sikander Saleem 2 years ago
parent d44bc37681
commit 610d4788c2

Before

Width:  |  Height:  |  Size: 549 B

After

Width:  |  Height:  |  Size: 549 B

Before

Width:  |  Height:  |  Size: 548 B

After

Width:  |  Height:  |  Size: 548 B

Before

Width:  |  Height:  |  Size: 470 B

After

Width:  |  Height:  |  Size: 470 B

@ -90,7 +90,7 @@ class AppState {
String get getHuaweiPushToken => _huaweiPushToken;
final PostParamsModel _postParamsInitConfig = PostParamsModel(channel: 31, versionID: 5.3, mobileType: Platform.isAndroid ? "android" : "ios");
final PostParamsModel _postParamsInitConfig = PostParamsModel(channel: 31, versionID: 6.3, mobileType: Platform.isAndroid ? "android" : "ios");
void setPostParamsInitConfig() {
isAuthenticated = false;

@ -45,34 +45,57 @@ class ItgResponseResult {
this.data,
this.errormsg,
});
dynamic totalItemsCount;
List<ItgResponseData>? data;
dynamic errormsg;
ItgResponseResult.fromJson(Map<String, dynamic> json) {
totalItemsCount = json['totalItemsCount'];
if (json['data'] != null) {
data = [];
//
// final dynamic totalItemsCount;
// final ItgResponseData? data;
// final dynamic errormsg;
//
// factory ItgResponseResult.fromJson(Map<String, dynamic> json) => ItgResponseResult(
// totalItemsCount: json["totalItemsCount"],
// data: json["data"] == null ? null : ItgResponseData.fromJson(json["data"]),
// errormsg: json["errormsg"],
// );
//
// Map<String, dynamic> toJson() => {
// "totalItemsCount": totalItemsCount,
// "data": data == null ? null : data!.toJson(),
// "errormsg": errormsg,
// };
// }
// todo these lines, for ERM new change on UAT
dynamic totalItemsCount;
List<ItgResponseData>? data;
dynamic errormsg;
ItgResponseResult.fromJson(Map<String, dynamic> json) {
totalItemsCount = json['totalItemsCount'];
if (json['data'] != null) {
data = [];
if(json['data'] is List) {
json['data'].forEach((v) {
data!.add(ItgResponseData.fromJson(v));
});
} else {
data!.add(ItgResponseData.fromJson(json['data']));
}
errormsg = json['errormsg'];
}
//
// factory ItgResponseResult.fromJson(Map<String, dynamic> json) => ItgResponseResult(
// totalItemsCount: json["totalItemsCount"],
// data: json["data"] == null ? null : ItgResponseData.fromJson(json["data"]),
// errormsg: json["errormsg"],
// );
}
errormsg = json['errormsg'];
}
Map<String, dynamic> toJson() => {
"totalItemsCount": totalItemsCount,
"data": data == null ? null : data!.map((v) => v.toJson()).toList(),
"errormsg": errormsg,
};
//
// factory ItgResponseResult.fromJson(Map<String, dynamic> json) => ItgResponseResult(
// totalItemsCount: json["totalItemsCount"],
// data: json["data"] == null ? null : ItgResponseData.fromJson(json["data"]),
// errormsg: json["errormsg"],
// );
Map<String, dynamic> toJson() => {
"totalItemsCount": totalItemsCount,
"data": data == null ? null : data!.map((v) => v.toJson()).toList(),
"errormsg": errormsg,
};
}
class ItgResponseData {

@ -9,13 +9,18 @@ class SurveyModel {
dynamic pageNo;
dynamic languageId;
SurveyModel({this.surveyId, this.referenceNo, this.title, this.description, this.questions, this.isActive, this.pageSize, this.pageNo, this.languageId});
String? descriptionAr;
String? titleAr;
SurveyModel({this.surveyId, this.referenceNo, this.title,this.titleAr, this.description, this.descriptionAr, this.questions, this.isActive, this.pageSize, this.pageNo, this.languageId});
SurveyModel.fromJson(Map<String, dynamic> json) {
surveyId = json['surveyId'];
referenceNo = json['referenceNo'];
title = json['title'];
titleAr = json['titleAr'];
description = json['description'];
descriptionAr = json['descriptionAr'];
if (json['questions'] != null) {
questions = <Questions>[];
json['questions'].forEach((v) {
@ -33,7 +38,9 @@ class SurveyModel {
data['surveyId'] = this.surveyId;
data['referenceNo'] = this.referenceNo;
data['title'] = this.title;
data['titleAr'] = this.titleAr;
data['description'] = this.description;
data['descriptionAr'] = this.descriptionAr;
if (this.questions != null) {
data['questions'] = this.questions!.map((v) => v.toJson()).toList();
}
@ -48,6 +55,7 @@ class SurveyModel {
class Questions {
int? questionId;
String? title;
String? titleAr;
bool? isRequired;
String? type;
int? sequenceNo;
@ -59,11 +67,12 @@ class Questions {
dynamic pageNo;
dynamic languageId;
Questions({this.questionId, this.title, this.isRequired, this.type, this.sequenceNo, this.surveyId, this.options, this.rspPercentage, this.isActive, this.pageSize, this.pageNo, this.languageId});
Questions({this.questionId, this.title, this.titleAr, this.isRequired, this.type, this.sequenceNo, this.surveyId, this.options, this.rspPercentage, this.isActive, this.pageSize, this.pageNo, this.languageId});
Questions.fromJson(Map<String, dynamic> json) {
questionId = json['questionId'];
title = json['title'];
titleAr = json['titleAr'];
isRequired = json['isRequired'];
type = json['type'];
sequenceNo = json['sequenceNo'];
@ -85,6 +94,7 @@ class Questions {
Map<String, dynamic> data = new Map<String, dynamic>();
data['questionId'] = this.questionId;
data['title'] = this.title;
data['titleAr'] = this.titleAr;
data['isRequired'] = this.isRequired;
data['type'] = this.type;
data['sequenceNo'] = this.sequenceNo;
@ -104,6 +114,7 @@ class Questions {
class Options {
int? optionId;
String? title;
String? titleAr;
bool? isCommentsRequired;
int? sequenceNo;
int? questionId;
@ -114,11 +125,12 @@ class Options {
dynamic pageNo;
dynamic languageId;
Options({this.optionId, this.title, this.isCommentsRequired, this.sequenceNo, this.questionId, this.rspPercentage, this.count, this.isActive, this.pageSize, this.pageNo, this.languageId});
Options({this.optionId, this.title,this.titleAr, this.isCommentsRequired, this.sequenceNo, this.questionId, this.rspPercentage, this.count, this.isActive, this.pageSize, this.pageNo, this.languageId});
Options.fromJson(Map<String, dynamic> json) {
optionId = json['optionId'];
title = json['title'];
titleAr = json['titleAr'];
isCommentsRequired = json['isCommentsRequired'];
sequenceNo = json['sequenceNo'];
questionId = json['questionId'];
@ -134,6 +146,7 @@ class Options {
Map<String, dynamic> data = new Map<String, dynamic>();
data['optionId'] = this.optionId;
data['title'] = this.title;
data['titleAr'] = this.titleAr;
data['isCommentsRequired'] = this.isCommentsRequired;
data['sequenceNo'] = this.sequenceNo;
data['questionId'] = this.questionId;

@ -168,7 +168,7 @@ class _DashboardScreenState extends State<DashboardScreen> with WidgetsBindingOb
if (value!.mohemmItgResponseItem!.statusCode == 200) {
if (value.mohemmItgResponseItem!.result!.data != null) {
// Navigator.pushNamed(context, AppRoutes.survey, arguments: val.result!.data);
Navigator.pushNamed(context, AppRoutes.survey, arguments: value.mohemmItgResponseItem!.result!.data);
Navigator.pushNamed(context, AppRoutes.survey, arguments: value.mohemmItgResponseItem!.result!.data!.first);
// Navigator.pushNamed(context, AppRoutes.advertisement, arguments: {
// "masterId": val.result!.data!.notificationMasterId,
// "advertisement": value.mohemmItgResponseItem!.result!.data!.advertisement,

@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_rating_bar/flutter_rating_bar.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:mohem_flutter_app/api/dashboard_api_client.dart';
import 'package:mohem_flutter_app/app_state/app_state.dart';
import 'package:mohem_flutter_app/classes/colors.dart';
import 'package:mohem_flutter_app/classes/utils.dart';
import 'package:mohem_flutter_app/extensions/int_extensions.dart';
@ -53,9 +54,9 @@ class _SurveyScreenState extends State<SurveyScreen> {
child: Column(
children: [
32.height,
itgResponseData?.survey?.title?.toText24() ?? const Text(""),
(AppState().isArabic(context) ? itgResponseData?.survey?.titleAr : itgResponseData?.survey?.title)?.toText24() ?? const Text(""),
8.height,
itgResponseData?.survey?.description?.toText16() ?? const Text(""),
(AppState().isArabic(context) ? itgResponseData?.survey?.descriptionAr : itgResponseData?.survey?.description)?.toText16() ?? const Text(""),
ListView.builder(
padding: EdgeInsets.zero,
shrinkWrap: true,
@ -105,7 +106,7 @@ class _SurveyScreenState extends State<SurveyScreen> {
answeredQuestions.clear();
itgResponseData?.survey?.questions?.forEach((element) {
if (element.type != "Stars") {
if(element.type == "Faces") {
if (element.type == "Faces") {
_selectedIndex = element.options![0].optionId!;
}
answeredQuestions.add(element.options![0].optionId.toString());
@ -122,15 +123,16 @@ class _SurveyScreenState extends State<SurveyScreen> {
return Column(
children: [
24.height,
question?.title?.toText18() ?? const Text(""),
(AppState().isArabic(context) ? question?.titleAr : question?.title)?.toText18() ?? const Text(""),
16.height,
GridView.builder(
padding: EdgeInsets.zero,
itemCount: question?.options?.length,
itemCount: question?.options?.length ?? 0,
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
itemBuilder: (context, index) {
return radioOption(question?.options?[index].title ?? "", question?.options?[index].optionId.toString() ?? "", answeredQuestions[parentIndex], parentIndex);
return radioOption((AppState().isArabic(context) ? (question!.options![index].titleAr) : question!.options![index].title) ?? "", question?.options?[index].optionId.toString() ?? "",
answeredQuestions[parentIndex], parentIndex);
},
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2,
@ -145,7 +147,7 @@ class _SurveyScreenState extends State<SurveyScreen> {
mainAxisSize: MainAxisSize.min,
children: [
24.height,
question?.title?.toText18() ?? Text(""),
(AppState().isArabic(context) ? question?.titleAr : question?.title)?.toText18() ?? Text(""),
16.height,
RatingBar.builder(
initialRating: 3,
@ -171,7 +173,7 @@ class _SurveyScreenState extends State<SurveyScreen> {
mainAxisSize: MainAxisSize.min,
children: [
24.height,
question?.title?.toText18() ?? Text("asdasdasdasd"),
(AppState().isArabic(context) ? question?.titleAr : question?.title)?.toText18() ?? Text(""),
16.height,
GridView(
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 5, crossAxisSpacing: 7, mainAxisSpacing: 7),
@ -179,11 +181,13 @@ class _SurveyScreenState extends State<SurveyScreen> {
padding: const EdgeInsets.only(top: 0),
shrinkWrap: true,
children: [
optionUI("poor.svg", question?.options?[0].optionId, parentIndex),
optionUI("bad.svg", question?.options?[1].optionId, parentIndex),
optionUI("normal.svg", question?.options?[2].optionId, parentIndex),
optionUI("good.svg", question?.options?[3].optionId, parentIndex),
optionUI("xcellent.svg", question?.options?[4].optionId, parentIndex),
for (int i = 0; i < (question?.options?.length ?? 0); i++) optionUI("${question?.options![i].title!.toLowerCase()}.svg", question?.options?[i].optionId, parentIndex),
// optionUI("poor.svg", question?.options?[0].optionId, parentIndex),
// optionUI("fair.svg", question?.options?[1].optionId, parentIndex),
// optionUI("ok.svg", question?.options?[2].optionId, parentIndex),
// optionUI("good.svg", question?.options?[3].optionId, parentIndex),
// optionUI("excellent.svg", question?.options?[4].optionId, parentIndex),
],
),
],

Loading…
Cancel
Save