import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

class ItemBtn extends StatelessWidget {
  final String title;
  final double font;
  final Color? bgColor;
  final Function? clickFunction;
  const ItemBtn({Key? key,required this.title,required this.font,this.clickFunction,this.bgColor}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return SizedBox(
      height:25.r,
      child: ElevatedButton(
        
          style: ButtonStyle(
              overlayColor:WidgetStateProperty.all(
                  const Color(0xFFE8E8E8)),
              backgroundColor:
              WidgetStateProperty.all(
                  bgColor??const Color(0xFFF4F4F4)),
              // foregroundColor: MaterialStateProperty.all(Colors.red.shade200),//文字颜色
              shape: WidgetStateProperty.all(
                  RoundedRectangleBorder(
                    borderRadius:
                    BorderRadius.circular(22), //设置圆角
                  )),
              padding:  WidgetStateProperty.all(
                EdgeInsets.zero,
              ),
            elevation: WidgetStateProperty.all(0),
          ),
          onPressed: () {
            clickFunction!();
          },
          child: Text(
            title,
            style: TextStyle(
                fontSize: font,
                color: bgColor != null?Colors.white:const Color(0xFF666666)),
          )),
    );
  }
}
