Untitled

 avatar
unknown
plain_text
a year ago
30 kB
2
Indexable
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:the_citizen_app/src/base_temp/base_temp.dart';
import 'package:the_citizen_app/src/helpers/k_log.dart';
import 'package:the_citizen_app/src/utility/utility.dart';
import '../../components/generate_profile_image.dart';
import '../../config/app_theme.dart';
import '../../config/base.dart';
import '../../controllers/agency_controller.dart';
import '../../helpers/custom_textfield_with_dropdown.dart';
import '../../helpers/hex_color.dart';
import '../../helpers/k_text.dart';
import '../../helpers/loading.dart';
import '../../helpers/render_svg.dart';
import '../../helpers/route.dart';
import '../../widgets/custom_review_widget.dart';

class FindSkilledPersonnelPage extends StatefulWidget {
  const FindSkilledPersonnelPage({super.key});

  @override
  State<FindSkilledPersonnelPage> createState() => _FindSkilledPersonnelPageState();
}

class _FindSkilledPersonnelPageState extends State<FindSkilledPersonnelPage> with Base {
  @override
  void initState() {
    super.initState();
  }

  @override
  void dispose() {
    mySkillsController.dropDownValue.value = '4';
    super.dispose();
  }

  final selectedAgency = Get.put(AgencyController()).selectedAgency;
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: hexToColor('#EFF6FF'),
        centerTitle: true,
        elevation: 0,
        title: KText(
          maxLines: 2,
          text: 'Find Skilled Personnel',
          fontSize: 15.0,
          color: AppTheme.textColor,
          bold: true,
        ),
        actions: [
          ReviewIconWidget(screenCode: '0005', screenTitle: 'Find Skilled Personnel'),
        ],
        leading: GestureDetector(
            onTap: () {
              back();
            },
            child: Icon(Icons.arrow_back)),
      ),
      body: Obx(
        () => SingleChildScrollView(
          padding: EdgeInsets.symmetric(horizontal: 10),
          child: Column(
            mainAxisAlignment: MainAxisAlignment.start,
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
              // SizedBox(height: 15),
              // Row(
              //   mainAxisAlignment: MainAxisAlignment.spaceBetween,
              //   children: [
              //     KText(text: 'Agency'),
              //     KText(text: agencyC.selectedAgency.agencyName ?? ''),
              //   ],
              // ),
              SizedBox(
                height: 8,
              ),
              // TextFormField(
              //   keyboardType: TextInputType.multiline,
              //   // controller: updateProfileCreateC.fullNameController.value,
              //   maxLines: 5,
              //   minLines: 1,
              //   textAlignVertical: TextAlignVertical.center,
              //   decoration: InputDecoration(
              //     contentPadding: EdgeInsets.all(5),
              //     focusedBorder: UnderlineInputBorder(
              //       borderSide: BorderSide(width: .1),
              //     ),
              //   ),
              // ),

              Row(
                mainAxisAlignment: MainAxisAlignment.spaceBetween,
                crossAxisAlignment: CrossAxisAlignment.start,
                children: [
                  searchField(
                    title: 'Service',
                    subtitle: '',
                    onTap: () {
                      BaseTemp.findSkillsPersonnelController.searchCategoryBottomSheet();
                    },
                  ),
                  SizedBox(
                    width: 10,
                  ),
                  KText(
                    text: BaseTemp.findSkillsPersonnelController.selectedCategoryName.isNotEmpty
                        ? BaseTemp.findSkillsPersonnelController.selectedCategoryName.first!.categoryName!
                        : '',
                    maxLines: 3,
                  ),
                ],
              ),
              if (BaseTemp.findSkillsPersonnelController.selectedCategoryName.isNotEmpty)
                Row(
                  mainAxisAlignment: MainAxisAlignment.spaceBetween,
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: [
                    searchField(
                      title: 'Skill',
                      subtitle: '',
                      onTap: () {
                        BaseTemp.findSkillsPersonnelController.searchSkillBottomSheet();
                      },
                    ),
                    KText(
                      text: BaseTemp.findSkillsPersonnelController.selectedskillName.isNotEmpty
                          ? BaseTemp.findSkillsPersonnelController.selectedskillName.first!.skillName!
                          : '',
                    ),
                  ],
                ),
              Row(
                crossAxisAlignment: CrossAxisAlignment.center,
                mainAxisAlignment: MainAxisAlignment.spaceBetween,
                children: [
                  KText(
                    text: 'Area Level',
                    fontSize: 14,
                  ),
                  SizedBox(
                    width: 40,
                    height: 25,
                    child: CustomTextFieldWithDropdown(
                      suffix: DropdownButton(
                        padding: EdgeInsets.zero,
                        value: mySkillsController.dropDownValue.value,
                        isExpanded: true,
                        alignment: Alignment.topCenter,
                        underline: Container(),
                        icon: SizedBox(
                          width: 25,
                          height: 25,
                          child: Icon(
                            Icons.arrow_drop_down,
                            color: hexToColor('#80939D'),
                          ),
                        ),
                        items: mySkillsController.areaLevel.map((item) {
                          return DropdownMenuItem(
                            onTap: () {
                              mySkillsController.dropDownValue.value = item;
                            },
                            value: item,
                            child: SizedBox(
                              width: 25,
                              child: KText(
                                text: item,
                                fontSize: 13,
                              ),
                            ),
                          );
                        }).toList(),
                        onChanged: (item) {},
                      ),
                    ),
                  ),
                ],
              ),
              SizedBox(
                height: 8,
              ),
              Row(
                children: [
                  SizedBox(
                    width: 20,
                    height: 25,
                    child: Checkbox(
                      activeColor: hexToColor('#434969'),
                      value: BaseTemp.findSkillsPersonnelController.isChecked.value,
                      onChanged: (bool? value) {
                        setState(() {
                          BaseTemp.findSkillsPersonnelController.isChecked.value = value ?? false;
                        });
                      },
                    ),
                  ),
                  SizedBox(
                    width: 8,
                  ),
                  GestureDetector(
                    onTap: () {
                      BaseTemp.findSkillsPersonnelController.isChecked.value = !BaseTemp.findSkillsPersonnelController.isChecked.value;
                    },
                    child: KText(text: 'Only for Geography'),
                  )
                ],
              ),
              if (BaseTemp.findSkillsPersonnelController.isChecked.value == true)
                Row(
                  mainAxisAlignment: MainAxisAlignment.spaceBetween,
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: [
                    searchField(
                      title: 'Add Areas',
                      subtitle: '',
                      onTap: () {
                        mySkillsController.searchLocationBottomSheet(route: 'findFreelancer');
                      },
                    ),
                    SizedBox(
                      width: 10,
                    ),
                    Expanded(
                      child: KText(
                        text: mySkillsController.selectedlocationsGeo.isNotEmpty
                            ? '${mySkillsController.selectedlocationsGeo[0].level1Name} > ${mySkillsController.selectedlocationsGeo[0].level2Name} > ${mySkillsController.selectedlocationsGeo[0].level3Name} > ${mySkillsController.selectedlocationsGeo[0].level4Name}'
                            : '',
                        bold: true,
                        maxLines: 4,
                      ),
                    ),
                  ],
                ),
              Padding(
                padding: EdgeInsets.symmetric(vertical: 5),
                child: Center(
                  child: ElevatedButton(
                    style: ButtonStyle(
                      shape: MaterialStateProperty.all<OutlinedBorder>(RoundedRectangleBorder(borderRadius: BorderRadius.circular(5))),
                      backgroundColor: MaterialStateProperty.all<Color>(AppTheme.appBarColor), //#78909C
                      fixedSize: MaterialStateProperty.all<Size>(Size.fromWidth(120)),
                    ),
                    onPressed: () {
                      if (BaseTemp.findSkillsPersonnelController.selectedCategoryName.isNotEmpty &&
                          BaseTemp.findSkillsPersonnelController.selectedskillName.isNotEmpty &&
                          BaseTemp.findSkillsPersonnelController.isSubmit.value != true) {
                        BaseTemp.findSkillsPersonnelController.getFindFreelancer(
                            categoryName: BaseTemp.findSkillsPersonnelController.selectedCategoryName.first!.categoryName!,
                            skillName: BaseTemp.findSkillsPersonnelController.selectedskillName.first!.skillName!,
                            areaLevelCode: BaseTemp.findSkillsPersonnelController.isSubmit == false
                                ? ''
                                : mySkillsController.selectedlocationsGeo.isNotEmpty
                                    ? '${mySkillsController.selectedlocationsGeo[0].level4Code}'
                                    : '');
                      } else {
                        Get.snackbar(
                          'Alart',
                          'Please add all fields',
                          snackPosition: SnackPosition.TOP,
                          backgroundColor: Colors.white,
                        );
                      }
                    },
                    child: BaseTemp.findSkillsPersonnelController.isSubmit.value
                        ? Row(
                            mainAxisAlignment: MainAxisAlignment.start,
                            children: [
                              SizedBox(
                                height: 20,
                                width: 20,
                                child: Loading(
                                  color: Colors.white,
                                ),
                              ),
                              SizedBox(
                                width: 4,
                              ),
                              KText(
                                text: 'Find',
                                fontSize: 14,
                                color: Colors.white,
                                bold: true,
                              ),
                            ],
                          )
                        : KText(
                            text: 'Find',
                            color: AppTheme.textColor1,
                            fontSize: 16,
                            bold: true,
                          ),
                  ),
                ),
              ),
              KText(
                text: 'List of Skilled Personnel',
                bold: true,
                fontSize: 14,
              ),
              SizedBox(
                height: 5,
              ),
              BaseTemp.findSkillsPersonnelController.findFreelancer.isNotEmpty
                  ? ListView.builder(
                      padding: EdgeInsets.all(0),
                      physics: BouncingScrollPhysics(),
                      shrinkWrap: true,
                      scrollDirection: Axis.vertical,
                      itemCount: BaseTemp.findSkillsPersonnelController.findFreelancer.length,
                      itemBuilder: (context, index) {
                        final item = BaseTemp.findSkillsPersonnelController.findFreelancer[index];
                        return GestureDetector(
                          onTap: () {
                            BaseTemp.findSkillsPersonnelController.getSKillsByUsername(item.username!);
                          },
                          child: Padding(
                            padding: EdgeInsets.symmetric(vertical: 5),
                            child: Container(
                              width: Get.width - 80,
                              decoration: BoxDecoration(
                                color: Colors.white,
                                borderRadius: BorderRadius.circular(10),
                                boxShadow: [
                                  BoxShadow(
                                    blurRadius: 10.0,
                                    color: Colors.black12,
                                  )
                                ],
                              ),
                              child: GestureDetector(
                                onTap: () {
                                  userDetailsComponent(name: item.personName, email: item.email, mobileNo: item.mobile);
                                },
                                child: ListTile(
                                  leading: item.username != null
                                      ? generateTeamMemberCircleImage(username: item.username!)
                                      : Container(
                                          height: 50,
                                          width: 50,
                                          padding: EdgeInsets.all(2),
                                          decoration: BoxDecoration(color: Colors.white, shape: BoxShape.circle, boxShadow: [
                                            BoxShadow(
                                              color: Colors.grey,
                                              offset: Offset(0, 0),
                                              blurRadius: 2.0,
                                            ),
                                          ]),
                                          child: CircleAvatar(
                                            //radius: 30,
                                            child: ClipRRect(
                                              borderRadius: BorderRadius.circular(50),
                                              child: Container(
                                                color: hexToColor('#AAAAAA'),
                                              ),
                                            ),
                                          ),
                                        ),
                                  title: KText(
                                    text: item.personName ?? '',
                                    bold: true,
                                    fontSize: 15,
                                    color: Colors.black,
                                  ),
                                  subtitle: KText(text: item.email ?? ''),
                                  trailing: IconButton(
                                    onPressed: () {
                                      Utility.makePhoneCall(item.mobile!);
                                    },
                                    icon: RenderSvg(
                                      path: 'call_button',
                                      height: 24,
                                      width: 24,
                                    ),
                                  ),
                                ),
                              ),
                            ),
                          ),
                        );
                        // return GestureDetector(
                        //   onTap: () {},
                        //   child: Padding(
                        //     padding: EdgeInsets.only(
                        //       top: 10,
                        //     ),
                        //     child: Container(
                        //       padding: EdgeInsets.only(left: 10, right: 10, top: 4),
                        //       width: Get.width - 80,
                        //       decoration: BoxDecoration(
                        //         color: Colors.white,
                        //         borderRadius: BorderRadius.circular(10),
                        //         boxShadow: [
                        //           BoxShadow(
                        //             blurRadius: 10.0,
                        //             color: Colors.black12,
                        //           )
                        //         ],
                        //       ),
                        //       child: Column(
                        //         mainAxisAlignment: MainAxisAlignment.start,
                        //         crossAxisAlignment: CrossAxisAlignment.start,
                        //         children: [
                        //           SizedBox(
                        //             height: 3,
                        //           ),
                        //           Row(
                        //             children: [
                        //               KText(
                        //                 text: Utility.isEmptyString(item.personName) ? 'N/A' : item.personName,
                        //                 fontSize: 16,
                        //                 bold: true,
                        //                 maxLines: 2,
                        //                 textOverflow: TextOverflow.visible,
                        //               ),
                        //               Spacer(),
                        //               item.username != null
                        //                   ? generateTeamMemberCircleImage(username: item.username!)
                        //                   : Container(
                        //                       height: 50,
                        //                       width: 50,
                        //                       padding: EdgeInsets.all(2),
                        //                       decoration: BoxDecoration(color: Colors.white, shape: BoxShape.circle, boxShadow: [
                        //                         BoxShadow(
                        //                           color: Colors.grey,
                        //                           offset: Offset(0, 0),
                        //                           blurRadius: 2.0,
                        //                         ),
                        //                       ]),
                        //                       child: CircleAvatar(
                        //                         //radius: 30,
                        //                         child: ClipRRect(
                        //                           borderRadius: BorderRadius.circular(50),
                        //                           child: Container(
                        //                             color: hexToColor('#AAAAAA'),
                        //                           ),
                        //                         ),
                        //                       ),
                        //                     ),
                        //             ],
                        //           ),
                        //           Divider(
                        //             color: Colors.black26,
                        //           ),
                        //           Row(
                        //             mainAxisAlignment: MainAxisAlignment.start,
                        //             crossAxisAlignment: CrossAxisAlignment.center,
                        //             children: [
                        //               KText(text: 'Email: '),
                        //               KText(text: Utility.isEmptyString(item.email) ? 'N/A' : item.email),
                        //               // Spacer(),
                        //               // InkWell(
                        //               //     onTap: () {
                        //               //       Utility.makeEmail(item.email!);
                        //               //     },
                        //               //     child: Icon(Icons.email)),
                        //               // SizedBox(
                        //               //   width: 10,
                        //               // ),
                        //             ],
                        //           ),
                        //           Divider(
                        //             color: Colors.black26,
                        //           ),
                        //           Row(
                        //             mainAxisAlignment: MainAxisAlignment.spaceBetween,
                        //             crossAxisAlignment: CrossAxisAlignment.center,
                        //             children: [
                        //               KText(text: 'Contact: '),
                        //               KText(text: Utility.isEmptyString(item.mobile) ? 'N/A' : item.mobile),
                        //               Spacer(),
                        //               InkWell(
                        //                 onTap: () {
                        //                   Utility.makePhoneCall(item.mobile!);
                        //                 },
                        //                 child: RenderSvg(
                        //                   path: 'call_button',
                        //                   height: 24,
                        //                   width: 24,
                        //                 ),
                        //               ),
                        //               SizedBox(
                        //                 width: 10,
                        //               ),
                        //             ],
                        //           ),
                        //           SizedBox(
                        //             height: 10,
                        //           ),
                        //         ],
                        //       ),
                        //     ),
                        //   ),
                        // );
                      },
                    )
                  : Padding(
                      padding: EdgeInsets.symmetric(vertical: 20),
                      child: Center(
                        child: KText(text: 'No Data Found'),
                      ),
                    ),
            ],
          ),
        ),
      ),
    );
  }

  //search
  Widget searchField({
    required String title,
    // required String placeholder,
    void Function()? onTap,
    String? subtitle,
  }) {
    return Container(
      padding: EdgeInsets.symmetric(horizontal: 0),
      child: Column(
        mainAxisAlignment: MainAxisAlignment.start,
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          Row(
            children: [
              KText(
                text: title,
                fontSize: 14,
                maxLines: 5,
              ),
              SizedBox(
                width: 2,
              ),
              KText(
                text: subtitle,
                fontSize: 14,
                maxLines: 5,
              ),
              GestureDetector(
                onTap: onTap,
                child: RenderSvg(
                  path: 'icon_search_elements',
                  color: hexToColor('#757575'),
                ),
              ),
            ],
          ),
          SizedBox(
            height: 10,
          )
        ],
      ),
    );
  }
}

