@ -34,6 +34,7 @@ class _SurveyPageState extends State<SurveyPage> {
/ / int serviceSatisfiedRating = - 1 ;
int serviceProvidedRating = - 1 ;
String comments = " " ;
String message = " " ;
bool loading = false ;
@ -50,7 +51,10 @@ class _SurveyPageState extends State<SurveyPage> {
void getSurveyQuestion ( ) async {
loading = true ;
setState ( ( ) { } ) ;
questionnaire = await Provider . of < SurveyProvider > ( context , listen: false ) . getQuestionnaire ( widget . surveyId ) ;
await Provider . of < SurveyProvider > ( context , listen: false ) . getQuestionnaire ( widget . surveyId , ( msg , questions ) {
message = msg ;
questionnaire = questions ;
} ) ;
for ( int i = 0 ; i < ( questionnaire ? . surveyQuestions ? . length ? ? 0 ) ; i + + ) {
answers . add ( SurveyAnswers (
questionId: questionnaire ! . surveyQuestions ! [ i ] . questionId ! ,
@ -79,18 +83,18 @@ class _SurveyPageState extends State<SurveyPage> {
crossAxisAlignment: CrossAxisAlignment . center ,
children: [
Text (
" Failed to get questionnaire " ,
message . isNotEmpty ? message : " Failed to get questionnaire " ,
overflow: TextOverflow . ellipsis ,
maxLines: 1 ,
style: AppTextStyles . heading6 . copyWith ( color: AppColor . neutral50 , fontWeight: FontWeight . w500 ) ,
) ,
24. height ,
AppFilledButton (
label: " Retry " ,
label: message . isNotEmpty ? " Go Back " : " Retry " ,
maxWidth: true ,
buttonColor: AppColor . primary10 ,
onPressed: ( ) {
getSurveyQuestion( ) ;
message. isNotEmpty ? Navigator . pop ( context ) : getSurveyQuestion( ) ;
} ,
) . paddingOnly ( start: 48 , end: 48 )
] ,
@ -171,7 +175,10 @@ class _SurveyPageState extends State<SurveyPage> {
bool isSuccess = await Provider . of < SurveyProvider > ( context , listen: false ) . submitQuestionare ( payload ) ;
Utils . hideLoading ( context ) ;
if ( isSuccess ) {
/ / getSurveyQuestion ( ) ;
context . showConfirmDialog ( " Thank you for submitting the Feedback. It value for us to improve system and overall experience. " , title: " Thanks! " , okTitle: " Go Back " ,
onTap: ( ) {
Navigator . pop ( context ) ;
} ) ;
} / / reload Data
}
} ,