import 'package:flutter/material.dart';
import 'package:syncrow_app/features/menu/view/widgets/menu_list_divider.dart';
import 'package:syncrow_app/features/menu/view/widgets/menu_list_item.dart';
import 'package:syncrow_app/features/shared_widgets/default_container.dart';
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_small.dart';

class MenuList extends StatelessWidget {
  const MenuList({
    super.key,
    required this.section,
  });

  final Map<String, dynamic> section;

  @override
  Widget build(BuildContext context) {
    return Column(
      crossAxisAlignment: CrossAxisAlignment.stretch,
      children: [
        const SizedBox(height: 5),
        BodySmall(
          text: section['title'] as String,
        ),
        const SizedBox(height: 5),
        DefaultContainer(
          child: ListView.separated(
              shrinkWrap: true,
              padding: const EdgeInsets.all(0),
              physics: const NeverScrollableScrollPhysics(),
              itemCount: section['buttons'].length,
              itemBuilder: (context, index) {
                return MenuListItem(
                  title: section['buttons'][index]['title'] as String,
                  icon: section['buttons'][index]['Icon'] as String,
                  page: section['buttons'][index]['page'] as Widget?,
                  color: section['color'],
                );
              },
              separatorBuilder: (context, index) => const MenuListDivider()),
        ),
        const SizedBox(height: 5),
      ],
    );
  }
}
