buildBody method
Implementation
Widget buildBody(
BuildContext context,
Controller controller,
ViewModel viewModel,
) {
debugPrint('building body');
final children = buildBodyChildren(context, controller, viewModel);
Widget wrapper(Widget child) => Padding(
padding: const EdgeInsets.symmetric(horizontal: 20),
child: child,
);
return switch (children) {
List<Widget> children => ListView(
physics: const ScrollPhysics(),
children: children.map(wrapper).toList(),
),
Iterable<Widget> children => ListView.builder(
physics: const ScrollPhysics(),
itemBuilder: (context, index) => wrapper(children.elementAt(index)),
),
};
// the following would not help, as the context inside the builder is always the same, so we would rebuild everything anyway
// // FFBuilder<Watched, Props, FFState, ViewModel, Controller>(
// // builder: (context, controller, viewModel) =>
// // buildBodyChild(context, controller, viewModel, index),
// // ),
}