906 lines
37 KiB
Dart
906 lines
37 KiB
Dart
|
// // import 'package:discover_module/custom_widget/custom_expansiontile.dart';
|
||
|
// import 'package:discover_module/contacts_module/custom_widget/custom_expansiontile.dart';
|
||
|
// import 'package:discover_module/contacts_module/custom_widget/text.dart';
|
||
|
// import 'package:discover_module/contacts_module/model_class/k2_api_model/kol_Certificate_k2.dart';
|
||
|
// import 'package:discover_module/contacts_module/model_class/k2_api_model/kol_awards_k2.dart';
|
||
|
// import 'package:discover_module/contacts_module/model_class/k2_api_model/kol_education_k2.dart';
|
||
|
// import 'package:discover_module/contacts_module/model_class/k2_api_model/kol_email_k2.dart';
|
||
|
// import 'package:discover_module/contacts_module/model_class/k2_api_model/kol_location_k2.dart';
|
||
|
// import 'package:discover_module/contacts_module/model_class/k2_api_model/kol_pno_k2.dart';
|
||
|
// import 'package:discover_module/contacts_module/model_class/k2_api_model/kol_training_k2.dart';
|
||
|
// import 'package:discover_module/contacts_module/provider_class/award_provider.dart';
|
||
|
// import 'package:discover_module/contacts_module/provider_class/certificate_provider.dart';
|
||
|
// import 'package:discover_module/contacts_module/provider_class/educationprovider.dart';
|
||
|
// import 'package:discover_module/contacts_module/provider_class/email_provider.dart';
|
||
|
// import 'package:discover_module/contacts_module/provider_class/k2_provider/kol_awards_provider.dart';
|
||
|
// import 'package:discover_module/contacts_module/provider_class/k2_provider/kol_certificate_provider.dart';
|
||
|
// import 'package:discover_module/contacts_module/provider_class/k2_provider/kol_education_provider.dart';
|
||
|
// import 'package:discover_module/contacts_module/provider_class/k2_provider/kol_email_provider.dart';
|
||
|
// import 'package:discover_module/contacts_module/provider_class/k2_provider/kol_locationprovider.dart';
|
||
|
// import 'package:discover_module/contacts_module/provider_class/k2_provider/kol_pno_provider.dart';
|
||
|
// import 'package:discover_module/contacts_module/provider_class/k2_provider/kol_training_provider.dart';
|
||
|
// import 'package:discover_module/contacts_module/provider_class/location_provider.dart';
|
||
|
// import 'package:discover_module/contacts_module/provider_class/phoneno_provider.dart';
|
||
|
// import 'package:discover_module/contacts_module/provider_class/training_provider.dart';
|
||
|
// import 'package:discover_module/contacts_module/storage_hive/awa_data/crud_awa.dart';
|
||
|
// import 'package:discover_module/contacts_module/storage_hive/cer_hive/crud_cer.dart';
|
||
|
// import 'package:discover_module/contacts_module/storage_hive/edu_data/crud_edu.dart';
|
||
|
// import 'package:discover_module/contacts_module/storage_hive/email_data/crud_email.dart';
|
||
|
// import 'package:discover_module/contacts_module/storage_hive/loc_data/crud_loc.dart';
|
||
|
// import 'package:discover_module/contacts_module/storage_hive/pno_data/crud_pno.dart';
|
||
|
// import 'package:discover_module/contacts_module/storage_hive/traning_data/crud_training.dart';
|
||
|
// import 'package:discover_module/contacts_module/ui_screen/k2api_integrated_ui/k2testbshhet.dart';
|
||
|
|
||
|
// import 'package:flutter/material.dart';
|
||
|
// import 'package:provider/provider.dart';
|
||
|
|
||
|
// class LocationTest extends StatefulWidget {
|
||
|
// // const LocationTab({super.key});
|
||
|
// LocationTest({required this.text, this.offline, Key? key, this.offlineMode})
|
||
|
// : super(key: key);
|
||
|
|
||
|
// final int text;
|
||
|
// int? offline;
|
||
|
// bool? offlineMode;
|
||
|
// @override
|
||
|
// State<LocationTest> createState() => _LocationTestState();
|
||
|
// }
|
||
|
|
||
|
// class _LocationTestState extends State<LocationTest> {
|
||
|
// //List<dynamic> locationList = [];
|
||
|
|
||
|
// List locationList = [];
|
||
|
// List pno = [];
|
||
|
// List emailid = [];
|
||
|
|
||
|
// List training = [];
|
||
|
// List education = [];
|
||
|
// List award = [];
|
||
|
// List certificate = [];
|
||
|
|
||
|
// @override
|
||
|
// void initState() {
|
||
|
// // TODO: implement initState
|
||
|
// super.initState();
|
||
|
|
||
|
// print("I_amFalseee: ${widget.offlineMode}");
|
||
|
|
||
|
// print("I_am_locationList: ${locationList}");
|
||
|
|
||
|
// // WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
|
||
|
// getAffiliations();
|
||
|
// // });
|
||
|
// }
|
||
|
|
||
|
// Future<void> getAffiliations() async {
|
||
|
// // ignore: prefer_typ(ing_uninitialized_variables
|
||
|
// var loclist, phoneno, emailno1, edu1, awa1, cer1, training1;
|
||
|
|
||
|
// if (widget.offline == 1) {
|
||
|
// loclist = await retrieveidlocations(widget.text);
|
||
|
// } else if (widget.offlineMode == false) {
|
||
|
// } else {
|
||
|
// if (locationList.isEmpty) {
|
||
|
// print("Location_is_empty");
|
||
|
|
||
|
// var location = Provider.of<LocationProvider>(context, listen: false);
|
||
|
// await location.locationinfo(widget.text);
|
||
|
// locationList = location.locationlist;
|
||
|
|
||
|
// // setState(() {
|
||
|
// // locationList = loclist;
|
||
|
// // });
|
||
|
// } else {
|
||
|
// print("Location_not empty");
|
||
|
// }
|
||
|
// }
|
||
|
// // final locationProvider =
|
||
|
// // Provider.of<LocationKolProvider>(context, listen: false);
|
||
|
|
||
|
// // if (locationProvider.locationList.isEmpty) {
|
||
|
// // await locationProvider.fetchLocations(
|
||
|
// // widget.text, widget.offline, widget.offlineMode);
|
||
|
|
||
|
// // locationList = locationProvider.locationList;
|
||
|
// // } else {
|
||
|
// // print("Iam_emptyyyy");
|
||
|
// // }
|
||
|
|
||
|
// if (mounted) {
|
||
|
// if (widget.offline == 1) {
|
||
|
// phoneno = await retrieveidpnos(widget.text);
|
||
|
// } else {
|
||
|
// var phone = Provider.of<PhonenoProvider>(context, listen: false);
|
||
|
// await phone.phoneinfo(widget.text);
|
||
|
// phoneno = phone.phonenolist;
|
||
|
// }
|
||
|
// setState(() {
|
||
|
// pno = phoneno;
|
||
|
// });
|
||
|
// }
|
||
|
|
||
|
// if (mounted) {
|
||
|
// if (widget.offline == 1) {
|
||
|
// emailno1 = await retrieveidemails(widget.text);
|
||
|
// print("Saved_CheckingloclistEmailll: $emailno1");
|
||
|
// } else {
|
||
|
// var email = Provider.of<EmailProvider>(context, listen: false);
|
||
|
// await email.emailinfo(widget.text);
|
||
|
// emailno1 = email.emailkollist;
|
||
|
// print("Saved_CheckingloclistEmailll123: $emailno1");
|
||
|
// }
|
||
|
|
||
|
// setState(() {
|
||
|
// emailid = emailno1;
|
||
|
// });
|
||
|
// }
|
||
|
|
||
|
// if (mounted) {
|
||
|
// if (widget.offline == 1) {
|
||
|
// training1 = await retrieveidtri(widget.text);
|
||
|
// print("Saved_CheckingloclistEmailll: $emailno1");
|
||
|
// } else {
|
||
|
// var trai = Provider.of<TrainigProvider>(context, listen: false);
|
||
|
// await trai.traininginfo(widget.text);
|
||
|
// training1 = trai.traininglist;
|
||
|
// }
|
||
|
|
||
|
// setState(() {
|
||
|
// training = training1;
|
||
|
// });
|
||
|
// }
|
||
|
|
||
|
// if (mounted) {
|
||
|
// if (widget.offline == 1) {
|
||
|
// edu1 = await retrieveidedus(widget.text);
|
||
|
// print("Saved_CheckingloclistEdu: $edu1");
|
||
|
// } else {
|
||
|
// var edu = Provider.of<EducationProvider>(context, listen: false);
|
||
|
// await edu.eduinfo(widget.text);
|
||
|
// edu1 = edu.educationlist;
|
||
|
// print("Saved_CheckingloclistEdu123: $edu1");
|
||
|
// }
|
||
|
|
||
|
// setState(() {
|
||
|
// education = edu1;
|
||
|
// });
|
||
|
// }
|
||
|
|
||
|
// if (mounted) {
|
||
|
// if (widget.offline == 1) {
|
||
|
// awa1 = await retrieveidawa(widget.text);
|
||
|
// print("Saved_CheckingloclistEdu: $edu1");
|
||
|
// } else {
|
||
|
// var awa = Provider.of<AwardProvider>(context, listen: false);
|
||
|
// await awa.awainfo(widget.text);
|
||
|
// awa1 = awa.awardlist;
|
||
|
// }
|
||
|
// setState(() {
|
||
|
// award = awa1;
|
||
|
// });
|
||
|
// }
|
||
|
|
||
|
// if (mounted) {
|
||
|
// if (widget.offline == 1) {
|
||
|
// cer1 = await retrieveidcer(widget.text);
|
||
|
// print("Saved_CheckingloclistEdu: $edu1");
|
||
|
// } else {
|
||
|
// var cer = Provider.of<CertificateProvider>(context, listen: false);
|
||
|
// await cer.certificateinfo(widget.text);
|
||
|
// cer1 = cer.certificatelist;
|
||
|
// }
|
||
|
|
||
|
// setState(() {
|
||
|
// certificate = cer1;
|
||
|
// });
|
||
|
// }
|
||
|
// }
|
||
|
|
||
|
// @override
|
||
|
// Widget build(BuildContext context) {
|
||
|
// return Center(
|
||
|
// child: ListView(
|
||
|
// children: [Text1(title: locationList.length.toString())],
|
||
|
|
||
|
// // children: [
|
||
|
// // locationList.length != 0
|
||
|
// // ? CustomExpansionTile<Data>(
|
||
|
// // title: "Locations",
|
||
|
// // itemList: locationList.cast<Data>(),
|
||
|
// // buttonText: 'Show More',
|
||
|
// // field1: 'Institutation',
|
||
|
// // field2: 'Address',
|
||
|
// // noexpand: widget.offlineMode == null ? true : false,
|
||
|
// // onItemSelected: (Data selectedPhoneNumber) {
|
||
|
// // List<Map<String, dynamic>> keyValue = [
|
||
|
// // {
|
||
|
// // "Address": selectedPhoneNumber.address1,
|
||
|
// // "Postal Code": selectedPhoneNumber.postalCode,
|
||
|
// // "Primary": selectedPhoneNumber.formattedIsPrimary,
|
||
|
// // "organization Name": selectedPhoneNumber.organizationName,
|
||
|
// // "Country Name": selectedPhoneNumber.countryName,
|
||
|
// // "State Name": selectedPhoneNumber.stateName,
|
||
|
// // "City Name": selectedPhoneNumber.cityName,
|
||
|
// // }
|
||
|
// // ];
|
||
|
|
||
|
// // modelbsheet(keyValue);
|
||
|
// // },
|
||
|
// // onButtonPressed: () {
|
||
|
// // print("Show More button clicked");
|
||
|
// // },
|
||
|
// // )
|
||
|
// // : widget.offlineMode != null
|
||
|
// // ? CustomExpansionTile<Data>(
|
||
|
// // title: "Locations",
|
||
|
// // itemList: locationList.cast<Data>(),
|
||
|
// // buttonText: 'Show More',
|
||
|
// // field1: 'Institutation',
|
||
|
// // field2: 'Address',
|
||
|
// // noexpand: widget.offlineMode == null ? true : false,
|
||
|
// // onItemSelected: (Data selectedPhoneNumber) {},
|
||
|
// // )
|
||
|
// // : Container(),
|
||
|
// // Container(),
|
||
|
// // pno.length != 0
|
||
|
// // ? CustomExpansionTile<DataPhno>(
|
||
|
// // title: "Phone Numbers",
|
||
|
// // itemList: pno.cast<DataPhno>(),
|
||
|
// // buttonText: 'Show More',
|
||
|
// // field1: 'Phone Type',
|
||
|
// // field2: 'Phone No',
|
||
|
// // noexpand: widget.offlineMode == null ? true : false,
|
||
|
// // onItemSelected: (DataPhno selectedPhoneNumber) {
|
||
|
// // List<Map<String, dynamic>> keyValue = [
|
||
|
// // {
|
||
|
// // "Phone Number": selectedPhoneNumber.number,
|
||
|
// // "Phone Type": selectedPhoneNumber.phoneTypeName,
|
||
|
// // "Primary": selectedPhoneNumber.formattedIsPrimary,
|
||
|
// // "organization Name": selectedPhoneNumber.organizationName,
|
||
|
// // }
|
||
|
// // ];
|
||
|
|
||
|
// // modelbsheet(keyValue);
|
||
|
// // },
|
||
|
// // )
|
||
|
// // : widget.offlineMode != null
|
||
|
// // ? CustomExpansionTile<DataPhno>(
|
||
|
// // title: "Phone Numbers",
|
||
|
// // itemList: pno.cast<DataPhno>(),
|
||
|
// // buttonText: 'Show More',
|
||
|
// // field1: 'Phone Type',
|
||
|
// // field2: 'Phone No',
|
||
|
// // noexpand: false,
|
||
|
// // onItemSelected: (DataPhno selectedPhoneNumber) {},
|
||
|
// // )
|
||
|
// // : Container(),
|
||
|
// // emailid.length != 0
|
||
|
// // ? CustomExpansionTile<EmailData>(
|
||
|
// // title: "Emails",
|
||
|
// // itemList: emailid.cast<EmailData>(),
|
||
|
// // buttonText: 'Show More',
|
||
|
// // field1: 'Email Type',
|
||
|
// // field2: 'Email',
|
||
|
// // noexpand: widget.offlineMode == null ? true : false,
|
||
|
// // onItemSelected: (EmailData selectedPhoneNumber) {
|
||
|
// // List<Map<String, dynamic>> keyValue = [
|
||
|
// // {
|
||
|
// // "Email": selectedPhoneNumber.email,
|
||
|
// // "Email Type": selectedPhoneNumber.emailTypeName,
|
||
|
// // }
|
||
|
// // ];
|
||
|
|
||
|
// // modelbsheet(keyValue);
|
||
|
// // },
|
||
|
// // )
|
||
|
// // : widget.offlineMode != null
|
||
|
// // ? CustomExpansionTile<EmailData>(
|
||
|
// // title: "Emails",
|
||
|
// // itemList: emailid.cast<EmailData>(),
|
||
|
// // buttonText: 'Show More',
|
||
|
// // field1: 'Email Type',
|
||
|
// // field2: 'Email',
|
||
|
// // noexpand: false,
|
||
|
// // onItemSelected: (EmailData selectedPhoneNumber) {},
|
||
|
// // )
|
||
|
// // : Container(),
|
||
|
// // training.length != 0
|
||
|
// // ? CustomExpansionTile<TrainingList>(
|
||
|
// // title: "Trainings",
|
||
|
// // itemList: training.cast<TrainingList>(),
|
||
|
// // buttonText: 'Show More',
|
||
|
// // field1: 'Education Type',
|
||
|
// // field2: 'Institution Name',
|
||
|
// // noexpand: widget.offlineMode == null ? true : false,
|
||
|
// // onItemSelected: (TrainingList selectedPhoneNumber) {
|
||
|
// // List<Map<String, dynamic>> keyValue = [
|
||
|
// // {
|
||
|
// // "organization Id": selectedPhoneNumber.organizationId,
|
||
|
// // "Degree": selectedPhoneNumber.degree,
|
||
|
// // "Specialty": selectedPhoneNumber.specialty,
|
||
|
// // "Start Date": selectedPhoneNumber.startDate,
|
||
|
// // "End Date": selectedPhoneNumber.endDate,
|
||
|
// // }
|
||
|
// // ];
|
||
|
// // modelbsheet(keyValue);
|
||
|
// // },
|
||
|
// // )
|
||
|
// // : widget.offlineMode != null
|
||
|
// // ? CustomExpansionTile<TrainingList>(
|
||
|
// // title: "Trainings",
|
||
|
// // itemList: training.cast<TrainingList>(),
|
||
|
// // buttonText: 'Show More',
|
||
|
// // field1: 'Education Type',
|
||
|
// // field2: 'Institution Name',
|
||
|
// // noexpand: false,
|
||
|
// // onItemSelected: (TrainingList selectedPhoneNumber) {},
|
||
|
// // )
|
||
|
// // : Container(),
|
||
|
// // education.length != 0
|
||
|
// // ? CustomExpansionTile<EducationList>(
|
||
|
// // title: "Education",
|
||
|
// // itemList: education.cast<EducationList>(),
|
||
|
// // buttonText: 'Show More',
|
||
|
// // field1: 'Education Type',
|
||
|
// // field2: 'Institution Name',
|
||
|
// // noexpand: widget.offlineMode == null ? true : false,
|
||
|
// // onItemSelected: (EducationList selectedPhoneNumber) {
|
||
|
// // List<Map<String, dynamic>> keyValue = [
|
||
|
// // {
|
||
|
// // "organization Id": selectedPhoneNumber.organizationId,
|
||
|
// // "Degree": selectedPhoneNumber.degree,
|
||
|
// // "Specialty": selectedPhoneNumber.specialty,
|
||
|
// // "Start Date": selectedPhoneNumber.startDate,
|
||
|
// // "End Date": selectedPhoneNumber.endDate,
|
||
|
// // }
|
||
|
// // ];
|
||
|
// // modelbsheet(keyValue);
|
||
|
// // },
|
||
|
// // )
|
||
|
// // : widget.offlineMode != null
|
||
|
// // ? CustomExpansionTile<EducationList>(
|
||
|
// // title: "Education",
|
||
|
// // itemList: education.cast<EducationList>(),
|
||
|
// // buttonText: 'Show More',
|
||
|
// // field1: 'Education Type',
|
||
|
// // field2: 'Institution Name',
|
||
|
// // noexpand: false,
|
||
|
// // onItemSelected: (EducationList selectedPhoneNumber) {},
|
||
|
// // )
|
||
|
// // : Container(),
|
||
|
// // award.length != 0
|
||
|
// // ? CustomExpansionTile<AwardsList>(
|
||
|
// // title: "Awards",
|
||
|
// // itemList: award.cast<AwardsList>(),
|
||
|
// // buttonText: 'Show More',
|
||
|
// // field1: 'Education Type',
|
||
|
// // field2: 'Institution Name',
|
||
|
// // noexpand: widget.offlineMode == null ? true : false,
|
||
|
// // onItemSelected: (AwardsList selectedPhoneNumber) {
|
||
|
// // List<Map<String, dynamic>> keyValue = [
|
||
|
// // {
|
||
|
// // "Name": selectedPhoneNumber.name,
|
||
|
// // "Start Date": selectedPhoneNumber.startDate,
|
||
|
// // "End Date": selectedPhoneNumber.endDate,
|
||
|
// // }
|
||
|
// // ];
|
||
|
// // modelbsheet(keyValue);
|
||
|
// // },
|
||
|
// // )
|
||
|
// // : widget.offlineMode != null
|
||
|
// // ? CustomExpansionTile<AwardsList>(
|
||
|
// // title: "Awards",
|
||
|
// // itemList: award.cast<AwardsList>(),
|
||
|
// // buttonText: 'Show More',
|
||
|
// // field1: 'Education Type',
|
||
|
// // field2: 'Institution Name',
|
||
|
// // noexpand: false,
|
||
|
// // onItemSelected: (AwardsList selectedPhoneNumber) {},
|
||
|
// // )
|
||
|
// // : Container(),
|
||
|
// // certificate.length != 0
|
||
|
// // ? CustomExpansionTile<CertificateList>(
|
||
|
// // title: "Certificates",
|
||
|
// // itemList: certificate.cast<CertificateList>(),
|
||
|
// // buttonText: 'Show More',
|
||
|
// // field1: 'Education Type',
|
||
|
// // field2: 'Institution Name',
|
||
|
// // noexpand: widget.offlineMode == null ? true : false,
|
||
|
// // onItemSelected: (CertificateList selectedPhoneNumber) {
|
||
|
// // List<Map<String, dynamic>> keyValue = [
|
||
|
// // {
|
||
|
// // "Organization Id": selectedPhoneNumber.organizationId,
|
||
|
// // "specialty": selectedPhoneNumber.specialty,
|
||
|
// // "Start Date": selectedPhoneNumber.startDate,
|
||
|
// // "End Date": selectedPhoneNumber.endDate,
|
||
|
// // }
|
||
|
// // ];
|
||
|
// // modelbsheet(keyValue);
|
||
|
// // },
|
||
|
// // )
|
||
|
// // : widget.offlineMode != null
|
||
|
// // ? CustomExpansionTile<CertificateList>(
|
||
|
// // title: "Certificates",
|
||
|
// // itemList: certificate.cast<CertificateList>(),
|
||
|
// // buttonText: 'Show More',
|
||
|
// // field1: 'Education Type',
|
||
|
// // field2: 'Institution Name',
|
||
|
// // noexpand: false,
|
||
|
// // onItemSelected: (CertificateList selectedPhoneNumber) {},
|
||
|
// // )
|
||
|
// // : Container(),
|
||
|
// // ]
|
||
|
// ),
|
||
|
// );
|
||
|
// }
|
||
|
|
||
|
// void modelbsheet(List<Map<String, dynamic>> keyValue) {
|
||
|
// showModalBottomSheet(
|
||
|
// useRootNavigator: true,
|
||
|
// isScrollControlled: false,
|
||
|
// enableDrag: true,
|
||
|
// useSafeArea: true,
|
||
|
// constraints: const BoxConstraints(
|
||
|
// maxWidth: double.infinity,
|
||
|
// ),
|
||
|
// shape: const RoundedRectangleBorder(
|
||
|
// borderRadius: BorderRadius.vertical(
|
||
|
// top: Radius.circular(0),
|
||
|
// ),
|
||
|
// ),
|
||
|
// clipBehavior: Clip.antiAliasWithSaveLayer,
|
||
|
// context: context,
|
||
|
// builder: (context) {
|
||
|
// return bsheetk2new(keyValue);
|
||
|
// },
|
||
|
// );
|
||
|
// }
|
||
|
// }
|
||
|
|
||
|
// import 'package:discover_module/custom_widget/custom_expansiontile.dart';
|
||
|
import 'package:discover_module/contacts_module/custom_widget/custom_expansiontile.dart';
|
||
|
import 'package:discover_module/contacts_module/model_class/k2_api_model/kol_Certificate_k2.dart';
|
||
|
import 'package:discover_module/contacts_module/model_class/k2_api_model/kol_awards_k2.dart';
|
||
|
import 'package:discover_module/contacts_module/model_class/k2_api_model/kol_education_k2.dart';
|
||
|
import 'package:discover_module/contacts_module/model_class/k2_api_model/kol_email_k2.dart';
|
||
|
import 'package:discover_module/contacts_module/model_class/k2_api_model/kol_location_k2.dart';
|
||
|
import 'package:discover_module/contacts_module/model_class/k2_api_model/kol_pno_k2.dart';
|
||
|
import 'package:discover_module/contacts_module/model_class/k2_api_model/kol_training_k2.dart';
|
||
|
import 'package:discover_module/contacts_module/provider_class/k2_provider/kol_awards_provider.dart';
|
||
|
import 'package:discover_module/contacts_module/provider_class/k2_provider/kol_certificate_provider.dart';
|
||
|
import 'package:discover_module/contacts_module/provider_class/k2_provider/kol_education_provider.dart';
|
||
|
import 'package:discover_module/contacts_module/provider_class/k2_provider/kol_email_provider.dart';
|
||
|
import 'package:discover_module/contacts_module/provider_class/k2_provider/kol_locationprovider.dart';
|
||
|
import 'package:discover_module/contacts_module/provider_class/k2_provider/kol_pno_provider.dart';
|
||
|
import 'package:discover_module/contacts_module/provider_class/k2_provider/kol_training_provider.dart';
|
||
|
import 'package:discover_module/contacts_module/storage_hive/awa_data/crud_awa.dart';
|
||
|
import 'package:discover_module/contacts_module/storage_hive/cer_hive/crud_cer.dart';
|
||
|
import 'package:discover_module/contacts_module/storage_hive/edu_data/crud_edu.dart';
|
||
|
import 'package:discover_module/contacts_module/storage_hive/email_data/crud_email.dart';
|
||
|
import 'package:discover_module/contacts_module/storage_hive/loc_data/crud_loc.dart';
|
||
|
import 'package:discover_module/contacts_module/storage_hive/pno_data/crud_pno.dart';
|
||
|
import 'package:discover_module/contacts_module/storage_hive/traning_data/crud_training.dart';
|
||
|
import 'package:discover_module/contacts_module/ui_screen/k2api_integrated_ui/k2testbshhet.dart';
|
||
|
|
||
|
import 'package:flutter/material.dart';
|
||
|
import 'package:provider/provider.dart';
|
||
|
|
||
|
class LocationK2Tab1 extends StatefulWidget {
|
||
|
// const LocationTab({super.key});
|
||
|
LocationK2Tab1({required this.text, this.offline, Key? key, this.offlineMode})
|
||
|
: super(key: key);
|
||
|
|
||
|
final int text;
|
||
|
int? offline;
|
||
|
bool? offlineMode;
|
||
|
@override
|
||
|
State<LocationK2Tab1> createState() => _LocationK2TabState();
|
||
|
}
|
||
|
|
||
|
class _LocationK2TabState extends State<LocationK2Tab1> {
|
||
|
List<dynamic> locationList = [];
|
||
|
|
||
|
// List locationList = [];
|
||
|
List pno = [];
|
||
|
List emailid = [];
|
||
|
|
||
|
List training = [];
|
||
|
List education = [];
|
||
|
List award = [];
|
||
|
List certificate = [];
|
||
|
|
||
|
@override
|
||
|
void initState() {
|
||
|
// TODO: implement initState
|
||
|
super.initState();
|
||
|
|
||
|
print("I_amFalseee: ${widget.offlineMode}");
|
||
|
|
||
|
print("I_am_locationList: ${locationList}");
|
||
|
|
||
|
// WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
|
||
|
getAffiliations();
|
||
|
// });
|
||
|
}
|
||
|
|
||
|
Future<void> getAffiliations() async {
|
||
|
// ignore: prefer_typ(ing_uninitialized_variables
|
||
|
var loclist, phoneno, emailno1, edu1, awa1, cer1, training1;
|
||
|
|
||
|
if (widget.offline == 1) {
|
||
|
loclist = await retrieveidlocations(widget.text);
|
||
|
} else if (widget.offlineMode == false) {
|
||
|
} else {
|
||
|
if (locationList.isEmpty) {
|
||
|
print("Location_is_empty");
|
||
|
|
||
|
var location = Provider.of<LocationKolProvider>(context, listen: false);
|
||
|
await location.locationinfo(widget.text);
|
||
|
locationList = location.locationlist;
|
||
|
|
||
|
// setState(() {
|
||
|
// locationList = loclist;
|
||
|
// });
|
||
|
} else {
|
||
|
print("Location_not empty");
|
||
|
}
|
||
|
}
|
||
|
// final locationProvider =
|
||
|
// Provider.of<LocationKolProvider>(context, listen: false);
|
||
|
|
||
|
// if (locationProvider.locationList.isEmpty) {
|
||
|
// await locationProvider.fetchLocations(
|
||
|
// widget.text, widget.offline, widget.offlineMode);
|
||
|
|
||
|
// locationList = locationProvider.locationList;
|
||
|
// } else {
|
||
|
// print("Iam_emptyyyy");
|
||
|
// }
|
||
|
|
||
|
if (mounted) {
|
||
|
if (widget.offline == 1) {
|
||
|
phoneno = await retrieveidpnos(widget.text);
|
||
|
} else {
|
||
|
var phone = Provider.of<PhonenoProviderK2>(context, listen: false);
|
||
|
await phone.phonek2info(widget.text);
|
||
|
phoneno = phone.phonenolist;
|
||
|
}
|
||
|
setState(() {
|
||
|
pno = phoneno;
|
||
|
});
|
||
|
}
|
||
|
|
||
|
if (mounted) {
|
||
|
if (widget.offline == 1) {
|
||
|
emailno1 = await retrieveidemails(widget.text);
|
||
|
print("Saved_CheckingloclistEmailll: $emailno1");
|
||
|
} else {
|
||
|
var email = Provider.of<EmailProviderK2>(context, listen: false);
|
||
|
await email.emailinfo(widget.text);
|
||
|
emailno1 = email.emailkollist;
|
||
|
print("Saved_CheckingloclistEmailll123: $emailno1");
|
||
|
}
|
||
|
|
||
|
setState(() {
|
||
|
emailid = emailno1;
|
||
|
});
|
||
|
}
|
||
|
|
||
|
if (mounted) {
|
||
|
if (widget.offline == 1) {
|
||
|
training1 = await retrieveidtri(widget.text);
|
||
|
print("Saved_CheckingloclistEmailll: $emailno1");
|
||
|
} else {
|
||
|
var trai = Provider.of<TrainigProviderK2>(context, listen: false);
|
||
|
await trai.traininginfo(widget.text);
|
||
|
training1 = trai.traininglist;
|
||
|
}
|
||
|
|
||
|
setState(() {
|
||
|
training = training1;
|
||
|
});
|
||
|
}
|
||
|
|
||
|
if (mounted) {
|
||
|
if (widget.offline == 1) {
|
||
|
edu1 = await retrieveidedus(widget.text);
|
||
|
print("Saved_CheckingloclistEdu: $edu1");
|
||
|
} else {
|
||
|
var edu = Provider.of<EducationProviderK2>(context, listen: false);
|
||
|
await edu.eduinfo(widget.text);
|
||
|
edu1 = edu.educationlist;
|
||
|
print("Saved_CheckingloclistEdu123: $edu1");
|
||
|
}
|
||
|
|
||
|
setState(() {
|
||
|
education = edu1;
|
||
|
});
|
||
|
}
|
||
|
|
||
|
if (mounted) {
|
||
|
if (widget.offline == 1) {
|
||
|
awa1 = await retrieveidawa(widget.text);
|
||
|
print("Saved_CheckingloclistEdu: $edu1");
|
||
|
} else {
|
||
|
var awa = Provider.of<AwardProviderK2>(context, listen: false);
|
||
|
await awa.awainfo(widget.text);
|
||
|
awa1 = awa.awardlist;
|
||
|
}
|
||
|
setState(() {
|
||
|
award = awa1;
|
||
|
});
|
||
|
}
|
||
|
|
||
|
if (mounted) {
|
||
|
if (widget.offline == 1) {
|
||
|
cer1 = await retrieveidcer(widget.text);
|
||
|
print("Saved_CheckingloclistEdu: $edu1");
|
||
|
} else {
|
||
|
var cer = Provider.of<CertificateProviderK2>(context, listen: false);
|
||
|
await cer.certificateinfo(widget.text);
|
||
|
cer1 = cer.certificatelist;
|
||
|
}
|
||
|
|
||
|
setState(() {
|
||
|
certificate = cer1;
|
||
|
});
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@override
|
||
|
Widget build(BuildContext context) {
|
||
|
return Center(
|
||
|
child: ListView(children: [
|
||
|
locationList.length != 0
|
||
|
? CustomExpansionTile<Data>(
|
||
|
title: "Locations",
|
||
|
itemList: locationList.cast<Data>(),
|
||
|
buttonText: 'Show More',
|
||
|
field1: 'Institutation',
|
||
|
field2: 'Address',
|
||
|
noexpand: widget.offlineMode == null ? true : false,
|
||
|
onItemSelected: (Data selectedPhoneNumber) {
|
||
|
List<Map<String, dynamic>> keyValue = [
|
||
|
{
|
||
|
"Address": selectedPhoneNumber.address1,
|
||
|
"Postal Code": selectedPhoneNumber.postalCode,
|
||
|
"Primary": selectedPhoneNumber.formattedIsPrimary,
|
||
|
"organization Name": selectedPhoneNumber.organizationName,
|
||
|
"Country Name": selectedPhoneNumber.countryName,
|
||
|
"State Name": selectedPhoneNumber.stateName,
|
||
|
"City Name": selectedPhoneNumber.cityName,
|
||
|
}
|
||
|
];
|
||
|
|
||
|
modelbsheet(keyValue);
|
||
|
},
|
||
|
onButtonPressed: () {
|
||
|
print("Show More button clicked");
|
||
|
},
|
||
|
)
|
||
|
: widget.offlineMode != null
|
||
|
? CustomExpansionTile<Data>(
|
||
|
title: "Locations",
|
||
|
itemList: locationList.cast<Data>(),
|
||
|
buttonText: 'Show More',
|
||
|
field1: 'Institutation',
|
||
|
field2: 'Address',
|
||
|
noexpand: widget.offlineMode == null ? true : false,
|
||
|
onItemSelected: (Data selectedPhoneNumber) {},
|
||
|
)
|
||
|
: Container(),
|
||
|
Container(),
|
||
|
pno.length != 0
|
||
|
? CustomExpansionTile<DataPhno>(
|
||
|
title: "Phone Numbers",
|
||
|
itemList: pno.cast<DataPhno>(),
|
||
|
buttonText: 'Show More',
|
||
|
field1: 'Phone Type',
|
||
|
field2: 'Phone No',
|
||
|
noexpand: widget.offlineMode == null ? true : false,
|
||
|
onItemSelected: (DataPhno selectedPhoneNumber) {
|
||
|
List<Map<String, dynamic>> keyValue = [
|
||
|
{
|
||
|
"Phone Number": selectedPhoneNumber.number,
|
||
|
"Phone Type": selectedPhoneNumber.phoneTypeName,
|
||
|
"Primary": selectedPhoneNumber.formattedIsPrimary,
|
||
|
"organization Name": selectedPhoneNumber.organizationName,
|
||
|
}
|
||
|
];
|
||
|
|
||
|
modelbsheet(keyValue);
|
||
|
},
|
||
|
)
|
||
|
: widget.offlineMode != null
|
||
|
? CustomExpansionTile<DataPhno>(
|
||
|
title: "Phone Numbers",
|
||
|
itemList: pno.cast<DataPhno>(),
|
||
|
buttonText: 'Show More',
|
||
|
field1: 'Phone Type',
|
||
|
field2: 'Phone No',
|
||
|
noexpand: false,
|
||
|
onItemSelected: (DataPhno selectedPhoneNumber) {},
|
||
|
)
|
||
|
: Container(),
|
||
|
emailid.length != 0
|
||
|
? CustomExpansionTile<EmailData>(
|
||
|
title: "Emails",
|
||
|
itemList: emailid.cast<EmailData>(),
|
||
|
buttonText: 'Show More',
|
||
|
field1: 'Email Type',
|
||
|
field2: 'Email',
|
||
|
noexpand: widget.offlineMode == null ? true : false,
|
||
|
onItemSelected: (EmailData selectedPhoneNumber) {
|
||
|
List<Map<String, dynamic>> keyValue = [
|
||
|
{
|
||
|
"Email": selectedPhoneNumber.email,
|
||
|
"Email Type": selectedPhoneNumber.emailTypeName,
|
||
|
}
|
||
|
];
|
||
|
|
||
|
modelbsheet(keyValue);
|
||
|
},
|
||
|
)
|
||
|
: widget.offlineMode != null
|
||
|
? CustomExpansionTile<EmailData>(
|
||
|
title: "Emails",
|
||
|
itemList: emailid.cast<EmailData>(),
|
||
|
buttonText: 'Show More',
|
||
|
field1: 'Email Type',
|
||
|
field2: 'Email',
|
||
|
noexpand: false,
|
||
|
onItemSelected: (EmailData selectedPhoneNumber) {},
|
||
|
)
|
||
|
: Container(),
|
||
|
training.length != 0
|
||
|
? CustomExpansionTile<TrainingList>(
|
||
|
title: "Trainings",
|
||
|
itemList: training.cast<TrainingList>(),
|
||
|
buttonText: 'Show More',
|
||
|
field1: 'Education Type',
|
||
|
field2: 'Institution Name',
|
||
|
noexpand: widget.offlineMode == null ? true : false,
|
||
|
onItemSelected: (TrainingList selectedPhoneNumber) {
|
||
|
List<Map<String, dynamic>> keyValue = [
|
||
|
{
|
||
|
"organization Id": selectedPhoneNumber.organizationId,
|
||
|
"Degree": selectedPhoneNumber.degree,
|
||
|
"Specialty": selectedPhoneNumber.specialty,
|
||
|
"Start Date": selectedPhoneNumber.startDate,
|
||
|
"End Date": selectedPhoneNumber.endDate,
|
||
|
}
|
||
|
];
|
||
|
modelbsheet(keyValue);
|
||
|
},
|
||
|
)
|
||
|
: widget.offlineMode != null
|
||
|
? CustomExpansionTile<TrainingList>(
|
||
|
title: "Trainings",
|
||
|
itemList: training.cast<TrainingList>(),
|
||
|
buttonText: 'Show More',
|
||
|
field1: 'Education Type',
|
||
|
field2: 'Institution Name',
|
||
|
noexpand: false,
|
||
|
onItemSelected: (TrainingList selectedPhoneNumber) {},
|
||
|
)
|
||
|
: Container(),
|
||
|
education.length != 0
|
||
|
? CustomExpansionTile<EducationList>(
|
||
|
title: "Education",
|
||
|
itemList: education.cast<EducationList>(),
|
||
|
buttonText: 'Show More',
|
||
|
field1: 'Education Type',
|
||
|
field2: 'Institution Name',
|
||
|
noexpand: widget.offlineMode == null ? true : false,
|
||
|
onItemSelected: (EducationList selectedPhoneNumber) {
|
||
|
List<Map<String, dynamic>> keyValue = [
|
||
|
{
|
||
|
"organization Id": selectedPhoneNumber.organizationId,
|
||
|
"Degree": selectedPhoneNumber.degree,
|
||
|
"Specialty": selectedPhoneNumber.specialty,
|
||
|
"Start Date": selectedPhoneNumber.startDate,
|
||
|
"End Date": selectedPhoneNumber.endDate,
|
||
|
}
|
||
|
];
|
||
|
modelbsheet(keyValue);
|
||
|
},
|
||
|
)
|
||
|
: widget.offlineMode != null
|
||
|
? CustomExpansionTile<EducationList>(
|
||
|
title: "Education",
|
||
|
itemList: education.cast<EducationList>(),
|
||
|
buttonText: 'Show More',
|
||
|
field1: 'Education Type',
|
||
|
field2: 'Institution Name',
|
||
|
noexpand: false,
|
||
|
onItemSelected: (EducationList selectedPhoneNumber) {},
|
||
|
)
|
||
|
: Container(),
|
||
|
award.length != 0
|
||
|
? CustomExpansionTile<AwardsList>(
|
||
|
title: "Awards",
|
||
|
itemList: award.cast<AwardsList>(),
|
||
|
buttonText: 'Show More',
|
||
|
field1: 'Education Type',
|
||
|
field2: 'Institution Name',
|
||
|
noexpand: widget.offlineMode == null ? true : false,
|
||
|
onItemSelected: (AwardsList selectedPhoneNumber) {
|
||
|
List<Map<String, dynamic>> keyValue = [
|
||
|
{
|
||
|
"Name": selectedPhoneNumber.name,
|
||
|
"Start Date": selectedPhoneNumber.startDate,
|
||
|
"End Date": selectedPhoneNumber.endDate,
|
||
|
}
|
||
|
];
|
||
|
modelbsheet(keyValue);
|
||
|
},
|
||
|
)
|
||
|
: widget.offlineMode != null
|
||
|
? CustomExpansionTile<AwardsList>(
|
||
|
title: "Awards",
|
||
|
itemList: award.cast<AwardsList>(),
|
||
|
buttonText: 'Show More',
|
||
|
field1: 'Education Type',
|
||
|
field2: 'Institution Name',
|
||
|
noexpand: false,
|
||
|
onItemSelected: (AwardsList selectedPhoneNumber) {},
|
||
|
)
|
||
|
: Container(),
|
||
|
certificate.length != 0
|
||
|
? CustomExpansionTile<CertificateList>(
|
||
|
title: "Certificates",
|
||
|
itemList: certificate.cast<CertificateList>(),
|
||
|
buttonText: 'Show More',
|
||
|
field1: 'Education Type',
|
||
|
field2: 'Institution Name',
|
||
|
noexpand: widget.offlineMode == null ? true : false,
|
||
|
onItemSelected: (CertificateList selectedPhoneNumber) {
|
||
|
List<Map<String, dynamic>> keyValue = [
|
||
|
{
|
||
|
"Organization Id": selectedPhoneNumber.organizationId,
|
||
|
"specialty": selectedPhoneNumber.specialty,
|
||
|
"Start Date": selectedPhoneNumber.startDate,
|
||
|
"End Date": selectedPhoneNumber.endDate,
|
||
|
}
|
||
|
];
|
||
|
modelbsheet(keyValue);
|
||
|
},
|
||
|
)
|
||
|
: widget.offlineMode != null
|
||
|
? CustomExpansionTile<CertificateList>(
|
||
|
title: "Certificates",
|
||
|
itemList: certificate.cast<CertificateList>(),
|
||
|
buttonText: 'Show More',
|
||
|
field1: 'Education Type',
|
||
|
field2: 'Institution Name',
|
||
|
noexpand: false,
|
||
|
onItemSelected: (CertificateList selectedPhoneNumber) {},
|
||
|
)
|
||
|
: Container(),
|
||
|
]),
|
||
|
);
|
||
|
}
|
||
|
|
||
|
void modelbsheet(List<Map<String, dynamic>> keyValue) {
|
||
|
showModalBottomSheet(
|
||
|
useRootNavigator: true,
|
||
|
isScrollControlled: false,
|
||
|
enableDrag: true,
|
||
|
useSafeArea: true,
|
||
|
constraints: const BoxConstraints(
|
||
|
maxWidth: double.infinity,
|
||
|
),
|
||
|
shape: const RoundedRectangleBorder(
|
||
|
borderRadius: BorderRadius.vertical(
|
||
|
top: Radius.circular(0),
|
||
|
),
|
||
|
),
|
||
|
clipBehavior: Clip.antiAliasWithSaveLayer,
|
||
|
context: context,
|
||
|
builder: (context) {
|
||
|
return bsheetk2new(keyValue);
|
||
|
},
|
||
|
);
|
||
|
}
|
||
|
}
|