themeSettingWidget method

Widget themeSettingWidget({
  1. required void onItemSelected(
    1. int
    ),
  2. required int themesCount,
  3. required (AppTheme, bool) itemBuilder(
    1. int
    ),
})

Implementation

Widget themeSettingWidget({
  required void Function(int) onItemSelected,
  required int themesCount,
  required (AppTheme theme, bool isSelected) Function(int) itemBuilder,
}) => Column(
  children: [
    MenuItemWidget(
      icon: Icons.palette_sharp,
      text: tr('theme'),
      description: tr('theme_description'),
      theme: theme,
    ),
    const SizedBox(height: 8),
    SizedBox(
      height: 40,
      child: ListView.separated(
        scrollDirection: Axis.horizontal,
        itemCount: themesCount,
        itemBuilder: (_, index) {
          final (themeItem, selected) = itemBuilder(index);
          return _themeItemSelectorWidget(
            theme: themeItem,
            isSelected: selected,
            onPressed: () => onItemSelected(index),
          );
        },
        separatorBuilder: (_, __) => const SizedBox(width: 8),
      ),
    ),
  ],
);