You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
cloudsolutions-atoms/lib/new_views/common_widgets/working_time_tile.dart

76 lines
2.5 KiB
Dart

import 'dart:developer';
import 'package:flutter/material.dart';
import 'package:test_sa/extensions/context_extension.dart';
import 'package:test_sa/extensions/int_extensions.dart';
import 'package:test_sa/extensions/widget_extensions.dart';
import 'package:test_sa/modules/cm_module/utilities/service_request_utils.dart';
import 'package:test_sa/new_views/app_style/app_color.dart';
import 'package:test_sa/views/widgets/total_working_time_detail_bottomsheet.dart';
class WorkingTimeTile extends StatelessWidget {
final List<TimerHistoryModel> timerList;
final double totalWorkingTime;
final String title;
const WorkingTimeTile({
Key? key,
required this.timerList,
required this.totalWorkingTime,
this.title = "Total Working Time",
}) : super(key: key);
@override
Widget build(BuildContext context) {
return Container(
height: 56.toScreenHeight,
padding: EdgeInsets.symmetric(horizontal: 16.toScreenWidth),
alignment: Alignment.centerLeft,
decoration: BoxDecoration(
color: AppColor.fieldBgColor(context),
borderRadius: BorderRadius.circular(10),
boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(0.05),
blurRadius: 10,
)
],
),
child: Row(
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: [
Text(
title,
style: Theme.of(context).textTheme.bodySmall?.copyWith(
color: context.isDark ? null : AppColor.neutral20,
fontWeight: FontWeight.w500,
),
),
Text(
" ${ServiceRequestUtils.formatTotalWorkingHours(totalWorkingTime)}",
style: Theme.of(context).textTheme.bodyMedium,
),
],
).expanded,
8.width,
const Icon(Icons.info_outline_rounded, color: AppColor.primary10),
],
),
).onPress(() async{
await showModalBottomSheet(
context: context,
isDismissible: true,
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.vertical(top: Radius.circular(20)),
),
clipBehavior: Clip.antiAliasWithSaveLayer,
builder: (BuildContext context) =>
TotalWorkingTimeDetailBottomSheet(timerList: timerList),
);
});
}
}