|
|
|
|
@ -10,6 +10,9 @@ import 'package:test_sa/new_views/common_widgets/app_filled_button.dart';
|
|
|
|
|
import 'package:test_sa/new_views/common_widgets/default_app_bar.dart';
|
|
|
|
|
import 'package:test_sa/controllers/api_routes/urls.dart';
|
|
|
|
|
import 'package:test_sa/views/widgets/images/files_list.dart';
|
|
|
|
|
import 'package:test_sa/modules/cm_module/cm_request_utils.dart';
|
|
|
|
|
import 'package:test_sa/views/widgets/timer/app_timer.dart';
|
|
|
|
|
import 'package:test_sa/models/timer_model.dart';
|
|
|
|
|
import 'dart:convert';
|
|
|
|
|
|
|
|
|
|
class OneTimeTaskPreviewScreen extends StatelessWidget {
|
|
|
|
|
@ -124,6 +127,16 @@ class OneTimeTaskPreviewScreen extends StatelessWidget {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Widget _buildWorkingHoursCard(BuildContext context) {
|
|
|
|
|
// Parse timer start time from taskData if available
|
|
|
|
|
DateTime? timerStartTime;
|
|
|
|
|
if (taskData.startTime != null) {
|
|
|
|
|
try {
|
|
|
|
|
timerStartTime = DateTime.parse(taskData.startTime!);
|
|
|
|
|
} catch (e) {
|
|
|
|
|
print('Error parsing start time: $e');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
@ -134,26 +147,50 @@ class OneTimeTaskPreviewScreen extends StatelessWidget {
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: [
|
|
|
|
|
Text(
|
|
|
|
|
'Total Working Hours',
|
|
|
|
|
style: AppTextStyles.bodyText.copyWith(
|
|
|
|
|
color: context.isDark ? AppColor.neutral10 : AppColor.neutral120,
|
|
|
|
|
),
|
|
|
|
|
12.height,
|
|
|
|
|
if (timerStartTime != null)
|
|
|
|
|
AppTimer(
|
|
|
|
|
label: 'Working Time',
|
|
|
|
|
timer: TimerModel(
|
|
|
|
|
startAt: timerStartTime,
|
|
|
|
|
endAt: null,
|
|
|
|
|
durationInSecond: 0,
|
|
|
|
|
),
|
|
|
|
|
Text(
|
|
|
|
|
'${totalWorkingHours.toStringAsFixed(2)} hrs',
|
|
|
|
|
style: AppTextStyles.heading6.copyWith(
|
|
|
|
|
color: context.isDark ? AppColor.neutral10 : AppColor.neutral120,
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
),
|
|
|
|
|
enabled: false, // Disable controls, just show the timer
|
|
|
|
|
showTimer: true,
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
color: context.isDark ? AppColor.neutral20.withValues(alpha: 0.5) : AppColor.neutral10.withValues(alpha: 0.1),
|
|
|
|
|
borderRadius: BorderRadius.circular(8),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
).paddingAll(12),
|
|
|
|
|
)
|
|
|
|
|
else
|
|
|
|
|
Container(
|
|
|
|
|
padding: const EdgeInsets.all(12),
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
color: context.isDark ? AppColor.neutral20.withValues(alpha: 0.5) : AppColor.neutral10.withValues(alpha: 0.1),
|
|
|
|
|
borderRadius: BorderRadius.circular(8),
|
|
|
|
|
),
|
|
|
|
|
child: Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: [
|
|
|
|
|
Text(
|
|
|
|
|
'Total Working Hours',
|
|
|
|
|
style: AppTextStyles.bodyText.copyWith(
|
|
|
|
|
color: context.isDark ? AppColor.neutral10 : AppColor.neutral120,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Text(
|
|
|
|
|
CMRequestUtils.formatTotalWorkingHours(totalWorkingHours),
|
|
|
|
|
style: AppTextStyles.heading6.copyWith(
|
|
|
|
|
color: context.isDark ? AppColor.neutral10 : AppColor.neutral120,
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
).toShadowContainer(context, padding: 12);
|
|
|
|
|
).toShadowContainer(context, padding: 16);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Widget _buildChecklistCard(BuildContext context) {
|
|
|
|
|
|