Add transfer tracking and secure admin access

This commit is contained in:
2026-07-26 11:57:57 +08:00
parent 0738953e6d
commit 7df25edd96
111 changed files with 6379 additions and 1934 deletions
@@ -22,6 +22,7 @@ class _SearchPageState extends State<SearchPage> {
bool _loading = false;
String? _error;
String? _timeFilter; // today | week | month
String? _typeFilter;
double? _minAmount, _maxAmount;
Future<void> _search() async {
@@ -29,6 +30,7 @@ class _SearchPageState extends State<SearchPage> {
if (q.isEmpty &&
!_aiOnly &&
_timeFilter == null &&
_typeFilter == null &&
_minAmount == null &&
_maxAmount == null)
return;
@@ -58,6 +60,7 @@ class _SearchPageState extends State<SearchPage> {
maxAmount: _maxAmount,
from: from,
to: to,
type: _typeFilter,
);
if (mounted)
setState(() {
@@ -74,7 +77,7 @@ class _SearchPageState extends State<SearchPage> {
@override
Widget build(BuildContext context) {
final total = _results
.where((t) => !t.isIncome)
.where((t) => t.isExpense)
.fold<double>(0, (s, t) => s + t.amount);
return Scaffold(
appBar: AppBar(
@@ -84,7 +87,7 @@ class _SearchPageState extends State<SearchPage> {
textInputAction: TextInputAction.search,
onSubmitted: (_) => _search(),
decoration: InputDecoration(
hintText: '搜备注 / 分类 / 你说过的',
hintText: '搜备注 / 对方 / 分类 / ',
contentPadding: EdgeInsets.symmetric(horizontal: 14, vertical: 8),
),
),
@@ -122,6 +125,20 @@ class _SearchPageState extends State<SearchPage> {
},
),
),
for (final option in const [
('expense', '支出'),
('transfer', '转账'),
('income', '收入'),
])
FilterChip(
label: Text(option.$2, style: TextStyle(fontSize: 11)),
selected: _typeFilter == option.$1,
selectedColor: context.jz.primaryBackground,
onSelected: (selected) {
setState(() => _typeFilter = selected ? option.$1 : null);
_search();
},
),
if (_searched && !_loading)
Padding(
padding: const EdgeInsets.symmetric(horizontal: 6),