import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:liftmanager/res/colors.dart';

class SelectCell extends StatelessWidget {
  final String icon; //图片
  final String title; //标题
  final String subTitle; //选择后的数值
  final Function onTap;
  final Color color;
  final double height;
  final bool isRequire; //是否必填（显示*）
  // final List<Widget> subList; // 内部子操作
  final bool isArrowVisible; // 箭头是否可见
  // final EdgeInsets margin;
  final EdgeInsets padding;
  final double leftMargin;

  SelectCell(
      {this.icon,
      this.height = 44,
      this.isRequire = false,
      this.title,
      this.subTitle,
      this.padding,
      this.onTap,
      this.isArrowVisible = true,
      // this.margin= EdgeInsets.only(left:ScreenUtil().setWidth(10)),
      this.color = Colours.text_black,
      this.leftMargin=10});

  Function fun;

  @override
  Widget build(BuildContext context) {
    return InkWell(
      onTap: onTap,
      child: Container(
        padding: EdgeInsets.symmetric(horizontal: 5),
        margin: EdgeInsets.only(left: ScreenUtil().setWidth(leftMargin)),
        height: ScreenUtil().setHeight(height),
        child: Row(
          children: <Widget>[
            Expanded(
                child: Row(
              crossAxisAlignment: CrossAxisAlignment.center,
              children: <Widget>[
                Text(title,
                    style: TextStyle(
                        fontSize: ScreenUtil().setSp(14), color: color)),
                SizedBox(
                  width: 5,
                ),
              ],
            )),

            Text(
              subTitle != null ? subTitle : "请选择",
              style: TextStyle(
                  color: subTitle != null
                      ? Colours.dark_text_gray
                      : Colours.text_gray_c),
            ),

            SizedBox(
              width: 4.5,
            ),
            if (isArrowVisible)
              Icon(
                Icons.arrow_forward_ios,
                size: 11,
                color: Colours.text_gray_c,
              )
            // Image.asset(Paths.imagePath('icon_arrow_right.png'))
          ],
        ),
      ),
    );
    //  GestureDetector(
    //   onTap: onTap,
    //   child:
    // );
  }
}
