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,34 +640,48 @@ 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(
height: 44,
padding: const EdgeInsets.symmetric(horizontal: 12),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
border: Border.all(color: Colors.grey.shade300),
color: Colors.white,
),
child: Row(
children: [
const Icon(Icons.search, size: 18, color: Colors.grey),
const SizedBox(width: 8),
Expanded(
child: TextField( child: TextField(
controller: controller, controller: controller,
focusNode: focusNode, focusNode: focusNode,
style: const TextStyle(fontSize: 14),
decoration: InputDecoration( decoration: InputDecoration(
hintText: hint, hintText: hint,
border: InputBorder.none, hintStyle: const TextStyle(
fontSize: 14,
color: Colors.grey,
),
filled: true,
fillColor: Colors.grey.shade100,
prefixIcon: const Padding(
padding: EdgeInsets.only(left: 12, right: 8),
child: Icon(Icons.search, size: 18, color: Colors.grey),
),
prefixIconConstraints: const BoxConstraints(
minWidth: 32,
minHeight: 32,
),
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, isDense: true,
), ),
style: const TextStyle(fontSize: 13),
),
),
],
),
), ),
); );
} }

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,17 +161,19 @@ 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(
height: 48,
decoration: _boxDecoration(),
child: OrganizationSelector(
controller: _organizationController, controller: _organizationController,
height: 44, height: 48,
onSelectionChanged: (Organization? org) async { onSelectionChanged: (Organization? org) async {
_selectedOrganization = org; _selectedOrganization = org;
_selectedEmployees.clear(); _selectedEmployees.clear();
@ -174,16 +181,16 @@ class _AssignEmployeeBottomSheetState extends State<AssignEmployeeBottomSheet> {
_serviceController.clearSelection(); _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(
height: 48,
decoration: _boxDecoration(),
child: ServiceSelector(
controller: _serviceController, controller: _serviceController,
height: 44, height: 48,
onSelectionChanged: (Service? service) async { onSelectionChanged: (Service? service) async {
_selectedRole = null; _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),