refactor: enhance navigation robustness by introducing popSafe and safePushNamedAndRemoveUntil methods and updating their usage.
This commit is contained in:
@@ -3,6 +3,7 @@ import 'package:design_system/design_system.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:flutter_modular/flutter_modular.dart';
|
||||
import 'package:krow_core/core.dart';
|
||||
|
||||
import '../blocs/billing_bloc.dart';
|
||||
import '../blocs/billing_state.dart';
|
||||
@@ -20,6 +21,7 @@ class PendingInvoicesPage extends StatelessWidget {
|
||||
appBar: UiAppBar(
|
||||
title: t.client_billing.awaiting_approval,
|
||||
showBackButton: true,
|
||||
onLeadingPressed: () => Modular.to.toClientBilling(),
|
||||
),
|
||||
body: _buildBody(context, state),
|
||||
);
|
||||
|
||||
@@ -46,19 +46,19 @@ class ClientMainCubit extends Cubit<ClientMainState> implements Disposable {
|
||||
|
||||
switch (index) {
|
||||
case 0:
|
||||
Modular.to.navigate(ClientPaths.coverage);
|
||||
Modular.to.toClientCoverage();
|
||||
break;
|
||||
case 1:
|
||||
Modular.to.navigate(ClientPaths.billing);
|
||||
Modular.to.toClientBilling();
|
||||
break;
|
||||
case 2:
|
||||
Modular.to.navigate(ClientPaths.home);
|
||||
Modular.to.toClientHome();
|
||||
break;
|
||||
case 3:
|
||||
Modular.to.navigate(ClientPaths.orders);
|
||||
Modular.to.toClientOrders();
|
||||
break;
|
||||
case 4:
|
||||
Modular.to.navigate(ClientPaths.reports);
|
||||
Modular.to.toClientReports();
|
||||
break;
|
||||
}
|
||||
// State update will happen via _onRouteChanged
|
||||
|
||||
@@ -80,7 +80,7 @@ class _RapidOrderFormState extends State<_RapidOrderForm> {
|
||||
subtitle: labels.subtitle,
|
||||
date: dateStr,
|
||||
time: timeStr,
|
||||
onBack: () => Modular.to.navigate(ClientPaths.createOrder),
|
||||
onBack: () => Modular.to.toCreateOrder(),
|
||||
),
|
||||
|
||||
// Content
|
||||
|
||||
@@ -2,13 +2,13 @@ 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_core/core.dart';
|
||||
|
||||
/// A quick report card widget for navigating to specific reports.
|
||||
///
|
||||
/// Displays an icon, name, and a quick navigation to a report page.
|
||||
/// Used in the quick reports grid of the reports page.
|
||||
class ReportCard extends StatelessWidget {
|
||||
|
||||
const ReportCard({
|
||||
super.key,
|
||||
required this.icon,
|
||||
@@ -17,6 +17,7 @@ class ReportCard extends StatelessWidget {
|
||||
required this.iconColor,
|
||||
required this.route,
|
||||
});
|
||||
|
||||
/// The icon to display for this report.
|
||||
final IconData icon;
|
||||
|
||||
@@ -35,7 +36,7 @@ class ReportCard extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GestureDetector(
|
||||
onTap: () => Modular.to.pushNamed(route),
|
||||
onTap: () => Modular.to.safePush(route),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
@@ -86,8 +87,7 @@ class ReportCard extends StatelessWidget {
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
Text(
|
||||
context.t.client_reports.quick_reports
|
||||
.two_click_export,
|
||||
context.t.client_reports.quick_reports.two_click_export,
|
||||
style: const TextStyle(
|
||||
fontSize: 12,
|
||||
color: UiColors.textSecondary,
|
||||
|
||||
Reference in New Issue
Block a user