import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_medium.dart';

class MenuListItem extends StatelessWidget {
  const MenuListItem({
    super.key,
    required this.title,
    required this.icon,
    required this.page,
    required this.color,
  });

  final String title;
  final String icon;
  final Widget? page;
  final Color color;
  @override
  Widget build(BuildContext context) {
    return InkWell(
      onTap: () {
        if (page == null) {
          return;
        }
        Navigator.of(context)
            .push(MaterialPageRoute(builder: (context) => page!));
      },
      child: Row(
        children: [
          Container(
              margin: const EdgeInsets.only(right: 10),
              height: 33,
              width: 33,
              decoration: BoxDecoration(
                color: color,
                borderRadius: BorderRadius.circular(15),
              ),
              child: Center(
                child: SizedBox.square(
                  dimension: 15,
                  child: SvgPicture.asset(
                    icon,
                    width: 15,
                    height: 15,
                    fit: BoxFit.contain,
                  ),
                ),
              )),
          BodyMedium(
            text: title,
          )
        ],
      ),
    );
  }
}
