import 'package:flutter/material.dart'; import 'package:ftrecruiter/comm/constants/color_constants.dart'; import 'package:ftrecruiter/comm/widget/my_load_image.dart'; // ignore: slash_for_doc_comments /** 默认是左边文本图标等 右边more小箭头 常用于Me页面的跳转 模板: MyClickItem( title: '测试SP-存和取', drawablePadding: 0, onTap: () { SpUtil.putString("username", "Sky24n"); SpUtil.putString(SPConstant.SP_KEY_TOKEN, "1234"); String? userName = SpUtil.getString("username"); if (!TextUtil.isEmpty(userName)) { SmartDialog.compatible.showToast('username:$userName'); } }, backgroundColor: ColorConstants.dividerColor, ), */ class MyClickItem extends StatelessWidget { const MyClickItem({ Key? key, required this.onTap, required this.title, this.title_color = Colors.black, this.title_size = 16, this.image_path, this.image_width = 25, this.image_height = 25, this.backgroundColor = Colors.white, this.paddingTop = 8, this.padingBottom = 8, this.paddingLeft = 15, this.paddingRight = 15, this.marginTop = 0, this.marginBottom = 0, this.marginLeft = 0, this.marginRight = 0, this.drawablePadding = 10, this.border_radius = 5.0, }) : super(key: key); final Function() onTap; final String? image_path; final double? image_width; final double? image_height; final String title; final Color title_color; final double title_size; final Color backgroundColor; final double border_radius; final double paddingLeft, paddingTop, paddingRight, padingBottom; final double marginLeft, marginTop, marginRight, marginBottom; final double drawablePadding; @override Widget build(BuildContext context) { return Container( margin: EdgeInsets.fromLTRB(marginLeft, marginTop, marginRight, marginBottom), child: Material( borderRadius: BorderRadius.circular(border_radius), color: backgroundColor, child: InkWell( onTap: onTap, customBorder: RoundedRectangleBorder(borderRadius: BorderRadius.circular(11)), child: Padding( padding: EdgeInsets.fromLTRB(paddingLeft, paddingTop, paddingRight, padingBottom), child: Row( children: [ image_path == null ? const SizedBox() : MyLoadImage( image_path!, width: image_width, height: image_height, ), SizedBox( width: drawablePadding, ), Expanded( child: Text( title, style: TextStyle(color: title_color, fontSize: title_size), )), const Icon( Icons.chevron_right, color: ColorConstants.darkGray, ), ], ), ), ), ), ); } }