diff --git a/lib/view/finance/advance_payment_screen.dart b/lib/view/finance/advance_payment_screen.dart index 7b84d0b..abff416 100644 --- a/lib/view/finance/advance_payment_screen.dart +++ b/lib/view/finance/advance_payment_screen.dart @@ -35,8 +35,6 @@ class _AdvancePaymentScreenState extends State } }); - _searchCtrl.addListener(() { - controller.searchQuery.value = _searchCtrl.text.trim(); _searchCtrl.addListener(() { controller.searchQuery.value = _searchCtrl.text.trim(); }); @@ -60,19 +58,25 @@ class _AdvancePaymentScreenState extends State final bool isLandscape = constraints.maxWidth > constraints.maxHeight; - return GestureDetector( - onTap: () => FocusScope.of(context).unfocus(), - child: RefreshIndicator( - onRefresh: () async { - final emp = controller.selectedEmployee.value; - if (emp != null) { - await controller.fetchAdvancePayments(emp.id.toString()); + return RefreshIndicator( + onRefresh: () async { + final emp = controller.selectedEmployee.value; + if (emp != null) { + await controller.fetchAdvancePayments(emp.id.toString()); + } + }, + color: Colors.white, + backgroundColor: contentTheme.primary, + strokeWidth: 2.5, + displacement: 60, + child: GestureDetector( + behavior: HitTestBehavior.translucent, + onTap: () { + FocusScopeNode currentFocus = FocusScope.of(context); + if (!currentFocus.hasPrimaryFocus) { + currentFocus.unfocus(); } }, - color: Colors.white, - backgroundColor: contentTheme.primary, - strokeWidth: 2.5, - displacement: 60, // ---------------- PORTRAIT (UNCHANGED) ---------------- child: !isLandscape @@ -204,13 +208,6 @@ class _AdvancePaymentScreenState extends State } }); }, - onTap: () { - Future.delayed(const Duration(milliseconds: 50), () { - if (mounted) { - FocusScope.of(context).requestFocus(_searchFocus); - } - }); - }, decoration: InputDecoration( contentPadding: const EdgeInsets.symmetric(horizontal: 12, vertical: 0), @@ -290,12 +287,6 @@ class _AdvancePaymentScreenState extends State TextPosition(offset: e.name.length), ); - _searchCtrl - ..text = e.name - ..selection = TextSelection.fromPosition( - TextPosition(offset: e.name.length), - ); - FocusScope.of(context).unfocus(); SystemChannels.textInput.invokeMethod('TextInput.hide'); controller.employees.clear(); @@ -422,7 +413,9 @@ class _AdvancePaymentScreenState extends State ? DateFormat('dd MMM yyyy').format(parsedDate) : (dateStr.isNotEmpty ? dateStr : '—'); - + // final formattedTime = + // parsedDate != null ? DateFormat('hh:mm a').format(parsedDate) : ''; + final project = item.name ?? ''; final desc = item.title ?? ''; final amount = (item.amount ?? 0).toDouble(); @@ -452,7 +445,16 @@ class _AdvancePaymentScreenState extends State style: TextStyle(fontSize: 12, color: Colors.grey.shade600), ), - + // if (formattedTime.isNotEmpty) ...[ + // const SizedBox(width: 6), + // Text( + // formattedTime, + // style: TextStyle( + // fontSize: 12, + // color: Colors.grey.shade500, + // fontStyle: FontStyle.italic), + // ), + // ] ], ), const SizedBox(height: 4),