Manish_Dev_13/12 #93

Closed
manish.zure wants to merge 3 commits from Manish_Dev_13/12 into Decription_Feature
2 changed files with 89 additions and 69 deletions

View File

@ -396,11 +396,10 @@ class _ManageReportingBottomSheetState
], ],
); );
// 🔥 WRAP EVERYTHING IN SAFEAREA + SCROLL + BOTTOM PADDING
final safeWrappedContent = SafeArea( final safeWrappedContent = SafeArea(
child: SingleChildScrollView( child: SingleChildScrollView(
padding: EdgeInsets.only( padding: EdgeInsets.only(
bottom: MediaQuery.of(context).viewPadding.bottom + 20, bottom: 8,
left: 16, left: 16,
right: 16, right: 16,
top: 8, top: 8,
@ -641,33 +640,47 @@ class _ManageReportingBottomSheetState
required FocusNode focusNode, required FocusNode focusNode,
required String hint, required String hint,
}) { }) {
return GestureDetector( return SizedBox(
onTap: () => focusNode.requestFocus(), height: 48,
child: Container( child: TextField(
height: 44, controller: controller,
padding: const EdgeInsets.symmetric(horizontal: 12), focusNode: focusNode,
decoration: BoxDecoration( style: const TextStyle(fontSize: 14),
borderRadius: BorderRadius.circular(12), decoration: InputDecoration(
border: Border.all(color: Colors.grey.shade300), hintText: hint,
color: Colors.white, hintStyle: const TextStyle(
), fontSize: 14,
child: Row( color: Colors.grey,
children: [ ),
const Icon(Icons.search, size: 18, color: Colors.grey), filled: true,
const SizedBox(width: 8), fillColor: Colors.grey.shade100,
Expanded( prefixIcon: const Padding(
child: TextField( padding: EdgeInsets.only(left: 12, right: 8),
controller: controller, child: Icon(Icons.search, size: 18, color: Colors.grey),
focusNode: focusNode, ),
decoration: InputDecoration( prefixIconConstraints: const BoxConstraints(
hintText: hint, minWidth: 32,
border: InputBorder.none, minHeight: 32,
isDense: true, ),
),
style: const TextStyle(fontSize: 13), border: OutlineInputBorder(
), borderRadius: BorderRadius.circular(12),
borderSide: BorderSide(color: Colors.grey.shade300),
),
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(12),
borderSide: BorderSide(color: Colors.grey.shade300),
),
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(12),
borderSide: const BorderSide(
color: Colors.blueAccent,
width: 1.5,
), ),
], ),
contentPadding:
const EdgeInsets.symmetric(horizontal: 16, vertical: 14),
isDense: true,
), ),
), ),
); );

View File

@ -15,7 +15,6 @@ import 'package:on_field_work/helpers/services/api_service.dart';
import 'package:on_field_work/helpers/utils/base_bottom_sheet.dart'; import 'package:on_field_work/helpers/utils/base_bottom_sheet.dart';
import 'package:on_field_work/model/infra_project/assign_project_allocation_request.dart'; import 'package:on_field_work/model/infra_project/assign_project_allocation_request.dart';
class JobRole { class JobRole {
final String id; final String id;
final String name; final String name;
@ -138,12 +137,18 @@ class _AssignEmployeeBottomSheetState extends State<AssignEmployeeBottomSheet> {
); );
if (res?.success == true) { if (res?.success == true) {
Navigator.of(context).pop(true); // 🔥 triggers refresh Navigator.of(context).pop(true);
} else { } else {
Get.snackbar('Error', res?.message ?? 'Assignment failed'); Get.snackbar('Error', res?.message ?? 'Assignment failed');
} }
} }
BoxDecoration _boxDecoration() => BoxDecoration(
color: Colors.grey.shade100,
borderRadius: BorderRadius.circular(12),
border: Border.all(color: Colors.grey.shade300),
);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return BaseBottomSheet( return BaseBottomSheet(
@ -156,34 +161,36 @@ class _AssignEmployeeBottomSheetState extends State<AssignEmployeeBottomSheet> {
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
//ORGANIZATION /// ORGANIZATION
MyText.bodySmall( MyText.labelMedium(
'Organization', 'Organization',
fontWeight: 600, fontWeight: 600,
color: Colors.grey.shade700,
), ),
MySpacing.height(6), MySpacing.height(8),
OrganizationSelector( Container(
controller: _organizationController, height: 48,
height: 44, decoration: _boxDecoration(),
onSelectionChanged: (Organization? org) async { child: OrganizationSelector(
_selectedOrganization = org; controller: _organizationController,
_selectedEmployees.clear(); height: 48,
_selectedRole = null; onSelectionChanged: (Organization? org) async {
_serviceController.clearSelection(); _selectedOrganization = org;
}, _selectedEmployees.clear();
_selectedRole = null;
_serviceController.clearSelection();
},
),
), ),
MySpacing.height(20), MySpacing.height(20),
///EMPLOYEES (SEARCH) /// EMPLOYEES
MyText.bodySmall( MyText.labelMedium(
'Employees', 'Employees',
fontWeight: 600, fontWeight: 600,
color: Colors.grey.shade700,
), ),
MySpacing.height(6), MySpacing.height(8),
Obx( Obx(
() => InkWell( () => InkWell(
@ -199,31 +206,33 @@ class _AssignEmployeeBottomSheetState extends State<AssignEmployeeBottomSheet> {
MySpacing.height(20), MySpacing.height(20),
///SERVICE /// SERVICE
MyText.bodySmall( MyText.labelMedium(
'Service', 'Service',
fontWeight: 600, fontWeight: 600,
color: Colors.grey.shade700,
), ),
MySpacing.height(6), MySpacing.height(8),
ServiceSelector( Container(
controller: _serviceController, height: 48,
height: 44, decoration: _boxDecoration(),
onSelectionChanged: (Service? service) async { child: ServiceSelector(
_selectedRole = null; controller: _serviceController,
}, height: 48,
onSelectionChanged: (Service? service) async {
_selectedRole = null;
},
),
), ),
MySpacing.height(20), MySpacing.height(20),
/// JOB ROLE /// JOB ROLE
MyText.bodySmall( MyText.labelMedium(
'Job Role', 'Job Role',
fontWeight: 600, fontWeight: 600,
color: Colors.grey.shade700,
), ),
MySpacing.height(6), MySpacing.height(8),
Obx(() { Obx(() {
if (_isLoadingRoles.value) { if (_isLoadingRoles.value) {
@ -231,6 +240,7 @@ class _AssignEmployeeBottomSheetState extends State<AssignEmployeeBottomSheet> {
} }
return PopupMenuButton<JobRole>( return PopupMenuButton<JobRole>(
offset: const Offset(0, 48),
onSelected: (role) { onSelected: (role) {
_selectedRole = role; _selectedRole = role;
setState(() {}); setState(() {});
@ -265,12 +275,9 @@ class _AssignEmployeeBottomSheetState extends State<AssignEmployeeBottomSheet> {
Widget _dropdownBox(String text, {IconData icon = Icons.arrow_drop_down}) { Widget _dropdownBox(String text, {IconData icon = Icons.arrow_drop_down}) {
return Container( return Container(
height: 44, height: 48,
padding: const EdgeInsets.symmetric(horizontal: 12), padding: const EdgeInsets.symmetric(horizontal: 16),
decoration: BoxDecoration( decoration: _boxDecoration(),
borderRadius: BorderRadius.circular(12),
border: Border.all(color: Colors.grey.shade300),
),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
@ -278,7 +285,7 @@ class _AssignEmployeeBottomSheetState extends State<AssignEmployeeBottomSheet> {
child: Text( child: Text(
text, text,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: const TextStyle(fontSize: 13), style: const TextStyle(fontSize: 14),
), ),
), ),
Icon(icon, color: Colors.grey), Icon(icon, color: Colors.grey),
@ -289,7 +296,7 @@ class _AssignEmployeeBottomSheetState extends State<AssignEmployeeBottomSheet> {
Widget _skeleton() { Widget _skeleton() {
return Container( return Container(
height: 44, height: 48,
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.grey.shade300, color: Colors.grey.shade300,
borderRadius: BorderRadius.circular(12), borderRadius: BorderRadius.circular(12),