matches ui of sheet with existing one

This commit is contained in:
Manish 2025-12-17 18:34:03 +05:30
parent 73bd5cdc92
commit f305f7ff41
2 changed files with 73 additions and 67 deletions

View File

@ -396,7 +396,6 @@ 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(
@ -641,35 +640,35 @@ class _ManageReportingBottomSheetState
required FocusNode focusNode, required FocusNode focusNode,
required String hint, required String hint,
}) { }) {
return GestureDetector( return TextField(
onTap: () => focusNode.requestFocus(), controller: controller,
child: Container( focusNode: focusNode,
height: 44, decoration: InputDecoration(
padding: const EdgeInsets.symmetric(horizontal: 12), hintText: hint,
decoration: BoxDecoration( hintStyle: const TextStyle(fontSize: 13, color: Colors.grey),
filled: true,
fillColor: Colors.grey.shade100,
prefixIcon: const Icon(Icons.search, size: 18, color: Colors.grey),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(12), borderRadius: BorderRadius.circular(12),
border: Border.all(color: Colors.grey.shade300), borderSide: BorderSide(color: Colors.grey.shade300),
color: Colors.white,
), ),
child: Row( enabledBorder: OutlineInputBorder(
children: [ borderRadius: BorderRadius.circular(12),
const Icon(Icons.search, size: 18, color: Colors.grey), borderSide: BorderSide(color: Colors.grey.shade300),
const SizedBox(width: 8),
Expanded(
child: TextField(
controller: controller,
focusNode: focusNode,
decoration: InputDecoration(
hintText: hint,
border: InputBorder.none,
isDense: true,
),
style: const TextStyle(fontSize: 13),
),
),
],
), ),
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,
), ),
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,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),