refactor: simplify widget structure and improve date selection logic in clock-in features
This commit is contained in:
@@ -155,7 +155,9 @@ class _ShiftDetailsPageState extends State<ShiftDetailsPage> {
|
||||
),
|
||||
),
|
||||
ShiftDetailsHeader(shift: displayShift),
|
||||
|
||||
const Divider(height: 1, thickness: 0.5),
|
||||
|
||||
ShiftStatsRow(
|
||||
estimatedTotal: estimatedTotal,
|
||||
hourlyRate: displayShift.hourlyRate,
|
||||
@@ -164,7 +166,9 @@ class _ShiftDetailsPageState extends State<ShiftDetailsPage> {
|
||||
hourlyRateLabel: i18n.hourly_rate,
|
||||
hoursLabel: i18n.hours,
|
||||
),
|
||||
|
||||
const Divider(height: 1, thickness: 0.5),
|
||||
|
||||
ShiftDateTimeSection(
|
||||
date: displayShift.date,
|
||||
endDate: displayShift.endDate,
|
||||
|
||||
@@ -8,93 +8,67 @@ class ShiftDetailsHeader extends StatelessWidget {
|
||||
final Shift shift;
|
||||
|
||||
/// Creates a [ShiftDetailsHeader].
|
||||
const ShiftDetailsHeader({
|
||||
super.key,
|
||||
required this.shift,
|
||||
});
|
||||
const ShiftDetailsHeader({super.key, required this.shift});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(UiConstants.space5),
|
||||
child: IntrinsicHeight(
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
spacing: UiConstants.space4,
|
||||
children: [
|
||||
Container(
|
||||
width: 114,
|
||||
decoration: BoxDecoration(
|
||||
color: UiColors.primary.withAlpha(20),
|
||||
borderRadius: BorderRadius.circular(
|
||||
UiConstants.radiusBase,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
spacing: UiConstants.space4,
|
||||
children: [
|
||||
// Icon + role name + client name
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
spacing: UiConstants.space4,
|
||||
children: [
|
||||
Container(
|
||||
width: 68,
|
||||
height: 68,
|
||||
decoration: BoxDecoration(
|
||||
color: UiColors.primary.withAlpha(20),
|
||||
borderRadius: UiConstants.radiusLg,
|
||||
border: Border.all(color: UiColors.primary, width: 0.5),
|
||||
),
|
||||
border: Border.all(color: UiColors.primary),
|
||||
),
|
||||
child: const Center(
|
||||
child: Icon(
|
||||
UiIcons.briefcase,
|
||||
color: UiColors.primary,
|
||||
size: 24,
|
||||
child: const Center(
|
||||
child: Icon(
|
||||
UiIcons.briefcase,
|
||||
color: UiColors.primary,
|
||||
size: 20,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
spacing: UiConstants.space3,
|
||||
children: [
|
||||
Text(
|
||||
shift.title,
|
||||
style: UiTypography.headline1b.textPrimary,
|
||||
),
|
||||
Column(
|
||||
spacing: UiConstants.space1,
|
||||
children: [
|
||||
// Client name
|
||||
Row(
|
||||
spacing: UiConstants.space1,
|
||||
children: [
|
||||
const Icon(
|
||||
UiIcons.building,
|
||||
size: 16,
|
||||
color: UiColors.textSecondary,
|
||||
),
|
||||
Expanded(
|
||||
child: Text(
|
||||
shift.clientName,
|
||||
style: UiTypography.body1m.textSecondary,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
// Location address (if available)
|
||||
Row(
|
||||
spacing: UiConstants.space1,
|
||||
children: [
|
||||
const Icon(
|
||||
UiIcons.mapPin,
|
||||
size: 16,
|
||||
color: UiColors.textSecondary,
|
||||
),
|
||||
Expanded(
|
||||
child: Text(
|
||||
shift.locationAddress,
|
||||
style: UiTypography.body2r.textSecondary,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
],
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(shift.title, style: UiTypography.headline1b.textPrimary),
|
||||
Text(shift.clientName, style: UiTypography.body1m.textSecondary),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
// Location address
|
||||
Row(
|
||||
spacing: UiConstants.space1,
|
||||
children: [
|
||||
const Icon(
|
||||
UiIcons.mapPin,
|
||||
size: 16,
|
||||
color: UiColors.textSecondary,
|
||||
),
|
||||
Expanded(
|
||||
child: Text(
|
||||
shift.locationAddress,
|
||||
style: UiTypography.body2r.textSecondary,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user