marco.pms.mobileapp/lib/model/expense/employee_selector_bottom_sheet.dart
Vaibhav Surve 5c53a3f4be Refactor project structure and rename from 'marco' to 'on field work'
- Updated import paths across multiple files to reflect the new package name.
- Changed application name and identifiers in CMakeLists.txt, Runner.rc, and other configuration files.
- Modified web index.html and manifest.json to update the app title and name.
- Adjusted macOS and Windows project settings to align with the new application name.
- Ensured consistency in naming across all relevant files and directories.
2025-11-22 14:20:37 +05:30

85 lines
3.0 KiB
Dart

import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:on_field_work/helpers/widgets/my_spacing.dart';
import 'package:on_field_work/helpers/widgets/my_text.dart';
import 'package:on_field_work/helpers/utils/base_bottom_sheet.dart';
import 'package:on_field_work/model/employees/employee_model.dart';
class ReusableEmployeeSelectorBottomSheet extends StatelessWidget {
final TextEditingController searchController;
final RxList<EmployeeModel> searchResults;
final RxBool isSearching;
final void Function(String) onSearch;
final void Function(EmployeeModel) onSelect;
const ReusableEmployeeSelectorBottomSheet({
super.key,
required this.searchController,
required this.searchResults,
required this.isSearching,
required this.onSearch,
required this.onSelect,
});
@override
Widget build(BuildContext context) {
return BaseBottomSheet(
title: "Search Employee",
onCancel: () => Get.back(),
onSubmit: () {},
showButtons: false,
child: Obx(() {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
TextField(
controller: searchController,
decoration: InputDecoration(
hintText: "Search by name, email...",
prefixIcon: const Icon(Icons.search),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(8),
),
contentPadding:
const EdgeInsets.symmetric(horizontal: 12, vertical: 10),
),
onChanged: onSearch,
),
MySpacing.height(12),
SizedBox(
height: 400,
child: isSearching.value
? const Center(child: CircularProgressIndicator())
: searchResults.isEmpty
? Center(
child: MyText.bodyMedium(
"No employees found.",
fontWeight: 500,
),
)
: ListView.builder(
itemCount: searchResults.length,
itemBuilder: (_, index) {
final emp = searchResults[index];
final fullName =
'${emp.firstName} ${emp.lastName}'.trim();
return ListTile(
title: MyText.bodyLarge(
fullName.isNotEmpty ? fullName : "Unnamed",
fontWeight: 600,
),
onTap: () {
onSelect(emp);
Get.back();
},
);
},
),
),
],
);
}),
);
}
}