59 lines
1.7 KiB
Dart
59 lines
1.7 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:rasadyar_core/core.dart';
|
|
|
|
Widget labelItem({required String label, String? value, String? unit, VoidCallback? onTap}) {
|
|
String getLabelText(String? value, String? unit) {
|
|
if (value != null && unit != null) {
|
|
return '$value ($unit)';
|
|
} else if (value != null) {
|
|
return value;
|
|
} else {
|
|
return 'بدون مقدار';
|
|
}
|
|
}
|
|
|
|
return GestureDetector(
|
|
onTap: onTap,
|
|
child: Container(
|
|
height: 49.h,
|
|
clipBehavior: Clip.antiAlias,
|
|
padding: EdgeInsets.fromLTRB(8.w, 7.h, 8.w, 7.h),
|
|
decoration: BoxDecoration(
|
|
color: Colors.white,
|
|
borderRadius: BorderRadius.circular(8),
|
|
border: Border.all(width: 1, color: const Color(0xFFB9B9B9)),
|
|
),
|
|
child: Column(
|
|
spacing: 6,
|
|
mainAxisSize: MainAxisSize.min,
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Row(
|
|
mainAxisSize: MainAxisSize.min,
|
|
spacing: 4,
|
|
children: [
|
|
Text(
|
|
label,
|
|
textAlign: TextAlign.right,
|
|
style: AppFonts.yekan10.copyWith(color: AppColor.unselectTextColor),
|
|
),
|
|
|
|
Assets.vec.arrowLeftSvg.svg(
|
|
width: 10.w,
|
|
height: 10.h,
|
|
colorFilter: ColorFilter.mode(AppColor.unselectTextColor, BlendMode.srcIn),
|
|
),
|
|
],
|
|
),
|
|
Text(
|
|
getLabelText(value, unit),
|
|
textAlign: TextAlign.right,
|
|
style: AppFonts.yekan10.copyWith(color: AppColor.iconColor),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|