refactor(clock_in): rename error handling variable for clarity in check-in interactions

This commit is contained in:
Achintha Isuru
2026-03-14 20:28:28 -04:00
parent 10bd61b250
commit f6de07fc25
7 changed files with 28 additions and 26 deletions

View File

@@ -16,7 +16,7 @@ abstract class CheckInInteraction {
required bool isCheckedIn,
required bool isDisabled,
required bool isLoading,
required bool hasError,
required bool hasClockinError,
required VoidCallback onCheckIn,
required VoidCallback onCheckOut,
});

View File

@@ -21,7 +21,7 @@ class NfcCheckInInteraction implements CheckInInteraction {
required bool isCheckedIn,
required bool isDisabled,
required bool isLoading,
required bool hasError,
required bool hasClockinError,
required VoidCallback onCheckIn,
required VoidCallback onCheckOut,
}) {

View File

@@ -16,7 +16,7 @@ class SwipeCheckInInteraction implements CheckInInteraction {
required bool isCheckedIn,
required bool isDisabled,
required bool isLoading,
required bool hasError,
required bool hasClockinError,
required VoidCallback onCheckIn,
required VoidCallback onCheckOut,
}) {
@@ -24,7 +24,7 @@ class SwipeCheckInInteraction implements CheckInInteraction {
isCheckedIn: isCheckedIn,
isDisabled: isDisabled,
isLoading: isLoading,
hasError: hasError,
hasClockinError: hasClockinError,
onCheckIn: onCheckIn,
onCheckOut: onCheckOut,
);

View File

@@ -5,6 +5,7 @@ import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_modular/flutter_modular.dart';
import 'package:krow_core/core.dart';
import 'package:krow_domain/krow_domain.dart';
import 'package:staff_clock_in/src/presentation/widgets/early_check_in_banner.dart';
import '../../domain/validators/clock_in_validation_context.dart';
import '../../domain/validators/validators/time_window_validator.dart';
@@ -34,7 +35,7 @@ class ClockInActionSection extends StatelessWidget {
required this.checkOutTime,
required this.checkInMode,
required this.isActionInProgress,
this.hasError = false,
this.hasClockinError = false,
super.key,
});
@@ -61,7 +62,7 @@ class ClockInActionSection extends StatelessWidget {
final bool isActionInProgress;
/// Whether the last action attempt resulted in an error.
final bool hasError;
final bool hasClockinError;
/// Resolves the [CheckInInteraction] for the current mode.
///
@@ -84,21 +85,21 @@ class ClockInActionSection extends StatelessWidget {
/// Builds the action widget for an active (not completed) shift.
Widget _buildActiveShiftAction(BuildContext context) {
// if (!isCheckedIn && !_isCheckInAllowed(selectedShift!)) {
// return Column(
// mainAxisSize: MainAxisSize.min,
// children: <Widget>[
// const GeofenceStatusBanner(),
// const SizedBox(height: UiConstants.space3),
// EarlyCheckInBanner(
// availabilityTime: _getAvailabilityTimeText(
// selectedShift!,
// context,
// ),
// ),
// ],
// );
// }
if (!isCheckedIn && !_isCheckInAllowed(selectedShift!)) {
return Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
const GeofenceStatusBanner(),
const SizedBox(height: UiConstants.space3),
EarlyCheckInBanner(
availabilityTime: _getAvailabilityTimeText(
selectedShift!,
context,
),
),
],
);
}
return BlocBuilder<GeofenceBloc, GeofenceState>(
builder: (BuildContext context, GeofenceState geofenceState) {
@@ -122,7 +123,7 @@ class ClockInActionSection extends StatelessWidget {
isCheckedIn: isCheckedIn,
isDisabled: isGeofenceBlocking,
isLoading: isActionInProgress,
hasError: hasError,
hasClockinError: hasClockinError,
onCheckIn: () => _handleCheckIn(context),
onCheckOut: () => _handleCheckOut(context),
),

View File

@@ -111,7 +111,7 @@ class _ClockInBodyState extends State<ClockInBody> {
checkInMode: state.checkInMode,
isActionInProgress:
state.status == ClockInStatus.actionInProgress,
hasError: state.status == ClockInStatus.failure,
hasClockinError: state.status == ClockInStatus.failure,
),
// checked-in banner (only when checked in to the selected shift)

View File

@@ -17,7 +17,7 @@ class SwipeToCheckIn extends StatefulWidget {
this.isLoading = false,
this.isCheckedIn = false,
this.isDisabled = false,
this.hasError = false,
this.hasClockinError = false,
});
/// Called when the user completes the swipe to check in.
@@ -36,7 +36,7 @@ class SwipeToCheckIn extends StatefulWidget {
final bool isDisabled;
/// Whether an error occurred during the last action attempt.
final bool hasError;
final bool hasClockinError;
@override
State<SwipeToCheckIn> createState() => _SwipeToCheckInState();
@@ -62,7 +62,7 @@ class _SwipeToCheckInState extends State<SwipeToCheckIn>
if (_isComplete &&
widget.isCheckedIn == oldWidget.isCheckedIn &&
((oldWidget.isLoading && !widget.isLoading) ||
(!oldWidget.hasError && widget.hasError))) {
(!oldWidget.hasClockinError && widget.hasClockinError))) {
setState(() {
_isComplete = false;
_dragValue = 0.0;