multipleTextBuilder function
Widget
multipleTextBuilder(
- BuildContext context,
- Elementbase element, {
- ElementConfiguration? configuration,
Implementation
Widget multipleTextBuilder(BuildContext context, s.Elementbase element,
{ElementConfiguration? configuration}) {
final e = element as s.Multipletext;
final node =
SurveyWidgetState.of(context).rootNode.findByElement(element: element)!;
return ReactiveNestedForm(
formControlName: e.name,
child: Builder(builder: (context) {
final control = ReactiveForm.of(context) as FormGroup;
final effectiveDecoration = const InputDecoration()
.applyDefaults(Theme.of(context).inputDecorationTheme);
return StreamBuilder(
stream:
StreamGroup.merge([control.touchChanges, control.statusChanged]),
builder: (context, _) {
return InputDecorator(
decoration: effectiveDecoration.copyWith(
errorText: getErrorTextFromFormControl(context, control)),
child: ListView.separated(
physics: const ClampingScrollPhysics(),
shrinkWrap: true,
itemCount: node.children.length,
itemBuilder: (BuildContext context, int index) {
final res = SurveyConfiguration.of(context)!
.factory
.resolve(context, node.children[index].element!);
return index == 0
? Padding(
padding: const EdgeInsets.only(top: 8.0),
child: res,
)
: res;
},
separatorBuilder: (BuildContext context, int index) {
return SurveyConfiguration.of(context)!
.separatorBuilder(context);
},
),
);
},
);
}).wrapQuestionTitle(context, element, configuration: configuration));
}