import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:star_lock/app_settings/app_colors.dart'; class CommonItem extends StatelessWidget { String? leftTitel; String? rightTitle; bool? isHaveDirection; bool? isHaveLine; bool? isHaveRightWidget; Widget? rightWidget; Function()? action; Function()? tipsImgAction; double? allHeight; bool? isTipsImg; bool? isPadding; CommonItem( {Key? key, required this.leftTitel, this.rightTitle, this.allHeight, this.isHaveDirection = false, this.isHaveLine = false, this.isHaveRightWidget = false, this.isPadding = true, this.rightWidget, this.isTipsImg, this.action, this.tipsImgAction}) : super(key: key); @override Widget build(BuildContext context) { return GestureDetector( onTap: action, child: Column( // mainAxisAlignment: MainAxisAlignment.center, children: [ Container( height: allHeight ?? 65.h, color: Colors.white, padding: isPadding == true ? EdgeInsets.only(left: 20.w, right: 10.w) : EdgeInsets.zero, // , top: 20.w, bottom: 20.w child: Row( children: [ // SizedBox(width: 20.w), SizedBox( // width: isHaveRightWidget! ? 100.w : 300.w, child: Text(leftTitel!, style: TextStyle(fontSize: 22.sp))), SizedBox(width: 6.w), isTipsImg == true ? GestureDetector( onTap: tipsImgAction, child: Container( width: 50.h, height: 50.h, padding: EdgeInsets.only(right:10.h, top: 15.h, bottom: 10.h), child: Image.asset( 'images/icon_tips_Q.png', width: 20.w, height: 20.w, ), ), ) : Container(), Expanded(child: SizedBox(width: 10.w)), Row( mainAxisAlignment: MainAxisAlignment.end, children: [ isHaveRightWidget! ? rightWidget! : SizedBox( // width: rightTitle!.isNotEmpty ? 260.w : 0.1.w, child: Text( rightTitle ?? "", textAlign: TextAlign.right, overflow: TextOverflow.ellipsis, maxLines: 2, style: TextStyle( fontSize: 22.sp, color: AppColors.darkGrayTextColor), ), ), ], ), isHaveDirection! ? SizedBox(width: 15.w) : Container(), isHaveDirection! ? Image.asset( 'images/icon_right_grey.png', width: 12.w, height: 21.w, ) : SizedBox(width: 10.w), isHaveDirection! ? SizedBox(width: 5.w) : Container(), ], ), ), // isHaveLine!?Container(height: 0.5.h, color: Colors.grey,):Container() //by DaisyWu isHaveLine! ? Divider( color: AppColors.greyLineColor, indent: isPadding == true ? 20.w : 0, endIndent: isPadding == true ? 20.w : 0, height: 1, ) : Container() ], ), ); } }