File tree Expand file tree Collapse file tree 3 files changed +17
-10
lines changed Expand file tree Collapse file tree 3 files changed +17
-10
lines changed Original file line number Diff line number Diff line change @@ -30,10 +30,16 @@ class _BuilderPageState extends State<BuilderPage> {
3030 }
3131
3232 void _onChangePage () {
33+ final questions = _cubit.state.surveyData.questions;
3334 final index = _surveyController.pageController.page;
35+ final question = index == questions.length
36+ ? _cubit.state.surveyData.endPage
37+ : index != null && index % 1 == 0
38+ ? questions[index.toInt ()]
39+ : null ;
3440
35- if (index != null && index % 1 == 0 ) {
36- _cubit.select (_cubit.state.surveyData.questions[index. toInt ()] );
41+ if (question != null ) {
42+ _cubit.select (question );
3743 }
3844 }
3945
Original file line number Diff line number Diff line change @@ -44,21 +44,25 @@ class EditorBar extends StatelessWidget {
4444 switch (questionData.type) {
4545 case QuestionTypes .choice:
4646 return ChoiceCustomizationPanel (
47+ key: UniqueKey (),
4748 onChange: onChange,
4849 editable: questionData as ChoiceQuestionData ,
4950 );
5051 case QuestionTypes .input:
5152 return InputCustomizationPanel (
53+ key: UniqueKey (),
5254 onChange: onChange,
5355 editable: questionData as InputQuestionData ,
5456 );
5557 case QuestionTypes .info:
5658 return InfoCustomizationPanel (
59+ key: UniqueKey (),
5760 onChange: onChange,
5861 editable: questionData as InfoQuestionData ,
5962 );
6063 case QuestionTypes .slider:
6164 return SliderCustomizationPanel (
65+ key: UniqueKey (),
6266 onChange: onChange,
6367 editable: questionData as SliderQuestionData ,
6468 );
Original file line number Diff line number Diff line change @@ -44,18 +44,15 @@ class _QuestionListState extends State<QuestionList> {
4444 ? widget.questions.length - 1
4545 : newIndex;
4646
47- final itemOld = widget.questions.removeAt (oldIndex);
48-
49- widget.questions.insert (
50- updatedIndex,
51- itemOld,
52- );
47+ final questions = List .of (widget.questions);
48+ final itemOld = questions.removeAt (oldIndex);
49+ questions.insert (updatedIndex, itemOld);
5350
5451 for (var i = 0 ; i < widget.questions.length; i++ ) {
55- widget. questions[i] = widget. questions[i].copyWith (index: i + 1 );
52+ questions[i] = questions[i].copyWith (index: i + 1 );
5653 }
5754
58- widget.onUpdate (widget. questions);
55+ widget.onUpdate (questions);
5956 }
6057
6158 @override
You can’t perform that action at this time.
0 commit comments