refactor: enhance navigation robustness by introducing popSafe and safePushNamedAndRemoveUntil methods and updating their usage.
This commit is contained in:
@@ -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