import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:tone_snap/modules/sidea/widgets/head_label.dart';
import 'package:tone_snap/generated/assets.dart';
import 'package:tone_snap/modules/sidea/settings/settings_controller.dart';

class SettingsView extends GetView<SettingsController>{
  const SettingsView({super.key});

  @override
  Widget build(BuildContext context) {
    Get.put(SettingsController());

    return Column(
      crossAxisAlignment: CrossAxisAlignment.start,
      children: [
        HeadLabel(
          assets: Assets.sideATheMonster2,
          width: 155.w,
          height: 51.h,
        ),
        Expanded(
          child: ListView.separated(
            padding: EdgeInsets.zero,
            itemCount: controller.options.length,
            itemBuilder: (context, index) {
              return _buildOptionItem(index);
            },
            separatorBuilder: (context, index) {
              return SizedBox(height: 10.h);
            },
          ),
        ),
      ],
    );
  }

  Widget _buildOptionItem(index) {
    return Material(
      color: Colors.transparent,
      child: InkWell(
        onTap: () => controller.onTapItem(index),
        child: Container(
          height: 56.h,
          padding: const EdgeInsets.only(left: 24, right: 32).w,
          child: Row(
            children: [
              Image.asset(controller.optionIcons[index]),
              SizedBox(width: 12.w),
              Expanded(
                child: Text(
                  controller.options[index],
                  maxLines: 1,
                  overflow: TextOverflow.ellipsis,
                  style: TextStyle(
                    color: Colors.white,
                    fontSize: 18.sp,
                    fontWeight: FontWeight.w500,
                  ),
                ),
              ),
              Image.asset(Assets.sideAIconChevronRight),
            ],
          ),
        ),
      ),
    );
  }
}
