|
|
|
|
@ -7,6 +7,8 @@ import 'package:test_sa/extensions/widget_extensions.dart';
|
|
|
|
|
import 'package:test_sa/models/new_models/work_order_detail_model.dart';
|
|
|
|
|
import 'package:test_sa/modules/cm_module/cm_request_utils.dart';
|
|
|
|
|
import 'package:test_sa/new_views/app_style/app_color.dart';
|
|
|
|
|
import 'package:test_sa/views/widgets/item_views/info_header_widget.dart';
|
|
|
|
|
import 'package:test_sa/models/size_config.dart';
|
|
|
|
|
|
|
|
|
|
class TotalWorkingTimeDetailBottomSheet extends StatelessWidget {
|
|
|
|
|
final List<TimerHistoryModel> timerList;
|
|
|
|
|
@ -15,57 +17,58 @@ class TotalWorkingTimeDetailBottomSheet extends StatelessWidget {
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
return SafeArea(
|
|
|
|
|
child: Container(
|
|
|
|
|
height: MediaQuery.of(context).size.height * 0.5,
|
|
|
|
|
padding: const EdgeInsets.all(16),
|
|
|
|
|
child: Column(
|
|
|
|
|
children: [
|
|
|
|
|
Container(
|
|
|
|
|
width: 40.toScreenWidth,
|
|
|
|
|
height: 5.toScreenHeight,
|
|
|
|
|
decoration: BoxDecoration(color: AppColor.neutral40, borderRadius: BorderRadius.circular(30)),
|
|
|
|
|
),
|
|
|
|
|
8.height,
|
|
|
|
|
Align(
|
|
|
|
|
alignment: AlignmentDirectional.centerStart,
|
|
|
|
|
child: Text(
|
|
|
|
|
"Total Working Time",
|
|
|
|
|
style: AppTextStyles.heading3.copyWith(fontWeight: FontWeight.w600, color: context.isDark ? AppColor.neutral30 : AppColor.neutral50),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
ListView.separated(
|
|
|
|
|
itemCount: timerList.length,
|
|
|
|
|
separatorBuilder: (cxt, index) => const Divider().defaultStyle(context),
|
|
|
|
|
padding: const EdgeInsets.only(top: 16, bottom: 16),
|
|
|
|
|
itemBuilder: (cxt, index) {
|
|
|
|
|
int totalWorkingHours = DateTime.parse(timerList[index].endTime!).difference(DateTime.parse(timerList[index].startTime!)).inSeconds;
|
|
|
|
|
return Column(
|
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
RichText(
|
|
|
|
|
text: TextSpan(
|
|
|
|
|
text: "From: ",
|
|
|
|
|
style: Theme.of(context).textTheme.bodySmall?.copyWith(color: context.isDark ? null : AppColor.neutral20, fontWeight: FontWeight.w500),
|
|
|
|
|
children: [TextSpan(text: timerList[index].startTime!.toServiceRequestDetailsFormatWithSS, style: Theme.of(context).textTheme.bodySmall)])),
|
|
|
|
|
4.height,
|
|
|
|
|
RichText(
|
|
|
|
|
text: TextSpan(
|
|
|
|
|
text: "To: ",
|
|
|
|
|
style: Theme.of(context).textTheme.bodySmall?.copyWith(color: context.isDark ? null : AppColor.neutral20, fontWeight: FontWeight.w500),
|
|
|
|
|
children: [TextSpan(text: timerList[index].endTime!.toServiceRequestDetailsFormatWithSS, style: Theme.of(context).textTheme.bodySmall)])),
|
|
|
|
|
4.height,
|
|
|
|
|
RichText(
|
|
|
|
|
text: TextSpan(
|
|
|
|
|
text: "Duration: ",
|
|
|
|
|
style: Theme.of(context).textTheme.bodySmall?.copyWith(color: context.isDark ? null : AppColor.neutral20, fontWeight: FontWeight.w500),
|
|
|
|
|
children: [TextSpan(text: " ${CMRequestUtils.formatTimerDuration(totalWorkingHours.round())}", style: Theme.of(context).textTheme.bodySmall)])),
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
}).expanded,
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
return SizedBox(
|
|
|
|
|
height: SizeConfig.screenHeight! / 2.2,
|
|
|
|
|
width: SizeConfig.screenWidth,
|
|
|
|
|
child: Column(
|
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
|
// crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Container(
|
|
|
|
|
width: 40.toScreenWidth,
|
|
|
|
|
height: 5.toScreenHeight,
|
|
|
|
|
decoration: BoxDecoration(color: AppColor.neutral40, borderRadius: BorderRadius.circular(30)),
|
|
|
|
|
),
|
|
|
|
|
16.height,
|
|
|
|
|
Align(
|
|
|
|
|
alignment: AlignmentDirectional.centerStart,
|
|
|
|
|
child: InfoHeader16Widget("Total Working Time".addTranslation),
|
|
|
|
|
),
|
|
|
|
|
8.height,
|
|
|
|
|
ListView.separated(
|
|
|
|
|
itemCount: timerList.length,
|
|
|
|
|
separatorBuilder: (cxt, index) => const Divider().defaultStyle(context),
|
|
|
|
|
padding: const EdgeInsets.only(bottom: 16),
|
|
|
|
|
itemBuilder: (cxt, index) {
|
|
|
|
|
int totalWorkingHours = DateTime.parse(timerList[index].endTime!).difference(DateTime.parse(timerList[index].startTime!)).inSeconds;
|
|
|
|
|
return Column(
|
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
RichText(
|
|
|
|
|
text: TextSpan(text: "From: ", style: AppTextStyles.bodyText.copyWith(color: AppColor.lightTextColor(context)), children: [
|
|
|
|
|
TextSpan(
|
|
|
|
|
text: timerList[index].startTime!.toServiceRequestDetailsFormatWithSS,
|
|
|
|
|
style: AppTextStyles.bodyText.copyWith(fontWeight: FontWeight.normal, color: AppColor.lightTextColor(context)))
|
|
|
|
|
])),
|
|
|
|
|
4.height,
|
|
|
|
|
RichText(
|
|
|
|
|
text: TextSpan(text: "To: ", style: AppTextStyles.bodyText.copyWith(color: AppColor.lightTextColor(context)), children: [
|
|
|
|
|
TextSpan(
|
|
|
|
|
text: timerList[index].endTime!.toServiceRequestDetailsFormatWithSS,
|
|
|
|
|
style: AppTextStyles.bodyText.copyWith(fontWeight: FontWeight.normal, color: AppColor.lightTextColor(context)))
|
|
|
|
|
])),
|
|
|
|
|
4.height,
|
|
|
|
|
RichText(
|
|
|
|
|
text: TextSpan(text: "Duration: ", style: AppTextStyles.bodyText.copyWith(color: AppColor.lightTextColor(context)), children: [
|
|
|
|
|
TextSpan(
|
|
|
|
|
text: " ${CMRequestUtils.formatTimerDuration(totalWorkingHours.round())}",
|
|
|
|
|
style: AppTextStyles.bodyText.copyWith(fontWeight: FontWeight.normal, color: AppColor.lightTextColor(context)))
|
|
|
|
|
])),
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
}).expanded,
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|