advance paymen
This commit is contained in:
parent
7a816ed26e
commit
fc72d3562d
@ -35,8 +35,8 @@ class _AdvancePaymentScreenState extends State<AdvancePaymentScreen>
|
||||
}
|
||||
});
|
||||
|
||||
controller.searchQuery.listen((q) {
|
||||
if (_searchCtrl.text != q) _searchCtrl.text = q;
|
||||
_searchCtrl.addListener(() {
|
||||
controller.searchQuery.value = _searchCtrl.text.trim();
|
||||
});
|
||||
}
|
||||
|
||||
@ -58,19 +58,25 @@ class _AdvancePaymentScreenState extends State<AdvancePaymentScreen>
|
||||
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
|
||||
@ -195,7 +201,13 @@ class _AdvancePaymentScreenState extends State<AdvancePaymentScreen>
|
||||
child: TextField(
|
||||
controller: _searchCtrl,
|
||||
focusNode: _searchFocus,
|
||||
onChanged: (v) => controller.searchQuery.value = v.trim(),
|
||||
onTap: () {
|
||||
Future.delayed(const Duration(milliseconds: 50), () {
|
||||
if (mounted) {
|
||||
FocusScope.of(context).requestFocus(_searchFocus);
|
||||
}
|
||||
});
|
||||
},
|
||||
decoration: InputDecoration(
|
||||
contentPadding:
|
||||
const EdgeInsets.symmetric(horizontal: 12, vertical: 0),
|
||||
@ -269,8 +281,12 @@ class _AdvancePaymentScreenState extends State<AdvancePaymentScreen>
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
controller.selectEmployee(e);
|
||||
_searchCtrl.text = e.name;
|
||||
controller.searchQuery.value = e.name;
|
||||
_searchCtrl
|
||||
..text = e.name
|
||||
..selection = TextSelection.fromPosition(
|
||||
TextPosition(offset: e.name.length),
|
||||
);
|
||||
|
||||
FocusScope.of(context).unfocus();
|
||||
SystemChannels.textInput.invokeMethod('TextInput.hide');
|
||||
controller.employees.clear();
|
||||
@ -397,8 +413,8 @@ class _AdvancePaymentScreenState extends State<AdvancePaymentScreen>
|
||||
? DateFormat('dd MMM yyyy').format(parsedDate)
|
||||
: (dateStr.isNotEmpty ? dateStr : '—');
|
||||
|
||||
final formattedTime =
|
||||
parsedDate != null ? DateFormat('hh:mm a').format(parsedDate) : '';
|
||||
// final formattedTime =
|
||||
// parsedDate != null ? DateFormat('hh:mm a').format(parsedDate) : '';
|
||||
|
||||
final project = item.name ?? '';
|
||||
final desc = item.title ?? '';
|
||||
@ -429,16 +445,16 @@ class _AdvancePaymentScreenState extends State<AdvancePaymentScreen>
|
||||
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),
|
||||
),
|
||||
]
|
||||
// if (formattedTime.isNotEmpty) ...[
|
||||
// const SizedBox(width: 6),
|
||||
// Text(
|
||||
// formattedTime,
|
||||
// style: TextStyle(
|
||||
// fontSize: 12,
|
||||
// color: Colors.grey.shade500,
|
||||
// fontStyle: FontStyle.italic),
|
||||
// ),
|
||||
// ]
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user