goxiaoy / flutter_survey_js Goto Github PK
View Code? Open in Web Editor NEWFlutter client library for parsing and display surveyjs.io survey
Home Page: https://goxiaoy.github.io/flutter_survey_js/
License: MIT License
Flutter client library for parsing and display surveyjs.io survey
Home Page: https://goxiaoy.github.io/flutter_survey_js/
License: MIT License
Describe the bug
When submitting a survey with dates, the answer is currently not jsonEncode
-able. Instead, the following error will be thrown:
errors.dart:288 Uncaught (in promise) Error: Converting object to an encodable object failed: Instance of 'DateTime'
To Reproduce
SurveyJs json
{
"title": "datetime jsonEncode issue",
"logoPosition": "right",
"pages": [
{
"name": "page1",
"elements": [
{
"type": "text",
"name": "102 visit date",
"title": "Visit Date",
"isRequired": true,
"inputType": "date"
}
]
}
],
"showQuestionNumbers": "off"
}
SurveyJs answer
{"102 visit date": 2023-06-07 00:00:00.000}
Expected behavior
The answer is properly encoded in JSON:
onSubmit: (v) async {
print(jsonEncode(v));
},
Here's how surveyjs.io
handles the same input:
{"102 visit date": "2023-06-07"}
Screenshots
Desktop (please complete the following information):
Currently, SurveyController
is not being attached to SurveyProvider
. The user can pass SurveyController
into SurveyWidget
, but this controller is never actually used. Attaching SurveyController
to SurveyProvider
will allow developers to reference the current SurveyController
off of context
and use SurveyController
functionality within the SurveyWidget
's builder
.
hasSelectAll
basically means when checked/unchecked, all "regular" checkboxes are all checked/unchecked.
hasNone
is meant to add a choice of "none of the above", and when checked, all other selections are cleared.
hasOther
is meant to add a choice of "other", and when checked, an additional text field shows up.
e.g.
{
"type": "checkbox",
"name": "Q099",
"title": "Q099",
"choices": [
"item1",
"item2",
"item3"
],
"hasSelectAll": true,
"hasNone": true,
"noneText": "None",
"hasOther": true,
"otherText": "Other:"
},
Many elements, such as Dropdown
and Checkbox
, can be showOtherItem
or showNoneItem
enabled.
We should make RadioGroup
support showOtherItem
and showNoneItem
as well.
Consider the following JSON:
{
"pages": [
{
"name": "page1",
"elements": [
{
"type": "text",
"name": "email",
"title": "Your e-mail:",
"isRequired": true,
"inputType": "email"
},
]
}
]
}
building a form with this JSON will put a validator on the field so that attempting to submit this field as empty will show an error:
If we remove "inputType":"email"
from the above JSON:
{
"pages": [
{
"name": "page1",
"elements": [
{
"type": "text",
"name": "email",
"title": "Your e-mail:",
"isRequired": true
},
]
}
]
}
attempting to submit with this field empty will not show an error:
Per Survey.js documentation, this is inconsistent with how officially support Survey.js frameworks handle isRequired
:
The Required validator ensures that a question value is not empty. Enable a question's isRequired property to add the Required validator to this question.
Makes the question required. If a respondent skips a required question, the survey displays a validation error.
Currently, when sumbit()
is triggered, either the form is valid (in which case user provided onSubimt
is called), or the entire form is touch
ed (in which case the validation errors, if any, are shown on the form itself, and that's it).
For the second case, especially in a multipage setting, the end-user is left in a state where the problem might not be obvious.
Thus it would be useful to provide a means to specify what to do with validation errors, e.g., from as simple as a toast of sorts, to more advanced usages such as extra logic in custom controllers.
Hi How can we display the saved data in edit mode so that user can edit them again and submit.
The surveyjs javascript use pegjs to parse expression, and use condition runner to provide logic features
original codes :
https://github.com/surveyjs/survey-library/tree/master/src/expressions
https://github.com/surveyjs/survey-library/blob/master/src/conditions.ts
https://github.com/surveyjs/survey-library/blob/master/src/conditionsParser.ts
https://github.com/surveyjs/survey-library/blob/master/src/conditionProcessValue.ts
Paths to achieve this
Index | Path | Desc | Implement difficulty | Maintain difficulty |
---|---|---|---|---|
1 | Fully rewrite with dart | 💪 | ⭐⭐⭐⭐⭐ | ⭐⭐⭐⭐⭐ |
2 | Use js engine in dart | Build tools to convert original js codes to single file. and run as js in dart | ⭐⭐⭐⭐ | ⭐⭐ |
3 | Rewrite with antlr4 | rewrite expression parser with antlr4, | ⭐⭐⭐⭐ | ⭐⭐⭐ |
4 | Use WebAssembly (WASM) | compile js into WASM and embed it into Flutter | Unknown | Unknown |
reactive_forms
is heavily usedreactive_forms
does not have a concept for question
s (which survey.js
uses at its core to model survey questions)reactive_forms
's validators are wired at widget levelreactive_forms
's main user base seems to be those who build online forms according to requirements and usually from scratch, we, however, are expected to take whatever the survey.js
creator throws at usflutter_survey_js
's most obvious use case for validators is the isRequired
attribute specified at question levelflutter_survey_js
's question usually consists of multiple widgets (either reactive or not)flutter_survey_js
's question sometimes map to more than one form control values (see #52 (comment) and #81)We already have a mechanism (or "wrap") for question titles. In the same vein, maybe we can come up with something similar? E.g. at the bottom of each question, we can choose to display an error message.
Once we have this "question-level validation message" in place, l10n of the required
message would be a breeze: currently if one is to provide a l10n message for required
, he/she'll have to patch (at each reactive form widget's constructor) something like validationMessages: {'required': (error) => '必填'}
.
update 20230528: as pointed out by @goxiaoy the l10n of required
validation messages can be handled at global/application level via a ReactiveFormConfig
.
Describe the bug
Survey response data for elements that support the showOtherItem
property do not match the web.
To Reproduce
Create a survey with an element that supports showOtherItem
(such as Dropdown
, Checkbox
, and soon Radiogroup
upon completion of #71). Select the "Other" option and enter a response into the text field. Submit your survey.
SurveyJs json
{
"pages": [
{
"name": "page1",
"elements": [
{
"type": "checkbox",
"name": "question1",
"choices": [
"Item 1",
"Item 2",
"Item 3"
],
"showOtherItem": true
}
]
}
]
}
Expected behavior
Expected SurveyJs answer
{
"question1": [
"other"
],
"question1-Comment": "Some other response"
}
Actual behavior
Actual SurveyJs answer
{
"question1": [
"Some other response"
]
}
Screenshots
Web:
Mobile:
Smartphone (please complete the following information):
Additional context
I was able to make the output for the Checkbox
correct in this commit by adding a _commentsStatusMap
alongside the already-existing _statusMap
in the ElementState
class. I also modified the elementsToFormGroup
method to take a commentsControlsMap
along side the already-existing controlsMap
. The same goes for the toFormObjects
method. Finally, I added a means to register/map survey element types to their respective comment controls in SurveyElementFactory
. This commit is difficult to pull in in its current state as there is a bit of now-irrelevant Checkbox
changes in this commit as well. But let me know what you all think of this approach for essentially registering a new FormControl
for all of the elements that supports showOtherItem
.
Whenever you paste
{
"title": "Single Page Survey",
"pages": [
{
"name": "page1",
"elements": [
{
"type": "dropdown",
"name": "question1",
"choices": [
"Item 1",
"Item 2",
"Item 3"
]
}
]
}
]
}
into https://surveyjs.io/create-free-survey and switch to the "Preview" tab, you will notice that the Dropdown
displays Select...
or 请选择...
despite "placeholder": "Select..."
not existing in the input JSON. This is how the web frameworks render this JSON as well.
Whenever "placeholder"
does not exist in the Dropdown
JSON, we should default to showing Select...
or 请选择...
for English or Chinese, respectively.
There are some SurveyJS elements that are not supported by flutter_survey_js, such as tagbox
.
The following JSON will throw Unhandled Exception: Unsupported operation: ElementBase
at package:flutter_survey_js/model/element.dart:41
and perpetually show a CircularProgressIndicator:
{
"title": "Software developer survey.",
"pages": [
{
"elements": [
{
"type": "tagbox",
"choicesByUrl": {
"url": "https://surveyjs.io/api/CountriesExample"
},
"name": "countries",
"title": "Which countries have you visited within the last three years?",
"description": "Please select all that apply."
}
]
}
]
}
This is because "tagbox"
is not a type that maps to any class subclassing ElementBase
.
Consider the following survey.js JSON:
{
"pages": [
{
"name": "page1",
"elements": [
{
"type": "radiogroup",
"name": "question1",
"title": "What is your T-Shirt size?",
"isRequired": true,
"choices": [
{
"value": "small",
"text": "S"
},
{
"value": "medium",
"text": "M"
},
{
"value": "large",
"text": "L"
}
]
}
]
}
]
}
A Survey.js element created from this JSON will show a required radio group. Attempting to submit a survey with this radio group in an unselected state should show an error.
In reality, attempting to submit a survey with this radio group in an unselected state successfully submits:
This issue is pretty similar to Issue #5, but the cause is likely quite different.
If somebody wants to display the survey's title in the Scaffold's AppBar rather than at the top of the survey, there is currently no way to do this.
We are thinking of, similarly to what was suggested in Issue #14, creating a SurveyStylesConfiguration
that is a part of the SurveyProvider
that has a shouldShowTitle
boolean. Then, if somebody wanted to hide the title of the survey within the SurveyWidget
(in order to display it elsewhere, like in the AppBar
), it could look something like this:
class SurveyStylesConfiguration {
SurveyStylesConfiguration({this.shouldShowTitle = true});
bool shouldShowTitle;
}
class SomeWidget extends StatelessWidget {
SomeWidget({required Survey this.survey});
final Survey survey;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(survey.title,),
),
body: SurveyWidget(
survey: survey,
stylesConfiguration:
SurveyStylesConfiguration(
shouldShowTitle: false,
),
);
}
}
Right now, SurveyWidget
is utilizing a PageView
via PageView.builder
regardless of if the user is trying to view a one-page or a multiple-page Survey
. There are benefits to not having a PageView
in your widget hierarchy. Namely, it is very difficult to wrap a PageView
within a ScrollView
. Using a PageView
only when we need to will enable users to use custom scroll views when viewing a one-page survey.
Our team needs this in conjunction with Issue #19 to make our designs work. If you feel this doesn't benefit the framework, my team can just keep it on our fork.
Current implementation ignores possible other value stored in or passed over via answer
. It starts with a state of "other" that is always unchecked. I'd like to improve on this by having checkboxes deduce the state and value of "other" from answer
. Something along the lines of the following:
choices
, and showOtherItem
is set to true, then the "other" item is checked and the text field associated with it is filled with that (supposedly single) value;choices
, and showOtherItem
is set to true, then the "other" item in unchecked.Once it's done and tested, I'll submit a PR. Suggestions are welcome.
Describe the bug
Checkbox
elements with isRequired: true
are displaying the isRequired
error immediately upon displaying the survey. To match the web, we should not display the isRequired
error until the element is either touched, or the survey is validated with none of the choices checked.
To Reproduce
SurveyJs json
{
"questions": [
{
"type": "checkbox",
"name": "question1",
"isRequired": true,
"choices": [
"Item 1",
"Item 2"
]
}
]
}
Expected behavior
The "question1" element should not display the isRequired
error message until either the Checkbox
element is touched or the survey is validated.
Screenshots
Desktop (please complete the following information):
N/a
Smartphone (please complete the following information):
Any
Currently the visibleIf
seems to be ignored.
e.g.
{
"type": "text",
"name": "Q039",
"visibleIf": "{Q038} anyof ['NA']",
"title": "Q039"
},
Right now, the scroll behavior of SurveyWidget
is not very flexible. If a developer wants to make it so that their submit button is only visible when the user has scrolled to the bottom of the page, there is currently no way to accomplish this. The submit button, in its current state, is always visible on the screen:
Making the SurveyWidget
non-scrollable allows us to wrap it with our own scroll view, so that we can make something like this:
Right now, only a handful of elements actually reflect their defaultValue
. We should make as many elements as we can reflect their defaultValue
.
The following elements have defaultValue
support (pending the merging of #72 and #73):
Per SurveyJS documentation, Survey
has a showQuestionNumbers
property. When showQuestionNumbers
is set to onPage
, the documentation explains that the survey should "display question numbers, start numbering on every page"
.
With the current implementation of flutter_survey_js, question numbering is disabled when we construct a Survey
with JSON containing "showQuestionNumbers": "onPage"
.
/example/assets/multi_page.json
"showQuestionNumbers": false,
to "showQuestionNumbers": "onPage",
All questions are numbered, with the numbering resetting back to 1.
when navigating to the second page.
No questions are numbered.
This issue is caused by survey_widget.dart
lines 81-90:
Map<s.Elementbase, ElementStatus> status = {};
int index = 0;
for (final kv in _controlsMap.entries) {
var visible = true;
status[kv.key] = ElementStatus(indexAll: index);
if (visible) {
index++;
}
}
final elementsState = ElementsState(status);
we should be setting status[kv.key]
on line 85 to an ElementStatus
with a defined pageIndex
. This is important when we consider question_title.dart
lines 40-46:
} else if ((survey.survey.showQuestionNumbers?.isOnPage ?? false) &&
status.indexInPage != null) {
return Text(
'${status.indexInPage! + 1}.',
style: titleTextStyle(),
);
}
where we see that Survey.showQuestionNumbers?.isOnPage
is only influencing the UI while status.indexInPage
is also non-null.
labelTrue
and labelFalse
text is missing from the Boolean Element{
"title": "Single Page Survey",
"pages": [
{
"name": "page1",
"elements": [
{
"type": "boolean",
"name": "question1",
"labelTrue": "No Pineapples",
"labelFalse": "Pineapples"
}
]
}
]
}
Every Survey
numbers its elements, regardless of whether Survey.showQuestionNumbers
is on
, onPage
, or off
. This is because we are never using Survey.showQuestionNumbers
as a condition for adding Text('${status.indexAll! + 1}.')
, as seen on question_title.dart
line 45:
final title = () {
List<Widget> listTitle = <Widget>[];
listTitle.add(Builder(builder: (context) {
final survey = SurveyProvider.of(context);
final status = survey.elementsState.get(q);
if (status != null && status.indexAll != null) {
return Text(
'${status.indexAll! + 1}.',
style: titleTextStyle(),
);
}
return Container();
}));
...
};
Dear,
I am getting type '_Map<dynamic, dynamic>' is not a subtype of type 'Map<String, Object?>?' while sending answer. with the reference of #79 issue.
A dropdown that is marked as required with showOtherItem true
returns the error text immediately after choosing Other.
The error text disappears after entering any text into the textfield.
Right now, the Text
widgets that display each survey element have hard-coded styling. For example, the QuestionTitle
widget uses the following lines of code to style its Text
:
final titleTextStyle = () {
return TextStyle(
fontSize: 16.0,
fontFamily: 'SF-UI-Text',
fontWeight: FontWeight.w900,
color: Theme.of(context).disabledColor //Color(0xff242833)
);
};
...
//later in the code:
Text(
'${status.indexAll! + 1}.',
style: titleTextStyle(),
)
I am envisioning a class where we could define the styles for basic UI elements, such as question titles. Implementation would look something like this:
class SurveyStylesConfiguration {
SurveyStylesConfiguration({this.questionTitleTextStyle});
TextStyle? questionTitleTextStyle;
}
class SomeWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
return SurveyWidget(
survey: survey!,
stylesConfiguration:
SurveyStylesConfiguration(
questionTitleTextStyle: TextStyle(
fontSize: 24.0,
fontFamily: 'Helvetica',
fontWeight: FontWeight.w700,
color: Colors.grey,
),
);
}
Alternatively, instead of passing SurveyStylesConfiguration
directly to the SurveyWidget
, we could use a provider/singleton pattern to distribute this configuration down a widget tree/across the whole app, respectively.
Currently, there is no way to delegate survey submission to the onPressed
of other widgets. We'd like to add an optional SurveyController
that will allow us to submit a survey from the onPressed
of any widget we'd like.
Describe the bug
Getting the error '_Map<dynamic, dynamic>' is not a subtype of type 'Map<String, Object?>?' however I am storing the survey response data to HiveBox and then sending the same response data to answer. If I add a survey and edit the same response works fine but Error coms when I restart the application and then going to the edit survey screen.
To Reproduce
SurveyJs json
{
"title": "Survey Form for Commune",
"description": "Survey for commune level users",
"logoFit": "cover",
"logoPosition": "right",
"pages": [
{
"name": "Page1",
"elements": [
{
"type": "matrixdynamic",
"name": "question1",
"title": "Question 1",
"columns": [
{
"name": "Column 1"
},
{
"name": "Column 2"
},
{
"name": "Column 3"
}
],
"choices": [
1,
2,
3,
4,
5
]
}
],
"title": "I. COUVERTURE DES RISQUES SOCIAUX",
"description": "Tableau001 : Couverture dela population par les mutuelles sociales toutes prestations (Une liste demutuelle sera fournie)"
},
{
"name": "page2",
"elements": [
{
"type": "matrixdynamic",
"name": "question2",
"title": "Question1",
"columns": [
{
"name": "Column 1"
},
{
"name": "Column 2"
},
{
"name": "Column 3"
}
],
"choices": [
1,
2,
3,
4,
5
]
}
],
"title": "1.2. Assurance Maladie Obligatoire (AMO)",
"description": "Tableau 002 : Couverture de la population par l’AMO (interopérabilité entre le SISo et la base de la CANAM)"
}
]
}
SurveyJs answer
{question1: [{Column 1: 2, Column 2: 2, Column 3: 2}], question2: []}
Expected behavior
Screenshots
Desktop (please complete the following information):
Smartphone (please complete the following information):
Additional context
Per SurveyJS documentation, the showQuestionNumbers
property for the Survey
data model can be either a string or a boolean.
The following JSON will throw Unhandled Exception: type 'bool' is not a subtype of type 'String?' in type cast
at package:flutter_survey_js/model/survey.g.dart:55
and perpetually show a CircularProgressIndicator
:
{
"title": "Software developer survey.",
"pages": [
{
"elements": [
{
"type": "text",
"isRequired": true,
"name": "question 1"
}
]
}
],
"showQuestionNumbers": true
}
This is because the JSON serializer for the Survey
object does not handle booleans, but only strings.
If I need to keep my progress, I can not see it in the checkbox types widget. All other types seem to work.
Per SurveyJS documentation, survey builders should be able to specify a Dropdown
as showOtherItem
and/or showNoneItem
.
In the case of showOtherItem
, a ReactiveTextField
should appear and set the value for this element if other
is selected from the Dropdown
.
Right now, the placeholder
property is being mapped to the Text
and Comment
objects. However, this placeholder
property is not propagating to the InputDecoration.hintText
of Text
's and Comment
's ReactiveTextField
s.
Describe the bug
Checkbox
es with the isRequired
property will display the required validator error when SurveyWidget.builder
is non-null. The
required validator error does appear when SurveyWidget.builder
is null.
To Reproduce
complex.json
to the following JSON:{
"pages": [
{
"elements": [
{
"type": "checkbox",
"name": "question1",
"title": "Pizza toppings can include...",
"isRequired": true,
"choices": [
{
"value": "Item 1",
"text": "Pepperoni"
},
{
"value": "Item 2",
"text": "Shrimp"
},
{
"value": "Item 3",
"text": "Chai tea"
},
{
"value": "Item 4",
"text": "Cheez Its"
}
],
"showNoneItem": true,
"showSelectAllItem": true,
"showOther": true
}
]
}
]
}
Expected behavior
The "required" validator error should appear under the Checkbox
element.
Actual behavior
The "required" validator error does not appear under the Checkbox
element.
Behavior
The "required" validator error does appear under the Checkbox
element.
Screenshots
Smartphone (please complete the following information):
Any
Context
Our team is seeing this same issue in our production app that uses a SurveyWidget
with a custom, non-null builder:
property.
Whenever didUpdateWidget
is called, whenever the keyboard appears on screen or the device orientation changes for example, we invoke rebuildForm
if oldWidget.survey != widget.survey
. Since this condition is only checking referential equality between the two Survey
s, this condition will never be false (as far as I am aware). rebuildForm
reassigns the value of formGroup
, which sets the value
s of all of its child FormControl
s to null
.
Whenever didUpdateWidget
is called, SurveyWidget
's formGroup
's control
s maintain their value
s.
Whenever didUpdateWidget
is called, SurveyWidget
's formGroup
's control
s are having their value
s set to null
.
single_page.json
to:{
"showQuestionNumbers": false,
"pages": [
{
"name": "page1",
"title": "Single Page Survey",
"elements": [
{
"type": "text",
"name": "text_question"
}
]
}
]
}
ReactiveTextField
{text_quesiton: null}
.Note that the response json will not be {text_quesiton: null}
if you have "Connect Hardware Keyboard" turned on. This is because the viewport is not adjusting and didUpdateWidget
is not being called, which means rebuildForm
is not being called.
The Survey
object has a showQuestionNumbers
property that determines whether question titles are prefixed by their appropriate question number.
This property can be one of 3 values:
When pasting the following JSON into SurveyJS's online survey builder, we see that it defaults to the on
value.
{
"title": "Survey",
"pages": [
{
"name": "page1",
"elements": [
{
"type": "dropdown",
"name": "question1",
"choices": [
"Item 1",
"Item 2",
"Item 3"
],
"showOtherItem": true,
"showNoneItem": true
}
]
},
{
"name": "page2",
"elements": [
{
"type": "text",
"name": "question2"
}
]
}
]
}
flutter_survey_js currently does not set a default value for Survey.showQuestionNumbers
, which means this value will be null
unless otherwise specified, in which case question titles are not prefixed by their appropriate question number. This does not match web behavior, which seems to be defaulting this property to on
.
Right now, the SurveyWidget
takes a Survey
object for its survey
property. The JSON for this object might look something like this:
{
"pages": [
{
"name": "page1",
"title": "Single Page Survey",
"elements": [
{
"type": "text",
"name": "text_question"
}
]
}
]
}
Our team is finding that, when multi-page/pagination is disabled in our survey builder, we are getting back a Page
object back from the API. The JSON for this object might look something like this:
{
"title": "Single Page Survey",
"elements": [
{
"type": "text",
"name": "text_question"
}
]
}
For this reason, we wanted to create a factory constructor on the Survey
object that would build a Survey
from a single given Page
. The alternative to this would be to add a factory constructor on SurveyWidget
that takes a single given Page
. Any properties that are shared between Page
and Survey
would be mapped over in a way that makes sense; for example Page
's elements
property would map to Survey
's questions
property. description
, maxTimeToFinish
, questionsOrder
, and title
are also properties shared between the two objects, amongst others that are not yet being mapped on the frontend (such as timeSpent
).
ReactiveForms
was recently updated to allow FormControl<dynamic>
to be passed as a control to fb.group
. This would allow us to register dynamic FormControl
s in lib/ui/survey_element_factory.dart
, which we should be able to do given that many elements can represent either a String
or a num
.
Upgrading this dependency would allow me to resolve #71 because I have written some tests that ensure RadioGroup can handle being provided either an int
or a String
.
Right now, the framework does not support visibleIf
conditions.
I have implemented basic visibleIf
functionality on this branch. There are many things that are not yet supported thus far, such as built in functions as well as condition chaining via and
and or
. The code can also be cleaned up quite a bit. Just creating this issue so that I don't forget about all of this.
Before the openapi codegen overhaul (see a129ec8) , the choice values converted from survey definition had the runtime type of String
. Now, after the codegen changes, the runtime type of choice values became StringJsonObject
. The runtime type gets reflected in answers as well (if one uses directly the value associated with the choice, that is).
Everything seems to work normally until you jsonEncode
the answer where your checkbox value is non-empty . This call would fail with the following error:
Uncaught (in promise) Error: Converting object to an encodable object failed: Instance of 'StringJsonObject'
at Object.throw_ [as throw] (errors.dart:266:49)
at convert._JsonStringStringifier.new.writeObject (json.dart:793:7)
at convert._JsonStringStringifier.new.writeList (json.dart:841:7)
at convert._JsonStringStringifier.new.writeJsonValue (json.dart:823:7)
at convert._JsonStringStringifier.new.writeObject (json.dart:784:9)
at convert._JsonStringStringifier.new.writeMap (json.dart:874:7)
at convert._JsonStringStringifier.new.writeJsonValue (json.dart:829:21)
at convert._JsonStringStringifier.new.writeObject (json.dart:784:9)
at _JsonStringStringifier.printOn (json.dart:982:16)
at _JsonStringStringifier.stringify (json.dart:967:5)
at JsonEncoder.convert (json.dart:345:30)
at JsonCodec.encode (json.dart:231:45)
at Object.jsonEncode (json.dart:114:10)
...
So far we only experienced this problem with checkboxes, and have a temporary fix (PR underway). I might investigate further while I try to implement #33 .
When a checkbox question is set as isRequired
, user has to at least check one box for the question.
This commit broke a test ensuring that Rating
elements reflect their defaultValue
.
There is currently no way to specify the padding you want around SurveyWidget
. Currently it is defaulting to EdgeInsets.all(8.0)
. This can make it difficult to incorporate SurveyWidget
into the UI such that it matches designs.
We are wanting to pass an optional padding
parameter to SurveyWidget
. If this parameter is omitted, padding
will continue to default to EdgeInsets.all(8.0)
.
Describe the bug
Currently a text input of type number
would allow characters such as a
(the captured value would then become null
), and at the same time double values such as 1.2
would fail the validation (with the follwing error message: {some number: {number: true}}
).
To Reproduce
SurveyJs json
{
"title": "number input issue",
"logoPosition": "right",
"pages": [
{
"name": "page1",
"elements": [
{
"type": "text",
"name": "some number",
"title": "some number",
"isRequired": true,
"inputType": "number"
}
]
}
],
"showQuestionNumbers": "off"
}
SurveyJs answer
{}
Expected behavior
A text field of type number
should restrict the keyboard to allow only digits and (0 or 1) decimal point(s). And decimal values (such as 1.2
) shouldn't fail the number
validator. This is also how the web version behaves.
Desktop (please complete the following information):
The build for the main branch has been failing for some time now.
pubspec.yaml
on main branch reads:
flutter_survey_js_model: ^0.0.2-dev.2
Yet this version is not found on pub.dev.
P.S. I noticed several dependency updates going on under the hood, mainly around the packages like multiple_localization
^0.4.0, which seems to be resolved earlier today. I wonder if there are still remaining issues to be sorted out before we can fully upgrade to flutter 3.10.0?
Both Dropdown
and Multiple Text
support placeholder
s in the SurveyJS web frameworks. Right now, flutter_survey_js does not render these placeholder
s.
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.