1
1
import 'package:collection/collection.dart' ;
2
+ import 'package:flutter/cupertino.dart' ;
2
3
import 'package:flutter_bloc/flutter_bloc.dart' ;
3
4
import 'package:image_picker/image_picker.dart' ;
4
5
import 'package:injectable/injectable.dart' ;
@@ -101,7 +102,7 @@ class CreateFormBloc extends Bloc<CreateFormEvents, CreateFormState> {
101
102
orgFormFields: state.fields,
102
103
fieldId: event.fieldId,
103
104
updater: (field) {
104
- List <EquatableTextEditingController > options = field? .options ?? [];
105
+ List <TextEditingController > options = field? .options ?? [];
105
106
if (event.type != FormFieldAnswerType .checkBox &&
106
107
event.type != FormFieldAnswerType .dropDown) {
107
108
for (final option in options) {
@@ -112,8 +113,8 @@ class CreateFormBloc extends Bloc<CreateFormEvents, CreateFormState> {
112
113
field? .inputType != FormFieldAnswerType .dropDown &&
113
114
(event.type == FormFieldAnswerType .checkBox ||
114
115
event.type == FormFieldAnswerType .dropDown)) {
115
- options. add ( EquatableTextEditingController (
116
- text: 'Option ${options .length }' ));
116
+ options
117
+ . add ( TextEditingController ( text: 'Option ${options .length }' ));
117
118
}
118
119
return field? .copyWith (
119
120
inputType: event.type,
@@ -129,10 +130,8 @@ class CreateFormBloc extends Bloc<CreateFormEvents, CreateFormState> {
129
130
orgFormFields: state.fields,
130
131
fieldId: event.fieldId,
131
132
updater: (field) {
132
- List <EquatableTextEditingController > options =
133
- field? .options? .toList () ?? [];
134
- options.add (
135
- EquatableTextEditingController (text: 'Option ${options .length }' ));
133
+ List <TextEditingController > options = field? .options? .toList () ?? [];
134
+ options.add (TextEditingController (text: 'Option ${options .length }' ));
136
135
return field? .copyWith (options: options);
137
136
});
138
137
emit (state.copyWith (fields: fields));
@@ -144,8 +143,7 @@ class CreateFormBloc extends Bloc<CreateFormEvents, CreateFormState> {
144
143
orgFormFields: state.fields,
145
144
fieldId: event.fieldId,
146
145
updater: (field) {
147
- List <EquatableTextEditingController >? options =
148
- field? .options? .toList ();
146
+ List <TextEditingController >? options = field? .options? .toList ();
149
147
if (options != null ) {
150
148
options[event.optionIndex].dispose ();
151
149
options.removeAt (event.optionIndex);
@@ -163,7 +161,7 @@ class CreateFormBloc extends Bloc<CreateFormEvents, CreateFormState> {
163
161
OrgFormFieldCreateFormState (
164
162
index: _index++ ,
165
163
id: _formRepo.generateNewFormFieldId (formId: state.formId),
166
- question: EquatableTextEditingController ());
164
+ question: TextEditingController ());
167
165
final fields = state.fields.toList ();
168
166
fields.sort ((a, b) => a.index.compareTo (b.index));
169
167
fields.add (orgFormField);
@@ -177,7 +175,7 @@ class CreateFormBloc extends Bloc<CreateFormEvents, CreateFormState> {
177
175
if (image != null ) {
178
176
final OrgFormFieldCreateFormState orgFormField =
179
177
OrgFormFieldCreateFormState (
180
- question: EquatableTextEditingController (),
178
+ question: TextEditingController (),
181
179
inputType: FormFieldAnswerType .none,
182
180
type: FormFieldType .image,
183
181
index: _index++ ,
0 commit comments