feat(client): 所有表格列头加筛选,图标更大靠右对齐
FilterableColumnHeader: - mainAxisAlignment.spaceBetween 将图标推到列头右侧 - 漏斗图标从 13px 增大到 16px,清除图标 14px 各页面改动: - batch_tracking:状态/仓库/供应商筛选移入列头,工具栏合并为一行 - finance:类型/往来单位筛选移入列头,工具栏保留月份选择和显示字段 - inventory:仓库筛选从 API 端单选改为客户端多选,移入"仓库"列头 - products:品牌列头加筛选,从加载数据中动态派生选项 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -4,7 +4,7 @@ import '../../core/theme/app_theme.dart';
|
||||
import '../../models/finance.dart';
|
||||
import '../../providers/finance_provider.dart';
|
||||
import '../../widgets/data_table_card.dart';
|
||||
import '../../widgets/multi_select_dropdown.dart';
|
||||
import '../../widgets/multi_select_dropdown.dart' show ColDef, ColumnToggleButton, FilterableColumnHeader;
|
||||
import '../../widgets/page_scaffold.dart';
|
||||
|
||||
class FinanceScreen extends ConsumerWidget {
|
||||
@@ -161,12 +161,26 @@ class _FinanceTabState extends ConsumerState<_FinanceTab> {
|
||||
(c.minWidth == null || screenWidth >= c.minWidth!))
|
||||
.toList();
|
||||
|
||||
final columns = visibleCols
|
||||
.map((c) => DataColumn(
|
||||
label: Text(c.label),
|
||||
numeric: c.key == 'amount' || c.key == 'balance',
|
||||
))
|
||||
.toList();
|
||||
final columns = visibleCols.map((c) {
|
||||
final label = switch (c.key) {
|
||||
'type' => FilterableColumnHeader(
|
||||
text: c.label,
|
||||
options: typeOptions,
|
||||
selected: _filterType,
|
||||
onChanged: (v) => setState(() => _filterType = v),
|
||||
),
|
||||
'partner' => FilterableColumnHeader(
|
||||
text: c.label,
|
||||
options: partnerOptions,
|
||||
selected: _filterPartner,
|
||||
onChanged: (v) => setState(() => _filterPartner = v),
|
||||
),
|
||||
_ => Text(c.label),
|
||||
};
|
||||
return DataColumn(
|
||||
label: label,
|
||||
numeric: c.key == 'amount' || c.key == 'balance');
|
||||
}).toList();
|
||||
|
||||
DataCell buildFinanceCell(String key, FinanceRecord r) {
|
||||
switch (key) {
|
||||
@@ -284,44 +298,22 @@ class _FinanceTabState extends ConsumerState<_FinanceTab> {
|
||||
_fetch();
|
||||
});
|
||||
},
|
||||
toolbar: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
toolbar: Row(
|
||||
children: [
|
||||
// Filter bar + month selector + column toggle
|
||||
Row(
|
||||
children: [
|
||||
if (typeOptions.length > 1)
|
||||
MultiSelectDropdown(
|
||||
label: '类型',
|
||||
options: typeOptions,
|
||||
selected: _filterType,
|
||||
onChanged: (v) => setState(() => _filterType = v),
|
||||
),
|
||||
if (typeOptions.length > 1) const SizedBox(width: 8),
|
||||
if (partnerOptions.length > 1)
|
||||
MultiSelectDropdown(
|
||||
label: '往来单位',
|
||||
options: partnerOptions,
|
||||
selected: _filterPartner,
|
||||
onChanged: (v) =>
|
||||
setState(() => _filterPartner = v),
|
||||
),
|
||||
const Spacer(),
|
||||
_MonthSelector(
|
||||
value: _month,
|
||||
onChanged: (v) {
|
||||
_month = v;
|
||||
_page = 1;
|
||||
_refetch();
|
||||
},
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
ColumnToggleButton(
|
||||
columns: _colDefs,
|
||||
hidden: _hiddenCols,
|
||||
onChanged: (v) => setState(() => _hiddenCols = v),
|
||||
),
|
||||
],
|
||||
const Spacer(),
|
||||
_MonthSelector(
|
||||
value: _month,
|
||||
onChanged: (v) {
|
||||
_month = v;
|
||||
_page = 1;
|
||||
_refetch();
|
||||
},
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
ColumnToggleButton(
|
||||
columns: _colDefs,
|
||||
hidden: _hiddenCols,
|
||||
onChanged: (v) => setState(() => _hiddenCols = v),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user