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