refactor: remove redundant pushShiftDetails navigation method and update its usages to toShiftDetails.
This commit is contained in:
@@ -159,15 +159,6 @@ extension StaffNavigator on IModularNavigator {
|
||||
navigate(StaffPaths.shiftDetails(shift.id), arguments: shift);
|
||||
}
|
||||
|
||||
/// Pushes the shift details page (alternative method).
|
||||
///
|
||||
/// Same as [toShiftDetails] but using pushNamed instead of navigate.
|
||||
/// Use this when you want to add the details page to the stack rather
|
||||
/// than replacing the current route.
|
||||
void pushShiftDetails(Shift shift) {
|
||||
pushNamed(StaffPaths.shiftDetails(shift.id), arguments: shift);
|
||||
}
|
||||
|
||||
// ==========================================================================
|
||||
// ONBOARDING & PROFILE SECTIONS
|
||||
// ==========================================================================
|
||||
|
||||
@@ -2,9 +2,8 @@ import 'package:core_localization/core_localization.dart';
|
||||
import 'package:design_system/design_system.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_modular/flutter_modular.dart';
|
||||
import 'package:krow_domain/krow_domain.dart';
|
||||
|
||||
import 'package:krow_core/core.dart';
|
||||
import 'package:krow_domain/krow_domain.dart';
|
||||
|
||||
class RecommendedShiftCard extends StatelessWidget {
|
||||
final Shift shift;
|
||||
@@ -17,7 +16,7 @@ class RecommendedShiftCard extends StatelessWidget {
|
||||
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
Modular.to.pushShiftDetails(shift);
|
||||
Modular.to.toShiftDetails(shift);
|
||||
},
|
||||
child: Container(
|
||||
width: 300,
|
||||
@@ -43,7 +42,9 @@ class RecommendedShiftCard extends StatelessWidget {
|
||||
children: [
|
||||
Text(
|
||||
recI18n.act_now,
|
||||
style: UiTypography.body3m.copyWith(color: UiColors.textError),
|
||||
style: UiTypography.body3m.copyWith(
|
||||
color: UiColors.textError,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: UiConstants.space2),
|
||||
Container(
|
||||
@@ -71,7 +72,9 @@ class RecommendedShiftCard extends StatelessWidget {
|
||||
height: UiConstants.space10,
|
||||
decoration: BoxDecoration(
|
||||
color: UiColors.tagInProgress,
|
||||
borderRadius: BorderRadius.circular(UiConstants.radiusBase),
|
||||
borderRadius: BorderRadius.circular(
|
||||
UiConstants.radiusBase,
|
||||
),
|
||||
),
|
||||
child: const Icon(
|
||||
UiIcons.calendar,
|
||||
@@ -128,10 +131,7 @@ class RecommendedShiftCard extends StatelessWidget {
|
||||
color: UiColors.mutedForeground,
|
||||
),
|
||||
const SizedBox(width: UiConstants.space1),
|
||||
Text(
|
||||
recI18n.today,
|
||||
style: UiTypography.body3r.textSecondary,
|
||||
),
|
||||
Text(recI18n.today, style: UiTypography.body3r.textSecondary),
|
||||
const SizedBox(width: UiConstants.space3),
|
||||
const Icon(
|
||||
UiIcons.clock,
|
||||
|
||||
@@ -60,7 +60,8 @@ class _ShiftCardState extends State<ShiftCard> {
|
||||
final date = DateTime.parse(dateStr);
|
||||
final diff = DateTime.now().difference(date);
|
||||
if (diff.inHours < 1) return t.staff_shifts.card.just_now;
|
||||
if (diff.inHours < 24) return t.staff_shifts.details.pending_time(time: '${diff.inHours}h');
|
||||
if (diff.inHours < 24)
|
||||
return t.staff_shifts.details.pending_time(time: '${diff.inHours}h');
|
||||
return t.staff_shifts.details.pending_time(time: '${diff.inDays}d');
|
||||
} catch (e) {
|
||||
return '';
|
||||
@@ -75,7 +76,7 @@ class _ShiftCardState extends State<ShiftCard> {
|
||||
? null
|
||||
: () {
|
||||
setState(() => isExpanded = !isExpanded);
|
||||
Modular.to.pushShiftDetails(widget.shift);
|
||||
Modular.to.toShiftDetails(widget.shift);
|
||||
},
|
||||
child: Container(
|
||||
margin: const EdgeInsets.only(bottom: UiConstants.space3),
|
||||
@@ -97,17 +98,15 @@ class _ShiftCardState extends State<ShiftCard> {
|
||||
),
|
||||
child: widget.shift.logoUrl != null
|
||||
? ClipRRect(
|
||||
borderRadius:
|
||||
BorderRadius.circular(UiConstants.radiusBase),
|
||||
borderRadius: BorderRadius.circular(
|
||||
UiConstants.radiusBase,
|
||||
),
|
||||
child: Image.network(
|
||||
widget.shift.logoUrl!,
|
||||
fit: BoxFit.contain,
|
||||
),
|
||||
)
|
||||
: Icon(
|
||||
UiIcons.building,
|
||||
color: UiColors.mutedForeground,
|
||||
),
|
||||
: Icon(UiIcons.building, color: UiColors.mutedForeground),
|
||||
),
|
||||
const SizedBox(width: UiConstants.space3),
|
||||
Expanded(
|
||||
@@ -129,10 +128,7 @@ class _ShiftCardState extends State<ShiftCard> {
|
||||
text: '\$${widget.shift.hourlyRate}',
|
||||
style: UiTypography.body1b.textPrimary,
|
||||
children: [
|
||||
TextSpan(
|
||||
text: '/h',
|
||||
style: UiTypography.body3r,
|
||||
),
|
||||
TextSpan(text: '/h', style: UiTypography.body3r),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -186,13 +182,16 @@ class _ShiftCardState extends State<ShiftCard> {
|
||||
height: UiConstants.space14,
|
||||
decoration: BoxDecoration(
|
||||
color: UiColors.white,
|
||||
borderRadius: BorderRadius.circular(UiConstants.radiusBase),
|
||||
borderRadius: BorderRadius.circular(
|
||||
UiConstants.radiusBase,
|
||||
),
|
||||
border: Border.all(color: UiColors.border),
|
||||
),
|
||||
child: widget.shift.logoUrl != null
|
||||
? ClipRRect(
|
||||
borderRadius:
|
||||
BorderRadius.circular(UiConstants.radiusBase),
|
||||
borderRadius: BorderRadius.circular(
|
||||
UiConstants.radiusBase,
|
||||
),
|
||||
child: Image.network(
|
||||
widget.shift.logoUrl!,
|
||||
fit: BoxFit.contain,
|
||||
@@ -251,10 +250,7 @@ class _ShiftCardState extends State<ShiftCard> {
|
||||
text: '\$${widget.shift.hourlyRate}',
|
||||
style: UiTypography.headline3m.textPrimary,
|
||||
children: [
|
||||
TextSpan(
|
||||
text: '/h',
|
||||
style: UiTypography.body1r,
|
||||
),
|
||||
TextSpan(text: '/h', style: UiTypography.body1r),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -336,8 +332,9 @@ class _ShiftCardState extends State<ShiftCard> {
|
||||
foregroundColor: UiColors.white,
|
||||
elevation: 0,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius:
|
||||
BorderRadius.circular(UiConstants.radiusBase),
|
||||
borderRadius: BorderRadius.circular(
|
||||
UiConstants.radiusBase,
|
||||
),
|
||||
),
|
||||
),
|
||||
child: Text(t.staff_shifts.card.accept_shift),
|
||||
@@ -355,8 +352,9 @@ class _ShiftCardState extends State<ShiftCard> {
|
||||
color: UiColors.destructive.withValues(alpha: 0.3),
|
||||
),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius:
|
||||
BorderRadius.circular(UiConstants.radiusBase),
|
||||
borderRadius: BorderRadius.circular(
|
||||
UiConstants.radiusBase,
|
||||
),
|
||||
),
|
||||
),
|
||||
child: Text(t.staff_shifts.card.decline_shift),
|
||||
|
||||
@@ -9,10 +9,7 @@ import '../shared/empty_state_view.dart';
|
||||
class HistoryShiftsTab extends StatelessWidget {
|
||||
final List<Shift> historyShifts;
|
||||
|
||||
const HistoryShiftsTab({
|
||||
super.key,
|
||||
required this.historyShifts,
|
||||
});
|
||||
const HistoryShiftsTab({super.key, required this.historyShifts});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -33,10 +30,8 @@ class HistoryShiftsTab extends StatelessWidget {
|
||||
(shift) => Padding(
|
||||
padding: const EdgeInsets.only(bottom: UiConstants.space3),
|
||||
child: GestureDetector(
|
||||
onTap: () => Modular.to.pushShiftDetails(shift),
|
||||
child: MyShiftCard(
|
||||
shift: shift,
|
||||
),
|
||||
onTap: () => Modular.to.toShiftDetails(shift),
|
||||
child: MyShiftCard(shift: shift),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user