app-starlock/star_lock/lib/tools/commonItem.dart
2023-07-18 18:10:57 +08:00

58 lines
1.8 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
class CommonItem extends StatelessWidget {
String? leftTitel;
String? rightTitle;
bool? isHaveDirection;
bool? isHaveLine;
bool? isHaveRightWidget;
Widget? rightWidget;
Function()? action;
double? allHeight;
CommonItem({Key? key,
required this.leftTitel,
this.rightTitle,
this.allHeight = 45,
this.isHaveDirection = false,
this.isHaveLine = false,
this.isHaveRightWidget = false,
this.rightWidget, this.action}) : super(key: key);
@override
Widget build(BuildContext context) {
return GestureDetector(
onTap: action,
child: Column(
// mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
height: allHeight??70.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),
Expanded(child: Text(leftTitel!, style: TextStyle(fontSize: 28.sp, fontWeight: FontWeight.w500))),
SizedBox(width:20.w),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
isHaveRightWidget!?rightWidget!:Text(rightTitle!, textAlign: TextAlign.end, style: TextStyle(fontSize: 28.sp, fontWeight: FontWeight.w500),)
],
),
SizedBox(width:5.w),
isHaveDirection!?Image.asset('images/icon_right.png', width: 50.w, height: 50.w,):SizedBox(width:10.w),
// SizedBox(width:10.w),
],
),
),
isHaveLine!?Container(height: 0.5.h, color: Colors.grey,):Container()
],
),
);
}
}