app-starlock/star_lock/lib/tools/commonItem.dart

58 lines
1.8 KiB
Dart
Raw Normal View History

2023-07-10 17:50:31 +08:00
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
class CommonItem extends StatelessWidget {
2023-07-15 15:11:28 +08:00
String? leftTitel;
String? rightTitle;
bool? isHaveDirection;
bool? isHaveLine;
bool? isHaveRightWidget;
Widget? rightWidget;
Function()? action;
double? allHeight;
2023-07-10 17:50:31 +08:00
2023-07-18 18:10:57 +08:00
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);
2023-07-10 17:50:31 +08:00
@override
Widget build(BuildContext context) {
return GestureDetector(
onTap: action,
child: Column(
// mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
height: allHeight??70.h,
color: Colors.white,
2023-07-18 18:10:57 +08:00
padding: EdgeInsets.only(left:20.w, right: 10.w),// , top: 20.w, bottom: 20.w
2023-07-10 17:50:31 +08:00
child: Row(
children: [
SizedBox(width:20.w),
2023-07-15 15:11:28 +08:00
Expanded(child: Text(leftTitel!, style: TextStyle(fontSize: 28.sp, fontWeight: FontWeight.w500))),
2023-07-10 17:50:31 +08:00
SizedBox(width:20.w),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
2023-07-15 15:11:28 +08:00
isHaveRightWidget!?rightWidget!:Text(rightTitle!, textAlign: TextAlign.end, style: TextStyle(fontSize: 28.sp, fontWeight: FontWeight.w500),)
2023-07-10 17:50:31 +08:00
],
),
SizedBox(width:5.w),
2023-07-15 15:11:28 +08:00
isHaveDirection!?Image.asset('images/icon_right.png', width: 50.w, height: 50.w,):SizedBox(width:10.w),
2023-07-10 17:50:31 +08:00
// SizedBox(width:10.w),
],
),
),
2023-07-15 15:11:28 +08:00
isHaveLine!?Container(height: 0.5.h, color: Colors.grey,):Container()
2023-07-10 17:50:31 +08:00
],
),
);
}
}