This package simplies measuring the users comprehension of your mobile application. After a quick setup you can ask questions to your users and improve your user experience with the generated insights. The questions are displayed in a survey-like environment and can require multiple choice, single choice or text answers. The questions can be static as well as contextual, where your app provides all necessary information to personalize your survey.
Text | Multiple Choice | Single Choice |
---|---|---|
- Customizable Intro Widget and Completion
Intro | Completion |
---|---|
- Contextual Questions
- Opt-out
- Persistent Storage of already answered questions
- Import this package into your Flutter package. See an example on how to achieve this below.
scio: ^0.1.0
- Create supabase project.
- Initialize the project tables. You can import this file into your Supabase project. How to do this is described in this Supabase discussion.
- Add the following SQL queries under '/sql':
create function increment_correct_answers(row_id int)
returns void as
$$
update questions
set correct_answers = correct_answers + 1
where id = row_id;
$$
language sql volatile;
create function increment_total_answers(row_id int)
returns void as
$$
update questions
set total_answers = total_answers + 1
where id = row_id;
$$
language sql volatile;
These are needed to track the number of correct and total answers to your questions.
- Add the surveys, questions and answers that you need
- Use Scio to measure user comprehension in your project
There are multiple ways to integrate comprehension measurement using this package.
To have complete control over when the survey component is opened, it can be called with the measureComprehension method. When calling this method the hive boxes are initialized first and then filled with the previously saved data. If the user opted out of surveys or the specified survey is already completed the method returns without a widget.
This method can be called from any page and displays the survey correctly, so it enables the developer to define a custom logic on when to call the survey, e.g the survey should only be shown when specific conditions are met. This method takes all parameters needed to create the comprehension model and comprehension widget.
When pushing a new page we can attach the helper method ComprehensionHelper.instance.attach
to it. This is done by passing a method call like context.router.push(Route())
to the singleton. After the page is popped from the router stack, which means that the user has left the page, the survey is called. For example, this class can be used when the tab is changed, since this does not pop the target page from the router stack, but still leaves the page.
Developers looking for fast results without extra effort into survey control should use the AutoComprehensiblePage
. This page extends StatefulWidget
and provides the functionality to open a comprehension measurement widget based on chance when the AutoComprehensiblePage
is left.
For this to work, you have to add the class AutoRouteObserver
to your AutoRoute
-configuration.
This package enables you to personalize questions based on the context of your application. Just pass a questionContext
to the package, with key value pairs you are referencing in the database with is_contextual
set to true and the context
set to the key.
The total line coverage is 65.1%.
The ComprehensionMeasurementModel
and ComprehensionMeasurementWidget
and the other widgets located in the types
folder are fully tested. However the ComprehensionHelper
and AutoComprehensiblePage
are not tested. Moreover, we do not test the Hive box SurveyData
and we do not cover generated files, because all are external dependencies.
Contributions, issues and feature requests are welcome. Read our Contribution Guide to get started.
This package was developed in the context of the project PharMe. Their you can find an example integration.