-
Notifications
You must be signed in to change notification settings - Fork 0
flutter: transactions Phase A — search/filter bar + grouping scaffold #65
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
9d1eeae
6301183
c1a00d2
139d958
cb8f290
f187d07
741b89f
51c6be6
39c2f5f
a1e7950
d4124c3
3973474
bff7320
927ac93
7a4f9ce
9824fca
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 | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -11,6 +11,10 @@ import 'package:flutter_riverpod/flutter_riverpod.dart'; | |||||||||||||
| typedef TransactionData = Transaction; | ||||||||||||||
|
|
||||||||||||||
| class TransactionList extends ConsumerWidget { | ||||||||||||||
| // Phase A: lightweight search/group controls | ||||||||||||||
| final ValueChanged<String>? onSearch; | ||||||||||||||
| final VoidCallback? onClearSearch; | ||||||||||||||
| final VoidCallback? onToggleGroup; | ||||||||||||||
|
Comment on lines
+14
to
+17
|
||||||||||||||
| final List<TransactionData> transactions; | ||||||||||||||
| final bool groupByDate; | ||||||||||||||
| final bool showSearchBar; | ||||||||||||||
|
|
@@ -36,6 +40,9 @@ class TransactionList extends ConsumerWidget { | |||||||||||||
| this.onTransactionLongPress, | ||||||||||||||
| this.scrollController, | ||||||||||||||
| this.isLoading = false, | ||||||||||||||
| this.onSearch, | ||||||||||||||
| this.onClearSearch, | ||||||||||||||
| this.onToggleGroup, | ||||||||||||||
| this.formatAmount, | ||||||||||||||
| this.transactionItemBuilder, | ||||||||||||||
| }); | ||||||||||||||
|
|
@@ -50,9 +57,14 @@ class TransactionList extends ConsumerWidget { | |||||||||||||
| return _buildEmptyState(context); | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| final content = groupByDate | ||||||||||||||
| ? _buildGroupedList(context, ref) | ||||||||||||||
| : _buildSimpleList(context, ref); | ||||||||||||||
| final listContent = groupByDate ? _buildGroupedList(context, ref) : _buildSimpleList(context, ref); | ||||||||||||||
|
|
||||||||||||||
| final content = Column( | ||||||||||||||
| children: [ | ||||||||||||||
| if (showSearchBar) _buildSearchBar(context), | ||||||||||||||
| Expanded(child: listContent), | ||||||||||||||
| ], | ||||||||||||||
| ); | ||||||||||||||
|
|
||||||||||||||
| if (onRefresh != null) { | ||||||||||||||
| return RefreshIndicator( | ||||||||||||||
|
|
@@ -64,6 +76,55 @@ class TransactionList extends ConsumerWidget { | |||||||||||||
| return content; | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
|
|
||||||||||||||
|
|
||||||||||||||
| Widget _buildSearchBar(BuildContext context) { | ||||||||||||||
| final theme = Theme.of(context); | ||||||||||||||
| return Container( | ||||||||||||||
| padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8), | ||||||||||||||
| color: theme.colorScheme.surfaceContainerHighest.withValues(alpha: 0.3), | ||||||||||||||
| child: Row( | ||||||||||||||
| children: [ | ||||||||||||||
| Expanded( | ||||||||||||||
| child: TextField( | ||||||||||||||
| decoration: InputDecoration( | ||||||||||||||
| hintText: '搜索 描述/备注/收款方…', | ||||||||||||||
|
||||||||||||||
| prefixIcon: const Icon(Icons.search), | ||||||||||||||
| suffixIcon: onClearSearch != null | ||||||||||||||
| ? IconButton(icon: const Icon(Icons.clear), onPressed: onClearSearch) | ||||||||||||||
|
||||||||||||||
| ? IconButton(icon: const Icon(Icons.clear), onPressed: onClearSearch) | |
| ? IconButton( | |
| icon: const Icon(Icons.clear), | |
| onPressed: onClearSearch, | |
| tooltip: '清除搜索', | |
| ) |
Copilot
AI
Oct 8, 2025
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.
Hard-coded tooltip string should be localized via the project's localization system.
Copilot
AI
Oct 8, 2025
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.
Hard-coded tooltip string should be localized for internationalization consistency.
Copilot
AI
Oct 8, 2025
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.
Hard-coded SnackBar message should be localized to maintain consistency with internationalization practices.
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.
Environment-specific absolute path in generated .dart_tool file should not be committed; revert this file and add/ensure .dart_tool is excluded from version control to avoid local path churn and leaking local usernames. Other similar lines (288, 312, 318, 792, 1057) should also be reverted.