advance paymen
This commit is contained in:
parent
d83bc838f4
commit
c6c11cc6fc
@ -35,6 +35,8 @@ class _AdvancePaymentScreenState extends State<AdvancePaymentScreen>
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
_searchCtrl.addListener(() {
|
||||||
|
controller.searchQuery.value = _searchCtrl.text.trim();
|
||||||
_searchCtrl.addListener(() {
|
_searchCtrl.addListener(() {
|
||||||
controller.searchQuery.value = _searchCtrl.text.trim();
|
controller.searchQuery.value = _searchCtrl.text.trim();
|
||||||
});
|
});
|
||||||
@ -59,19 +61,25 @@ class _AdvancePaymentScreenState extends State<AdvancePaymentScreen>
|
|||||||
final bool isLandscape =
|
final bool isLandscape =
|
||||||
constraints.maxWidth > constraints.maxHeight;
|
constraints.maxWidth > constraints.maxHeight;
|
||||||
|
|
||||||
return GestureDetector(
|
return RefreshIndicator(
|
||||||
onTap: () => FocusScope.of(context).unfocus(),
|
onRefresh: () async {
|
||||||
child: RefreshIndicator(
|
final emp = controller.selectedEmployee.value;
|
||||||
onRefresh: () async {
|
if (emp != null) {
|
||||||
final emp = controller.selectedEmployee.value;
|
await controller.fetchAdvancePayments(emp.id.toString());
|
||||||
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) ----------------
|
// ---------------- PORTRAIT (UNCHANGED) ----------------
|
||||||
child: !isLandscape
|
child: !isLandscape
|
||||||
@ -203,6 +211,13 @@ class _AdvancePaymentScreenState extends State<AdvancePaymentScreen>
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
onTap: () {
|
||||||
|
Future.delayed(const Duration(milliseconds: 50), () {
|
||||||
|
if (mounted) {
|
||||||
|
FocusScope.of(context).requestFocus(_searchFocus);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
contentPadding:
|
contentPadding:
|
||||||
const EdgeInsets.symmetric(horizontal: 12, vertical: 0),
|
const EdgeInsets.symmetric(horizontal: 12, vertical: 0),
|
||||||
@ -282,6 +297,12 @@ class _AdvancePaymentScreenState extends State<AdvancePaymentScreen>
|
|||||||
TextPosition(offset: e.name.length),
|
TextPosition(offset: e.name.length),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
_searchCtrl
|
||||||
|
..text = e.name
|
||||||
|
..selection = TextSelection.fromPosition(
|
||||||
|
TextPosition(offset: e.name.length),
|
||||||
|
);
|
||||||
|
|
||||||
FocusScope.of(context).unfocus();
|
FocusScope.of(context).unfocus();
|
||||||
SystemChannels.textInput.invokeMethod('TextInput.hide');
|
SystemChannels.textInput.invokeMethod('TextInput.hide');
|
||||||
controller.employees.clear();
|
controller.employees.clear();
|
||||||
@ -408,7 +429,9 @@ class _AdvancePaymentScreenState extends State<AdvancePaymentScreen>
|
|||||||
? DateFormat('dd MMM yyyy').format(parsedDate)
|
? DateFormat('dd MMM yyyy').format(parsedDate)
|
||||||
: (dateStr.isNotEmpty ? dateStr : '—');
|
: (dateStr.isNotEmpty ? dateStr : '—');
|
||||||
|
|
||||||
|
// final formattedTime =
|
||||||
|
// parsedDate != null ? DateFormat('hh:mm a').format(parsedDate) : '';
|
||||||
|
|
||||||
final project = item.name ?? '';
|
final project = item.name ?? '';
|
||||||
final desc = item.title ?? '';
|
final desc = item.title ?? '';
|
||||||
final amount = (item.amount ?? 0).toDouble();
|
final amount = (item.amount ?? 0).toDouble();
|
||||||
@ -438,7 +461,16 @@ class _AdvancePaymentScreenState extends State<AdvancePaymentScreen>
|
|||||||
style:
|
style:
|
||||||
TextStyle(fontSize: 12, color: Colors.grey.shade600),
|
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),
|
const SizedBox(height: 4),
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user