Code Monkey home page Code Monkey logo

Comments (5)

Numoy avatar Numoy commented on June 1, 2024

Hi,

the idea is that you open the 'SurveyKit' Widget via Navigation, e.g. by calling

Navigator.push(
    context,
    MaterialPageRoute(builder: (context) => SurveyKit()),
  );

After the Survey Navigator.pop(context) is called and you will go back to the Widget where you called Navigator.push.
Another way to control what happens after the Survey is finished is to override the onCloseSurvey Method in the SurveyController.

from survey_kit.

alpapado avatar alpapado commented on June 1, 2024

Is it possible that the onCloseSurvey is called only when the survey is aborted? Finishing the survey seems to NOT call the onCloseSurvey Method. Is it possible to somehow change navigation behavior in this case?

My use case is to initiate the survey via a notification when the app is terminated. In this case, after finishing the survey
Navigator.pop() results in a black screen (since the stack is empty I guess). Hence, I would like to redirect to the home page instead of poping.

from survey_kit.

Numoy avatar Numoy commented on June 1, 2024

Hi sorry for the late response.

It is true onCloseSurvey is only called when the survey is aborted. One way to change the behaviour/navigation, when the survey is finished, is to override the 'onResult' Function in SurveyKit. There you can listen when and why the survey was finished (finished,discarded,...) and do the navigation.

from survey_kit.

waletoyo1 avatar waletoyo1 commented on June 1, 2024

Hi sorry for the late response.

It is true onCloseSurvey is only called when the survey is aborted. One way to change the behaviour/navigation, when the survey is finished, is to override the 'onResult' Function in SurveyKit. There you can listen when and why the survey was finished (finished,discarded,...) and do the navigation.

Hi, thanks for the contribution. How can the onResult callback be overridden?

from survey_kit.

Numoy avatar Numoy commented on June 1, 2024

You can just override this in the 'SurveyKit' widget:

SurveyKit(
                    onResult: (SurveyResult result) {
                      print(result.finishReason);
                    },
....

from survey_kit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.