build method

  1. @override
Component build(
  1. BuildContext context
)

Describes the part of the user interface represented by this component.

Implementation

@override
Component build(BuildContext context) {
  final configurations = state.configurations;

  return Scrollbar(
    controller: scrollController,
    thumbVisibility: true,
    child: SingleChildScrollView(
      controller: scrollController,
      child: Padding(
        padding: padding,
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.stretch,
          children: [
            for (final config in configurations.indexed) ...[
              FormConfiguration(
                state: state,
                config: config.$2,
                focused: config.$1 == state.focusedConfigIndex,
                rebuild: rebuild,
                onFormInputSubmit: onSubmit,
                onFormInputArrowUp: () {
                  state.updateFocusedConfig(-1);
                  if (state.focusedConfigIndex ==
                      state.maxFocusedConfigIndex) {
                    scrollController.scrollToEnd();
                  } else {
                    scrollController.scrollUp(3);
                  }
                  rebuild();
                },
                onFormInputArrowDown: () {
                  state.updateFocusedConfig(1);
                  if (state.focusedConfigIndex == 0) {
                    scrollController.scrollToStart();
                  } else {
                    scrollController.scrollDown(3);
                  }
                  rebuild();
                },
              ),
              SizedBox(height: spacing),
            ],
          ],
        ),
      ),
    ),
  );
}