import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter/material.dart';
import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/utils/font_weight.dart';

class CommentMenu extends StatefulWidget {
  final bool isSelf;

  final Function(String type) clickType;

  CommentMenu(
    this.clickType, {
    this.isSelf = false,
  });

  @override
  State<StatefulWidget> createState() {
    return _CommentMenu();
  }
}

class _CommentMenu extends State<CommentMenu> {
  @override
  Widget build(BuildContext context) {
    return Container(
      height: widget.isSelf ? 224.h : 164.h,
      decoration: BoxDecoration(
        color: Colors.white,
        borderRadius: BorderRadius.vertical(top: Radius.circular(8)),
      ),
      child: Column(
        mainAxisSize: MainAxisSize.max,
        children: [
          InkWell(
            onTap: () {
              widget.clickType("huifu");
            },
            child: Container(
              width: MediaQuery.of(context).size.width,
              alignment: Alignment.center,
              padding: EdgeInsets.all(20.h),
              child: Text(
                S.of(context).huifu,
                style: TextStyle(
                  fontWeight: MyFontWeight.medium,
                  fontSize: 16.sp,
                  color: Color(0xFF353535),
                ),
              ),
            ),
          ),
          Container(
            height: 1.h,
            color: Color(0xFFF7F7F7),
          ),
          if (widget.isSelf)
            InkWell(
              onTap: () {
                widget.clickType("shanchu");
              },
              child: Container(
                width: MediaQuery.of(context).size.width,
                alignment: Alignment.center,
                padding: EdgeInsets.all(20.h),
                child: Text(
                  S.of(context).shanchu,
                  style: TextStyle(
                    fontWeight: MyFontWeight.medium,
                    fontSize: 16.sp,
                    color: Color(0xFF353535),
                  ),
                ),
              ),
            ),
          if (widget.isSelf)
            Container(
              height: 1.h,
              color: Color(0xFFF7F7F7),
            ),
          InkWell(
            onTap: () {
              widget.clickType("quxiao");
            },
            child: Container(
              width: MediaQuery.of(context).size.width,
              alignment: Alignment.center,
              padding: EdgeInsets.all(20.h),
              child: Text(
                S.of(context).quxiao,
                style: TextStyle(
                  fontWeight: MyFontWeight.medium,
                  fontSize: 16.sp,
                  color: Color(0xFF727272),
                ),
              ),
            ),
          ),
        ],
      ),
    );
  }
}