quickbirdeng / survey_kit Goto Github PK
View Code? Open in Web Editor NEWFlutter library to create beautiful surveys (aligned with ResearchKit on iOS)
License: MIT License
Flutter library to create beautiful surveys (aligned with ResearchKit on iOS)
License: MIT License
How to run once only upon first launch and store into Firestore database, and optionally rerun the series of questions later if user feels motivated to do so.
I am looking for a way to have multiple questions in a single QuestionStep which would result in a better user experience in my case. Is there a clear way to do so or would this be considered a CustomStep?
Thanks!
can i apply validation for the answerFormat: SingleChoiceAnswerFormat ?
[edit] the isOptional flag still not working even in version 0.12
I have added the question to survey kit in below format.
steps.add(InstructionStep(
title: 'Welcome to Lab Survey',
text: 'Get ready for a bunch of questions!',
buttonText: 'Let\'s go!',
));
steps.add(
QuestionStep(
title: 'Done?',
text: 'We are done, do you mind to tell us more about yourself?',
answerFormat: SingleChoiceAnswerFormat(
textChoices: [
TextChoice(text: 'Yes', value: 'Yes'),
TextChoice(text: 'No', value: 'No'),
],
),
),
);
steps.add(
QuestionStep(
title: 'Done?',
text: 'kjdsfkjaskdfj?',
answerFormat: SingleChoiceAnswerFormat(
textChoices: [
TextChoice(text: 'none', value: 'none'),
TextChoice(text: 'none', value: 'noe'),
],
),
),
);
and returning the task to suveyKit task,
var task = NavigableTask(id: TaskIdentifier(), steps: steps);
return task;
Issue is on pressing next, the question changes but options remain the same.
It should be possible to adapt the color of the checkmark in CompletionStep.
Hello, the completion step when loaded from a JSON file does not seem to work as expected. When one gets to the end of the survey and on clicking the submit button, it just goes back to the beginning. How can I correct this behavior please?
/opt/hostedtoolcache/flutter/2.4.0-4.2.pre-beta/x64/.pub-cache/hosted/pub.dartlang.org/survey_kit-0.0.11/lib/src/views/time_answer_view.dart:82:14: Error: 'TimePickerDialog' is imported from both 'package:flutter/src/material/time_picker.dart' and 'package:survey_kit/src/views/widget/time_picker.dart'.
child: TimePickerDialog(
Hi, I am currently migrating an app to Jetpack Compose, is there any version which can be used directly with compose?
Thanks a lot.
Hello
I created survey with survey_kit commit: 41f3229.
At the beginning of the survey, the person's ID is asked. After inserting the person id, I want to check in the DB if the person already exists. If yes, the default survey values will be replaced with the values from the DB. Can I do it and how?
Also, I want to log after every step that goes through in the survey. Can I do it and how?
Thanks in advance
as defined in the plugin answer creation process:
TextChoice(text: answer.text, value: answer.id);
i think the TextChoice value may vary from the TextChoice text
So i think the QuestionResult.valueIdentifier should equal to TextChoice.value not as it is now Textchoice.text
A completed survey produces an json file.
I want to allow users to be able to create surveys. Is there a way to do this using the package? Or would I need to do this externally to this package and generate the JSON file?
The checkmark of a TextChoice leads to breaking long words.
The word should look the same before and after selection.
See the following images:
Not selected
Selected
on Android, when I tap on the text field of TextAnswerFormat
the keyboard does not show and instead the survey goes one step backward
minSdkVersion 19
targetSdkVersion 30
It would be useful if there are examples on how to get all the key-value pairs of the survey items.. Currently I am unable to understand how to get the question name.
First of all thanks for this beautiful package! :)
Unfortunately the "text area" is being cut of at half the height, when the text length reaches the display width.
Do you have any quick advice to handle this scenario, or is this a bug?
Setting the "maxLines" to a high value doesn't fix it.
The questions are generated via a JSON file.
(And "isOptional" doesn't work as well)
Hi,
I'd like to change the font style of the survey elements. I tried overriding the textTheme in SurveyKit().
I found out that headline6 is used for e.g. question type title and selected value (scale). I was able to change color and font size here. However, I wasn't able to change the font size for "type" "intro" (note: I'm using json import). It seems that bodytext2 is used b/c I could change the color - but not the size.
Am I missing something?
Thanks in advance.
As the title states, what about integrating a progressbar at the top of the questions widgets, showing the recent step.
Similar to this package https://pub.dev/packages/linear_progress_bar
Or is there a way to interact with the recent step (, when the questions are imported via json)?
great package, thank you!
2 questions:
-- would you demonstrate a custom step for attaching images to the step (no need to demo image picker);
-- how to restart the survey, possibly from a specific step (in case if user decided to change some answers).
thank you in advance!
yury
Is there any way to add a rule that will allow to use different completion step depending on answer?
Hello,
This post is not related to any issues but I just have some queries about customizing survey pages like appbar and next button. Is there any way to remove cancel button, rename back arrow in app bar. I just want to navigate to the next question once a question is answered by removing next button in survey question page. Can you please let me know if there is anyway.
Thanks
When I try to run the following getJsonTask()
from the example code, the app just stays on the loading screen for some time.
Using Flutter 3.0.1
class _MyAppState extends State<MyApp> {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: Container(
color: Colors.white,
child: Align(
alignment: Alignment.center,
child: FutureBuilder<Task>(
future: getJsonTask(), //HERE
builder: (context, snapshot) {
.....
Running getSampleTask()
it works fine.
Hi, I have a question regarding when the questionnaire is finished.
I'm using the example from the page. However, when the questionnaire ends, the application goes to a completely black screen.
I would like to know how do I go to a custom screen.
What I want is to present a simple screen saying that the questionnaire has already been answered.
Hi!
Thank you very much for this awesome library! I would like to use it, but currently it's missing one the main features: an image choice and value picker. Any estimation if these will be added anytime soon?
Thanks! :)
When trying to implement this package with our project we have a conflict in dependencies; namely we are relying on a bloc version in which mapEventToState has been deprecated (bloc 8.0.0 or greater). In the future will the bloc dependency of the package be updated to usable with projects depending on newer versions of bloc?
Hi,
I'd like to congratulate you on this excellent work you did here.
I just have a question that I'm sure is due to my lack of expertise with Flutter/Dart, than with your work.
I'm trying to load the questions from a database through a NodeJS API & Mongo DB as backend, everything seem to work just fine, but when I call SurveyKit from a Future Builder (see code below), as soon as I tap/click on the Answer text field it takes me immediately the InstructionsStep screen.
Can you please guide me on what am I missing here?
...
FutureBuilder(
future: getQuestionSteps(surveyId:'1'),
builder: (ctx, snapshot) {
// Checking if future is resolved or not
if (snapshot.connectionState == ConnectionState.done) {
// If we got an error
if (snapshot.hasError) {
return Center(
child: Text(
'${snapshot.error} occured',
style: TextStyle(fontSize: 18),
),
);
// if we got our data
} else if (snapshot.hasData) {
// Extracting data from snapshot object
final questionSteps = snapshot.data;
return Survey.SurveyKit(
onResult: (Survey.SurveyResult result) {
print(result.finishReason);
},
task: getSampleTask()
);
}
}
// Displaying LoadingSpinner to indicate waiting state
return Center(
child: CircularProgressIndicator(),
);
},
)
I'm developing a new answer format that you can upload a file and a description on a question step. I would like to know if there is some example or some ongoing code you can provide me so I can base on it.
Appreciate.
Hi, I have an error with this package. When I try to install it, it tells me that survey_kit> = 0.0.10 depends on provider ^ 5.0.0 and that my app depends on provider ^ 6.0.1. How can i fix this?
The survey does not preselect the default answer when I provide the defaultSelection.
Here is the code snippet
this.questions.asMap().forEach((index, each) => {
choices = [],
each['options'].forEach((eachOption) {
choices.add(TextChoice(
text: eachOption['text'],
value: eachOption['text']
)
);
}),
steps.add(QuestionStep(
isOptional: false,
id: StepIdentifier(id: index.toString()),
title: 'Question ' + index.toString(),
text: each['question'],
answerFormat: SingleChoiceAnswerFormat(
defaultSelection: TextChoice(
text: capitalize(getDefaultSelection(each['question'])),
value: getDefaultSelection(each['question'])
),
textChoices: choices
)
))
});
Hello,
Thanks for creating this good looking suvery kit, I think this will help to implement in our project.
Im facing issue to run the example project.
Google%20Drive/src/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_platform_widgets-1.9.0/lib/src/platform_app.dart:577:9: Error: No named parameter with the name 'scrollBehavior'.
scrollBehavior: dataRouter?.scrollBehavior ?? scrollBehavior,
^^^^^^^^^^^^^^
../../../../Google%20Drive/src/flutter/packages/flutter/lib/src/material/app.dart:217:9: Context: Found this candidate, but the arguments don't match.
const MaterialApp.router({
^^^^^^^^^^^^^^^^^^
../../../../Google%20Drive/src/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_platform_widgets-1.9.0/lib/src/platform_app.dart:632:9: Error: No named parameter with the name 'scrollBehavior'.
scrollBehavior: data?.scrollBehavior ?? scrollBehavior,
^^^^^^^^^^^^^^
../../../../Google%20Drive/src/flutter/packages/flutter/lib/src/material/app.dart:167:9: Context: Found this candidate, but the arguments don't match.
const MaterialApp({
^^^^^^^^^^^
../../../../Google%20Drive/src/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_platform_widgets-1.9.0/lib/src/platform_circluar_progress_indicator.dart:75:7: Error: No named parameter with the name 'color'.
color: data?.color,
^^^^^
../../../../Google%20Drive/src/flutter/packages/flutter/lib/src/material/progress_indicator.dart:542:9: Context: Found this candidate, but the arguments don't match.
const CircularProgressIndicator({
^^^^^^^^^^^^^^^^^^^^^^^^^
../../../../Google%20Drive/src/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_platform_widgets-1.9.0/lib/src/platform_nav_bar.dart:166:7: Error: No named parameter with the name 'enableFeedback'.
enableFeedback: data?.enableFeedback,
^^^^^^^^^^^^^^
../../../../Google%20Drive/src/flutter/packages/flutter/lib/src/material/bottom_navigation_bar.dart:257:3: Context: Found this candidate, but the arguments don't match.
BottomNavigationBar({
^^^^^^^^^^^^^^^^^^^
../../../../Google%20Drive/src/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_platform_widgets-1.9.0/lib/src/platform_page.dart:128:7: Error: No named parameter with the name 'restorationId'.
restorationId: data?.restorationId ?? restorationId,
^^^^^^^^^^^^^
../../../../Google%20Drive/src/flutter/packages/flutter/lib/src/material/page.dart:153:9: Context: Found this candidate,
but the arguments don't match.
const MaterialPage({
^^^^^^^^^^^^
../../../../Google%20Drive/src/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_platform_widgets-1.9.0/lib/src/platform_page.dart:140:7: Error: No named parameter with the name 'restorationId'.
restorationId: data?.restorationId ?? restorationId,
^^^^^^^^^^^^^
../../../../Google%20Drive/src/flutter/packages/flutter/lib/src/cupertino/route.dart:419:9: Context: Found this candidate, but the arguments don't match.
const CupertinoPage({
^^^^^^^^^^^^^
../../../../Google%20Drive/src/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_platform_widgets-1.9.0/lib/src/platform_text_form_field.dart:386:7: Error: No named parameter with the name 'scrollController'.
scrollController: data?.scrollController,
^^^^^^^^^^^^^^^^
../../../../Google%20Drive/src/flutter/packages/flutter/lib/src/material/text_form_field.dart:135:3: Context: Found this
candidate, but the arguments don't match.
TextFormField({
^^^^^^^^^^^^^
FAILURE: Build failed with an exception.
can you help me or fix this problem so that I can have example project as reference one.
Thank you.
I couldn't find a way to change the text of the cancel and next buttons in the step view.
I think the text for the cancel button is hard coded in step_view.dart line 64 and 91.
Is it possible to adapt these texts?
If this is not the case, could you please use internationalization for these texts or provide a way to change the texts.
I would need a german translation in addition to the english one.
Is there an option to override the cancel option behaviour ? or do i have to modify the library
The entire page gets popped if i tap on cancel, I want it to behave like the back button of a scaffold.
could not find package surveykit at https://pub.dartlang.org), version solving failed.
For the below step there is an exception on the default value.
QuestionStep(
title: 'Your Birthday?',
answerFormat: DateAnswerFormat(
minDate: DateTime.now().subtract(const Duration(days: 365 * 70)),
maxDate: DateTime.now().subtract(const Duration(days: 365 * 15)),
defaultDate:
DateTime.now().subtract(const Duration(days: 365 * 20)),
),
),
Below is the exception. Does not make sense as I set the default date within the range.
The following assertion was thrown building DateAnswerView(dirty, dependencies: [_LocalizationsScope-[GlobalKey#9b781], _InheritedTheme], state: _DateAnswerViewState#9bd0a):
initialDate 2021-04-10 00:00:00.000 must be on or before lastDate 2006-04-14 00:00:00.000.
'package:flutter/src/material/calendar_date_picker.dart':
Failed assertion: line 116 pos 7: '!this.initialDate.isAfter(this.lastDate)'
The relevant error-causing widget was:
SurveyKit file:///D:/Flutter/club/lib/pages/survey/user_survey.dart:8:13
When the exception was thrown, this was the stack:
#2 new CalendarDatePicker (package:flutter/src/material/calendar_date_picker.dart:116:7)
#3 _DateAnswerViewState._androidDatePicker (package:survey_kit/src/views/date_answer_view.dart:109:18)
#4 _DateAnswerViewState.build (package:survey_kit/src/views/date_answer_view.dart:73:32)
#5 StatefulElement.build (package:flutter/src/widgets/framework.dart:4612:27)
#6 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4495:15)
...
====================================================================================================
Hi,
I'm working on a research application that needs to show users some videos, I saw that survey_kit has a VideoStepResult
and depends on video_player
, is there a code sample for a VideoStep?
Hi,
Can you show me how to access the survey answers with sample code in Dart/Flutter?
Thanks,
Mike
When using a QuestionStep
with TextAnswerFormat
the "Next" button stays disabled if no validationRegEx
is defined.
Either the validationRegEx
parameter should be defined as required or the default RegEx should be ".*".
Hey guys,
Awesome plugin, great work!
I've been playing around with it in the last couple of a days and plan on using it in my current project. I would need to export the survey results to json though and saw (on another thread + in the code) that it's not implemented yet.
Just wanted to check with you: did you start that at any point?
I took a quick look on how to do it and at this stage I think I would just go ahead, use freezed and make all the subclasses of QuestionResult
(BooleanQuestionResult
, DateQuestionResult
etc) serializable...
Did you maybe see any potential problems with that approach?
Cheers
Though I set isOptional "false" in Questionsteps, the "next" buttons are activated in all Questionsteps with an AnswerFormat,. How can I solve this problem?
There is rating question in Screen shoot we provided conditions
Is there any workaround for this Type of question in package.
Hi all,
on my QuestionStep:
QuestionStep(
title: 'Congestive heart failure within the past month',
answerFormat: const SingleChoiceAnswerFormat(
textChoices: [
TextChoice(text: 'Yes', value: '1'),
TextChoice(text: 'No', value: '0'),
],
defaultSelection: TextChoice(text: 'No', value: '0'),
),
),
I see the text and value for each answer, I'm not able to see the value of all the answers when I finish the survey, only the text.
My need is to sum all the value... there is a way to do it?
I can't find where to chance the color or remove the final ico. I see in previous issue that is possible to create my own. but how to do that?
this.questions.asMap().forEach((index, each) => {
choices = [],
each['options'].forEach((eachOption) {
choices.add(TextChoice(
text: capitalize(eachOption['text']),
value: eachOption['text']));
}),
steps.add(QuestionStep(
isOptional: false,
id: StepIdentifier(id: index.toString()),
title: 'Question ' + index.toString() + '/' + total.toString(),
text: each['question'],
answerFormat: SingleChoiceAnswerFormat(
defaultSelection: null, textChoices: choices)))
});
Even if I mark the isOptional
false, I am able to skip the question by clicking next button, my Goal is to restrict the user.
Hi,
Thank you for your project. It is very useful. I want to add animation when switching to other page. Can you help me about this or can you say me what should I research?
Everyting is okay when publishing for iOS and Android, but when targeting for web I got this error: UnsupportedError: Unsupported operation: Platform._operatingSystem
Context: thrown building BlocBuilder<SurveyPresenter, SurveyState>(dirty, state: _BlocBuilderBaseState<SurveyPresenter, SurveyState>#4664a)
Information: debugCreator: BlocBuilder<SurveyPresenter, SurveyState> ← BlocConsumer<SurveyPresenter, SurveyState> ← SurveyPage ← _InheritedProviderScope<SurveyPresenter?> ← InheritedProvider<SurveyPresenter> ← BlocProvider<SurveyPresenter> ← _InheritedProviderScope<Map<String, String>?> ← Provider<Map<String, String>?> ← _NestedHook ← _InheritedProviderScope<SurveyProgressConfiguration?> ← Provider<SurveyProgressConfiguration> ← _NestedHook ← ⋯
I'd run the workflows which asserts the general integrity of the library on every PR.
Also: set the requirements for being able to merge so that that workflow has to pass without error.
In my opinion, running it on master/develop servers of little purpose, since by then you'd already created a new published version and it's either too late or you already ran the checks yourself locally.
If you let it run on every PR, also other PRs (besides your own) have the benefit having the security of a successful workflow run.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.