userDetailsComponent({String? name, String? email, String? mobileNo}) {
  // final teamC = Get.put(MyTeamLocationController());
  Get.dialog(
    Dialog(
      shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(2)),
      insetPadding: EdgeInsets.symmetric(horizontal: 15, vertical: 10),
      child: Container(
        height: 250,
        color: Colors.black54,
        child:
            // Obx(
            //   () =>
            Stack(
          children: [
            Container(
              color: Colors.white,
              height: 200,
              padding: EdgeInsets.symmetric(horizontal: 25, vertical: 20),
              // margin: EdgeInsets.only(top: 40),
              child: Column(
                crossAxisAlignment: CrossAxisAlignment.center,
                mainAxisAlignment: MainAxisAlignment.end,
                children: [
                  Row(
                    mainAxisAlignment: MainAxisAlignment.start,
                    crossAxisAlignment: CrossAxisAlignment.center,
                    children: [
                      KText(text: 'Name: '),
                      Expanded(
                        child: KText(
                          text: name,
                          bold: true,
                          maxLines: 3,
                        ),
                      ),
                    ],
                  ),
                  SizedBox(
                    height: 5,
                  ),
                  Row(
                    mainAxisAlignment: MainAxisAlignment.start,
                    crossAxisAlignment: CrossAxisAlignment.center,
                    children: [
                      KText(text: 'Email: '),
                      Expanded(
                        child: KText(
                          text: email,
                          maxLines: 2,
                          bold: true,
                        ),
                      ),
                    ],
                  ),
                  SizedBox(
                    height: 5,
                  ),
                  // Row(
                  //   mainAxisAlignment: MainAxisAlignment.start,
                  //   crossAxisAlignment: CrossAxisAlignment.center,
                  //   children: [
                  //     Expanded(flex: 5, child: KText(text: 'Phone: ')),
                  //     Expanded(
                  //       flex: 6,
                  //       child: KText(
                  //         text: userInfo.officerMobile,
                  //         bold: true,
                  //       ),
                  //     ),
                  //   ],
                  // ),
                  // SizedBox(
                  //   height: 5,
                  // ),
                  Row(
                    mainAxisAlignment: MainAxisAlignment.start,
                    crossAxisAlignment: CrossAxisAlignment.center,
                    children: [
                      KText(text: 'Contact: '),
                      Expanded(
                        child: KText(
                          text: mobileNo,
                          maxLines: 2,
                          bold: true,
                        ),
                      ),
                    ],
                  ),
                ],
              ),
            ),
            Positioned(
              left: 127,
              right: 127,
              top: 5,
              child: Container(
                height: 100,
                width: 80,
                padding: EdgeInsets.all(2),
                decoration: BoxDecoration(color: Colors.white, shape: BoxShape.circle, boxShadow: [
                  BoxShadow(
                    color: Colors.grey,
                    offset: Offset(0, 0),
                    blurRadius: 8.0,
                  ),
                ]),
                // child: pickedImageMemory.value != null
                //     ? ClipRRect(
                //         borderRadius: BorderRadius.circular(50),
                //         child: Image.memory(
                //           pickedImageMemory.value!,
                //           fit: BoxFit.cover,
                //         ),
                //       )

                // CircleAvatar(
                //     backgroundColor: hexToColor('#EFF6FF'),
                //     radius: 40,
                //     child: Image.memory(
                //       teamC.image.value!,
                //       // GetStorage().read('image'),
                //       fit: BoxFit.cover,
                //       // width: 55.0 * 2,
                //       // height: 55.0 * 2,
                //     ),
                //   )
                child: CircleAvatar(
                  backgroundColor: hexToColor('#EFF6FF'),
                  radius: 40,
                  child: Image.asset(
                    "assets/images/profile_avatar.png",
                    fit: BoxFit.cover,
                    // width: 55.0 * 2,
                    // height: 55.0 * 2,
                  ),
                ),
              ),
            )
          ],
        ),
      ),
    ),
    // )
  );
}
Editor is loading...
Leave a Comment