buildSection method

  1. @override
Widget buildSection(
  1. BuildContext context
)
override

Implementation

@override
Widget buildSection(BuildContext context) {
  ValueNotifier<int> selectedSubSection = ValueNotifier(0);
  return ValueListenableBuilder<int>(
      valueListenable: selectedSubSection,
      builder: (_, subSection, __) {
        return Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: [
            Expanded(
              child: subSections.values.toList()[subSection],
            ),
            SingleChildScrollView(
              physics: const BouncingScrollPhysics(),
              scrollDirection: Axis.horizontal,
              child: Padding(
                padding: const EdgeInsets.symmetric(vertical: 8.0),
                child: Row(
                  children: subSections.keys
                      .map(
                        (e) => InkWell(
                          onTap: () {
                            selectedSubSection.value =
                                subSections.keys.toList().indexOf(e);
                          },
                          child: Padding(
                            padding:
                                const EdgeInsets.symmetric(horizontal: 4.0),
                            child: Text(
                              e,
                              style: subSections.keys.toList().indexOf(e) ==
                                      subSection
                                  ? TextStyle(
                                      color: creationSectionData.color,
                                      fontWeight: FontWeight.bold,
                                    )
                                  : null,
                            ),
                          ),
                        ),
                      )
                      .toList(),
                ),
              ),
            ),
          ],
        );
      });
}