import 'package:flutter/material.dart';
import 'package:flyinsono/lab/color/lab_colors.dart';
import 'package:flyinsono/lab/pages/lab_project/controller.dart';
import 'package:get/get.dart';
import 'package:fis_ui/index.dart';

class ProjectMemberItem extends GetView<LabProjectController> {
  const ProjectMemberItem({
    Key? key,
    required this.member,
    required this.onChangeSelectMember,
    required this.isSelected,
    this.imageSize,
  }) : super(key: key);

  final MemberModel member;
  final ValueCallback<MemberModel> onChangeSelectMember;
  final bool isSelected;
  final double? imageSize;

  @override
  Widget build(BuildContext context) {
    return Container(
      margin: const EdgeInsets.all(5),
      child: Material(
        color: Colors.transparent,
        child: InkWell(
          onTap: () {
            onChangeSelectMember.call(member);
          },
          child: Column(
            children: [
              Container(
                width: imageSize ?? 80,
                height: imageSize ?? 80,
                decoration: BoxDecoration(
                  color: LabColors.memberCardColor,
                  borderRadius: BorderRadius.circular(3),
                  border: Border.all(
                    color: isSelected ? LabColors.green600 : Colors.transparent,
                    width: 4,
                  ),
                ),
                child: Center(
                  child: Text(
                    member.name?.substring(0, 1) ?? '',
                    style: TextStyle(
                      fontSize: imageSize != null ? 14 : 24,
                      fontWeight: FontWeight.w100,
                      color: LabColors.text300,
                    ),
                  ),
                ),
              ),
              SizedBox(
                height: 5,
              ),
              Container(
                width: 50,
                child: Text(
                  member.name ?? '',
                  textAlign: TextAlign.center,
                  overflow: TextOverflow.ellipsis,
                  maxLines: 1,
                  style: TextStyle(
                    fontSize: 12,
                    color: LabColors.text800,
                  ),
                ),
              ),
            ],
          ),
        ),
      ),
    );
  }
}
