import 'package:fis_measure/interfaces/process/items/item_metas.dart';
import 'package:fis_ui/index.dart';
import 'package:fis_ui/interface/interactive_container.dart';
import 'package:flutter/material.dart';
import 'package:flyinsono/lab/color/lab_colors.dart';

class NormalChildButton extends FStatelessWidget {
  final int activeIndex;
  final int index;
  final ItemMeta itemMeta;

  final VoidCallback onClick;

  final FInteractiveContainer businessParent;

  const NormalChildButton({
    super.key,
    required this.activeIndex,
    required this.index,
    required this.itemMeta,
    required this.onClick,
    required this.businessParent,
  });

  @override
  FWidget build(BuildContext context) {
    final isActived = index == activeIndex;
    return FContainer(
      width: double.infinity,
      margin: const EdgeInsetsDirectional.all(5),
      child: FElevatedButton(
        businessParent: businessParent,
        name: "selectChildItemIdnex:$index",
        onPressed: () {
          onClick.call();
        },
        child: FText(
          itemMeta.description,
        ),
        style: ElevatedButton.styleFrom(
          backgroundColor: isActived ? LabColors.base600 : LabColors.base200,
          side: BorderSide(
            color: isActived ? Colors.transparent : LabColors.buttonColor,
          ),
        ),
      ),
    );
  }
}
