Pārlūkot izejas kodu

fix: change context.go to context.push for proper navigation stack

chengc 6 dienas atpakaļ
vecāks
revīzija
e25c40dc14

+ 1 - 1
lib/features/announcement/announcement_list_page.dart

@@ -47,7 +47,7 @@ class _AnnouncementListPageState extends ConsumerState<AnnouncementListPage> {
 
   Widget _buildItem(AnnouncementModel item) {
     return AppCard(
-      onTap: () => context.go('/announcement/detail/${item.id}'),
+      onTap: () => context.push('/announcement/detail/${item.id}'),
       child: Column(
         crossAxisAlignment: CrossAxisAlignment.start,
         children: [

+ 3 - 3
lib/features/expense/expense_list_page.dart

@@ -32,7 +32,7 @@ class _ExpenseListPageState extends ConsumerState<ExpenseListPage> {
         title: const Text('报销单'),
         actions: [
           TextButton(
-            onPressed: () => context.go('/expense/apply'),
+            onPressed: () => context.push('/expense/apply'),
             child: const Text('+ 新建',
                 style: TextStyle(color: Colors.white, fontSize: 13)),
           ),
@@ -129,7 +129,7 @@ class _ExpenseListPageState extends ConsumerState<ExpenseListPage> {
         motion: const ScrollMotion(),
         children: [
           SlidableAction(
-            onPressed: (_) => context.go('/expense/apply?id=${item.id}'),
+            onPressed: (_) => context.push('/expense/apply?id=${item.id}'),
             backgroundColor: AppColors.primary,
             foregroundColor: Colors.white,
             icon: Icons.edit,
@@ -138,7 +138,7 @@ class _ExpenseListPageState extends ConsumerState<ExpenseListPage> {
         ],
       ),
       child: AppCard(
-        onTap: () => context.go('/expense/detail/${item.id}'),
+        onTap: () => context.push('/expense/detail/${item.id}'),
         child: Column(
           crossAxisAlignment: CrossAxisAlignment.start,
           children: [

+ 5 - 5
lib/features/home/home_page.dart

@@ -58,21 +58,21 @@ class HomePage extends ConsumerWidget {
                 label: '报销',
                 badge: '${summary.expensePending}待办',
                 color: AppColors.primary,
-                onTap: () => context.go('/expense/list'),
+                onTap: () => context.push('/expense/list'),
               ),
               _EntryItem(
                 icon: Icons.access_time,
                 label: '加班',
                 badge: '${summary.overtimePending}待办',
                 color: AppColors.primary,
-                onTap: () => context.go('/overtime/list'),
+                onTap: () => context.push('/overtime/list'),
               ),
               _EntryItem(
                 icon: Icons.directions_car,
                 label: '用车',
                 badge: '${summary.vehiclePending}待办',
                 color: AppColors.warning,
-                onTap: () => context.go('/vehicle/list'),
+                onTap: () => context.push('/vehicle/list'),
               ),
             ],
           ),
@@ -86,7 +86,7 @@ class HomePage extends ConsumerWidget {
                 label: '外出日志',
                 badge: '${summary.logCount}条',
                 color: AppColors.success,
-                onTap: () => context.go('/outing-log/list'),
+                onTap: () => context.push('/outing-log/list'),
               ),
               _EntryItem(
                 icon: Icons.campaign,
@@ -95,7 +95,7 @@ class HomePage extends ConsumerWidget {
                     ? '${summary.announcementUnread}未读'
                     : '${summary.announcementCount}条',
                 color: const Color(0xFF722ED1),
-                onTap: () => context.go('/announcement/list'),
+                onTap: () => context.push('/announcement/list'),
               ),
               _EntryItem(
                 icon: Icons.description,

+ 2 - 2
lib/features/outing_log/outing_log_list_page.dart

@@ -29,7 +29,7 @@ class _OutingLogListPageState extends ConsumerState<OutingLogListPage> {
         title: const Text('外出日志'),
         actions: [
           TextButton(
-            onPressed: () => context.go('/outing-log/create'),
+            onPressed: () => context.push('/outing-log/create'),
             child: const Text('+ 新建', style: TextStyle(color: Colors.white, fontSize: 13)),
           ),
         ],
@@ -55,7 +55,7 @@ class _OutingLogListPageState extends ConsumerState<OutingLogListPage> {
 
   Widget _buildItem(OutingLogModel item) {
     return AppCard(
-      onTap: () => context.go('/outing-log/detail/${item.id}'),
+      onTap: () => context.push('/outing-log/detail/${item.id}'),
       child: Column(
         crossAxisAlignment: CrossAxisAlignment.start,
         children: [

+ 3 - 3
lib/features/overtime/overtime_list_page.dart

@@ -32,7 +32,7 @@ class _OvertimeListPageState extends ConsumerState<OvertimeListPage> {
         title: const Text('加班申请'),
         actions: [
           TextButton(
-            onPressed: () => context.go('/overtime/apply'),
+            onPressed: () => context.push('/overtime/apply'),
             child: const Text('+ 新建',
                 style: TextStyle(color: Colors.white, fontSize: 13)),
           ),
@@ -125,7 +125,7 @@ class _OvertimeListPageState extends ConsumerState<OvertimeListPage> {
         motion: const ScrollMotion(),
         children: [
           SlidableAction(
-            onPressed: (_) => context.go('/overtime/apply?id=${item.id}'),
+            onPressed: (_) => context.push('/overtime/apply?id=${item.id}'),
             backgroundColor: AppColors.primary,
             foregroundColor: Colors.white,
             icon: Icons.edit,
@@ -134,7 +134,7 @@ class _OvertimeListPageState extends ConsumerState<OvertimeListPage> {
         ],
       ),
       child: AppCard(
-        onTap: () => context.go('/overtime/detail/${item.id}'),
+        onTap: () => context.push('/overtime/detail/${item.id}'),
         child: Column(
           crossAxisAlignment: CrossAxisAlignment.start,
           children: [

+ 3 - 3
lib/features/vehicle/vehicle_list_page.dart

@@ -32,7 +32,7 @@ class _VehicleListPageState extends ConsumerState<VehicleListPage> {
         title: const Text('用车申请'),
         actions: [
           TextButton(
-            onPressed: () => context.go('/vehicle/apply'),
+            onPressed: () => context.push('/vehicle/apply'),
             child: const Text('+ 新建', style: TextStyle(color: Colors.white, fontSize: 13)),
           ),
         ],
@@ -110,14 +110,14 @@ class _VehicleListPageState extends ConsumerState<VehicleListPage> {
         motion: const ScrollMotion(),
         children: [
           SlidableAction(
-            onPressed: (_) => context.go('/vehicle/apply?id=${item.id}'),
+            onPressed: (_) => context.push('/vehicle/apply?id=${item.id}'),
             backgroundColor: AppColors.primary, foregroundColor: Colors.white,
             icon: Icons.edit, label: '编辑',
           ),
         ],
       ),
       child: AppCard(
-        onTap: () => context.go('/vehicle/detail/${item.id}'),
+        onTap: () => context.push('/vehicle/detail/${item.id}'),
         child: Column(
           crossAxisAlignment: CrossAxisAlignment.start,
           children: [