-
Notifications
You must be signed in to change notification settings - Fork 0
UI: dry-run preview — render server details (predicted rename/actions) #19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
8d4ab62
8cef9ac
091c8d3
d6b01d4
23e1ab0
4260fce
b8dcfea
74aa573
6dd6bd0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,11 @@ | ||
| import 'package:flutter/material.dart'; | ||
| import 'package:flutter_riverpod/flutter_riverpod.dart'; | ||
| import 'package:jive_money/models/category.dart'; | ||
| import 'package:jive_money/models/category_template.dart'; | ||
| import 'package:jive_money/providers/category_provider.dart'; | ||
| import 'package:jive_money/providers/ledger_provider.dart'; | ||
| import 'package:jive_money/services/api/category_service.dart'; | ||
| import 'package:jive_money/widgets/bottom_sheets/import_details_sheet.dart'; | ||
| import '../../models/category.dart'; | ||
| import '../../models/category_template.dart'; | ||
| import '../../providers/category_provider.dart'; | ||
| import '../../providers/ledger_provider.dart'; | ||
| import '../../services/api/category_service.dart'; | ||
| import '../../widgets/bottom_sheets/import_details_sheet.dart'; | ||
|
|
||
| class CategoryManagementEnhancedPage extends ConsumerStatefulWidget { | ||
| const CategoryManagementEnhancedPage({super.key}); | ||
|
|
@@ -17,6 +17,22 @@ class CategoryManagementEnhancedPage extends ConsumerStatefulWidget { | |
| class _CategoryManagementEnhancedPageState extends ConsumerState<CategoryManagementEnhancedPage> { | ||
| bool _busy = false; | ||
|
|
||
| String _renderDryRunSubtitle(ImportActionDetail d) { | ||
| switch (d.action) { | ||
| case 'renamed': | ||
| return '将重命名' + (d.predictedName != null ? ' → ${d.predictedName}' : ''); | ||
| case 'updated': | ||
| return '将覆盖同名分类'; | ||
| case 'skipped': | ||
| return '将跳过' + (d.reason != null ? '(${d.reason})' : ''); | ||
| case 'failed': | ||
| return '预检失败' + (d.reason != null ? '(${d.reason})' : ''); | ||
| case 'imported': | ||
| default: | ||
| return '将创建'; | ||
| } | ||
| } | ||
|
|
||
| @override | ||
| Widget build(BuildContext context) { | ||
| return Scaffold( | ||
|
|
@@ -183,8 +199,8 @@ class _CategoryManagementEnhancedPageState extends ConsumerState<CategoryManagem | |
| final color = (d.action == 'failed' || d.action == 'skipped') ? Colors.orange : Colors.green; | ||
| return ListTile( | ||
| dense: true, | ||
| title: Text(d.finalName ?? d.originalName), | ||
| subtitle: Text(d.action + (d.reason!=null ? ' (${d.reason})' : '')), | ||
| title: Text(d.predictedName ?? d.finalName ?? d.originalName), | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The UI is attempting to use The backend has been updated to provide |
||
| subtitle: Text(_renderDryRunSubtitle(d)), | ||
| trailing: Icon( | ||
| d.action == 'failed' ? Icons.error : (d.action=='skipped'? Icons.warning_amber : Icons.check_circle), | ||
| color: color, | ||
|
|
@@ -239,8 +255,8 @@ class _CategoryManagementEnhancedPageState extends ConsumerState<CategoryManagem | |
| child: const Text('确认导入'), | ||
| ), | ||
| ], | ||
| ), | ||
| ); | ||
| ); | ||
| }); | ||
| }, | ||
| ); | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the 'renamed' case, if predictedName is absent but finalName is present, the subtitle omits the target name. Consider falling back to finalName so users always see the rename target: for example, use final target = d.predictedName ?? d.finalName ?? d.originalName; then return '将重命名 → $target'.
Copilot uses AI. Check for mistakes.