refactor: update navigation methods in ShiftDetailsPage for improved user experience
This commit is contained in:
@@ -4,6 +4,7 @@ import 'package:flutter_modular/flutter_modular.dart';
|
||||
import 'package:krow_domain/krow_domain.dart';
|
||||
import 'package:design_system/design_system.dart'; // Re-added for UiIcons/Colors as they are used in expanded logic
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:staff_shifts/staff_shifts.dart';
|
||||
import '../blocs/shift_details/shift_details_bloc.dart';
|
||||
import '../blocs/shift_details/shift_details_event.dart';
|
||||
import '../blocs/shift_details/shift_details_state.dart';
|
||||
@@ -137,7 +138,7 @@ class ShiftDetailsPage extends StatelessWidget {
|
||||
backgroundColor: const Color(0xFF10B981),
|
||||
),
|
||||
);
|
||||
Modular.to.pop(true); // Return outcome
|
||||
Modular.to.navigateToShiftsHome();
|
||||
} else if (state is ShiftDetailsError) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
@@ -178,8 +179,8 @@ class ShiftDetailsPage extends StatelessWidget {
|
||||
return Scaffold(
|
||||
appBar: UiAppBar(
|
||||
title: displayShift.title,
|
||||
showBackButton: true,
|
||||
centerTitle: false,
|
||||
onLeadingPressed:() => Modular.to.navigateToShiftsHome(),
|
||||
),
|
||||
body: Column(
|
||||
children: [
|
||||
@@ -511,12 +512,11 @@ class ShiftDetailsPage extends StatelessWidget {
|
||||
content: const Text('Do you want to instantly book this shift?'),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.of(ctx).pop(),
|
||||
onPressed: () => Modular.to.pop(),
|
||||
child: const Text('Cancel'),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Navigator.of(ctx).pop();
|
||||
BlocProvider.of<ShiftDetailsBloc>(
|
||||
context,
|
||||
).add(BookShiftDetailsEvent(id, roleId: roleId));
|
||||
@@ -541,12 +541,11 @@ class ShiftDetailsPage extends StatelessWidget {
|
||||
),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.of(ctx).pop(),
|
||||
onPressed: () => Modular.to.pop(),
|
||||
child: const Text('Cancel'),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Navigator.of(ctx).pop();
|
||||
BlocProvider.of<ShiftDetailsBloc>(
|
||||
context,
|
||||
).add(DeclineShiftDetailsEvent(id));
|
||||
|
||||
Reference in New Issue
Block a user