app-starlock/star_lock/lib/tools/commonItem.dart
2024-01-19 11:09:46 +08:00

98 lines
3.1 KiB
Dart

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;
double? allHeight;
bool? isTipsImg;
CommonItem(
{Key? key,
required this.leftTitel,
this.rightTitle,
this.allHeight,
this.isHaveDirection = false,
this.isHaveLine = false,
this.isHaveRightWidget = false,
this.rightWidget,
this.isTipsImg,
this.action})
: 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: EdgeInsets.only(
left: 20.w, right: 10.w), // , 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
? 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!
: Text(
rightTitle ?? "",
textAlign: TextAlign.right,
overflow: TextOverflow.ellipsis,
maxLines: 2,
style: TextStyle(fontSize: 22.sp, color: AppColors.darkGrayTextColor),
),
],
),
isHaveDirection! ? SizedBox(width: 3.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: 20.w,
endIndent: 20.w,
height: 1,
)
: Container()
],
),
);
}
}