Vaibhav_Task-#200 #17
@ -78,7 +78,8 @@ class _LoadingAnimation extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Column(
|
return SingleChildScrollView(
|
||||||
|
child: Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
Image.asset(
|
Image.asset(
|
||||||
@ -100,6 +101,7 @@ class _LoadingAnimation extends StatelessWidget {
|
|||||||
size: 50,
|
size: 50,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,12 +24,12 @@ class AddEmployeeScreen extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _AddEmployeeScreenState extends State<AddEmployeeScreen> with UIMixin {
|
class _AddEmployeeScreenState extends State<AddEmployeeScreen> with UIMixin {
|
||||||
AddEmployeeController controller = Get.put(AddEmployeeController());
|
final AddEmployeeController controller = Get.put(AddEmployeeController());
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Layout(
|
return Layout(
|
||||||
child: GetBuilder(
|
child: GetBuilder<AddEmployeeController>(
|
||||||
init: controller,
|
init: controller,
|
||||||
tag: 'add_employee_controller',
|
tag: 'add_employee_controller',
|
||||||
builder: (controller) {
|
builder: (controller) {
|
||||||
@ -73,8 +73,7 @@ class _AddEmployeeScreenState extends State<AddEmployeeScreen> with UIMixin {
|
|||||||
|
|
||||||
Widget detail() {
|
Widget detail() {
|
||||||
return Form(
|
return Form(
|
||||||
key: controller
|
key: controller.basicValidator.formKey,
|
||||||
.basicValidator.formKey, // Ensure the key is correctly assigned
|
|
||||||
child: MyCard.bordered(
|
child: MyCard.bordered(
|
||||||
borderRadiusAll: 4,
|
borderRadiusAll: 4,
|
||||||
border: Border.all(color: Colors.grey.withOpacity(0.2)),
|
border: Border.all(color: Colors.grey.withOpacity(0.2)),
|
||||||
@ -97,10 +96,8 @@ class _AddEmployeeScreenState extends State<AddEmployeeScreen> with UIMixin {
|
|||||||
MyText.labelMedium("First Name"),
|
MyText.labelMedium("First Name"),
|
||||||
MySpacing.height(8),
|
MySpacing.height(8),
|
||||||
TextFormField(
|
TextFormField(
|
||||||
validator:
|
validator: controller.basicValidator.getValidation('first_name'),
|
||||||
controller.basicValidator.getValidation('first_name'),
|
controller: controller.basicValidator.getController('first_name'),
|
||||||
controller:
|
|
||||||
controller.basicValidator.getController('first_name'),
|
|
||||||
keyboardType: TextInputType.name,
|
keyboardType: TextInputType.name,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
hintText: "eg: Jhon",
|
hintText: "eg: Jhon",
|
||||||
@ -117,10 +114,8 @@ class _AddEmployeeScreenState extends State<AddEmployeeScreen> with UIMixin {
|
|||||||
MyText.labelMedium("Last Name"),
|
MyText.labelMedium("Last Name"),
|
||||||
MySpacing.height(8),
|
MySpacing.height(8),
|
||||||
TextFormField(
|
TextFormField(
|
||||||
validator:
|
validator: controller.basicValidator.getValidation('last_name'),
|
||||||
controller.basicValidator.getValidation('last_name'),
|
controller: controller.basicValidator.getController('last_name'),
|
||||||
controller:
|
|
||||||
controller.basicValidator.getController('last_name'),
|
|
||||||
keyboardType: TextInputType.name,
|
keyboardType: TextInputType.name,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
hintText: "eg: Doe",
|
hintText: "eg: Doe",
|
||||||
@ -137,10 +132,8 @@ class _AddEmployeeScreenState extends State<AddEmployeeScreen> with UIMixin {
|
|||||||
MyText.labelMedium("Phone Number"),
|
MyText.labelMedium("Phone Number"),
|
||||||
MySpacing.height(8),
|
MySpacing.height(8),
|
||||||
TextFormField(
|
TextFormField(
|
||||||
validator:
|
validator: controller.basicValidator.getValidation('phone_number'),
|
||||||
controller.basicValidator.getValidation('phone_number'),
|
controller: controller.basicValidator.getController('phone_number'),
|
||||||
controller:
|
|
||||||
controller.basicValidator.getController('phone_number'),
|
|
||||||
keyboardType: TextInputType.phone,
|
keyboardType: TextInputType.phone,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
hintText: "eg: +91 9876543210",
|
hintText: "eg: +91 9876543210",
|
||||||
@ -171,8 +164,7 @@ class _AddEmployeeScreenState extends State<AddEmployeeScreen> with UIMixin {
|
|||||||
return DropdownMenuItem<Gender>(
|
return DropdownMenuItem<Gender>(
|
||||||
value: gender,
|
value: gender,
|
||||||
child: MyText.labelMedium(
|
child: MyText.labelMedium(
|
||||||
gender.name[0].toUpperCase() +
|
gender.name[0].toUpperCase() + gender.name.substring(1),
|
||||||
gender.name.substring(1),
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}).toList(),
|
}).toList(),
|
||||||
@ -235,11 +227,10 @@ class _AddEmployeeScreenState extends State<AddEmployeeScreen> with UIMixin {
|
|||||||
children: [
|
children: [
|
||||||
MyButton.text(
|
MyButton.text(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Get.toNamed('/dashboard/employees');
|
Get.back();
|
||||||
},
|
},
|
||||||
padding: MySpacing.xy(20, 16),
|
padding: MySpacing.xy(20, 16),
|
||||||
splashColor:
|
splashColor: contentTheme.secondary.withValues(alpha: 0.1),
|
||||||
contentTheme.secondary.withValues(alpha: 0.1),
|
|
||||||
child: MyText.bodySmall('Cancel'),
|
child: MyText.bodySmall('Cancel'),
|
||||||
),
|
),
|
||||||
MySpacing.width(12),
|
MySpacing.width(12),
|
||||||
|
@ -41,9 +41,11 @@ class _EmployeeScreenState extends State<EmployeeScreen> with UIMixin {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Layout(
|
return Layout(
|
||||||
child: Stack(
|
child: Obx(() {
|
||||||
children: [
|
return LoadingComponent(
|
||||||
GetBuilder<EmployeesScreenController>(
|
isLoading: employeesScreenController.isLoading.value,
|
||||||
|
loadingText: 'Loading Employees...',
|
||||||
|
child: GetBuilder<EmployeesScreenController>(
|
||||||
init: employeesScreenController,
|
init: employeesScreenController,
|
||||||
builder: (controller) {
|
builder: (controller) {
|
||||||
return Column(
|
return Column(
|
||||||
@ -70,7 +72,8 @@ class _EmployeeScreenState extends State<EmployeeScreen> with UIMixin {
|
|||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
Container(
|
Expanded(
|
||||||
|
child: Container(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
border: Border.all(
|
border: Border.all(
|
||||||
color: Colors.black,
|
color: Colors.black,
|
||||||
@ -117,7 +120,7 @@ class _EmployeeScreenState extends State<EmployeeScreen> with UIMixin {
|
|||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.symmetric(
|
padding: const EdgeInsets.symmetric(
|
||||||
horizontal: 12.0, vertical: 8.0),
|
horizontal: 12.0, vertical: 8.0),
|
||||||
child: MyText.bodySmall(
|
child: Text(
|
||||||
employeesScreenController.selectedProjectId ==
|
employeesScreenController.selectedProjectId ==
|
||||||
null
|
null
|
||||||
? 'All Employees'
|
? 'All Employees'
|
||||||
@ -127,7 +130,10 @@ class _EmployeeScreenState extends State<EmployeeScreen> with UIMixin {
|
|||||||
employeesScreenController
|
employeesScreenController
|
||||||
.selectedProjectId)
|
.selectedProjectId)
|
||||||
.name,
|
.name,
|
||||||
fontWeight: 600,
|
overflow: TextOverflow
|
||||||
|
.ellipsis,
|
||||||
|
style: TextStyle(fontWeight: FontWeight.w600),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -155,22 +161,8 @@ class _EmployeeScreenState extends State<EmployeeScreen> with UIMixin {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
Obx(() {
|
);
|
||||||
return employeesScreenController.isLoading.value
|
|
||||||
? Container(
|
|
||||||
color: Colors.black.withOpacity(0.05),
|
|
||||||
child: const Center(
|
|
||||||
child: LoadingComponent(
|
|
||||||
isLoading: true,
|
|
||||||
loadingText: 'Loading Employees...',
|
|
||||||
child: SizedBox.shrink(),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
: const SizedBox.shrink();
|
|
||||||
}),
|
}),
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -186,8 +178,6 @@ class _EmployeeScreenState extends State<EmployeeScreen> with UIMixin {
|
|||||||
DataColumn(label: MyText.labelLarge('Name', color: contentTheme.primary)),
|
DataColumn(label: MyText.labelLarge('Name', color: contentTheme.primary)),
|
||||||
DataColumn(
|
DataColumn(
|
||||||
label: MyText.labelLarge('Contact', color: contentTheme.primary)),
|
label: MyText.labelLarge('Contact', color: contentTheme.primary)),
|
||||||
DataColumn(
|
|
||||||
label: MyText.labelLarge('Actions', color: contentTheme.primary)),
|
|
||||||
];
|
];
|
||||||
|
|
||||||
final rows =
|
final rows =
|
||||||
@ -217,26 +207,6 @@ class _EmployeeScreenState extends State<EmployeeScreen> with UIMixin {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
DataCell(
|
|
||||||
Row(
|
|
||||||
children: [
|
|
||||||
IconButton(
|
|
||||||
icon: const Icon(Icons.visibility),
|
|
||||||
tooltip: 'View',
|
|
||||||
onPressed: () {
|
|
||||||
// View employee action
|
|
||||||
},
|
|
||||||
),
|
|
||||||
IconButton(
|
|
||||||
icon: const Icon(Icons.edit),
|
|
||||||
tooltip: 'Edit',
|
|
||||||
onPressed: () {
|
|
||||||
// Edit employee action
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}).toList();
|
}).toList();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user