widgets.dart 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. import 'package:flutter/material.dart';
  2. import 'package:flutter_screenutil/flutter_screenutil.dart';
  3. import 'package:liftmanager/res/colors.dart';
  4. class SelectCell extends StatelessWidget {
  5. final String icon; //图片
  6. final String title; //标题
  7. final String subTitle; //选择后的数值
  8. final Function onTap;
  9. final Color color;
  10. final double height;
  11. final bool isRequire; //是否必填(显示*)
  12. // final List<Widget> subList; // 内部子操作
  13. final bool isArrowVisible; // 箭头是否可见
  14. // final EdgeInsets margin;
  15. final EdgeInsets padding;
  16. final double leftMargin;
  17. SelectCell(
  18. {this.icon,
  19. this.height = 44,
  20. this.isRequire = false,
  21. this.title,
  22. this.subTitle,
  23. this.padding,
  24. this.onTap,
  25. this.isArrowVisible = true,
  26. // this.margin= EdgeInsets.only(left:ScreenUtil().setWidth(10)),
  27. this.color = Colours.text_black,
  28. this.leftMargin=10});
  29. Function fun;
  30. @override
  31. Widget build(BuildContext context) {
  32. return InkWell(
  33. onTap: onTap,
  34. child: Container(
  35. padding: EdgeInsets.symmetric(horizontal: 5),
  36. margin: EdgeInsets.only(left: ScreenUtil().setWidth(leftMargin)),
  37. height: ScreenUtil().setHeight(height),
  38. child: Row(
  39. children: <Widget>[
  40. Expanded(
  41. child: Row(
  42. crossAxisAlignment: CrossAxisAlignment.center,
  43. children: <Widget>[
  44. Text(title,
  45. style: TextStyle(
  46. fontSize: ScreenUtil().setSp(14), color: color)),
  47. SizedBox(
  48. width: 5,
  49. ),
  50. ],
  51. )),
  52. Text(
  53. subTitle != null ? subTitle : "请选择",
  54. style: TextStyle(
  55. color: subTitle != null
  56. ? Colours.dark_text_gray
  57. : Colours.text_gray_c),
  58. ),
  59. SizedBox(
  60. width: 4.5,
  61. ),
  62. if (isArrowVisible)
  63. Icon(
  64. Icons.arrow_forward_ios,
  65. size: 11,
  66. color: Colours.text_gray_c,
  67. )
  68. // Image.asset(Paths.imagePath('icon_arrow_right.png'))
  69. ],
  70. ),
  71. ),
  72. );
  73. // GestureDetector(
  74. // onTap: onTap,
  75. // child:
  76. // );
  77. }
  78. }