chengc 2 هفته پیش
والد
کامیت
80774e7080

+ 8 - 8
lib/features/expense/expense_detail_page.dart

@@ -141,17 +141,17 @@ class _ExpenseDetailPageState extends ConsumerState<ExpenseDetailPage>
             padding: const EdgeInsets.all(16),
             child: Column(
               children: [
-                if (_statusLoading && _billStatus == null) ...[
+                if (_statusLoading) ...[
                   const Padding(
                     padding: EdgeInsets.symmetric(vertical: 8),
                     child: Center(child: TDLoading(size: TDLoadingSize.small, icon: TDLoadingIcon.activity)),
                   ),
-                  const SizedBox(height: 8),
-                ],
-                if (_billStatus != null) ...[
-                  _buildStatusBadge(l10n),
-                  const SizedBox(height: 16),
                 ],
+                Builder(builder: (ctx) {
+                  final badge = _buildStatusBadge(l10n);
+                  if (badge == null) return const SizedBox.shrink();
+                  return Column(children: [badge, const SizedBox(height: 16)]);
+                }),
                 _buildBasicInfoSection(expense, l10n, colors),
                 const SizedBox(height: 16),
                 _buildExpenseDetailSection(expense, l10n, colors),
@@ -178,7 +178,7 @@ class _ExpenseDetailPageState extends ConsumerState<ExpenseDetailPage>
   }
 
   // ═══ 状态 badge ═══
-  Widget _buildStatusBadge(AppLocalizations l10n) {
+  Widget? _buildStatusBadge(AppLocalizations l10n) {
     final isClosed = _billStatus?['isClosed'] == true;
     final isTransferred = _billStatus?['isTransferred'] == true;
     final approvalStatus = _billStatus?['approvalStatus'] as String?;
@@ -199,7 +199,7 @@ class _ExpenseDetailPageState extends ConsumerState<ExpenseDetailPage>
       case 'SHCOUNT2':
         return StatusBanner(icon: Icons.block_outlined, statusText: l10n.get('statusReviewRejected'), subText: '', color: Colors.deepOrange);
       default:
-        return const SizedBox.shrink();
+        return null;
     }
   }
 

+ 4 - 2
lib/features/expense/widgets/expense_detail_dialog.dart

@@ -391,8 +391,10 @@ class _ExpenseDetailDialogState extends State<ExpenseDetailDialog> {
                           _buildBankInfoCard(colors),
                           const SizedBox(height: 12),
                           _buildRemarkInput(colors),
-                          const SizedBox(height: 12),
-                          _buildAttachmentCard(colors),
+                          if (widget.initialData == null) ...[
+                            const SizedBox(height: 12),
+                            _buildAttachmentCard(colors),
+                          ],
                         ],
                       ),
                     ),

+ 8 - 8
lib/features/expense_apply/expense_apply_detail_page.dart

@@ -156,17 +156,17 @@ class _ExpenseApplyDetailPageState extends ConsumerState<ExpenseApplyDetailPage>
             padding: const EdgeInsets.all(16),
             child: Column(
               children: [
-                if (_statusLoading && _billStatus == null) ...[
+                if (_statusLoading) ...[
                   const Padding(
                     padding: EdgeInsets.symmetric(vertical: 8),
                     child: Center(child: TDLoading(size: TDLoadingSize.small, icon: TDLoadingIcon.activity)),
                   ),
-                  const SizedBox(height: 8),
-                ],
-                if (_billStatus != null) ...[
-                  _buildStatusBadge(l10n),
-                  const SizedBox(height: 16),
                 ],
+                Builder(builder: (ctx) {
+                  final badge = _buildStatusBadge(l10n);
+                  if (badge == null) return const SizedBox.shrink();
+                  return Column(children: [badge, const SizedBox(height: 16)]);
+                }),
                 _buildBasicInfoSection(app, l10n, colors),
                 const SizedBox(height: 16),
                 _buildExpenseDetailSection(app, l10n, colors),
@@ -195,7 +195,7 @@ class _ExpenseApplyDetailPageState extends ConsumerState<ExpenseApplyDetailPage>
   }
 
   // ═══ 状态徽章 ═══
-  Widget _buildStatusBadge(AppLocalizations l10n) {
+  Widget? _buildStatusBadge(AppLocalizations l10n) {
     final isTransferred = _billStatus?['isTransferred'] == true;
     final approvalStatus = _billStatus?['approvalStatus'] as String?;
 
@@ -212,7 +212,7 @@ class _ExpenseApplyDetailPageState extends ConsumerState<ExpenseApplyDetailPage>
       case 'SHCOUNT2':
         return StatusBanner(icon: Icons.block_outlined, statusText: l10n.get('statusReviewRejected'), subText: '', color: Colors.deepOrange);
       default:
-        return const SizedBox.shrink();
+        return null;
     }
   }