diff --git a/assets/introduction_animation/care_image.png b/assets/introduction_animation/care_image.png new file mode 100644 index 0000000..7881c2b Binary files /dev/null and b/assets/introduction_animation/care_image.png differ diff --git a/assets/images/events3.jpg b/assets/introduction_animation/events3.jpg similarity index 100% rename from assets/images/events3.jpg rename to assets/introduction_animation/events3.jpg diff --git a/assets/introduction_animation/introduction_animation.png b/assets/introduction_animation/introduction_animation.png new file mode 100644 index 0000000..5013b4c Binary files /dev/null and b/assets/introduction_animation/introduction_animation.png differ diff --git a/assets/introduction_animation/introduction_image.png b/assets/introduction_animation/introduction_image.png new file mode 100644 index 0000000..703317a Binary files /dev/null and b/assets/introduction_animation/introduction_image.png differ diff --git a/assets/introduction_animation/introduction_image1.png b/assets/introduction_animation/introduction_image1.png new file mode 100644 index 0000000..d39b345 Binary files /dev/null and b/assets/introduction_animation/introduction_image1.png differ diff --git a/assets/introduction_animation/mood_dairy_image.png b/assets/introduction_animation/mood_dairy_image.png new file mode 100644 index 0000000..595a971 Binary files /dev/null and b/assets/introduction_animation/mood_dairy_image.png differ diff --git a/assets/introduction_animation/relax_image.png b/assets/introduction_animation/relax_image.png new file mode 100644 index 0000000..091c932 Binary files /dev/null and b/assets/introduction_animation/relax_image.png differ diff --git a/assets/introduction_animation/welcome.png b/assets/introduction_animation/welcome.png new file mode 100644 index 0000000..c980acd Binary files /dev/null and b/assets/introduction_animation/welcome.png differ diff --git a/assets/medicalinsightform.json b/assets/medicalinsightform.json new file mode 100644 index 0000000..aee1992 --- /dev/null +++ b/assets/medicalinsightform.json @@ -0,0 +1,184 @@ +{ + "data": [ + { + "id": "MedInsight", + "name": "Medical Insights Form", + "form-fields": [ + { + "sectionName": "Medical Insight", + "multiple": false, + "sectionList": [ + { + "name": "HCP Name", + "id": "hcpname", + "depid": "", + "widget": "label", + "input": "label", + "validation": { + "isRequired": false + } + }, + { + "name": "Date", + "id": "date", + "depid": "", + "widget": "text", + "input": "Date", + "validation": { + "isRequired": true + } + }, + { + "name": "Therapeutic Area", + "param": "therapeutic_area", + "id": "therapeutic", + "selectedValue": [], + "depid": "", + "widget": "dropdown", + "input": "dropdown", + "inputList": [ + { + "id": "1", + "name": "Acute Neurology1" + }, + { + "id": "2", + "name": "Cystic Fibrosis" + } + ], + "validation": { + "isRequired": true + } + }, + { + "name": "Product", + "id": "product", + "depid": "therapeutic", + "widget": "dropdown", + "input": "dropdown", + "inputList": [ + { + "id": "11", + "pid": "1", + "name": "Prometra Pump" + }, + { + "id": "12", + "pid": "2", + "name": "Prometra Pump" + }, + { + "id": "13", + "pid": "2", + "name": "Prometra Catheter" + } + ], + "validation": { + "isRequired": true + } + }, + { + "name": "Source Type", + "id": "sourcetype", + "depid": "", + "widget": "dropdown", + "input": "dropdown", + "inputList": [ + { + "id": "21", + "name": "Advisory Board/Expert Committee" + }, + { + "id": "22", + "name": "Congress" + }, + { + "id": "23", + "name": "Industry professional direct knowledge " + } + ], + "validation": { + "isRequired": true + } + }, + { + "name": "Congress Source", + "id": "congresssource", + "depid": "sourcetype", + "widget": "dropdown", + "input": "dropdown", + "inputList": [ + { + "id": "31", + "pid": "22", + "name": "Industry professional" + }, + { + "id": "32", + "pid": "22", + "name": "Symposium" + } + + ], + "validation": { + "isRequired": false + } + }, + { + "name": "Congress Name", + "id": "congressName", + "depid": "sourcetype", + "widget": "text", + "input": "text", + "validation": { + "isRequired": false + } + } + ] + }, + { + "sectionName": "Key Insight Topics", + "multiple": false, + "sectionList": [ + { + "name": "Key Insight Topics", + "id": "keyinsighttopics", + "depid": "", + "param": "keyinsighttopics", + "widget": "dropdown", + "input": "dropdown", + "inputList": [ + { + "id": "41", + "name": "Data Gap" + } + + ], + "validation": { + "isRequired": true + } + } + ] + }, + { + "sectionName": "Medical Insights Details", + "multiple": false, + "sectionList": [ + { + "name": "Medical Insight Summary", + "id": "summary", + "depid": "", + "widget": "text", + "input": "textArea", + "validation": { + "isRequired": true, + "maxchars": "300" + } + } + + ] + } + ] + } + ] + } \ No newline at end of file diff --git a/ios/Podfile.lock b/ios/Podfile.lock index eedaa08..a7979f8 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -3,9 +3,7 @@ PODS: - Flutter - connectivity_plus (0.0.1): - Flutter - - ReachabilitySwift - - device_info_plus (0.0.1): - - Flutter + - FlutterMacOS - DKImagePickerController/Core (4.3.4): - DKImagePickerController/ImageDataManager - DKImagePickerController/Resource @@ -94,7 +92,7 @@ PODS: - mobile_device_identifier (0.0.1): - Flutter - JNKeychain - - package_info_plus (0.4.5): + - open_file (0.0.1): - Flutter - path_provider_foundation (0.0.1): - Flutter @@ -102,31 +100,33 @@ PODS: - permission_handler_apple (9.3.0): - Flutter - PromisesObjC (2.4.0) - - ReachabilitySwift (5.0.0) - SDWebImage (5.18.10): - SDWebImage/Core (= 5.18.10) - SDWebImage/Core (5.18.10) - shared_preferences_foundation (0.0.1): - Flutter - FlutterMacOS + - sqflite (0.0.3): + - Flutter + - FlutterMacOS - SwiftyGif (5.4.4) - url_launcher_ios (0.0.1): - Flutter DEPENDENCIES: - add_2_calendar (from `.symlinks/plugins/add_2_calendar/ios`) - - connectivity_plus (from `.symlinks/plugins/connectivity_plus/ios`) - - device_info_plus (from `.symlinks/plugins/device_info_plus/ios`) + - connectivity_plus (from `.symlinks/plugins/connectivity_plus/darwin`) - file_picker (from `.symlinks/plugins/file_picker/ios`) - firebase_core (from `.symlinks/plugins/firebase_core/ios`) - firebase_remote_config (from `.symlinks/plugins/firebase_remote_config/ios`) - Flutter (from `Flutter`) - image_picker_ios (from `.symlinks/plugins/image_picker_ios/ios`) - mobile_device_identifier (from `.symlinks/plugins/mobile_device_identifier/ios`) - - package_info_plus (from `.symlinks/plugins/package_info_plus/ios`) + - open_file (from `.symlinks/plugins/open_file/ios`) - path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`) - permission_handler_apple (from `.symlinks/plugins/permission_handler_apple/ios`) - shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`) + - sqflite (from `.symlinks/plugins/sqflite/darwin`) - url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`) SPEC REPOS: @@ -144,7 +144,6 @@ SPEC REPOS: - GoogleUtilities - JNKeychain - PromisesObjC - - ReachabilitySwift - SDWebImage - SwiftyGif @@ -152,9 +151,7 @@ EXTERNAL SOURCES: add_2_calendar: :path: ".symlinks/plugins/add_2_calendar/ios" connectivity_plus: - :path: ".symlinks/plugins/connectivity_plus/ios" - device_info_plus: - :path: ".symlinks/plugins/device_info_plus/ios" + :path: ".symlinks/plugins/connectivity_plus/darwin" file_picker: :path: ".symlinks/plugins/file_picker/ios" firebase_core: @@ -167,24 +164,25 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/image_picker_ios/ios" mobile_device_identifier: :path: ".symlinks/plugins/mobile_device_identifier/ios" - package_info_plus: - :path: ".symlinks/plugins/package_info_plus/ios" + open_file: + :path: ".symlinks/plugins/open_file/ios" path_provider_foundation: :path: ".symlinks/plugins/path_provider_foundation/darwin" permission_handler_apple: :path: ".symlinks/plugins/permission_handler_apple/ios" shared_preferences_foundation: :path: ".symlinks/plugins/shared_preferences_foundation/darwin" + sqflite: + :path: ".symlinks/plugins/sqflite/darwin" url_launcher_ios: :path: ".symlinks/plugins/url_launcher_ios/ios" SPEC CHECKSUMS: add_2_calendar: 5eee66d5a3b99cd5e1487a7e03abd4e3ac4aff11 - connectivity_plus: 413a8857dd5d9f1c399a39130850d02fe0feaf7e - device_info_plus: c6fb39579d0f423935b0c9ce7ee2f44b71b9fce6 + connectivity_plus: ddd7f30999e1faaef5967c23d5b6d503d10434db DKImagePickerController: b512c28220a2b8ac7419f21c491fc8534b7601ac DKPhotoGallery: fdfad5125a9fdda9cc57df834d49df790dbb4179 - file_picker: 15fd9539e4eb735dc54bae8c0534a7a9511a03de + file_picker: 09aa5ec1ab24135ccd7a1621c46c84134bfd6655 Firebase: 0312a2352584f782ea56f66d91606891d4607f06 firebase_core: 0b39f4f424e02eecabb2356ddf331fa07b772af8 firebase_remote_config: f57c28ff78d1d933bbe1b2cc11659cc82f9978e8 @@ -200,13 +198,13 @@ SPEC CHECKSUMS: image_picker_ios: b545a5f16c0fa88e3ecbbce3ed4de45567a8ec18 JNKeychain: fb6cc9ec95959ba46cd95d0ee6f7a05e41da9f42 mobile_device_identifier: 34f80c8985bb1506880c2ae10cb24cfb9918f1a7 - package_info_plus: 115f4ad11e0698c8c1c5d8a689390df880f47e85 + open_file: 02eb5cb6b21264bd3a696876f5afbfb7ca4f4b7d path_provider_foundation: 3784922295ac71e43754bd15e0653ccfd36a147c permission_handler_apple: 9878588469a2b0d0fc1e048d9f43605f92e6cec2 PromisesObjC: f5707f49cb48b9636751c5b2e7d227e43fba9f47 - ReachabilitySwift: 985039c6f7b23a1da463388634119492ff86c825 SDWebImage: fc8f2d48bbfd72ef39d70e981bd24a3f3be53fec shared_preferences_foundation: b4c3b4cddf1c21f02770737f147a3f5da9d39695 + sqflite: 673a0e54cc04b7d6dba8d24fb8095b31c3a99eec SwiftyGif: 93a1cc87bf3a51916001cf8f3d63835fb64c819f url_launcher_ios: 6116280ddcfe98ab8820085d8d76ae7449447586 diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 0f1ee7f..4622697 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -490,7 +490,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; - DEVELOPMENT_TEAM = 69ERN967NS; + DEVELOPMENT_TEAM = 44SNAJ6T8L; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( @@ -668,8 +668,10 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; + CODE_SIGN_IDENTITY = "Apple Development"; + CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; - DEVELOPMENT_TEAM = 69ERN967NS; + DEVELOPMENT_TEAM = 44SNAJ6T8L; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( @@ -678,6 +680,7 @@ ); PRODUCT_BUNDLE_IDENTIFIER = com.example.konectarEvents; PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE_SPECIFIER = ""; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_VERSION = 5.0; diff --git a/lib/contacts_module/ui_screen/interactionform/configprovider.dart b/lib/contacts_module/ui_screen/interactionform/configprovider.dart index b6e79d2..5b32eee 100644 --- a/lib/contacts_module/ui_screen/interactionform/configprovider.dart +++ b/lib/contacts_module/ui_screen/interactionform/configprovider.dart @@ -3,6 +3,9 @@ // import 'package:konectar_events/ui_screen/interactionform/model/interaction_config_data.dart'; // import 'package:konectar_events/ui_screen/interactionform/model/interaction_data.dart'; // import 'package:konectar_events/ui_screen/interactionform/util.dart'; +import 'dart:convert'; + +import 'package:flutter/services.dart'; import 'package:konectar_events/contacts_module/ui_screen/interactionform/NewtworkConnectivity.dart'; import 'package:konectar_events/contacts_module/ui_screen/interactionform/mockapi.dart'; import 'package:konectar_events/contacts_module/ui_screen/interactionform/model/interaction_config_data.dart'; @@ -151,6 +154,39 @@ class ConfigDataProvider extends ChangeNotifier { notifyListeners(); } + Future initConfigUIDataMediccalInsight() async { + List interactionConfigData = []; + // interactionConfigData = await fetchInteactionConfigData(); + //interactionConfigData = fetchInteactionUIConfigData(jsonResult); + + NetworkConnectivity networkConnectivity = NetworkConnectivity(); + bool isOnline = await networkConnectivity.isInternetAvailable(); + if (isOnline) { + // if (await InternetConnectionChecker().hasConnection) { + interactionConfigData = await fetchLocalMedicalInsight(); + var box = Hive.box('InteractionConfigDataBox'); + + if (!box.isOpen) { + box = await Hive.openBox( + 'InteractionConfigDataBox'); + } + + if (box.isEmpty) { + for (InteractionConfigData data in interactionConfigData) { + box.put(await getNextAutoIncrementValue(), data); + } + } else { + box.clear(); + print("IamELse"); + + for (InteractionConfigData data in interactionConfigData) { + box.put(await getNextAutoIncrementValue(), data); + } + } + } + notifyListeners(); + } + Future> fetchLocalInteactionConfigDataMedical() async { // dynamic jsonResult = jsonDecode( @@ -171,6 +207,25 @@ class ConfigDataProvider extends ChangeNotifier { return interactionConfigData; } + Future> fetchLocalMedicalInsight() async { + dynamic jsonResult = jsonDecode( + await rootBundle.loadString("assets/medicalinsightform.json")); + //dynamic jsonResult = await MockApiCall().getConfigDataMedical(); + + List interactionConfigData = []; + + ResponseData responseData = ResponseDataFromJson(jsonResult); + print('Response_data_is: $responseData'); + print('Response_data_dta_is: ${responseData.data}'); + + for (InteractionResultData obj in responseData.data) { + interactionConfigData + .add(InteractionConfigData(widgets: obj, id: obj.id, name: obj.name)); + } + print("interactionConfigData_issss: ${interactionConfigData.length}"); + return interactionConfigData; + } + Future initConfigUIDataEng() async { List interactionConfigData = []; // interactionConfigData = await fetchInteactionConfigData(); diff --git a/lib/contacts_module/ui_screen/interactionform/interaction_screen.dart b/lib/contacts_module/ui_screen/interactionform/interaction_screen.dart index a7f47e5..b7a813a 100644 --- a/lib/contacts_module/ui_screen/interactionform/interaction_screen.dart +++ b/lib/contacts_module/ui_screen/interactionform/interaction_screen.dart @@ -560,11 +560,12 @@ class _InteractionScreenState extends State { ), ), ); - case InteractionWidget.DROPDOWN: - // return customdropdown(sectionItem, provider, list, multiple); - return customAutoCompletedropdown( - sectionItem, provider, list, multiple); + case InteractionWidget.DROPDOWN: + return customdropdown(sectionItem, provider, list, multiple); + + // return customAutoCompletedropdown( + // sectionItem, provider, list, multiple); } } @@ -671,7 +672,7 @@ class _InteractionScreenState extends State { backgroundColor: Colors.green.shade500, onPressed: () async { String record = - await provider.saveJsonObject(context, widget.form); + await provider.saveJsonObject(context, widget.form, "hc"); print("Validation_isss: ${provider.isLoading}"); diff --git a/lib/contacts_module/ui_screen/interactionform/interactionprovider.dart b/lib/contacts_module/ui_screen/interactionform/interactionprovider.dart index 51ffe72..7dce420 100644 --- a/lib/contacts_module/ui_screen/interactionform/interactionprovider.dart +++ b/lib/contacts_module/ui_screen/interactionform/interactionprovider.dart @@ -1496,7 +1496,8 @@ class InteractionProvider extends ChangeNotifier { return false; } - Future saveJsonObject(BuildContext context, String form, + Future saveJsonObject( + BuildContext context, String form, String? title, {bool isEdit = false}) async { print("form_data: $form"); // for (var ob in interactionReponseList) { @@ -1562,6 +1563,7 @@ class InteractionProvider extends ChangeNotifier { id: generateId, updatedTime: DateTime.now().toString(), form: form, + hcp: title, intId: intId ?? "id", intName: intName ?? "name"); var box = Hive.box('InteractionDataBox'); diff --git a/lib/contacts_module/ui_screen/interactionform/model/save_interaction.dart b/lib/contacts_module/ui_screen/interactionform/model/save_interaction.dart index e34b857..a646c7c 100644 --- a/lib/contacts_module/ui_screen/interactionform/model/save_interaction.dart +++ b/lib/contacts_module/ui_screen/interactionform/model/save_interaction.dart @@ -38,6 +38,8 @@ class SaveInteraction { String intId; @HiveField(5) String intName; + @HiveField(6) + String? hcp; SaveInteraction( {required this.save, @@ -45,6 +47,7 @@ class SaveInteraction { this.form, this.updatedTime, required this.intId, + this.hcp, required this.intName}); factory SaveInteraction.fromJson(Map json) => @@ -53,6 +56,7 @@ class SaveInteraction { json["save"].map((x) => SaveData.fromJson(x))), intId: 'intId', intName: 'intName', + hcp: 'hcp', id: 'id'); Map toJson() => { @@ -62,6 +66,7 @@ class SaveInteraction { Map savetoJson() => { "form": form, "intId": intId, + "hcp": hcp, }; @override diff --git a/lib/contacts_module/ui_screen/interactionform/model/save_interaction.g.dart b/lib/contacts_module/ui_screen/interactionform/model/save_interaction.g.dart index fb41995..83bfdb7 100644 --- a/lib/contacts_module/ui_screen/interactionform/model/save_interaction.g.dart +++ b/lib/contacts_module/ui_screen/interactionform/model/save_interaction.g.dart @@ -22,6 +22,7 @@ class SaveInteractionAdapter extends TypeAdapter { form: fields[2] as String?, updatedTime: fields[3] as String?, intId: fields[4] as String, + hcp: fields[6] as String?, intName: fields[5] as String, ); } @@ -29,7 +30,7 @@ class SaveInteractionAdapter extends TypeAdapter { @override void write(BinaryWriter writer, SaveInteraction obj) { writer - ..writeByte(6) + ..writeByte(7) ..writeByte(0) ..write(obj.id) ..writeByte(1) @@ -41,7 +42,9 @@ class SaveInteractionAdapter extends TypeAdapter { ..writeByte(4) ..write(obj.intId) ..writeByte(5) - ..write(obj.intName); + ..write(obj.intName) + ..writeByte(6) + ..write(obj.hcp); } @override diff --git a/lib/contacts_module/ui_screen/interactionform/new_dynamicform.dart b/lib/contacts_module/ui_screen/interactionform/new_dynamicform.dart index 75ff031..0f28f25 100644 --- a/lib/contacts_module/ui_screen/interactionform/new_dynamicform.dart +++ b/lib/contacts_module/ui_screen/interactionform/new_dynamicform.dart @@ -5,6 +5,7 @@ import 'package:konectar_events/contacts_module/constants.dart'; import 'package:konectar_events/contacts_module/ui_screen/interactionform/interactionprovider.dart'; import 'package:konectar_events/contacts_module/ui_screen/interactionform/model/interaction_data.dart'; import 'package:konectar_events/contacts_module/ui_screen/interactionform/util.dart'; +import 'package:konectar_events/contacts_module/ui_screen/interactionform/viewinteractionprovider.dart'; import 'package:konectar_events/contacts_module/ui_screen/interactionform/widget/custombutton.dart'; import 'package:konectar_events/contacts_module/ui_screen/interactionform/widget/customrangeslider.dart'; import 'package:konectar_events/contacts_module/ui_screen/interactionform/widget/responsive_ext.dart'; @@ -34,7 +35,9 @@ import 'widget/interatciontextfield.dart'; class InteractionScreen1 extends StatefulWidget { int index; String form; - InteractionScreen1({super.key, required this.index, required this.form}); + String? title; + InteractionScreen1( + {super.key, required this.index, required this.form, this.title}); @override State createState() => _InteractionScreen1State(); @@ -119,10 +122,11 @@ class _InteractionScreen1State extends State { child: Scaffold( backgroundColor: Colors.white, appBar: AppBar( - title: const FittedBox( + backgroundColor: Constants.k2color, + title: FittedBox( fit: BoxFit.scaleDown, child: Text( - 'Record New Interaction', + widget.title ?? 'Record New Interaction', style: TextStyle(color: Colors.white, fontSize: 18.0), ), ), @@ -316,7 +320,7 @@ class _InteractionScreen1State extends State { : 4.8 : isTablet ? 2.8 - : 4.5, + : 5.5, children: List.generate( sectionList.length, @@ -484,7 +488,9 @@ class _InteractionScreen1State extends State { onPressed: () async { String record = await provider.saveJsonObject( - context, widget.form); + context, + widget.form, + widget.title); print( "Validation_isss: ${provider.isLoading}"); @@ -618,7 +624,14 @@ class _InteractionScreen1State extends State { : buildRadio(sectionItem, provider); case InteractionWidget.LABEL: - return Text(sectionItem.input!); + sectionItem.selectedValue!.add(widget.title ?? "NA"); + return Padding( + padding: const EdgeInsets.all(8.0), + child: Text( + "${widget.title}", + style: TextStyle(fontSize: 18), + ), + ); case InteractionWidget.RANGESLIDER: return CustomRangeSlider( @@ -687,8 +700,8 @@ class _InteractionScreen1State extends State { // maxchars: int.parse(sectionItem.validation!.chars ?? "0"), controller: sectionItem.controller!, labelText: sectionItem.name, - // maxlines: 8, - //minlines: 4, + maxlines: 8, + minlines: 8, onChanged: (val) { sectionItem.selectedValue = []; setState(() {}); @@ -997,10 +1010,10 @@ class _InteractionScreen1State extends State { ), ); case InteractionWidget.DROPDOWN: - // return customdropdown(sectionItem, provider, list, multiple); + return customdropdown(sectionItem, provider, list, multiple); - return customAutoCompletedropdown( - sectionItem, provider, list, multiple); + // return customAutoCompletedropdown( + // sectionItem, provider, list, multiple); } } @@ -1015,11 +1028,13 @@ class _InteractionScreen1State extends State { } Widget buildDateWidget(SectionList sectionItem) { + // sectionItem.controller!.text = + // DateFormat('yyyy-MM-dd').format(DateTime.now()); return Padding( padding: const EdgeInsets.only(left: 8.0, right: 8.0), child: SizedBox( // width: isTablet ? 200 : MediaQuery.of(context).size.width, - // height: isTablet ? 50 : 40, + height: isTablet ? 50 : 40, width: MediaQuery.of(context).size.width, child: TextField( controller: @@ -1106,8 +1121,8 @@ class _InteractionScreen1State extends State { child: CustomButton( backgroundColor: Colors.green.shade500, onPressed: () async { - String record = - await provider.saveJsonObject(context, widget.form); + String record = await provider.saveJsonObject( + context, widget.form, widget.title); print("Validation_isss: ${provider.isLoading}"); @@ -1843,6 +1858,8 @@ class _InteractionScreen1State extends State { Widget cancelButton = TextButton( child: const Text("Ok"), onPressed: () async { + await Provider.of(context, listen: false) + .getRecords(widget.form, hcp: widget.title ?? ""); Navigator.of(context).pop(); Navigator.of(context).pop(); }, diff --git a/lib/contacts_module/ui_screen/interactionform/view_interaction_screen.dart b/lib/contacts_module/ui_screen/interactionform/view_interaction_screen.dart index 8e4afc2..2deaa2e 100644 --- a/lib/contacts_module/ui_screen/interactionform/view_interaction_screen.dart +++ b/lib/contacts_module/ui_screen/interactionform/view_interaction_screen.dart @@ -300,7 +300,7 @@ class _ViewInteractionScreenState extends State { sectionItem.id, sectionItem.selectedValue!.last)); case InteractionWidget.LABEL: - return Text(sectionItem.input!); + return Text(sectionItem.selectedValue!.last.toString()); case InteractionWidget.RANGESLIDER: return Text(sectionItem.selectedValue!.isNotEmpty diff --git a/lib/contacts_module/ui_screen/interactionform/viewinteractionprovider.dart b/lib/contacts_module/ui_screen/interactionform/viewinteractionprovider.dart index 03b50ee..8f71e9c 100644 --- a/lib/contacts_module/ui_screen/interactionform/viewinteractionprovider.dart +++ b/lib/contacts_module/ui_screen/interactionform/viewinteractionprovider.dart @@ -61,13 +61,13 @@ class ViewInteractionProvider extends ChangeNotifier { notifyListeners(); } - Future getRecords(String formname) async { + Future getRecords(String formname, {String? hcp}) async { var box = await Hive.openBox('InteractionDataBox'); savedList = box.values.toList(); savedList = savedList - .where( - (element) => element.form == formname, - ) + .where((element) => element.form == formname && element.hcp != null + ? element.hcp == hcp + : element.form == formname) .toList(); notifyListeners(); } diff --git a/lib/contacts_module/ui_screen/new_editinteraction.dart b/lib/contacts_module/ui_screen/new_editinteraction.dart index e4183b7..825eb8a 100644 --- a/lib/contacts_module/ui_screen/new_editinteraction.dart +++ b/lib/contacts_module/ui_screen/new_editinteraction.dart @@ -122,6 +122,7 @@ class _EditInteractionScreenState extends State { return SafeArea( child: Scaffold( appBar: AppBar( + backgroundColor: Constants.k2color, title: Text( widget.saveInteraction.id, style: TextStyle( @@ -258,7 +259,7 @@ class _EditInteractionScreenState extends State { : 4.8 : isTablet ? 2.8 - : 3.5, + : 4.5, children: List.generate( sectionList.length, (i) { @@ -474,7 +475,13 @@ class _EditInteractionScreenState extends State { : buildRadio(sectionItem, provider); case InteractionWidget.LABEL: - return Text(sectionItem.input!); + return Padding( + padding: const EdgeInsets.all(8.0), + child: Text( + sectionItem.selectedValue!.last.toString(), + style: TextStyle(fontSize: 18), + ), + ); case InteractionWidget.RANGESLIDER: return CustomRangeSlider( @@ -579,10 +586,10 @@ class _EditInteractionScreenState extends State { ), ); case InteractionWidget.DROPDOWN: - // return customdropdown(sectionItem, provider, list, multiple); + return customdropdown(sectionItem, provider, list, multiple); - return customAutoCompletedropdown( - sectionItem, provider, list, multiple); + // return customAutoCompletedropdown( + // sectionItem, provider, list, multiple); } } @@ -593,7 +600,7 @@ class _EditInteractionScreenState extends State { // width: isTablet ? 200 : MediaQuery.of(context).size.width, width: MediaQuery.of(context).size.width, - // height: isTablet ? 50 : 40, + height: isTablet ? 50 : 40, child: TextField( controller: sectionItem.controller, //editing controller of this TextField @@ -764,13 +771,17 @@ class _EditInteractionScreenState extends State { // sectionItem.value = ''; // print("%%%%${sectionItem.selectedValue!.last}"); print("ItemList_is: $list"); + // if (list.isEmpty) { + // print("###list empty###"); + // list = []; + // InputClass inputClass = + // InputClass(id: "no value", name: "Select ${sectionItem.name}"); + // list.add(inputClass); + // sectionItem.selectedObject = list[0]; + // } + if (list.isEmpty) { - print("###list empty###"); - list = []; - InputClass inputClass = - InputClass(id: "no value", name: "Select ${sectionItem.name}"); - list.add(inputClass); - sectionItem.selectedObject = list[0]; + list = sectionItem.inputList!; } // InputClass selectedObj = list[0]; return Padding( diff --git a/lib/contacts_module/ui_screen/new_viewinteraction.dart b/lib/contacts_module/ui_screen/new_viewinteraction.dart index 1d63cc4..f1917a0 100644 --- a/lib/contacts_module/ui_screen/new_viewinteraction.dart +++ b/lib/contacts_module/ui_screen/new_viewinteraction.dart @@ -63,6 +63,7 @@ class _ViewInteractionScreenState extends State { backgroundColor: Colors.white, //resizeToAvoidBottomInset: false, appBar: AppBar( + backgroundColor: Constants.k2color, title: Text( widget.saveInteraction.id, style: TextStyle( @@ -320,7 +321,7 @@ class _ViewInteractionScreenState extends State { case InteractionWidget.LABEL: return Text( - sectionItem.input!, + sectionItem.selectedValue!.last.toString(), style: TextStyle(fontSize: 18.0), ); diff --git a/lib/main.dart b/lib/main.dart index 48f16fb..24ca5f0 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -2,6 +2,7 @@ import 'dart:async'; import 'dart:convert'; import 'dart:io'; +import 'package:connectivity_plus/connectivity_plus.dart'; import 'package:dio/dio.dart'; import 'package:firebase_core/firebase_core.dart'; import 'package:firebase_remote_config/firebase_remote_config.dart'; @@ -70,10 +71,12 @@ import 'package:konectar_events/model/userdata_model.dart'; import 'package:konectar_events/utils/sessionmanager.dart'; import 'package:konectar_events/view/home.dart'; import 'package:konectar_events/view/login.dart'; +import 'package:konectar_events/view/login_components/intropaging.dart'; import 'package:konectar_events/view/navigation_home_screen.dart'; import 'package:konectar_events/viewmodel/eventsprovider.dart'; import 'package:konectar_events/viewmodel/hcpprofprovider.dart'; import 'package:konectar_events/viewmodel/loginprovider.dart'; +import 'package:overlay_support/overlay_support.dart'; import 'package:provider/provider.dart'; @@ -190,11 +193,25 @@ Future main() async { // userInfo = await credential!.getUserInfo(); //runApp(const MyApp()); // activateTimer(); - SharedPreferences.getInstance().then((instance) async { + SharedPreferences.getInstance().then((instance) { //StorageService().sharedPreferencesInstance = instance; bool isloggedIn = instance.getBool('isloggedin') ?? false; - String secretkey = instance.getString('secretkey') ?? ""; + print("checkhere before:$isloggedIn"); + String secretkey = instance.getString('secretkey') ?? ""; + OverlaySupportEntry entry; + Connectivity().onConnectivityChanged.listen((event) { + print("CHECK INTERNET"); + print(event); + if (event.toString().contains("ConnectivityResult.none")) { + entry = showOverlayNotification((context) { + return Text("this is a message from simple notification"); + }, duration: Duration(hours: 1)); + } + }); + OverlaySupport overlaySupport = OverlaySupport.global( + child: Text("ONLINE"), + ); runApp( MultiProvider( providers: [ @@ -242,32 +259,38 @@ Future main() async { ], child: SafeArea( top: true, - child: MaterialApp( - theme: ThemeData( - fontFamily: "OpenSans", + child: new OverlaySupport.global( + toastTheme: ToastThemeData(background: Colors.green), + child: MaterialApp( + theme: ThemeData( + //fontFamily: "SourceSerif", + ), + debugShowCheckedModeBanner: false, + title: 'Dynamic Links Example', + initialRoute: '/', + routes: { + '/': (BuildContext context) => FutureBuilder( + future: SessionManager().isLoggedIn(), + builder: (context, snapshot) { + print("Data_is : $snapshot"); + if (snapshot.connectionState == + ConnectionState.waiting) { + return const CircularProgressIndicator(); + } else if (snapshot.hasError) { + return Text('Error: ${snapshot.error}'); + } else { + final isLoggedIn = snapshot.data ?? false; + print("isLoggedIn_is : $isLoggedIn"); + print("secret : $secretkey"); + return isLoggedIn + ? IntroductionAnimationScreen() + : IntroductionAnimationScreen(); + } + }, + ), //userInfo != null ? const Home() : OpenidScreen(credential: credential,), + // '/details': (BuildContext context) => const HomeScreen(), + }, ), - debugShowCheckedModeBanner: false, - title: 'Dynamic Links Example', - initialRoute: '/', - routes: { - '/': (BuildContext context) => FutureBuilder( - future: SessionManager().isLoggedIn(), - builder: (context, snapshot) { - print("Data_is : $snapshot"); - if (snapshot.connectionState == ConnectionState.waiting) { - return const CircularProgressIndicator(); - } else if (snapshot.hasError) { - return Text('Error: ${snapshot.error}'); - } else { - final isLoggedIn = snapshot.data ?? false; - print("isLoggedIn_is : $isLoggedIn"); - print("secret : $secretkey"); - return isLoggedIn ? MyApp() : LoginScreen(); - } - }, - ), //userInfo != null ? const Home() : OpenidScreen(credential: credential,), - // '/details': (BuildContext context) => const HomeScreen(), - }, ), ), ), @@ -275,7 +298,27 @@ Future main() async { }); } -class MyApp extends StatelessWidget { +class MyApp extends StatefulWidget { + @override + _MyAppState createState() => _MyAppState(); +} + +class _MyAppState extends State { + @override + void initState() { + OverlaySupportEntry entry; + Connectivity().onConnectivityChanged.listen((event) { + print("CHECK INTERNET"); + print(event); + if (event.toString().contains("ConnectivityResult.wifi")) { + entry = showOverlayNotification((context) { + return Text("this is a message from simple notification"); + }, duration: Duration(hours: 1)); + } + }); + super.initState(); + } + @override Widget build(BuildContext context) { SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle( @@ -287,15 +330,55 @@ class MyApp extends StatelessWidget { systemNavigationBarDividerColor: Colors.transparent, systemNavigationBarIconBrightness: Brightness.dark, )); - return MaterialApp( - title: 'Flutter UI', - debugShowCheckedModeBanner: false, - // theme: ThemeData( - // primarySwatch: Colors.blue, - // textTheme: AppTheme.textTheme, - // platform: TargetPlatform.iOS, - // ), - home: NavigationHomeScreen(), + return OverlaySupport( + child: MaterialApp( + title: 'Flutter UI', + debugShowCheckedModeBanner: false, + // theme: ThemeData( + // primarySwatch: Colors.blue, + // textTheme: AppTheme.textTheme, + // platform: TargetPlatform.iOS, + // ), + home: NavigationHomeScreen(), + ), ); } + + @override + State createState() { + // TODO: implement createState + throw UnimplementedError(); + } } + +// class App extends StatefulWidget { +// @override +// _AppState createState() => _AppState(); +// } + +// class _AppState extends State { +// @override +// void initState() { +// OverlaySupportEntry entry; +// Connectivity().onConnectivityChanged.listen((event) { +// print(event); +// if (event.toString().contains("ConnectivityResult.none")) { +// entry = showOverlayNotification((context) { +// return Text("this is a message from simple notification"); +// }, duration: Duration(hours: 1)); +// } +// }); +// super.initState(); +// } + +// @override +// Widget build(BuildContext context) { +// return OverlaySupport( +// child: MaterialApp( +// title: 'Network Checker App', +// debugShowCheckedModeBanner: false, +// home: Homepage(), +// ), +// ); +// } +// } diff --git a/lib/model/affiliationsmodel.dart b/lib/model/affiliationsmodel.dart index 5e5b448..b590f60 100644 --- a/lib/model/affiliationsmodel.dart +++ b/lib/model/affiliationsmodel.dart @@ -47,24 +47,54 @@ class AffiliationsResp { }; } +List affiliationsFromJson(String str) => List.from( + json.decode(str).map((x) => Affiliations.fromJson(x))); + +String affiliationsToJson(List data) => + json.encode(List.from(data.map((x) => x.toJson()))); + class Affiliations { - List affiliationNames; - List affiliationCount; + String? id; + String? orgCount; + String? orgName; Affiliations({ - required this.affiliationNames, - required this.affiliationCount, + this.id, + this.orgCount, + this.orgName, }); factory Affiliations.fromJson(Map json) => Affiliations( - affiliationNames: - List.from(json["affiliationNames"].map((x) => x)), - affiliationCount: - List.from(json["affiliationCount"].map((x) => x)), + id: json["id"], + orgCount: json["org_count"], + orgName: json["org_name"], ); Map toJson() => { - "affiliationNames": List.from(affiliationNames.map((x) => x)), - "affiliationCount": List.from(affiliationCount.map((x) => x)), + "id": id, + "org_count": orgCount, + "org_name": orgName, }; } + +// class Affiliations { +// List affiliationNames; +// List affiliationCount; + +// Affiliations({ +// required this.affiliationNames, +// required this.affiliationCount, +// }); + +// factory Affiliations.fromJson(Map json) => Affiliations( +// affiliationNames: +// List.from(json["affiliationNames"].map((x) => x)), +// affiliationCount: +// List.from(json["affiliationCount"].map((x) => x)), +// ); + +// Map toJson() => { +// "affiliationNames": List.from(affiliationNames.map((x) => x)), +// "affiliationCount": List.from(affiliationCount.map((x) => x)), +// }; +// } diff --git a/lib/model/events_details.dart b/lib/model/events_details.dart new file mode 100644 index 0000000..05640d6 --- /dev/null +++ b/lib/model/events_details.dart @@ -0,0 +1,347 @@ +// To parse this JSON data, do +// +// final eventsOverviewDetails = eventsOverviewDetailsFromJson(jsonString); + +import 'dart:convert'; + +EventsOverviewDetails eventsOverviewDetailsFromJson(String str) => + EventsOverviewDetails.fromJson(json.decode(str)); + +String eventsOverviewDetailsToJson(EventsOverviewDetails data) => + json.encode(data.toJson()); + +class EventsOverviewDetails { + OverviewData? data; + + EventsOverviewDetails({ + this.data, + }); + + factory EventsOverviewDetails.fromJson(Map json) => + EventsOverviewDetails( + data: json["data"] == null ? null : OverviewData.fromJson(json["data"]), + ); + + Map toJson() => { + "data": data?.toJson(), + }; +} + +class OverviewData { + int? projectKolAttendee; + bool? cal; + int? grid; + String? eventFor; + String? eventId; + List? eventData; + dynamic eventTopics; + List? eventSponsers; + bool? eventUserAttendee; + bool? eventUserInterest; + List? arrEvents; + int? attendeeCount; + + OverviewData({ + this.projectKolAttendee, + this.cal, + this.grid, + this.eventFor, + this.eventId, + this.eventData, + this.eventTopics, + this.eventSponsers, + this.eventUserAttendee, + this.eventUserInterest, + this.arrEvents, + this.attendeeCount, + }); + + factory OverviewData.fromJson(Map json) => OverviewData( + projectKolAttendee: json["project_kol_attendee"], + cal: json["cal"], + grid: json["grid"], + eventFor: json["eventFor"], + eventId: json["eventId"], + eventData: json["eventData"] == null + ? [] + : List.from( + json["eventData"]!.map((x) => TopSpeakers.fromJson(x))), + eventTopics: json["eventTopics"], + eventSponsers: json["eventSponsers"] == null + ? [] + : List.from( + json["eventSponsers"]!.map((x) => EventSponser.fromJson(x))), + eventUserAttendee: json["event_user_attendee"], + eventUserInterest: json["event_user_interest"], + arrEvents: json["arrEvents"] == null + ? [] + : List.from( + json["arrEvents"]!.map((x) => ArrEvent.fromJson(x))), + attendeeCount: json["attendeeCount"], + ); + + Map toJson() => { + "project_kol_attendee": projectKolAttendee, + "cal": cal, + "grid": grid, + "eventFor": eventFor, + "eventId": eventId, + "eventData": eventData == null + ? [] + : List.from(eventData!.map((x) => x.toJson())), + "eventTopics": eventTopics, + "eventSponsers": eventSponsers == null + ? [] + : List.from(eventSponsers!.map((x) => x.toJson())), + "event_user_attendee": eventUserAttendee, + "event_user_interest": eventUserInterest, + "arrEvents": arrEvents == null + ? [] + : List.from(arrEvents!.map((x) => x.toJson())), + "attendeeCount": attendeeCount, + }; +} + +class ArrEvent { + String? sponsorType; + String? sponsorTypeName; + String? id; + String? kolId; + String? type; + String? eventType; + String? eventId; + String? sessionType; + String? sessionName; + String? role; + dynamic topic; + String? start; + String? end; + String? organizer; + String? sessionSponsor; + String? organizerType; + String? location; + String? address; + String? cityId; + String? stateId; + String? countryId; + String? postalCode; + dynamic subject; + String? url1; + dynamic url2; + dynamic notes; + String? createdBy; + DateTime? createdOn; + dynamic modifiedBy; + DateTime? modifiedOn; + String? clientId; + dynamic projectId; + String? activityType; + String? profileType; + dynamic globalEventId; + String? eventUniqueId; + String? name; + String? confEventType; + String? country; + dynamic eventTopic; + String? confSessionType; + String? region; + String? city; + + ArrEvent({ + this.sponsorType, + this.sponsorTypeName, + this.id, + this.kolId, + this.type, + this.eventType, + this.eventId, + this.sessionType, + this.sessionName, + this.role, + this.topic, + this.start, + this.end, + this.organizer, + this.sessionSponsor, + this.organizerType, + this.location, + this.address, + this.cityId, + this.stateId, + this.countryId, + this.postalCode, + this.subject, + this.url1, + this.url2, + this.notes, + this.createdBy, + this.createdOn, + this.modifiedBy, + this.modifiedOn, + this.clientId, + this.projectId, + this.activityType, + this.profileType, + this.globalEventId, + this.eventUniqueId, + this.name, + this.confEventType, + this.country, + this.eventTopic, + this.confSessionType, + this.region, + this.city, + }); + + factory ArrEvent.fromJson(Map json) => ArrEvent( + sponsorType: json["sponsor_type"], + sponsorTypeName: json["sponsor_type_name"], + id: json["id"], + kolId: json["kol_id"], + type: json["type"], + eventType: json["event_type"], + eventId: json["event_id"], + sessionType: json["session_type"], + sessionName: json["session_name"], + role: json["role"], + topic: json["topic"], + start: json["start"], + end: json["end"], + organizer: json["organizer"], + sessionSponsor: json["session_sponsor"], + organizerType: json["organizer_type"], + location: json["location"], + address: json["address"], + cityId: json["city_id"], + stateId: json["state_id"], + countryId: json["country_id"], + postalCode: json["postal_code"], + subject: json["subject"], + url1: json["url1"], + url2: json["url2"], + notes: json["notes"], + createdBy: json["created_by"], + createdOn: json["created_on"] == null + ? null + : DateTime.parse(json["created_on"]), + modifiedBy: json["modified_by"], + modifiedOn: json["modified_on"] == null + ? null + : DateTime.parse(json["modified_on"]), + clientId: json["client_id"], + projectId: json["project_id"], + activityType: json["activity_type"], + profileType: json["profile_type"], + globalEventId: json["global_event_id"], + eventUniqueId: json["event_unique_id"], + name: json["name"], + confEventType: json["conf_event_type"], + country: json["country"], + eventTopic: json["event_topic"], + confSessionType: json["conf_session_type"], + region: json["region"], + city: json["city"], + ); + + Map toJson() => { + "sponsor_type": sponsorType, + "sponsor_type_name": sponsorTypeName, + "id": id, + "kol_id": kolId, + "type": type, + "event_type": eventType, + "event_id": eventId, + "session_type": sessionType, + "session_name": sessionName, + "role": role, + "topic": topic, + "start": start, + "end": end, + "organizer": organizer, + "session_sponsor": sessionSponsor, + "organizer_type": organizerType, + "location": location, + "address": address, + "city_id": cityId, + "state_id": stateId, + "country_id": countryId, + "postal_code": postalCode, + "subject": subject, + "url1": url1, + "url2": url2, + "notes": notes, + "created_by": createdBy, + "created_on": createdOn?.toIso8601String(), + "modified_by": modifiedBy, + "modified_on": modifiedOn?.toIso8601String(), + "client_id": clientId, + "project_id": projectId, + "activity_type": activityType, + "profile_type": profileType, + "global_event_id": globalEventId, + "event_unique_id": eventUniqueId, + "name": name, + "conf_event_type": confEventType, + "country": country, + "event_topic": eventTopic, + "conf_session_type": confSessionType, + "region": region, + "city": city, + }; +} + +class TopSpeakers { + String? firstName; + dynamic middleName; + dynamic lastName; + String? numSess; + + TopSpeakers({ + this.firstName, + this.middleName, + this.lastName, + this.numSess, + }); + + factory TopSpeakers.fromJson(Map json) => TopSpeakers( + firstName: json["first_name"], + middleName: json["middle_name"], + lastName: json["last_name"], + numSess: json["num_sess"], + ); + + Map toJson() => { + "first_name": firstName, + "middle_name": middleName, + "last_name": lastName, + "num_sess": numSess, + }; +} + +class EventSponser { + String? numSess; + String? sessionSponsor; + String? type; + String? sponsorsType; + + EventSponser({ + this.numSess, + this.sessionSponsor, + this.type, + this.sponsorsType, + }); + + factory EventSponser.fromJson(Map json) => EventSponser( + numSess: json["num_sess"], + sessionSponsor: json["session_sponsor"], + type: json["type"], + sponsorsType: json["sponsors_type"], + ); + + Map toJson() => { + "num_sess": numSess, + "session_sponsor": sessionSponsor, + "type": type, + "sponsors_type": sponsorsType, + }; +} diff --git a/lib/model/events_list_resp_2.dart b/lib/model/events_list_resp_2.dart new file mode 100644 index 0000000..b2b1625 --- /dev/null +++ b/lib/model/events_list_resp_2.dart @@ -0,0 +1,219 @@ +class EventsListResp2 { + int? code; + String? message; + List? data; + int? lastPage; + int? lastRow; + int? count; + + EventsListResp2( + {this.code, + this.message, + this.data, + this.lastPage, + this.lastRow, + this.count}); + + EventsListResp2.fromJson(Map json) { + if (json["code"] is int) { + code = json["code"]; + } + if (json["message"] is String) { + message = json["message"]; + } + if (json["data"] is List) { + data = json["data"] == null + ? null + : (json["data"] as List) + .map((e) => EventsListingData.fromJson(e)) + .toList(); + } + if (json["last_page"] is int) { + lastPage = json["last_page"]; + } + if (json["last_row"] is int) { + lastRow = json["last_row"]; + } + if (json["count"] is int) { + count = json["count"]; + } + } + + Map toJson() { + final Map _data = {}; + _data["code"] = code; + _data["message"] = message; + if (data != null) { + _data["data"] = data?.map((e) => e.toJson()).toList(); + } + _data["last_page"] = lastPage; + _data["last_row"] = lastRow; + _data["count"] = count; + return _data; + } +} + +class EventsListingData { + String? uniqueId; + String? sessionName; + String? startDate; + String? endDate; + String? organizer; + String? sessionSponsor; + dynamic location; + dynamic address; + dynamic postalCode; + dynamic url; + String? activityType; + String? role; + String? eventTypeName; + String? countryName; + String? stateName; + String? cityName; + String? organizerTypeName; + String? sponsorTypeName; + String? sessionTypeName; + String? kolName; + dynamic kolUniqueId; + String? eventName; + String? eventUniqueId; + String? createdByUser; + String? updatedByUser; + String? formattedCreatedAt; + String? formattedUpdatedAt; + + EventsListingData( + {this.uniqueId, + this.sessionName, + this.startDate, + this.endDate, + this.organizer, + this.sessionSponsor, + this.location, + this.address, + this.postalCode, + this.url, + this.activityType, + this.role, + this.eventTypeName, + this.countryName, + this.stateName, + this.cityName, + this.organizerTypeName, + this.sponsorTypeName, + this.sessionTypeName, + this.kolName, + this.kolUniqueId, + this.eventName, + this.eventUniqueId, + this.createdByUser, + this.updatedByUser, + this.formattedCreatedAt, + this.formattedUpdatedAt}); + + EventsListingData.fromJson(Map json) { + if (json["unique_id"] is String) { + uniqueId = json["unique_id"]; + } + if (json["session_name"] is String) { + sessionName = json["session_name"]; + } + if (json["start_date"] is String) { + startDate = json["start_date"]; + } + if (json["end_date"] is String) { + endDate = json["end_date"]; + } + if (json["organizer"] is String) { + organizer = json["organizer"]; + } + if (json["session_sponsor"] is String) { + sessionSponsor = json["session_sponsor"]; + } + location = json["location"]; + address = json["address"]; + postalCode = json["postal_code"]; + url = json["url"]; + if (json["activity_type"] is String) { + activityType = json["activity_type"]; + } + if (json["role"] is String) { + role = json["role"]; + } + if (json["event_type_name"] is String) { + eventTypeName = json["event_type_name"]; + } + if (json["country_name"] is String) { + countryName = json["country_name"]; + } + if (json["state_name"] is String) { + stateName = json["state_name"]; + } + if (json["city_name"] is String) { + cityName = json["city_name"]; + } + if (json["organizer_type_name"] is String) { + organizerTypeName = json["organizer_type_name"]; + } + if (json["sponsor_type_name"] is String) { + sponsorTypeName = json["sponsor_type_name"]; + } + if (json["session_type_name"] is String) { + sessionTypeName = json["session_type_name"]; + } + if (json["kol_name"] is String) { + kolName = json["kol_name"]; + } + kolUniqueId = json["kol_unique_id"]; + if (json["event_name"] is String) { + eventName = json["event_name"]; + } + if (json["event_unique_id"] is String) { + eventUniqueId = json["event_unique_id"]; + } + if (json["created_by_user"] is String) { + createdByUser = json["created_by_user"]; + } + if (json["updated_by_user"] is String) { + updatedByUser = json["updated_by_user"]; + } + if (json["formatted_created_at"] is String) { + formattedCreatedAt = json["formatted_created_at"]; + } + if (json["formatted_updated_at"] is String) { + formattedUpdatedAt = json["formatted_updated_at"]; + } + } + + Map toJson() { + final Map _data = {}; + _data["unique_id"] = uniqueId; + _data["session_name"] = sessionName; + _data["start_date"] = startDate; + _data["end_date"] = endDate; + _data["organizer"] = organizer; + _data["session_sponsor"] = sessionSponsor; + _data["location"] = location; + _data["address"] = address; + _data["postal_code"] = postalCode; + _data["url"] = url; + _data["activity_type"] = activityType; + _data["role"] = role; + _data["event_type_name"] = eventTypeName; + _data["country_name"] = countryName; + _data["state_name"] = stateName; + _data["city_name"] = cityName; + _data["organizer_type_name"] = organizerTypeName; + _data["sponsor_type_name"] = sponsorTypeName; + _data["session_type_name"] = sessionTypeName; + _data["kol_name"] = kolName; + _data["kol_unique_id"] = kolUniqueId; + _data["event_name"] = eventName; + _data["event_unique_id"] = eventUniqueId; + _data["created_by_user"] = createdByUser; + _data["updated_by_user"] = updatedByUser; + _data["formatted_created_at"] = formattedCreatedAt; + _data["formatted_updated_at"] = formattedUpdatedAt; + return _data; + } +} diff --git a/lib/model/eventspeakers.dart b/lib/model/eventspeakers.dart new file mode 100644 index 0000000..69de2bb --- /dev/null +++ b/lib/model/eventspeakers.dart @@ -0,0 +1,330 @@ +// To parse this JSON data, do +// +// final speakersResponse = speakersResponseFromJson(jsonString); + +import 'dart:convert'; + +import 'package:hive_flutter/hive_flutter.dart'; +import 'package:konectar_events/contacts_module/model_class/speaker.dart'; + +part 'eventspeakers.g.dart'; + +SpeakersResponse speakersResponseFromJson(String str) => + SpeakersResponse.fromJson(json.decode(str)); + +String speakersResponseToJson(SpeakersResponse data) => + json.encode(data.toJson()); + +class SpeakersResponse { + int? code; + String? message; + List? data; + int? lastPage; + int? lastRow; + int? count; + + SpeakersResponse({ + this.code, + this.message, + this.data, + this.lastPage, + this.lastRow, + this.count, + }); + + factory SpeakersResponse.fromJson(Map json) => + SpeakersResponse( + code: json["code"], + message: json["message"], + data: json["data"] == null + ? [] + : List.from( + json["data"]!.map((x) => SpeakersList.fromJson(x))), + lastPage: json["last_page"], + lastRow: json["last_row"], + count: json["count"], + ); + + Map toJson() => { + "code": code, + "message": message, + "data": data == null + ? [] + : List.from(data!.map((x) => x.toJson())), + "last_page": lastPage, + "last_row": lastRow, + "count": count, + }; +} + +class SpeakersResponse1 { + Data1? data; + + SpeakersResponse1({ + this.data, + }); + + factory SpeakersResponse1.fromJson(Map json) => + SpeakersResponse1( + data: json["data"] == null ? null : Data1.fromJson(json["data"]), + ); + + Map toJson() => { + "data": data?.toJson(), + }; +} + +class Data1 { + List? data; + + Data1({ + this.data, + }); + + factory Data1.fromJson(Map json) => Data1( + data: json["data"] == null + ? [] + : List.from( + json["data"]!.map((x) => SpeakersList.fromJson(x))), + ); + + Map toJson() => { + "data": data == null + ? [] + : List.from(data!.map((x) => x.toJson())), + }; +} + +@HiveType(typeId: 25) +class SpeakersList { + @HiveField(0) + String? uniqueId; + @HiveField(1) + String? hcpFullName; + @HiveField(2) + String? hcpPin; + @HiveField(3) + int? npiNum; + @HiveField(4) + String? specialty; + @HiveField(5) + String? organization; + @HiveField(6) + String? therapeuticArea; + @HiveField(7) + dynamic cleansStatus; + @HiveField(8) + int? isDeleted; + @HiveField(9) + CreatedByUser? createdByUser; + @HiveField(10) + CreatedByUser? updatedByUser; + @HiveField(11) + String? cityName; + @HiveField(12) + String? stateName; + @HiveField(13) + String? countryName; + @HiveField(14) + dynamic deletedByUser; + @HiveField(15) + DateTime? formattedCreatedAt; + @HiveField(16) + DateTime? formattedUpdatedAt; + @HiveField(17) + dynamic formattedDeletedAt; + @HiveField(18) + List? sessionNames; + @HiveField(19) + List? topics; + + SpeakersList({ + this.uniqueId, + this.hcpFullName, + this.hcpPin, + this.npiNum, + this.specialty, + this.organization, + this.therapeuticArea, + this.cleansStatus, + this.isDeleted, + this.createdByUser, + this.updatedByUser, + this.cityName, + this.stateName, + this.countryName, + this.deletedByUser, + this.formattedCreatedAt, + this.formattedUpdatedAt, + this.formattedDeletedAt, + this.sessionNames, + this.topics, + }); + + // SpeakersList.fromJson(Map json) { + + // if (json["unique_id"] is String) { + // city = json["city_name"] ?? null; + // } + // if (json["country_name"] is String) { + // country = json["country_name"] ?? null; + // } + // if (json["state_name"] is String) { + // region = json["state_name"] ?? null; + // } + // if (json["activity_type"] is String) { + // activityType = json["activity_type"]; + // } + // if (json["address"] is String) { + // address = json["address"]; + // } + // if (json["city_id"] is String) { + // cityId = json["city_id"]; + // } + // if (json["client_id"] is String) { + // clientId = json["client_id"]; + // } + // if (json["cnt"] is String) { + // cnt = json["cnt"]; + // } + // if (json["country_id"] is String) { + // countryId = json["country_id"]; + // } + // if (json["created_by"] is String) { + // createdBy = json["created_by"]; + // } + // if (json["created_on"] is String) { + // createdOn = json["created_on"]; + // } + // if (json["dAllowed"] is bool) { + // dAllowed = json["dAllowed"]; + // } + // if (json["eAllowed"] is bool) { + // eAllowed = json["eAllowed"]; + // } + // if (json["end_date"] is String) { + // end = json["end_date"]; + // } + // if (json["eventLat"] is String) { + // eventLat = json["eventLat"]; + // } + // if (json["eventLong"] is String) { + // eventLong = json["eventLong"]; + // } + // if (json["unique_id"] is String) { + // eventId = json["unique_id"]; + // } + // if (json["event_type_name"] is String) { + // eventType = json["event_type_name"]; + // } + // if (json["event_unique_id"] is String) { + // eventUniqueId = json["event_unique_id"]; + // } + // if (json["event_user_attendee"] is bool) { + // eventUserAttendee = json["event_user_attendee"]; + // } + // if (json["global_event_id"] is String) { + // globalEventId = json["global_event_id"]; + // } + // if (json["hcp_pin"] is String) { + // hcpPin = json["hcp_pin"]; + // } + // if (json["id"] is String) { + // id = json["id"]; + // } + // if (json["kol_id"] is String) { + // kolId = json["kol_id"]; + // } + // if (json["location"] is String) { + // location = json["location"]; + // } + // if (json["modified_by"] is String) { + // modifiedBy = json["modified_by"]; + // } + // if (json["modified_on"] is String) { + // modifiedOn = json["modified_on"]; + // } + // if (json["event_name"] is String) { + // name1 = json["event_name"]; + // } + + // } + factory SpeakersList.fromJson(Map json) => SpeakersList( + uniqueId: json["unique_id"], + hcpFullName: json["hcp_full_name"] ?? null, + hcpPin: json["hcp_pin"] ?? null, + npiNum: json["npi_num"] ?? null, + specialty: json["specialty"] ?? null, + organization: json["organization"] ?? null, + therapeuticArea: json["therapeutic_area"] ?? null, + cleansStatus: json["cleans_status"] ?? null, + isDeleted: json["is_deleted"] ?? null, + createdByUser: CreatedByUserValues.map[json["created_by_user"]] ?? null, + updatedByUser: CreatedByUserValues.map[json["updated_by_user"]] ?? null, + cityName: json["city_name"] ?? null, + stateName: json["state_name"] ?? null, + countryName: json["country_name"] ?? null, + deletedByUser: json["deleted_by_user"], + formattedCreatedAt: json["formatted_created_at"] == null + ? null + : DateTime.parse(json["formatted_created_at"]), + formattedUpdatedAt: json["formatted_updated_at"] == null + ? null + : DateTime.parse(json["formatted_updated_at"]), + formattedDeletedAt: json["formatted_deleted_at"], + sessionNames: json["session_names"] == null + ? [] + : List.from(json["session_names"]!.map((x) => x)), + topics: json["topics"] == null + ? [] + : List.from(json["topics"]!.map((x) => x)), + ); + + Map toJson() => { + "unique_id": uniqueId, + "hcp_full_name": hcpFullName, + "hcp_pin": hcpPin, + "npi_num": npiNum, + "specialty": specialty, + "organization": organization, + "therapeutic_area": therapeuticAreaValues.reverse[therapeuticArea], + "cleans_status": cleansStatus, + "is_deleted": isDeleted, + "created_by_user": CreatedByUserValues.reverse[createdByUser], + "updated_by_user": CreatedByUserValues.reverse[updatedByUser], + "city_name": cityName, + "state_name": stateName, + "country_name": countryName, + "deleted_by_user": deletedByUser, + "formatted_created_at": formattedCreatedAt?.toIso8601String(), + "formatted_updated_at": formattedUpdatedAt?.toIso8601String(), + "formatted_deleted_at": formattedDeletedAt, + "session_names": sessionNames == null + ? [] + : List.from(sessionNames!.map((x) => x)), + "topics": + topics == null ? [] : List.from(topics!.map((x) => x)), + }; +} + +enum CreatedByUser { ADMIN_SUPER_ROOT } + +final CreatedByUserValues = + EnumValues({"admin super root": CreatedByUser.ADMIN_SUPER_ROOT}); + +enum TherapeuticArea { ONCOLOGY_WOMENS_HEALTH } + +final therapeuticAreaValues = EnumValues( + {"Oncology | Womens Health": TherapeuticArea.ONCOLOGY_WOMENS_HEALTH}); + +class EnumValues { + Map map; + late Map reverseMap; + + EnumValues(this.map); + + Map get reverse { + reverseMap = map.map((k, v) => MapEntry(v, k)); + return reverseMap; + } +} diff --git a/lib/model/eventspeakers.g.dart b/lib/model/eventspeakers.g.dart new file mode 100644 index 0000000..d944da1 --- /dev/null +++ b/lib/model/eventspeakers.g.dart @@ -0,0 +1,98 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'eventspeakers.dart'; + +// ************************************************************************** +// TypeAdapterGenerator +// ************************************************************************** + +class SpeakersListAdapter extends TypeAdapter { + @override + final int typeId = 25; + + @override + SpeakersList read(BinaryReader reader) { + final numOfFields = reader.readByte(); + final fields = { + for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(), + }; + return SpeakersList( + uniqueId: fields[0] as String?, + hcpFullName: fields[1] as String?, + hcpPin: fields[2] as String?, + npiNum: fields[3] as int?, + specialty: fields[4] as String?, + organization: fields[5] as String?, + therapeuticArea: fields[6] as String?, + cleansStatus: fields[7] as dynamic, + isDeleted: fields[8] as int?, + createdByUser: fields[9] as CreatedByUser?, + updatedByUser: fields[10] as CreatedByUser?, + cityName: fields[11] as String?, + stateName: fields[12] as String?, + countryName: fields[13] as String?, + deletedByUser: fields[14] as dynamic, + formattedCreatedAt: fields[15] as DateTime?, + formattedUpdatedAt: fields[16] as DateTime?, + formattedDeletedAt: fields[17] as dynamic, + sessionNames: (fields[18] as List?)?.cast(), + topics: (fields[19] as List?)?.cast(), + ); + } + + @override + void write(BinaryWriter writer, SpeakersList obj) { + writer + ..writeByte(20) + ..writeByte(0) + ..write(obj.uniqueId) + ..writeByte(1) + ..write(obj.hcpFullName) + ..writeByte(2) + ..write(obj.hcpPin) + ..writeByte(3) + ..write(obj.npiNum) + ..writeByte(4) + ..write(obj.specialty) + ..writeByte(5) + ..write(obj.organization) + ..writeByte(6) + ..write(obj.therapeuticArea) + ..writeByte(7) + ..write(obj.cleansStatus) + ..writeByte(8) + ..write(obj.isDeleted) + ..writeByte(9) + ..write(obj.createdByUser) + ..writeByte(10) + ..write(obj.updatedByUser) + ..writeByte(11) + ..write(obj.cityName) + ..writeByte(12) + ..write(obj.stateName) + ..writeByte(13) + ..write(obj.countryName) + ..writeByte(14) + ..write(obj.deletedByUser) + ..writeByte(15) + ..write(obj.formattedCreatedAt) + ..writeByte(16) + ..write(obj.formattedUpdatedAt) + ..writeByte(17) + ..write(obj.formattedDeletedAt) + ..writeByte(18) + ..write(obj.sessionNames) + ..writeByte(19) + ..write(obj.topics); + } + + @override + int get hashCode => typeId.hashCode; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is SpeakersListAdapter && + runtimeType == other.runtimeType && + typeId == other.typeId; +} diff --git a/lib/model/my_events_list_model.dart b/lib/model/my_events_list_model.dart new file mode 100644 index 0000000..5ac4b2e --- /dev/null +++ b/lib/model/my_events_list_model.dart @@ -0,0 +1,486 @@ +import 'package:hive_flutter/hive_flutter.dart'; + +class MyEventsListModel { + int? code; + String? message; + List? data; + int? lastPage; + int? lastRow; + int? count; + + MyEventsListModel( + {this.code, + this.message, + this.data, + this.lastPage, + this.lastRow, + this.count}); + + MyEventsListModel.fromJson(Map json) { + if (json["code"] is int) { + code = json["code"]; + } + if (json["message"] is String) { + message = json["message"]; + } + if (json["data"] is List) { + data = json["data"] == null + ? null + : (json["data"] as List) + .map((e) => MyEventsData.fromJson(e)) + .toList(); + } + if (json["last_page"] is int) { + lastPage = json["last_page"]; + } + if (json["last_row"] is int) { + lastRow = json["last_row"]; + } + if (json["count"] is int) { + count = json["count"]; + } + } + + Map toJson() { + final Map _data = {}; + _data["code"] = code; + _data["message"] = message; + if (data != null) { + _data["data"] = data?.map((e) => e.toJson()).toList(); + } + _data["last_page"] = lastPage; + _data["last_row"] = lastRow; + _data["count"] = count; + return _data; + } +} + +class MyEventsData { + String? uniqueId; + dynamic switchedId; + String? createdByUser; + String? updatedByUser; + dynamic deletedByUser; + String? formattedCreatedAt; + String? formattedUpdatedAt; + dynamic formattedDeletedAt; + List? events; + + MyEventsData( + {this.uniqueId, + this.switchedId, + this.createdByUser, + this.updatedByUser, + this.deletedByUser, + this.formattedCreatedAt, + this.formattedUpdatedAt, + this.formattedDeletedAt, + this.events}); + + MyEventsData.fromJson(Map json) { + if (json["unique_id"] is String) { + uniqueId = json["unique_id"]; + } + switchedId = json["switched_id"]; + if (json["created_by_user"] is String) { + createdByUser = json["created_by_user"]; + } + if (json["updated_by_user"] is String) { + updatedByUser = json["updated_by_user"]; + } + deletedByUser = json["deleted_by_user"]; + if (json["formatted_created_at"] is String) { + formattedCreatedAt = json["formatted_created_at"]; + } + if (json["formatted_updated_at"] is String) { + formattedUpdatedAt = json["formatted_updated_at"]; + } + formattedDeletedAt = json["formatted_deleted_at"]; + if (json["events"] is List) { + events = json["events"] == null + ? null + : (json["events"] as List) + .map((e) => MyEventsList.fromJson(e)) + .toList(); + } + } + + Map toJson() { + final Map _data = {}; + _data["unique_id"] = uniqueId; + _data["switched_id"] = switchedId; + _data["created_by_user"] = createdByUser; + _data["updated_by_user"] = updatedByUser; + _data["deleted_by_user"] = deletedByUser; + _data["formatted_created_at"] = formattedCreatedAt; + _data["formatted_updated_at"] = formattedUpdatedAt; + _data["formatted_deleted_at"] = formattedDeletedAt; + if (events != null) { + _data["events"] = events?.map((e) => e.toJson()).toList(); + } + return _data; + } +} + +@HiveType(typeId: 101) +class MyEventsList { + @HiveField(0) + String? myeventid; + @HiveField(1) + String? eventid; + @HiveField(2) + String? sessionName; + @HiveField(3) + String? start; + @HiveField(4) + String? end; + @HiveField(5) + String? organizer; + @HiveField(6) + String? sessionSponsor; + @HiveField(7) + dynamic location; + @HiveField(8) + dynamic address; + @HiveField(9) + dynamic postalCode; + @HiveField(10) + String? url; + @HiveField(11) + String? activityType; + @HiveField(12) + dynamic topic; + @HiveField(13) + String? role; + @HiveField(14) + String? eventTypeName; + @HiveField(15) + String? country; + @HiveField(16) + String? region; + @HiveField(17) + String? city; + @HiveField(18) + String? organizerTypeName; + @HiveField(19) + String? sponsorTypeName; + @HiveField(20) + String? sessionTypeName; + @HiveField(21) + String? kolName; + @HiveField(22) + dynamic kolUniqueId; + @HiveField(23) + String? name1; + @HiveField(24) + String? eventUniqueId; + @HiveField(25) + String? createdByUser; + @HiveField(26) + String? updatedByUser; + @HiveField(27) + String? formattedCreatedAt; + @HiveField(28) + String? formattedUpdatedAt; + @HiveField(29) + List? attendees; + @HiveField(30) + bool isfav = false; + @HiveField(31) + bool isAttending = false; + @HiveField(32) + String? speakerscount; + @HiveField(33) + String? topTopics; + @HiveField(34) + String? topSpeakers; + + MyEventsList( + {this.eventid, + this.sessionName, + this.start, + this.end, + this.organizer, + this.sessionSponsor, + this.location, + this.address, + this.postalCode, + this.url, + this.activityType, + this.topic, + this.role, + this.eventTypeName, + this.country, + this.region, + this.city, + this.organizerTypeName, + this.sponsorTypeName, + this.sessionTypeName, + this.kolName, + this.kolUniqueId, + this.name1, + this.eventUniqueId, + this.createdByUser, + this.updatedByUser, + this.formattedCreatedAt, + this.formattedUpdatedAt, + this.attendees}); + + MyEventsList.fromJson(Map json) { + if (json["unique_id"] is String) { + eventid = json["unique_id"]; + } + if (json["session_name"] is String) { + sessionName = json["session_name"]; + } + if (json["start_date"] is String) { + start = json["start_date"]; + } + if (json["end_date"] is String) { + end = json["end_date"]; + } + if (json["organizer"] is String) { + organizer = json["organizer"]; + } + if (json["session_sponsor"] is String) { + sessionSponsor = json["session_sponsor"]; + } + location = json["location"]; + address = json["address"]; + postalCode = json["postal_code"]; + if (json["url"] is String) { + url = json["url"]; + } + if (json["activity_type"] is String) { + activityType = json["activity_type"]; + } + topic = json["topic"]; + if (json["role"] is String) { + role = json["role"]; + } + if (json["event_type_name"] is String) { + eventTypeName = json["event_type_name"]; + } + if (json["country_name"] is String) { + country = json["country_name"]; + } + if (json["state_name"] is String) { + region = json["state_name"]; + } + if (json["city_name"] is String) { + city = json["city_name"]; + } + if (json["organizer_type_name"] is String) { + organizerTypeName = json["organizer_type_name"]; + } + if (json["sponsor_type_name"] is String) { + sponsorTypeName = json["sponsor_type_name"]; + } + if (json["session_type_name"] is String) { + sessionTypeName = json["session_type_name"]; + } + if (json["kol_name"] is String) { + kolName = json["kol_name"]; + } + kolUniqueId = json["kol_unique_id"]; + if (json["event_name"] is String) { + name1 = json["event_name"]; + } + if (json["event_unique_id"] is String) { + eventUniqueId = json["event_unique_id"]; + } + if (json["created_by_user"] is String) { + createdByUser = json["created_by_user"]; + } + if (json["updated_by_user"] is String) { + updatedByUser = json["updated_by_user"]; + } + if (json["formatted_created_at"] is String) { + formattedCreatedAt = json["formatted_created_at"]; + } + if (json["formatted_updated_at"] is String) { + formattedUpdatedAt = json["formatted_updated_at"]; + } + if (json["attendees"] is List) { + attendees = json["attendees"] == null + ? null + : (json["attendees"] as List) + .map((e) => Attendees.fromJson(e)) + .toList(); + } + } + + Map toJson() { + final Map _data = {}; + _data["unique_id"] = eventid; + _data["session_name"] = sessionName; + _data["start_date"] = start; + _data["end_date"] = end; + _data["organizer"] = organizer; + _data["session_sponsor"] = sessionSponsor; + _data["location"] = location; + _data["address"] = address; + _data["postal_code"] = postalCode; + _data["url"] = url; + _data["activity_type"] = activityType; + _data["topic"] = topic; + _data["role"] = role; + _data["event_type_name"] = eventTypeName; + _data["country_name"] = country; + _data["state_name"] = region; + _data["city_name"] = city; + _data["organizer_type_name"] = organizerTypeName; + _data["sponsor_type_name"] = sponsorTypeName; + _data["session_type_name"] = sessionTypeName; + _data["kol_name"] = kolName; + _data["kol_unique_id"] = kolUniqueId; + _data["event_name"] = name1; + _data["event_unique_id"] = eventUniqueId; + _data["created_by_user"] = createdByUser; + _data["updated_by_user"] = updatedByUser; + _data["formatted_created_at"] = formattedCreatedAt; + _data["formatted_updated_at"] = formattedUpdatedAt; + if (attendees != null) { + _data["attendees"] = attendees?.map((e) => e.toJson()).toList(); + } + return _data; + } +} + +@HiveType(typeId: 102) +class Attendees { + @HiveField(0) + String? uniqueId; + @HiveField(1) + int? kolEventId; + @HiveField(2) + int? kolId; + @HiveField(3) + String? hcpFullName; + @HiveField(4) + String? hcpPin; + @HiveField(5) + int? npiNum; + @HiveField(6) + dynamic specialty; + @HiveField(7) + dynamic organization; + @HiveField(8) + String? therapeuticArea; + @HiveField(9) + dynamic cityId; + @HiveField(10) + dynamic stateId; + @HiveField(11) + dynamic countryId; + @HiveField(12) + dynamic cleansStatus; + @HiveField(13) + int? isDeleted; + @HiveField(14) + String? createdByUser; + @HiveField(15) + String? updatedByUser; + @HiveField(16) + dynamic deletedByUser; + @HiveField(17) + String? formattedCreatedAt; + @HiveField(18) + String? formattedUpdatedAt; + @HiveField(19) + dynamic formattedDeletedAt; + + Attendees( + {this.uniqueId, + this.kolEventId, + this.kolId, + this.hcpFullName, + this.hcpPin, + this.npiNum, + this.specialty, + this.organization, + this.therapeuticArea, + this.cityId, + this.stateId, + this.countryId, + this.cleansStatus, + this.isDeleted, + this.createdByUser, + this.updatedByUser, + this.deletedByUser, + this.formattedCreatedAt, + this.formattedUpdatedAt, + this.formattedDeletedAt}); + + Attendees.fromJson(Map json) { + if (json["unique_id"] is String) { + uniqueId = json["unique_id"]; + } + if (json["kol_event_id"] is int) { + kolEventId = json["kol_event_id"]; + } + if (json["kol_id"] is int) { + kolId = json["kol_id"]; + } + if (json["hcp_full_name"] is String) { + hcpFullName = json["hcp_full_name"]; + } + if (json["hcp_pin"] is String) { + hcpPin = json["hcp_pin"]; + } + if (json["npi_num"] is int) { + npiNum = json["npi_num"]; + } + specialty = json["specialty"]; + organization = json["organization"]; + if (json["therapeutic_area"] is String) { + therapeuticArea = json["therapeutic_area"]; + } + cityId = json["city_id"]; + stateId = json["state_id"]; + countryId = json["country_id"]; + cleansStatus = json["cleans_status"]; + if (json["is_deleted"] is int) { + isDeleted = json["is_deleted"]; + } + if (json["created_by_user"] is String) { + createdByUser = json["created_by_user"]; + } + if (json["updated_by_user"] is String) { + updatedByUser = json["updated_by_user"]; + } + deletedByUser = json["deleted_by_user"]; + if (json["formatted_created_at"] is String) { + formattedCreatedAt = json["formatted_created_at"]; + } + if (json["formatted_updated_at"] is String) { + formattedUpdatedAt = json["formatted_updated_at"]; + } + formattedDeletedAt = json["formatted_deleted_at"]; + } + + Map toJson() { + final Map _data = {}; + _data["unique_id"] = uniqueId; + _data["kol_event_id"] = kolEventId; + _data["kol_id"] = kolId; + _data["hcp_full_name"] = hcpFullName; + _data["hcp_pin"] = hcpPin; + _data["npi_num"] = npiNum; + _data["specialty"] = specialty; + _data["organization"] = organization; + _data["therapeutic_area"] = therapeuticArea; + _data["city_id"] = cityId; + _data["state_id"] = stateId; + _data["country_id"] = countryId; + _data["cleans_status"] = cleansStatus; + _data["is_deleted"] = isDeleted; + _data["created_by_user"] = createdByUser; + _data["updated_by_user"] = updatedByUser; + _data["deleted_by_user"] = deletedByUser; + _data["formatted_created_at"] = formattedCreatedAt; + _data["formatted_updated_at"] = formattedUpdatedAt; + _data["formatted_deleted_at"] = formattedDeletedAt; + return _data; + } +} diff --git a/lib/model/neweventsmodel.dart b/lib/model/neweventsmodel.dart index 228698d..fe1fbd0 100644 --- a/lib/model/neweventsmodel.dart +++ b/lib/model/neweventsmodel.dart @@ -1,4 +1,5 @@ import 'package:hive_flutter/hive_flutter.dart'; +import 'package:konectar_events/contacts_module/model_class/k2_api_model/kol_event_k2.dart'; part 'neweventsmodel.g.dart'; class EventsResp { @@ -27,12 +28,10 @@ class EventsData { EventsData({this.events}); EventsData.fromJson(Map json) { - if (json["events"] is List) { - events = json["events"] == null + if (json["data"] is List) { + events = json["data"] == null ? null - : (json["events"] as List) - .map((e) => EventsList.fromJson(e)) - .toList(); + : (json["data"] as List).map((e) => EventsList.fromJson(e)).toList(); } } @@ -67,6 +66,61 @@ class EventsDataStaging { } } +// RESPONSE FROM K2 + +class EventsListRespK2 { + int? code; + String? message; + List? data; + int? lastPage; + int? lastRow; + int? count; + + EventsListRespK2( + {this.code, + this.message, + this.data, + this.lastPage, + this.lastRow, + this.count}); + + EventsListRespK2.fromJson(Map json) { + if (json["code"] is int) { + code = json["code"]; + } + if (json["message"] is String) { + message = json["message"]; + } + if (json["data"] is List) { + data = json["data"] == null + ? null + : (json["data"] as List).map((e) => EventsList.fromJson(e)).toList(); + } + if (json["last_page"] is int) { + lastPage = json["last_page"]; + } + if (json["last_row"] is int) { + lastRow = json["last_row"]; + } + if (json["count"] is int) { + count = json["count"]; + } + } + + Map toJson() { + final Map _data = {}; + _data["code"] = code; + _data["message"] = message; + if (data != null) { + _data["data"] = data?.map((e) => e.toJson()).toList(); + } + _data["last_page"] = lastPage; + _data["last_row"] = lastRow; + _data["count"] = count; + return _data; + } +} + @HiveType(typeId: 2) class EventsList { @HiveField(0) @@ -195,319 +249,449 @@ class EventsList { String? topSpeakers; @HiveField(62) String? sponsors; + @HiveField(63) + bool? eventUserInterest = false; - EventsList( - {this.city, - this.sponsors, - this.speakerscount, - this.topSpeakers, - this.topTopics, - this.isfav = false, - this.isAttending = false, - this.country, - this.region, - this.activityType, - this.address, - this.cityId, - this.clientId, - this.cnt, - this.countryId, - this.createdBy, - this.createdOn, - this.dAllowed, - this.eAllowed, - this.end, - this.eventLat, - this.eventLong, - this.eventId, - this.eventType, - this.eventUniqueId, - this.eventUserAttendee, - this.globalEventId, - this.hcpPin, - this.id, - this.kolId, - this.location, - this.modifiedBy, - this.modifiedOn, - this.name1, - this.notes, - this.organizer, - this.organizerAlias, - this.organizerType, - this.otype, - this.partialcount, - this.partiallyReleasedEvent, - this.postalCode, - this.profileType, - this.projectId, - this.role, - this.sessionName, - this.sessionNote, - this.sessionNote1, - this.sessionSponsor, - this.sessionType, - this.sponsorType, - this.start, - this.stateId, - this.stype, - this.subject, - this.therapeuticArea, - this.topic, - this.topicName, - this.type, - this.updated, - this.url1, - this.url2, - this.userCount}); + EventsList({ + this.city, + this.sponsors, + this.speakerscount, + this.topSpeakers, + this.topTopics, + this.isfav = false, + this.isAttending = false, + this.country, + this.region, + this.activityType, + this.address, + this.cityId, + this.clientId, + this.cnt, + this.countryId, + this.createdBy, + this.createdOn, + this.dAllowed, + this.eAllowed, + this.end, + this.eventLat, + this.eventLong, + this.eventId, + this.eventType, + this.eventUniqueId, + this.eventUserAttendee, + this.globalEventId, + this.hcpPin, + this.id, + this.kolId, + this.location, + this.modifiedBy, + this.modifiedOn, + this.name1, + this.notes, + this.organizer, + this.organizerAlias, + this.organizerType, + this.otype, + this.partialcount, + this.partiallyReleasedEvent, + this.postalCode, + this.profileType, + this.projectId, + this.role, + this.sessionName, + this.sessionNote, + this.sessionNote1, + this.sessionSponsor, + this.sessionType, + this.sponsorType, + this.start, + this.stateId, + this.stype, + this.subject, + this.therapeuticArea, + this.topic, + this.topicName, + this.type, + this.updated, + this.url1, + this.url2, + this.userCount, + this.eventUserInterest, + }); - EventsList.fromJson(Map json) { - isfav = false; - if (json["City"] is String) { - city = json["City"] ?? null; - } - if (json["Country"] is String) { - country = json["Country"] ?? null; - } - if (json["Region"] is String) { - region = json["Region"] ?? null; - } - if (json["activity_type"] is String) { - activityType = json["activity_type"]; - } - if (json["address"] is String) { - address = json["address"]; - } - if (json["city_id"] is String) { - cityId = json["city_id"]; - } - if (json["client_id"] is String) { - clientId = json["client_id"]; - } - if (json["cnt"] is String) { - cnt = json["cnt"]; - } - if (json["country_id"] is String) { - countryId = json["country_id"]; - } - if (json["created_by"] is String) { - createdBy = json["created_by"]; - } - if (json["created_on"] is String) { - createdOn = json["created_on"]; - } - if (json["dAllowed"] is bool) { - dAllowed = json["dAllowed"]; - } - if (json["eAllowed"] is bool) { - eAllowed = json["eAllowed"]; - } - if (json["end"] is String) { - end = json["end"]; - } - if (json["eventLat"] is String) { - eventLat = json["eventLat"]; - } - if (json["eventLong"] is String) { - eventLong = json["eventLong"]; - } - if (json["event_id"] is String) { - eventId = json["event_id"]; - } - if (json["event_type"] is String) { - eventType = json["event_type"]; - } - if (json["event_unique_id"] is String) { - eventUniqueId = json["event_unique_id"]; - } - if (json["event_user_attendee"] is bool) { - eventUserAttendee = json["event_user_attendee"]; - } - if (json["global_event_id"] is String) { - globalEventId = json["global_event_id"]; - } - if (json["hcp_pin"] is String) { - hcpPin = json["hcp_pin"]; - } - if (json["id"] is String) { - id = json["id"]; - } - if (json["kol_id"] is String) { - kolId = json["kol_id"]; - } - if (json["location"] is String) { - location = json["location"]; - } - if (json["modified_by"] is String) { - modifiedBy = json["modified_by"]; - } - if (json["modified_on"] is String) { - modifiedOn = json["modified_on"]; - } - if (json["name1"] is String) { - name1 = json["name1"]; - } - if (json["notes"] is String) { - notes = json["notes"]; - } - if (json["organizer"] is String) { - organizer = json["organizer"]; - } - if (json["organizerAlias"] is String) { - organizerAlias = json["organizerAlias"]; - } - if (json["organizer_type"] is String) { - organizerType = json["organizer_type"]; - } - if (json["otype"] is String) { - otype = json["otype"]; - } - if (json["partialcount"] is String) { - partialcount = json["partialcount"]; - } - if (json["partially_released_event"] is String) { - partiallyReleasedEvent = json["partially_released_event"]; - } - if (json["postal_code"] is String) { - postalCode = json["postal_code"]; - } - if (json["profile_type"] is String) { - profileType = json["profile_type"]; - } - if (json["project_id"] is String) { - projectId = json["project_id"]; - } - if (json["role"] is String) { - role = json["role"]; - } - if (json["session_name"] is String) { - sessionName = json["session_name"]; - } - if (json["session_note"] is String) { - sessionNote = json["session_note"]; - } - if (json["session_note1"] is String) { - sessionNote1 = json["session_note1"]; - } - if (json["session_sponsor"] is String) { - sessionSponsor = json["session_sponsor"]; - } - if (json["session_type"] is String) { - sessionType = json["session_type"]; - } - if (json["sponsor_type"] is String) { - sponsorType = json["sponsor_type"]; - } - if (json["start"] is String) { - start = json["start"]; - } - if (json["state_id"] is String) { - stateId = json["state_id"]; - } - if (json["stype"] is String) { - stype = json["stype"]; - } - if (json["subject"] is String) { - subject = json["subject"]; - } - if (json["therapeutic_area"] is String) { - therapeuticArea = json["therapeutic_area"]; - } - if (json["topic"] is String) { - topic = json["topic"]; - } - if (json["topic_name"] is String) { - topicName = json["topic_name"]; - } - if (json["type"] is String) { - type = json["type"]; - } - if (json["updated"] is bool) { - updated = json["updated"]; - } - if (json["url1"] is String) { - url1 = json["url1"]; - } - if (json["url2"] is String) { - url2 = json["url2"]; - } - if (json["user_count"] is String) { - userCount = json["user_count"]; - } + factory EventsList.fromJson(Map json) => EventsList( + therapeuticArea: json["therapeutic_area"], + hcpPin: json["hcp_pin"], + cnt: json["cnt"], + id: json["id"], + kolId: json["kol_id"], + type: json["type"], + eventType: json["event_type"], + eventId: json["event_id"], + sessionType: json["session_type"], + sessionName: json["session_name"], + role: json["role"], + topic: json["topic"], + start: json["start"], + end: json["end"], + organizer: json["organizer"], + sponsorType: json["sponsor_type"], + sessionSponsor: json["session_sponsor"], + organizerType: json["organizer_type"], + location: json["location"], + address: json["address"], + cityId: json["city_id"], + stateId: json["state_id"], + countryId: json["country_id"], + postalCode: json["postal_code"], + subject: json["subject"], + url1: json["url1"], + url2: json["url2"], + notes: json["notes"], + createdBy: json["created_by"], + createdOn: json["created_on"], + modifiedBy: json["modified_by"], + modifiedOn: json[ + "modified_on"], // == null ? null : DateTime.parse(json["modified_on"]), + clientId: json["client_id"], + projectId: json["project_id"], + activityType: json["activity_type"], + profileType: json["profile_type"], + globalEventId: json["global_event_id"], + eventUniqueId: json["event_unique_id"], + stype: json["stype"], + otype: json["otype"], + // name: json["name"], + partiallyReleasedEvent: json["partially_released_event"], + country: json["Country"], + region: json["Region"], + city: json["City"], + topicName: json["topic_name"], + eventLat: json["eventLat"], + eventLong: json["eventLong"], + userCount: json["user_count"], + partialcount: json["partialcount"], + sessionNote1: json["session_note1"], + sessionNote: json["session_note"], + organizerAlias: json["organizerAlias"], + eAllowed: json["eAllowed"], + dAllowed: json["dAllowed"], + updated: json["updated"], + eventUserAttendee: json["event_user_attendee"], + eventUserInterest: json["event_user_interest"], + name1: json["name1"], + ); - if (json["speakerscount"] is String) { - speakerscount = json["speakerscount"]; - } - if (json["topTopics"] is String) { - topTopics = json["topTopics"]; - } - if (json["topSpeakers"] is String) { - topSpeakers = json["topSpeakers"]; - } - if (json["sponsors"] is String) { - sponsors = json["sponsors"]; - } - } - - Map toJson() { - final Map _data = {}; - _data["City"] = city; - _data["country"] = country; - _data["region"] = region; - _data["activity_type"] = activityType; - _data["address"] = address; - _data["city_id"] = cityId; - _data["client_id"] = clientId; - _data["cnt"] = cnt; - _data["country_id"] = countryId; - _data["created_by"] = createdBy; - _data["created_on"] = createdOn; - _data["dAllowed"] = dAllowed; - _data["eAllowed"] = eAllowed; - _data["end"] = end; - _data["eventLat"] = eventLat; - _data["eventLong"] = eventLong; - _data["event_id"] = eventId; - _data["event_type"] = eventType; - _data["event_unique_id"] = eventUniqueId; - _data["event_user_attendee"] = eventUserAttendee; - _data["global_event_id"] = globalEventId; - _data["hcp_pin"] = hcpPin; - _data["id"] = id; - _data["kol_id"] = kolId; - _data["location"] = location; - _data["modified_by"] = modifiedBy; - _data["modified_on"] = modifiedOn; - _data["name1"] = name1; - _data["notes"] = notes; - _data["organizer"] = organizer; - _data["organizerAlias"] = organizerAlias; - _data["organizer_type"] = organizerType; - _data["otype"] = otype; - _data["partialcount"] = partialcount; - _data["partially_released_event"] = partiallyReleasedEvent; - _data["postal_code"] = postalCode; - _data["profile_type"] = profileType; - _data["project_id"] = projectId; - _data["role"] = role; - _data["session_name"] = sessionName; - _data["session_note"] = sessionNote; - _data["session_note1"] = sessionNote1; - _data["session_sponsor"] = sessionSponsor; - _data["session_type"] = sessionType; - _data["sponsor_type"] = sponsorType; - _data["start"] = start; - _data["state_id"] = stateId; - _data["stype"] = stype; - _data["subject"] = subject; - _data["therapeutic_area"] = therapeuticArea; - _data["topic"] = topic; - _data["topic_name"] = topicName; - _data["type"] = type; - _data["updated"] = updated; - _data["url1"] = url1; - _data["url2"] = url2; - _data["user_count"] = userCount; - return _data; - } + Map toJson() => { + "therapeutic_area": therapeuticArea, + "hcp_pin": hcpPin, + "cnt": cnt, + "id": id, + "kol_id": kolId, + "type": type, + "event_type": eventType, + "event_id": eventId, + "session_type": sessionType, + "session_name": sessionName, + "role": role, + "topic": topic, + "start": start, + "end": end, + "organizer": organizer, + "sponsor_type": sponsorType, + "session_sponsor": sessionSponsor, + "organizer_type": organizerType, + "location": location, + "address": address, + "city_id": cityId, + "state_id": stateId, + "country_id": countryId, + "postal_code": postalCode, + "subject": subject, + "url1": url1, + "url2": url2, + "notes": notes, + "created_by": createdBy, + "created_on": createdOn, + "modified_by": modifiedBy, + "modified_on": modifiedOn, + "client_id": clientId, + "project_id": projectId, + "activity_type": activityType, + "profile_type": profileType, + "global_event_id": globalEventId, + "event_unique_id": eventUniqueId, + "stype": stype, + "otype": otype, + // "name": name, + "partially_released_event": partiallyReleasedEvent, + "Country": country, + "Region": region, + "City": city, + "topic_name": topicName, + "eventLat": eventLat, + "eventLong": eventLong, + "user_count": userCount, + "partialcount": partialcount, + "session_note1": sessionNote1, + "session_note": sessionNote, + "organizerAlias": organizerAlias, + "eAllowed": eAllowed, + "dAllowed": dAllowed, + "updated": updated, + "event_user_attendee": eventUserAttendee, + "event_user_interest": eventUserInterest, + "name1": name1, + }; } + +// EventsList.fromJson(Map json) { +// isfav = false; +// if (json["city_name"] is String) { +// city = json["city_name"] ?? null; +// } +// if (json["country_name"] is String) { +// country = json["country_name"] ?? null; +// } +// if (json["state_name"] is String) { +// region = json["state_name"] ?? null; +// } +// if (json["activity_type"] is String) { +// activityType = json["activity_type"]; +// } +// if (json["address"] is String) { +// address = json["address"]; +// } +// if (json["city_id"] is String) { +// cityId = json["city_id"]; +// } +// if (json["client_id"] is String) { +// clientId = json["client_id"]; +// } +// if (json["cnt"] is String) { +// cnt = json["cnt"]; +// } +// if (json["country_id"] is String) { +// countryId = json["country_id"]; +// } +// if (json["created_by"] is String) { +// createdBy = json["created_by"]; +// } +// if (json["created_on"] is String) { +// createdOn = json["created_on"]; +// } +// if (json["dAllowed"] is bool) { +// dAllowed = json["dAllowed"]; +// } +// if (json["eAllowed"] is bool) { +// eAllowed = json["eAllowed"]; +// } +// if (json["end_date"] is String) { +// end = json["end_date"]; +// } +// if (json["eventLat"] is String) { +// eventLat = json["eventLat"]; +// } +// if (json["eventLong"] is String) { +// eventLong = json["eventLong"]; +// } +// if (json["unique_id"] is String) { +// eventId = json["unique_id"]; +// } +// if (json["event_type_name"] is String) { +// eventType = json["event_type_name"]; +// } +// if (json["event_unique_id"] is String) { +// eventUniqueId = json["event_unique_id"]; +// } +// if (json["event_user_attendee"] is bool) { +// eventUserAttendee = json["event_user_attendee"]; +// } +// if (json["global_event_id"] is String) { +// globalEventId = json["global_event_id"]; +// } +// if (json["hcp_pin"] is String) { +// hcpPin = json["hcp_pin"]; +// } +// if (json["id"] is String) { +// id = json["id"]; +// } +// if (json["kol_id"] is String) { +// kolId = json["kol_id"]; +// } +// if (json["location"] is String) { +// location = json["location"]; +// } +// if (json["modified_by"] is String) { +// modifiedBy = json["modified_by"]; +// } +// if (json["modified_on"] is String) { +// modifiedOn = json["modified_on"]; +// } +// if (json["event_name"] is String) { +// name1 = json["event_name"]; +// } +// if (json["notes"] is String) { +// notes = json["notes"]; +// } +// if (json["organizer"] is String) { +// organizer = json["organizer"]; +// } +// if (json["organizerAlias"] is String) { +// organizerAlias = json["organizerAlias"]; +// } +// if (json["organizer_type_name"] is String) { +// organizerType = json["organizer_type_name"]; +// } +// if (json["otype"] is String) { +// otype = json["otype"]; +// } +// if (json["partialcount"] is String) { +// partialcount = json["partialcount"]; +// } +// if (json["partially_released_event"] is String) { +// partiallyReleasedEvent = json["partially_released_event"]; +// } +// if (json["postal_code"] is String) { +// postalCode = json["postal_code"]; +// } +// if (json["profile_type"] is String) { +// profileType = json["profile_type"]; +// } +// if (json["project_id"] is String) { +// projectId = json["project_id"]; +// } +// if (json["role"] is String) { +// role = json["role"]; +// } +// if (json["session_name"] is String) { +// sessionName = json["session_name"]; +// } +// if (json["session_note"] is String) { +// sessionNote = json["session_note"]; +// } +// if (json["session_note1"] is String) { +// sessionNote1 = json["session_note1"]; +// } +// if (json["session_sponsor"] is String) { +// sessionSponsor = json["session_sponsor"]; +// } +// if (json["session_type"] is String) { +// sessionType = json["session_type"]; +// } +// if (json["sponsor_type_name"] is String) { +// sponsorType = json["sponsor_type_name"]; +// } +// if (json["start_date"] is String) { +// start = json["start_date"]; +// } +// if (json["state_id"] is String) { +// stateId = json["state_id"]; +// } +// if (json["stype"] is String) { +// stype = json["stype"]; +// } +// if (json["subject"] is String) { +// subject = json["subject"]; +// } +// if (json["therapeutic_area"] is String) { +// therapeuticArea = json["therapeutic_area"]; +// } +// if (json["topic"] is String) { +// topic = json["topic"]; +// } +// if (json["topic_name"] is String) { +// topicName = json["topic_name"]; +// } +// if (json["type"] is String) { +// type = json["type"]; +// } +// if (json["updated"] is bool) { +// updated = json["updated"]; +// } +// if (json["url"] is String) { +// url1 = json["url"]; +// } +// if (json["url2"] is String) { +// url2 = json["url2"]; +// } +// if (json["user_count"] is String) { +// userCount = json["user_count"]; +// } + +// if (json["speakerscount"] is String) { +// speakerscount = json["speakerscount"]; +// } +// if (json["topTopics"] is String) { +// topTopics = json["topTopics"]; +// } +// if (json["topSpeakers"] is String) { +// topSpeakers = json["topSpeakers"]; +// } +// if (json["sponsors"] is String) { +// sponsors = json["sponsors"]; +// } +// } + +// Map toJson() { +// final Map _data = {}; +// _data["City"] = city; +// _data["country"] = country; +// _data["region"] = region; +// _data["activity_type"] = activityType; +// _data["address"] = address; +// _data["city_id"] = cityId; +// _data["client_id"] = clientId; +// _data["cnt"] = cnt; +// _data["country_id"] = countryId; +// _data["created_by"] = createdBy; +// _data["created_on"] = createdOn; +// _data["dAllowed"] = dAllowed; +// _data["eAllowed"] = eAllowed; +// _data["end"] = end; +// _data["eventLat"] = eventLat; +// _data["eventLong"] = eventLong; +// _data["event_id"] = eventId; +// _data["event_type"] = eventType; +// _data["event_unique_id"] = eventUniqueId; +// _data["event_user_attendee"] = eventUserAttendee; +// _data["global_event_id"] = globalEventId; +// _data["hcp_pin"] = hcpPin; +// _data["id"] = id; +// _data["kol_id"] = kolId; +// _data["location"] = location; +// _data["modified_by"] = modifiedBy; +// _data["modified_on"] = modifiedOn; +// _data["name1"] = name1; +// _data["notes"] = notes; +// _data["organizer"] = organizer; +// _data["organizerAlias"] = organizerAlias; +// _data["organizer_type"] = organizerType; +// _data["otype"] = otype; +// _data["partialcount"] = partialcount; +// _data["partially_released_event"] = partiallyReleasedEvent; +// _data["postal_code"] = postalCode; +// _data["profile_type"] = profileType; +// _data["project_id"] = projectId; +// _data["role"] = role; +// _data["session_name"] = sessionName; +// _data["session_note"] = sessionNote; +// _data["session_note1"] = sessionNote1; +// _data["session_sponsor"] = sessionSponsor; +// _data["session_type"] = sessionType; +// _data["sponsor_type"] = sponsorType; +// _data["start"] = start; +// _data["state_id"] = stateId; +// _data["stype"] = stype; +// _data["subject"] = subject; +// _data["therapeutic_area"] = therapeuticArea; +// _data["topic"] = topic; +// _data["topic_name"] = topicName; +// _data["type"] = type; +// _data["updated"] = updated; +// _data["url1"] = url1; +// _data["url2"] = url2; +// _data["user_count"] = userCount; +// return _data; +// } +// } diff --git a/lib/model/specialtymodel.dart b/lib/model/specialtymodel.dart index 6eb51f0..8034a6f 100644 --- a/lib/model/specialtymodel.dart +++ b/lib/model/specialtymodel.dart @@ -46,13 +46,19 @@ class Specialtyresp { }; } +List specialtyFromJson(String str) => + List.from(json.decode(str).map((x) => Specialty.fromJson(x))); + +String specialtyToJson(List data) => + json.encode(List.from(data.map((x) => x.toJson()))); + class Specialty { - String specialtyCount; - String specialtyName; + String? specialtyCount; + String? specialtyName; Specialty({ - required this.specialtyCount, - required this.specialtyName, + this.specialtyCount, + this.specialtyName, }); factory Specialty.fromJson(Map json) => Specialty( diff --git a/lib/model/topics_cloud_model.dart b/lib/model/topics_cloud_model.dart index 3afbca0..2848079 100644 --- a/lib/model/topics_cloud_model.dart +++ b/lib/model/topics_cloud_model.dart @@ -54,6 +54,13 @@ class Topicsresp { }; } +List topicsCloudDataFromJson(String str) => + List.from( + json.decode(str).map((x) => TopicsCloudData.fromJson(x))); + +String topicsCloudDataToJson(List data) => + json.encode(List.from(data.map((x) => x.toJson()))); + class TopicsCloudData { String? total; String? topic; diff --git a/lib/utils/apicall.dart b/lib/utils/apicall.dart index 96cfdb7..fd0f49f 100644 --- a/lib/utils/apicall.dart +++ b/lib/utils/apicall.dart @@ -5,9 +5,11 @@ import 'package:dio/dio.dart'; import 'package:dio/io.dart'; import 'package:flutter/services.dart'; import 'package:konectar_events/model/affiliationsmodel.dart'; +import 'package:konectar_events/model/events_list_resp_2.dart'; import 'package:konectar_events/model/eventsdetailmodel.dart'; import 'package:konectar_events/model/eventsmodel.dart'; import 'package:konectar_events/model/eventsoverview.dart'; +import 'package:konectar_events/model/eventspeakers.dart'; import 'package:konectar_events/model/keywords_model.dart'; import 'package:konectar_events/model/neweventsmodel.dart'; import 'package:konectar_events/model/scope_model.dart'; @@ -19,6 +21,7 @@ import 'package:konectar_events/utils/constants.dart'; class ApiCall { final dio = Dio(); + //K1 API CALLS Future parseInfo() async { Dio dio = Dio(); (dio.httpClientAdapter as IOHttpClientAdapter).onHttpClientCreate = @@ -42,30 +45,6 @@ class ApiCall { return response.data; } - //https://cardio-staging.konectar.io/notifications/list_all_notifications - Future listnotifications() async { - Dio dio = Dio(); - (dio.httpClientAdapter as IOHttpClientAdapter).onHttpClientCreate = - (HttpClient client) { - client.badCertificateCallback = - (X509Certificate cert, String host, int port) => true; - return client; - }; - Response response; - response = await dio.post( - 'https://cardio-staging.konectar.io/requested_kols/list_my_pending_approvals/', - options: Options( - followRedirects: false, - validateStatus: (status) { - return status! < 500; - }, - headers: {'Content-type': 'application/json; charset=UTF-8'}), - data: {"rows": "10", "page": "1", "sidx": "name", "sord": "desc"}); - print("response user settings here "); - print(response.data.toString()); - return response.data; - } - Future> getscopes() async { Dio dio = Dio(); (dio.httpClientAdapter as IOHttpClientAdapter).onHttpClientCreate = @@ -122,7 +101,7 @@ class ApiCall { return keywordList; } - Future?> getStagingEvents() async { + Future> getEventsFromK1({String? type}) async { Dio dio = Dio(); (dio.httpClientAdapter as IOHttpClientAdapter).onHttpClientCreate = (HttpClient client) { @@ -134,10 +113,222 @@ class ApiCall { var formData = FormData.fromMap({ "user_email": "vinodh@aissel.com", "project_id": "", - "start": "", + "start": DateTime.now().toString, "end": "", "order_by": "7", - "type": "1" + "type": type ?? "1" + }); + response = await dio.post( + '${EventsConstants.devUrl}${EventsConstants.eventslistapi}', + options: Options(), + queryParameters: { + "user_email": "vinodh@aissel.com", + "project_id": "", + "start": DateTime.now().toString, + "end": "", + "order_by": "7", + "type": type ?? "1" + }, + data: formData); + print("response user eventssssss here!!!!!!!!!!!!!!!!!!!!! "); + print(response.data.toString()); + Map jsondata = json.decode(response.data); + + EventsData eventresponse = EventsData.fromJson(jsondata); + List? eventdata = eventresponse.events; + return eventdata!; + } + + Future followUnfollowEvent(String flag, String eventid) async { + Dio dio = Dio(); + (dio.httpClientAdapter as IOHttpClientAdapter).onHttpClientCreate = + (HttpClient client) { + client.badCertificateCallback = + (X509Certificate cert, String host, int port) => true; + return client; + }; + Response response; + var formData = FormData.fromMap( + {"user_email": "vinodh@aissel.com", "eid": eventid, "flag": flag}); + response = await dio.post( + '${EventsConstants.devUrl}${EventsConstants.followUnfollowEvent}', + options: Options(), + queryParameters: { + "user_email": "vinodh@aissel.com", + "eid": eventid, + "flag": flag, + }, + data: formData); + print("response user FOLLOW UNFOLLOW here!!!!!!!!!!!!!!!!!!!!! "); + print(response.data.toString()); + + return response.data.toString(); + } + + Future attendNotAttendEvent(String flag, String eventid) async { + Dio dio = Dio(); + (dio.httpClientAdapter as IOHttpClientAdapter).onHttpClientCreate = + (HttpClient client) { + client.badCertificateCallback = + (X509Certificate cert, String host, int port) => true; + return client; + }; + Response response; + var formData = FormData.fromMap( + {"user_email": "vinodh@aissel.com", "eid": eventid, "flag": flag}); + response = await dio.post( + '${EventsConstants.devUrl}${EventsConstants.attendNotAttendEvent}', + options: Options(), + queryParameters: { + "user_email": "vinodh@aissel.com", + "eid": eventid, + "flag": flag, + }, + data: formData); + print("response user FOLLOW UNFOLLOW here!!!!!!!!!!!!!!!!!!!!! "); + print(response.data.toString()); + + return response.data.toString(); + } + + Future> specialtyOfSpeakers({ + required String eventid, + required String startDate, + required String endDate, + }) async { + Dio dio = Dio(); + (dio.httpClientAdapter as IOHttpClientAdapter).onHttpClientCreate = + (HttpClient client) { + client.badCertificateCallback = + (X509Certificate cert, String host, int port) => true; + return client; + }; + Response response; + var formData = FormData.fromMap({ + "user_email": "vinodh@aissel.com", + "eventId": eventid, + "sd": "\"$startDate\"", + "ed": "\"$endDate\"", + "type": "\"1\"", + }); + print("FORMDATA:${formData.toString()},$startDate,$endDate"); + response = await dio.post( + '${EventsConstants.devUrl}${EventsConstants.specialtyOfSpeakers}', + options: Options(), + queryParameters: { + "user_email": "vinodh@aissel.com", + "eventId": eventid, + "sd": "\"$startDate\"", + "ed": "\"$endDate\"", + "type": "\"1\"", + }, + data: formData); + print("response SPECIALTY SPEAKERS here!!!!!!!!!!!!!!!!!!!!! "); + print(response.data.toString()); + // Map jsondata = json.decode(response.data); + + // Specialtyresp resp = Specialtyresp.fromJson(jsondata); + List data = specialtyFromJson(response.data); + return data; + } + + Future> insightsTopicsCloud({ + required String eventid, + required String startDate, + required String endDate, + }) async { + Dio dio = Dio(); + (dio.httpClientAdapter as IOHttpClientAdapter).onHttpClientCreate = + (HttpClient client) { + client.badCertificateCallback = + (X509Certificate cert, String host, int port) => true; + return client; + }; + Response response; + var formData = FormData.fromMap({ + "user_email": "vinodh@aissel.com", + "eventId": eventid, + "sd": "\"$startDate\"", + "ed": "\"$endDate\"", + "type": "\"1\"", + }); + print("FORMDATA:${formData.toString()},$startDate,$endDate"); + response = await dio.post( + '${EventsConstants.devUrl}${EventsConstants.insightsTopicsCloud}', + options: Options(), + queryParameters: { + "user_email": "vinodh@aissel.com", + "eventId": eventid, + "sd": "\"$startDate\"", + "ed": "\"$endDate\"", + "type": "\"1\"", + }, + data: formData); + print("response SPECIALTY SPEAKERS here!!!!!!!!!!!!!!!!!!!!! "); + print(response.data.toString()); + // Map jsondata = json.decode(response.data); + + // Specialtyresp resp = Specialtyresp.fromJson(jsondata); + List data = topicsCloudDataFromJson(response.data); + return data; + } + + Future> insightsBarChart({ + required String eventid, + required String startDate, + required String endDate, + }) async { + Dio dio = Dio(); + (dio.httpClientAdapter as IOHttpClientAdapter).onHttpClientCreate = + (HttpClient client) { + client.badCertificateCallback = + (X509Certificate cert, String host, int port) => true; + return client; + }; + Response response; + var formData = FormData.fromMap({ + "user_email": "vinodh@aissel.com", + "eventId": eventid, + "sd": "\"$startDate\"", + "ed": "\"$endDate\"", + "type": "\"1\"", + }); + print("FORMDATA:${formData.toString()},$startDate,$endDate"); + response = await dio.post( + '${EventsConstants.devUrl}${EventsConstants.insightsBarChart}', + options: Options(), + queryParameters: { + "user_email": "vinodh@aissel.com", + "eventId": eventid, + "sd": "\"$startDate\"", + "ed": "\"$endDate\"", + "type": "\"1\"", + }, + data: formData); + print("response SPECIALTY SPEAKERS here!!!!!!!!!!!!!!!!!!!!! "); + print(response.data.toString()); + // Map jsondata = json.decode(response.data); + + // Specialtyresp resp = Specialtyresp.fromJson(jsondata); + List data = affiliationsFromJson(response.data); + return data; + } + + Future getEventsOverview( + String eventid, String startDate, String endDate) async { + Dio dio = Dio(); + (dio.httpClientAdapter as IOHttpClientAdapter).onHttpClientCreate = + (HttpClient client) { + client.badCertificateCallback = + (X509Certificate cert, String host, int port) => true; + return client; + }; + Response response; + var formData = FormData.fromMap({ + "user_email": "vinodh@aissel.com", + "start": startDate, + "end": endDate, + "event_id": eventid, }); response = await dio.post( '${EventsConstants.stagingUrl}${EventsConstants.eventslistapi}', @@ -149,14 +340,16 @@ class ApiCall { print("response user eventssssss here!!!!!!!!!!!!!!!!!!!!! "); print(response.data.toString()); Map jsondata = json.decode(response.data); - EventsDataStaging? eventdata = EventsDataStaging.fromJson(jsondata); - List? eventList = eventdata.events; + EventsDetailsResp? eventdata = EventsDetailsResp.fromJson(jsondata); + OverviewData overviewData = eventdata.data; - return eventList; + return overviewData; } - Future verifyEmail( - String email, String deviceid, String platform) async { + //************ K2 API CALLS *********************************************************************************************************************************** + + Future> getEventsFromK2(int page, String search, + {String? startdate, String? enddate}) async { Dio dio = Dio(); (dio.httpClientAdapter as IOHttpClientAdapter).onHttpClientCreate = (HttpClient client) { @@ -165,27 +358,178 @@ class ApiCall { return client; }; Response response; - var formData = FormData.fromMap({ - "email": email, - }); - response = await dio.post('${EventsConstants.getTokenApi}', - options: Options(), - queryParameters: { - "email": email, - "device_id": deviceid, - "platform": platform, - }, + var formData; + if (startdate != "") { + formData = { + "page": page, + "limit": 20, + "start_date": startdate, + "end_date": enddate, + }; + } else { + formData = { + "page": page, + "limit": 20, + "conditions": [ + {"field": "event_name", "type": "like", "value": search} + ] + }; + } + + response = await dio.post('${EventsConstants.eventslistapifromk2}', + options: Options(headers: { + "Authorization": + "Bearer 242|f4s7EfBjD01z1tuGeJfgKm7v2WzZk22uDOehqFyla72c481a", + HttpHeaders.contentTypeHeader: "application/json", + }), + // queryParameters: { + // "page": page, + // "limit": 20, + // // "id": "11c39192480587d2d6213bfef6744571", + // "conditions": jsonEncode([ + // {"field": eventfield, "type": "like", "value": searchkey} + // ]) + // }, data: formData); if (response.statusCode == 200) { - print("response user login!!!!!!!!!!!!!!!!!!!!! "); + print("response EVENTS!!!!!!!!!!!!!!!!!!!! "); print(response.data.toString()); - return response.data; + Map jsondata = response.data; + EventsListRespK2 eventresponse = EventsListRespK2.fromJson(jsondata); + List? eventdata = eventresponse.data; + + return eventdata!; } else { - print("isEmplty"); - return null; + print("isEmpty"); + return []; } } + Future> getMyEventsFromK2(int page, String search, + {String? startdate, String? enddate}) async { + Dio dio = Dio(); + (dio.httpClientAdapter as IOHttpClientAdapter).onHttpClientCreate = + (HttpClient client) { + client.badCertificateCallback = + (X509Certificate cert, String host, int port) => true; + return client; + }; + Response response; + var formData; + if (startdate != "") { + formData = { + "page": page, + "limit": 20, + "id": "11c39192480587d2d6213bfef6744571", + "start_date": startdate, + "end_date": enddate, + }; + } else { + formData = { + "page": page, + "limit": 20, + "id": "11c39192480587d2d6213bfef6744571", + "conditions": [ + {"field": "event_name", "type": "like", "value": search} + ] + }; + } + + response = await dio.post('${EventsConstants.eventslistapifromk2}', + options: Options(headers: { + "Authorization": + "Bearer 242|f4s7EfBjD01z1tuGeJfgKm7v2WzZk22uDOehqFyla72c481a", + HttpHeaders.contentTypeHeader: "application/json", + }), + // queryParameters: { + // "page": page, + // "limit": 20, + // // "id": "11c39192480587d2d6213bfef6744571", + // "conditions": jsonEncode([ + // {"field": eventfield, "type": "like", "value": searchkey} + // ]) + // }, + data: formData); + + if (response.statusCode == 200) { + print("response MY EVENTS!!!!!!!!!!!!!!!!!!!! "); + print(response.data.toString()); + Map jsondata = response.data; + EventsListRespK2 eventresponse = EventsListRespK2.fromJson(jsondata); + List? eventdata = eventresponse.data; + + return eventdata!; + } else { + print("isEmpty"); + return []; + } + } + +//ADD TO FAVS + Future addEventsToFav(String eventid) async { + Dio dio = Dio(); + (dio.httpClientAdapter as IOHttpClientAdapter).onHttpClientCreate = + (HttpClient client) { + client.badCertificateCallback = + (X509Certificate cert, String host, int port) => true; + return client; + }; + Response response; + + response = await dio.post( + '${EventsConstants.addToMyEventsApi}', + options: Options(headers: { + "Authorization": + "Bearer 242|f4s7EfBjD01z1tuGeJfgKm7v2WzZk22uDOehqFyla72c481a" + }), + queryParameters: { + "event_id": eventid, + "user_id": "11c39192480587d2d6213bfef6744571", + }, + ); + print("response user keywords here########## "); + print(response.data.toString()); + Map jsondata = json.decode(response.toString()); + String message = jsondata["message"]; + print("***$message"); + + return message; + } + +//REMOVE FROM FAVS + + Future removeEventsFromFav(String eventid) async { + Dio dio = Dio(); + (dio.httpClientAdapter as IOHttpClientAdapter).onHttpClientCreate = + (HttpClient client) { + client.badCertificateCallback = + (X509Certificate cert, String host, int port) => true; + return client; + }; + Response response; + + response = await dio.post( + '${EventsConstants.removeFromMyEventsApi}', + options: Options(headers: { + "Authorization": + "Bearer 242|f4s7EfBjD01z1tuGeJfgKm7v2WzZk22uDOehqFyla72c481a", + }), + queryParameters: { + "event_id": eventid, + "user_id": "11c39192480587d2d6213bfef6744571", + }, + ); + print("response user keywords here########## "); + print(response.data.toString()); + Map jsondata = json.decode(response.toString()); + String message = jsondata["message"]; + print("***$message"); + + return message; + } + + //GET MY EVENTS + Future verifyCode(String email, String code) async { Dio dio = Dio(); (dio.httpClientAdapter as IOHttpClientAdapter).onHttpClientCreate = @@ -238,8 +582,151 @@ class ApiCall { return response.data; } - Future getEventsOverview( - String eventid, String startDate, String endDate) async { + //SEARCH EVENTS API FROM K2 + + Future> getSearchedEventsFromK2( + int page, String eventfield, String searchkey) async { + Dio dio = Dio(); + (dio.httpClientAdapter as IOHttpClientAdapter).onHttpClientCreate = + (HttpClient client) { + client.badCertificateCallback = + (X509Certificate cert, String host, int port) => true; + return client; + }; + Response response; + var formData = { + "page": page, + "limit": 20, + "conditions": [ + {"field": eventfield, "type": "like", "value": searchkey} + ] + }; + response = await dio.post('${EventsConstants.eventslistapifromk2}', + options: Options(headers: { + "Authorization": + "Bearer 242|f4s7EfBjD01z1tuGeJfgKm7v2WzZk22uDOehqFyla72c481a", + HttpHeaders.contentTypeHeader: "application/json", + }), + // queryParameters: { + // "page": page, + // "limit": 20, + // // "id": "11c39192480587d2d6213bfef6744571", + // "conditions": jsonEncode([ + // {"field": eventfield, "type": "like", "value": searchkey} + // ]) + // }, + data: formData); + if (response.statusCode == 200) { + print("response SEARCH EVENTS!!!!!!!!!!!!!!!!!!!! "); + print(response.data.toString()); + Map jsondata = response.data; + EventsListRespK2 eventresponse = EventsListRespK2.fromJson(jsondata); + List? eventdata = eventresponse.data; + + return eventdata!; + } else { + print("isEmpty"); + return []; + } + } + +//SPEAKERS LIST FROM K2 + Future> getSpeakersFromK2( + int page, String eventid, String event_unique_id, + {String? searchkey}) async { + Dio dio = Dio(); + print("see pages^^^^^^^ : $page"); + (dio.httpClientAdapter as IOHttpClientAdapter).onHttpClientCreate = + (HttpClient client) { + client.badCertificateCallback = + (X509Certificate cert, String host, int port) => true; + return client; + }; + Response response; + var formData = { + "page": page, + "limit": 40, + "id": eventid, + "event_id": event_unique_id, + "hcp_full_name": searchkey + // "conditions": [ + // {"field": eventfield, "type": "like", "value": searchkey} + // ] + }; + response = await dio.post('${EventsConstants.speakerslistapifromk2}', + options: Options(headers: { + "Authorization": + "Bearer 242|f4s7EfBjD01z1tuGeJfgKm7v2WzZk22uDOehqFyla72c481a", + HttpHeaders.contentTypeHeader: "application/json", + }), + // queryParameters: { + // "page": page, + // "limit": 20, + // // "id": "11c39192480587d2d6213bfef6744571", + // "conditions": jsonEncode([ + // {"field": eventfield, "type": "like", "value": searchkey} + // ]) + // }, + data: formData); + if (response.statusCode == 200) { + print("respons Speakers !!!!!!!!!!!!!!!!!!!! "); + print(response.data.toString()); + Map jsondata = response.data; + SpeakersResponse resp = SpeakersResponse.fromJson(jsondata); + List? data = resp.data; + var respdata = {"count": resp.count, "list": data ?? []}; + + return respdata; + } else { + print("isEmpty"); + return {}; + } + } + + //************ OTHER API CALLS *********************************************************************************************************************************** + + Future dummyapi() async { + Dio dio = Dio(); + (dio.httpClientAdapter as IOHttpClientAdapter).onHttpClientCreate = + (HttpClient client) { + client.badCertificateCallback = + (X509Certificate cert, String host, int port) => true; + return client; + }; + Response response; + response = await dio.get('http://203.129.219.14:3043/weather?city=London', + options: Options()); + print("response PLATFORMATIC here "); + print(response.data.toString()); + return response.data; + } + + //https://cardio-staging.konectar.io/notifications/list_all_notifications + Future listnotifications() async { + Dio dio = Dio(); + (dio.httpClientAdapter as IOHttpClientAdapter).onHttpClientCreate = + (HttpClient client) { + client.badCertificateCallback = + (X509Certificate cert, String host, int port) => true; + return client; + }; + Response response; + response = await dio.post( + 'https://cardio-staging.konectar.io/requested_kols/list_my_pending_approvals/', + options: Options( + followRedirects: false, + validateStatus: (status) { + return status! < 500; + }, + headers: {'Content-type': 'application/json; charset=UTF-8'}), + data: {"rows": "10", "page": "1", "sidx": "name", "sord": "desc"}); + print("response user settings here "); + print(response.data.toString()); + return response.data; + } + + Future verifyEmail( + String email, String deviceid, String platform) async { Dio dio = Dio(); (dio.httpClientAdapter as IOHttpClientAdapter).onHttpClientCreate = (HttpClient client) { @@ -249,25 +736,24 @@ class ApiCall { }; Response response; var formData = FormData.fromMap({ - "user_email": "vinodh@aissel.com", - "start": startDate, - "end": endDate, - "event_id": eventid, + "email": email, }); - response = await dio.post( - '${EventsConstants.stagingUrl}${EventsConstants.eventslistapi}', + response = await dio.post('${EventsConstants.getTokenApi}', options: Options(), queryParameters: { - "user_email": "vinodh@aissel.com", + "email": email, + "device_id": deviceid, + "platform": platform, }, data: formData); - print("response user eventssssss here!!!!!!!!!!!!!!!!!!!!! "); - print(response.data.toString()); - Map jsondata = json.decode(response.data); - EventsDetailsResp? eventdata = EventsDetailsResp.fromJson(jsondata); - OverviewData overviewData = eventdata.data; - - return overviewData; + if (response.statusCode == 200) { + print("response user login!!!!!!!!!!!!!!!!!!!!! "); + print(response.data.toString()); + return response.data; + } else { + print("isEmplty"); + return null; + } } Future?> getEvents() async { @@ -324,29 +810,6 @@ class ApiCall { return eventsdetailList; } - Future addEventsToFav(String eventid) async { - Dio dio = Dio(); - (dio.httpClientAdapter as IOHttpClientAdapter).onHttpClientCreate = - (HttpClient client) { - client.badCertificateCallback = - (X509Certificate cert, String host, int port) => true; - return client; - }; - Response response; - - response = await dio.post( - '${EventsConstants.domainUrl}eventsapi.api.addEventsToFav?eventid=$eventid', - options: Options(), - ); - print("response user keywords here########## "); - print(response.data.toString()); - Map jsondata = json.decode(response.toString()); - String message = jsondata["message"]; - print("***$message"); - - return message; - } - Future attendEvents(String eventid) async { Dio dio = Dio(); (dio.httpClientAdapter as IOHttpClientAdapter).onHttpClientCreate = @@ -619,4 +1082,58 @@ class ApiCall { return data; } + + Future> getSpeakersFromLocal( + int page, String eventid, String event_unique_id, + {String? searchkey}) async { + Dio dio = Dio(); + print("see pages^^^^^^^ : $page"); + (dio.httpClientAdapter as IOHttpClientAdapter).onHttpClientCreate = + (HttpClient client) { + client.badCertificateCallback = + (X509Certificate cert, String host, int port) => true; + return client; + }; + Response response; + var formData = { + "page": page, + "limit": 40, + "id": eventid, + "event_id": event_unique_id, + "hcp_full_name": searchkey + // "conditions": [ + // {"field": eventfield, "type": "like", "value": searchkey} + // ] + }; + response = await dio.post( + '${EventsConstants.speakerslistapifromLocal}', + // options: Options(headers: { + // "Authorization": + // "Bearer 242|f4s7EfBjD01z1tuGeJfgKm7v2WzZk22uDOehqFyla72c481a", + // HttpHeaders.contentTypeHeader: "application/json", + // }), + // queryParameters: { + // "page": page, + // "limit": 20, + // // "id": "11c39192480587d2d6213bfef6744571", + // "conditions": jsonEncode([ + // {"field": eventfield, "type": "like", "value": searchkey} + // ]) + // }, + // data: formData + ); + if (response.statusCode == 200) { + print("respons Speakers !!!!!!!!!!!!!!!!!!!! "); + print(response.data.toString()); + Map jsondata = response.data; + SpeakersResponse1 resp = SpeakersResponse1.fromJson(jsondata); + List? data = resp.data!.data; + var respdata = {"count": 92, "list": data ?? []}; + + return respdata; + } else { + print("isEmpty"); + return {}; + } + } } diff --git a/lib/utils/constants.dart b/lib/utils/constants.dart index 418d016..a1dd382 100644 --- a/lib/utils/constants.dart +++ b/lib/utils/constants.dart @@ -14,14 +14,38 @@ class EventsConstants { static const Color btnBlueColor = Color.fromARGB(255, 0, 102, 204); // static const String domainUrl = "http://192.0.0.2:8007/api/method/"; static const String domainUrl = "http://192.168.2.109:8007/api/method/"; + //192.0.0.2:8007 - iphone // 192.168.2.109:8007 - office static const String stagingUrl = "https://cardio-staging.konectar.io/reports/"; + static const String devUrl = "http://192.168.2.130/konectar-sandbox/reports/"; static const String eventslistapi = "load_future_events"; + static const String followUnfollowEvent = "save_user_interested_event/"; + static const String attendNotAttendEvent = "save_user_attending_event/"; + static const String specialtyOfSpeakers = "get_top_specialities_donut_chart"; + static const String insightsTopicsCloud = "get_topic_clouds_chart/"; + static const String insightsBarChart = "get_top_affiliation_bar_chart/"; static const String speakerslistapi = "view_micro_event_data"; static const String eventdetailsapi = "view_micro_event"; + static const String eventslistapifromk2 = + "http://192.168.2.130:8888/api/kolevents/v1/en/fetch"; + + static const String speakerslistapifromk2 = + "http://192.168.2.130:8888/api/kolevents/v1/en/event_speakers"; + static const String speakerslistapifromLocal = + "http://events.localhost:8007/api/method/speakerslist"; + static const String addToMyEventsApi = + "http://192.168.2.130:8888/api/kolevents/v1/en/add_to_my_event"; + + static const String removeFromMyEventsApi = + "http://192.168.2.130:8888/api/kolevents/v1/en/delete_my_event"; + + static const String fetchMyEventsApi = + "http://192.168.2.130:8888/api/kolevents/v1/en/list_my_events"; + static const String unfollowMyEventsApi = + "http://192.168.2.130:8888/api/kolevents/v1/en/delete_my_event"; static const String getTokenApi = "http://192.168.2.155:8002/api/auth/mobile/get_token"; static const String validateTokenApi = diff --git a/lib/utils/dateformater.dart b/lib/utils/dateformater.dart index 5552860..8b2251d 100644 --- a/lib/utils/dateformater.dart +++ b/lib/utils/dateformater.dart @@ -3,13 +3,29 @@ import 'package:intl/intl.dart'; class CustomDateFormatter { DateTime convertStringToDate(String datestring) { print("Date string : $datestring"); - List datearray = datestring.split('/'); + String char = "/"; + if (datestring.contains("-")) { + char = "-"; + } + List datearray = datestring.split(char); DateTime outputDate = DateTime(int.parse(datearray[2]), int.parse(datearray[0]), int.parse(datearray[1])); print("Output date : $outputDate"); return outputDate; } + String convertDateTimeToDate(String datestring) { + print("Date string : $datestring"); + List datearray1 = datestring.split(' '); + print("Date string22 : $datearray1[0]"); + List datearray = datearray1[0].split('-'); + DateTime outputDate = DateTime(int.parse(datearray[0]), + int.parse(datearray[1]), int.parse(datearray[2])); + final DateFormat formatter = DateFormat('dd-MM-yyyy'); + print("Output date : $outputDate"); + return formatter.format(outputDate); + } + String formatDate() { final DateFormat formatter = DateFormat('yyyy-MM-dd hh:mm'); final String formatted = formatter.format(DateTime.now()); diff --git a/lib/view/eventslist.dart b/lib/view/eventslist.dart index 532996b..0dbc047 100644 --- a/lib/view/eventslist.dart +++ b/lib/view/eventslist.dart @@ -2,22 +2,19 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; import 'package:flutter/widgets.dart'; -import 'package:intl/intl.dart'; +import 'package:infinite_scroll_pagination/infinite_scroll_pagination.dart'; import 'package:konectar_events/model/eventsdetailmodel.dart'; -import 'package:konectar_events/model/eventsmodel.dart'; +import 'package:konectar_events/model/eventspeakers.dart'; import 'package:konectar_events/model/neweventsmodel.dart'; import 'package:konectar_events/utils/constants.dart'; import 'package:konectar_events/utils/dateformater.dart'; import 'package:konectar_events/utils/util.dart'; -import 'package:konectar_events/view/hcplist.dart'; import 'package:konectar_events/view/home.dart'; import 'package:konectar_events/view/insights.dart'; +import 'package:konectar_events/view/login_components/intropaging.dart'; import 'package:konectar_events/view/profileview.dart'; import 'package:konectar_events/view/socialmedia.dart'; import 'package:konectar_events/viewmodel/eventsprovider.dart'; -import 'package:konectar_events/viewmodel/hcpprofprovider.dart'; -import 'package:konectar_events/widgets/customappbar.dart'; -import 'package:konectar_events/widgets/gridview.dart'; import 'package:konectar_events/widgets/snackbar.dart'; import 'package:provider/provider.dart'; import 'package:url_launcher/url_launcher.dart'; @@ -39,7 +36,10 @@ class _EventsListingScreenState extends State bool isExtended = false; bool isExtendedInterested = false; final ScrollController _scrollController = ScrollController(); - + final PagingController pagingController = + PagingController(firstPageKey: 1); + static const _pageSize = 20; + String searchSpeaker = ""; @override void initState() { super.initState(); @@ -47,6 +47,45 @@ class _EventsListingScreenState extends State WidgetsBinding.instance.addPostFrameCallback((timeStamp) { init(); }); + pagingController.addPageRequestListener((pageKey) { + _fetchPage(pageKey); + }); + } + + Future _fetchPage(int pageKey) async { + //await initConnectivity(); + // if (connectionStatus.toString().contains("ConnectivityResult.none")) { + // try { + // final newItems = + // await Provider.of(context, listen: false) + // .getOfflineMyEvents(); + // final isLastPage = newItems.length < _pageSize; + // if (isLastPage) { + // _pagingController.appendLastPage(newItems); + // } else { + // final nextPageKey = pageKey + newItems.length; + // _pagingController.appendPage(newItems, nextPageKey); + // } + // } catch (error) { + // _pagingController.error = error; + // } + // } else { + try { + final newItems = await Provider.of(context, listen: false) + .getSpeakersDetails(pageKey, widget.event.eventId!, + widget.event.eventUniqueId!, searchSpeaker); + final isLastPage = newItems.isEmpty; + if (isLastPage) { + pagingController.appendLastPage(newItems); + } else { + final nextPageKey = pageKey + 1; + + pagingController.appendPage(newItems, nextPageKey); + } + } catch (error) { + pagingController.error = error; + } + // } } init() async { @@ -54,15 +93,22 @@ class _EventsListingScreenState extends State CustomDateFormatter().convertStringToDate(widget.event.start!)); String end = CustomDateFormatter().formatYearDate( CustomDateFormatter().convertStringToDate(widget.event.end!)); + // await Provider.of(context, listen: false) + // .getSessionCount(widget.event.eventId!, widget.event.eventUniqueId!); + final provider = Provider.of(context, listen: false); + + // pagingController.addPageRequestListener((pageKey) { + // _fetchPage(pageKey); + // }); + // await Provider.of(context, listen: false) + // .getEventsDetails(widget.event.eventId!); + // await Provider.of(context, listen: false).getSessionCount(); await Provider.of(context, listen: false) - .getEventsDetails(widget.event.eventId!); - await Provider.of(context, listen: false).getSessionCount(); + .getTopicsCloud(widget.event); await Provider.of(context, listen: false) - .getTopicsCloud(widget.event.eventId!); + .getSpecialtyData(widget.event); await Provider.of(context, listen: false) - .getSpecialtyData(widget.event.eventId!); - await Provider.of(context, listen: false) - .getAffiliations(widget.event.eventId!); + .getAffiliations(widget.event); // await Provider.of(context, listen: false) // .getOverviewData(widget.event.eventId!, start, end); setState(() {}); @@ -71,6 +117,7 @@ class _EventsListingScreenState extends State @override void dispose() { _tabController.dispose(); + pagingController.dispose(); super.dispose(); } @@ -78,7 +125,7 @@ class _EventsListingScreenState extends State return Consumer( builder: (BuildContext context, provider, Widget? child) { return DefaultTabController( - length: 4, + length: 3, //child: SafeArea( // appBar: CustomAppBar(title: "", backgroundcolor: Constants.bgcolor), //body: @@ -214,7 +261,18 @@ class _EventsListingScreenState extends State ), ), ), - // const Spacer(), + const Spacer(), + IconButton( + icon: Icon( + provider.ifOfflineExists(widget.event.eventId!) + ? Icons.bookmark + : Icons.bookmark_add_outlined, + color: Colors.white, + size: isTablet ? 14 : 18), + onPressed: () async { + setState(() {}); + }, + ) // widget.event.isfav // ? RichText( // text: TextSpan( @@ -271,6 +329,17 @@ class _EventsListingScreenState extends State tooltip: 'Actions', // heroTag: "floatbtn232342", onPressed: () { + if (provider.offlineEvents.isNotEmpty) { + provider.offlineEvents.forEach( + (element) { + if (element.eventId == widget.event.eventId) { + provider.offlineExists = true; + } else { + provider.offlineExists = false; + } + }, + ); + } showModalBottomSheet( context: context, builder: (BuildContext context) { @@ -292,6 +361,25 @@ class _EventsListingScreenState extends State // 'Actions', // style: TextStyle(fontSize: 18), // )), + // ),IntroductionAnimationScreen + // InkWell( + // onTap: () { + // Navigator.push( + // context, + // MaterialPageRoute( + // builder: (BuildContext context) => + // IntroductionAnimationScreen(), + // ), + // ); + // // Navigator.pop(context); + // }, + // child: ListTile( + // title: Text("GOTO"), + // leading: Icon( + // Icons.calendar_month, + // color: Colors.green, + // ), + // ), // ), InkWell( onTap: () { @@ -309,11 +397,30 @@ class _EventsListingScreenState extends State ), ), InkWell( - onTap: () { + onTap: () async { + if (provider.offlineEvents.isEmpty) { + await provider.saveEventsData(widget.event); + SnackBarWidget.displaySnackBar( + "Event Saved Offline", context); + } else { + if (!provider.offlineExists) { + await provider.saveEventsData(widget.event); + SnackBarWidget.displaySnackBar( + "Event Saved Offline", context); + } else { + await provider.delateOfflineEvent(widget.event); + provider.offlineExists = false; + SnackBarWidget.displaySnackBar( + "Removed from Offline", context); + } + } + Navigator.pop(context); }, child: ListTile( - title: Text("Download Pdf"), + title: Text(provider.offlineExists + ? "Remove the event from offline" + : "Save the event offline"), leading: Icon( Icons.download, color: Colors.blue, @@ -322,8 +429,8 @@ class _EventsListingScreenState extends State ), InkWell( onTap: () { - if (widget.event.isAttending) { - widget.event.isAttending = false; + if (widget.event.eventUserAttendee!) { + widget.event.eventUserAttendee = false; // if (event.isAttending) { // SnackBarWidget.displaySnackBar( @@ -428,10 +535,7 @@ class _EventsListingScreenState extends State ProfileInfoItem( "Session(s)", provider.eventSessionCount), ProfileInfoItem( - "Speakers(s)", - // int.parse( - // provider.overviewData!.attendeeCount - 0), + "Speaker(s)", provider.speakercount), //ProfileInfoItem("Note(s)", 1), ], widget.event, provider), SizedBox( @@ -465,14 +569,14 @@ class _EventsListingScreenState extends State //controller: _tabController, children: [ expandableDetails(), - speakersList(provider), + speakersList(context, provider), EventsInsights( eventid: widget.event.eventId!, kFlutterHashtags: provider.kFlutterHashtags, specialtyList: provider.specialtyList, affiliations: provider.affiliations, ), - SocialMedia(), + //SocialMedia(), ], ), ), @@ -861,7 +965,8 @@ class _EventsListingScreenState extends State ), InkWell( onTap: () async { - await _launchUrl(provider.eventdetailList[0].url1!); + print("URL:${event.url1!}"); + await _launchUrl(event.url1!); }, child: RichText( text: TextSpan( @@ -967,7 +1072,7 @@ class _EventsListingScreenState extends State } Widget favbtn(EventsList event, EventsProvider provider) { - return event.isfav + return event.eventUserInterest! ? SizedBox( height: 40, child: TextButton( @@ -977,18 +1082,19 @@ class _EventsListingScreenState extends State onPressed: () async { // String msg = await provider // .addEventsToFavs(event.eventId!); - setState(() { - event.isfav = !event.isfav; - if (event.isfav) { - provider.favsEventsData(event); - SnackBarWidget.displaySnackBar( - "You are following the event!", context); - } else { - provider.delateEventsData(event); - SnackBarWidget.displaySnackBar("Not Following", context); - } - }); + event.eventUserInterest = !event.eventUserInterest!; + + if (event.eventUserInterest!) { + await provider.addEventsToFavs(event.eventId!); + SnackBarWidget.displaySnackBar( + "You are following the event!", context); + } else { + // provider.delateOfflineEvent(event); + await provider.removeEventsToFavs(event.eventId!); + SnackBarWidget.displaySnackBar("Not Following", context); + } + setState(() {}); }, child: AnimatedSwitcher( duration: Duration(seconds: 1), @@ -1025,18 +1131,19 @@ class _EventsListingScreenState extends State // String msg = await provider // .addEventsToFavs(event.eventId!); - setState(() { - event.isfav = !event.isfav; + event.eventUserInterest = !event.eventUserInterest!; - if (event.isfav) { - provider.favsEventsData(event); - SnackBarWidget.displaySnackBar( - "You are following the event!", context); - } else { - provider.delateEventsData(event); - SnackBarWidget.displaySnackBar("Not Following", context); - } - }); + if (event.eventUserInterest!) { + await provider.addEventsToFavs(event.eventId!); + SnackBarWidget.displaySnackBar( + "You are following the event!", context); + } else { + // provider.delateOfflineEvent(event); + await provider.removeEventsToFavs(event.eventId!); + SnackBarWidget.displaySnackBar("Not Following", context); + } + + setState(() {}); }, label: AnimatedSwitcher( duration: Duration(seconds: 1), @@ -1058,14 +1165,16 @@ class _EventsListingScreenState extends State // ), Icon( Icons.favorite, - color: event.isfav ? Colors.red : Colors.grey, + color: event.eventUserInterest! + ? Colors.white + : Colors.grey, size: 14, ), const SizedBox( width: 10, ), Text( - event.isfav ? "Following" : "Follow", + event.eventUserInterest! ? "Following" : "Follow", style: TextStyle(color: Colors.black), ) ], @@ -1074,7 +1183,7 @@ class _EventsListingScreenState extends State } Widget attendingbtn(EventsList event, EventsProvider provider) { - return event.isAttending + return event.eventUserAttendee! ? SizedBox( height: 40, child: TextButton( @@ -1082,22 +1191,18 @@ class _EventsListingScreenState extends State // : Colors.transparent, onPressed: () async { - if (!event.isfav) { - event.isfav = !event.isfav; - // String msg1 = await provider - // .addEventsToFavs(event.eventId!); - } - + event.eventUserAttendee = !event.eventUserAttendee!; // String msg = await provider // .markAttending(event.eventId!); + if (event.eventUserAttendee!) { + await provider.attendNotAttendEvent(event.eventId!, "1"); + SnackBarWidget.displaySnackBar("Attending", context); + } else { + await provider.attendNotAttendEvent(event.eventId!, "0"); + SnackBarWidget.displaySnackBar("Not Attending", context); + } setState(() { - event.isAttending = !event.isAttending; - - if (event.isAttending) { - SnackBarWidget.displaySnackBar("Attending", context); - } else { - SnackBarWidget.displaySnackBar("Not Attending", context); - } + // }); }, child: AnimatedSwitcher( @@ -1131,23 +1236,26 @@ class _EventsListingScreenState extends State elevation: 1, backgroundColor: EventsConstants.bgcolor, onPressed: () async { - if (!event.isfav) { - event.isfav = !event.isfav; + if (!event.eventUserInterest!) { + await provider.addEventsToFavs(event.eventId!); + event.eventUserInterest = !event.eventUserInterest!; // String msg1 = await provider // .addEventsToFavs(event.eventId!); } // String msg = await provider // .markAttending(event.eventId!); - setState(() { - event.isAttending = !event.isAttending; - - if (event.isAttending) { - SnackBarWidget.displaySnackBar("Attending", context); - } else { - SnackBarWidget.displaySnackBar("Not Attending", context); - } - }); + event.eventUserAttendee = !event.eventUserAttendee!; + // String msg = await provider + // .markAttending(event.eventId!); + if (event.eventUserAttendee!) { + await provider.attendNotAttendEvent(event.eventId!, "1"); + SnackBarWidget.displaySnackBar("Attending", context); + } else { + await provider.attendNotAttendEvent(event.eventId!, "0"); + SnackBarWidget.displaySnackBar("Not Attending", context); + } + setState(() {}); }, //heroTag: "attending545", label: AnimatedSwitcher( @@ -1162,7 +1270,7 @@ class _EventsListingScreenState extends State axis: Axis.horizontal, ), ), - child: event.isAttending + child: event.eventUserAttendee! ? Row( children: [ Padding( @@ -1228,12 +1336,12 @@ class _EventsListingScreenState extends State SizedBox( height: 3, ), - listViewTopicCard( - "Speakers with most sessions", widget.event.topSpeakers!, true), + listViewTopicCard("Speakers with most sessions", + widget.event.topSpeakers ?? "", true), SizedBox( height: 3, ), - listViewTopicCard("Sponsors", widget.event.sponsors!, true) + listViewTopicCard("Sponsors", widget.event.sponsors ?? "", true) ]), ), ); @@ -1314,8 +1422,14 @@ class _EventsListingScreenState extends State ); } - Widget speakersList(EventsProvider provider) { + void _updateSearchTerm(String searchTerm) { + setState(() => searchSpeaker = searchTerm); + pagingController.refresh(); + } + + Widget speakersList(BuildContext context, EventsProvider provider) { var searchtextEditingController; + // pagingController.refresh(); return Container( width: double.maxFinite, padding: EdgeInsets.only(left: 8), @@ -1332,15 +1446,15 @@ class _EventsListingScreenState extends State // decoration: BoxDecoration( // // color: Colors.white, // borderRadius: BorderRadius.circular(5.0)), + child: TextField( controller: searchtextEditingController, onChanged: (String txt) async { - if (txt.length >= 2) { - provider.OnSearchSpeakers(txt); + if (txt.length >= 1) { + _updateSearchTerm(txt); } - if (txt.length < 2) { - await provider - .onSearchSpeakersReset(widget.event.eventId!); + if (txt.length == 0) { + _updateSearchTerm(""); } }, decoration: InputDecoration( @@ -1374,155 +1488,166 @@ class _EventsListingScreenState extends State ), ), Expanded( - child: ListView.separated( - padding: const EdgeInsets.all(8), - itemCount: provider.isSearchSpeakers - ? provider.srcheventdetailList.length - : provider.eventdetailList.length, - itemBuilder: (BuildContext context, int index) { - Eventsdetail detail = provider.isSearchSpeakers - ? provider.srcheventdetailList[index] - : provider.eventdetailList[index]; - return GestureDetector( - onTap: () { - Navigator.of(context).push( - MaterialPageRoute( - builder: (context) => HCPProfileScreen( - eventsdetail: detail, - eventid: widget.event.eventId!, - title: widget.event.name1!, + child: PagedListView.separated( + pagingController: pagingController, + builderDelegate: PagedChildBuilderDelegate( + //padding: const EdgeInsets.all(8), + // itemCount: provider.isSearchSpeakers + // ? provider.srcheventdetailList.length + // : provider.eventdetailList.length, + itemBuilder: (BuildContext context, detail, int index) { + // Eventsdetail detail = provider.isSearchSpeakers + // ? provider.srcheventdetailList[index] + // : provider.eventdetailList[index]; + + return GestureDetector( + onTap: () { + Navigator.of(context).push( + MaterialPageRoute( + builder: (context) => HCPProfileScreen( + eventsdetail: detail, + eventid: widget.event.eventId!, + title: widget.event.name1!, + ), ), - ), - ); - }, - child: Container( - // height: double.infinity, - child: Column( - children: [ - Row( - children: [ - Center( - child: CircleAvatar( - radius: 24, - backgroundColor: Colors.grey, - // child: Icon( - // Icons.person, - // size: 18, - // color: Colors.white, - // ), - child: Text( - detail.kolFullName![0], - style: TextStyle( - fontWeight: FontWeight.bold, - color: Colors.white), + ); + }, + child: Container( + // height: double.infinity, + child: Column( + children: [ + Row( + children: [ + Center( + child: CircleAvatar( + radius: 24, + backgroundColor: Colors.grey, + // child: Icon( + // Icons.person, + // size: 18, + // color: Colors.white, + // ), + child: Text( + detail.hcpFullName![0], + style: TextStyle( + fontWeight: FontWeight.bold, + color: Colors.white), + ), ), ), - ), - // Container( - // width: 45, - // height: 45, - // decoration: const BoxDecoration( - // color: Colors.black, - // shape: BoxShape.circle, - // image: DecorationImage( - // fit: BoxFit.cover, - // image: NetworkImage( - // 'https://cardio-staging.konectar.io/images/kol_images/resized/1093755944.jpeg')), - // // 'https://images.unsplash.com/photo-1438761681033-6461ffad8d80?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1470&q=80')), - // ), - // ), - SizedBox( - width: 20, - ), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - detail.kolFullName!, - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 14, - ), - maxLines: 2, - softWrap: true, - overflow: TextOverflow.ellipsis, - ), - SizedBox( - width: isTablet - ? MediaQuery.of(context).size.width * 0.25 - : MediaQuery.of(context).size.width * 0.5, - child: Text( - detail.eventTopics ?? - 'Programmed Cell Death 1 Receptor | Human Epidermal Growth Factor Receptor 2 +6more', - maxLines: 3, - style: TextStyle( - // decoration: TextDecoration.underline, - // decorationColor: Colors.blue, + // Container( + // width: 45, + // height: 45, + // decoration: const BoxDecoration( + // color: Colors.black, + // shape: BoxShape.circle, + // image: DecorationImage( + // fit: BoxFit.cover, + // image: NetworkImage( + // 'https://cardio-staging.konectar.io/images/kol_images/resized/1093755944.jpeg')), + // // 'https://images.unsplash.com/photo-1438761681033-6461ffad8d80?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1470&q=80')), + // ), + // ), + SizedBox( + width: 20, + ), + Padding( + padding: const EdgeInsets.all(8.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + "$index : ${detail.hcpFullName!}", + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 14, + ), + maxLines: 2, + softWrap: true, + overflow: TextOverflow.ellipsis, + ), + SizedBox( + width: isTablet + ? MediaQuery.of(context).size.width * + 0.25 + : MediaQuery.of(context).size.width * + 0.5, + child: Text( + detail.topics!.join(" | "), + maxLines: 3, + style: TextStyle( + // decoration: TextDecoration.underline, + // decorationColor: Colors.blue, - color: Colors.black, + color: Colors.black, - //fontStyle: FontStyle.italic, - fontSize: 14), - ), + //fontStyle: FontStyle.italic, + fontSize: 14), + ), + ), + ], ), - ], - ), - // const Spacer(), - // SizedBox( - // height: 30, - // child: OutlinedButton( - // onPressed: () {}, - // child: Icon( - // Icons.add, - // size: 24, - // color: Colors.white, - // ), - // style: OutlinedButton.styleFrom( - // shape: CircleBorder(), - // backgroundColor: Constants.bgcolor, - // ), - // ), - // ), - ], - ), - // SEE ALL BUTTON CODE.. - // index == provider.eventdetailList.length - 1 - // ? Padding( - // padding: const EdgeInsets.all(8.0), - // child: Container( - // height: 30, - // child: OutlinedButton( - // onPressed: () { - // setState(() { - // itemcount = 15; - // }); - // // Navigator.of(context).push( - // // MaterialPageRoute( - // // builder: (context) => HcpListScreen(), - // // ), - // // ); - // }, - // child: Text( - // 'See All', - // style: TextStyle( - // // fontFamily: "SourceSerif", - // fontSize: 14, - // color: Colors.black, - // fontWeight: FontWeight.normal), - // ), - // style: OutlinedButton.styleFrom( - // shape: StadiumBorder(), - // ), - // ), - // ), - // ) - // : SizedBox.shrink() - ], - )), - ); - }, + ), + // const Spacer(), + // SizedBox( + // height: 30, + // child: OutlinedButton( + // onPressed: () {}, + // child: Icon( + // Icons.add, + // size: 24, + // color: Colors.white, + // ), + // style: OutlinedButton.styleFrom( + // shape: CircleBorder(), + // backgroundColor: Constants.bgcolor, + // ), + // ), + // ), + ], + ), + // SEE ALL BUTTON CODE.. + // index == provider.eventdetailList.length - 1 + // ? Padding( + // padding: const EdgeInsets.all(8.0), + // child: Container( + // height: 30, + // child: OutlinedButton( + // onPressed: () { + // setState(() { + // itemcount = 15; + // }); + // // Navigator.of(context).push( + // // MaterialPageRoute( + // // builder: (context) => HcpListScreen(), + // // ), + // // ); + // }, + // child: Text( + // 'See All', + // style: TextStyle( + // // fontFamily: "SourceSerif", + // fontSize: 14, + // color: Colors.black, + // fontWeight: FontWeight.normal), + // ), + // style: OutlinedButton.styleFrom( + // shape: StadiumBorder(), + // ), + // ), + // ), + // ) + // : SizedBox.shrink() + ], + )), + ); + }, + ), separatorBuilder: (BuildContext context, int index) { - return Divider(); + return Padding( + padding: const EdgeInsets.symmetric(horizontal: 14.0), + child: Divider(), + ); }, ), ), @@ -1562,7 +1687,7 @@ class _EventsListingScreenState extends State Padding( padding: const EdgeInsets.all(8.0), child: Text( - item.value.toString(), + item.value.toString() == 0 ? "..." : item.value.toString(), style: const TextStyle( fontWeight: FontWeight.bold, fontSize: 14, @@ -1642,7 +1767,7 @@ const _tabs = [ Tab(text: "Details"), Tab(text: "Speakers"), Tab(text: "Insights"), - Tab(text: "Social Media"), + //Tab(text: "Social Media"), ]; class _SliverAppBarDelegate extends SliverPersistentHeaderDelegate { @@ -1666,3 +1791,27 @@ class _SliverAppBarDelegate extends SliverPersistentHeaderDelegate { return true; } } + +class ContestTabHeader extends SliverPersistentHeaderDelegate { + ContestTabHeader( + this.searchUI, + ); + final TabBar searchUI; + + @override + Widget build( + BuildContext context, double shrinkOffset, bool overlapsContent) { + return Container(color: Colors.white, child: searchUI); + } + + @override + double get maxExtent => 52.0; + + @override + double get minExtent => 52.0; + + @override + bool shouldRebuild(SliverPersistentHeaderDelegate oldDelegate) { + return true; + } +} diff --git a/lib/view/eventslistoffline.dart b/lib/view/eventslistoffline.dart new file mode 100644 index 0000000..1dc486b --- /dev/null +++ b/lib/view/eventslistoffline.dart @@ -0,0 +1,1664 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/rendering.dart'; +import 'package:flutter/widgets.dart'; +import 'package:konectar_events/model/eventsdetailmodel.dart'; +import 'package:konectar_events/model/eventsmodel.dart'; +import 'package:konectar_events/model/neweventsmodel.dart'; + +import 'package:konectar_events/utils/constants.dart'; +import 'package:konectar_events/utils/dateformater.dart'; +import 'package:konectar_events/utils/util.dart'; +import 'package:konectar_events/view/hcplist.dart'; +import 'package:konectar_events/view/home.dart'; +import 'package:konectar_events/view/insights.dart'; +import 'package:konectar_events/view/profileview.dart'; +import 'package:konectar_events/view/socialmedia.dart'; +import 'package:konectar_events/viewmodel/eventsprovider.dart'; +import 'package:konectar_events/viewmodel/hcpprofprovider.dart'; +import 'package:konectar_events/viewmodel/offlineeventsprovider.dart'; +import 'package:konectar_events/widgets/customappbar.dart'; +import 'package:konectar_events/widgets/gridview.dart'; +import 'package:konectar_events/widgets/snackbar.dart'; +import 'package:provider/provider.dart'; +import 'package:url_launcher/url_launcher.dart'; +import 'package:font_awesome_flutter/font_awesome_flutter.dart'; +import 'package:add_2_calendar/add_2_calendar.dart'; + +class EventsListingOfflineScreen extends StatefulWidget { + EventsList event; + EventsListingOfflineScreen({super.key, required this.event}); + + @override + State createState() => + _EventsListingOfflineScreenState(); +} + +class _EventsListingOfflineScreenState extends State + with TickerProviderStateMixin { + late final TabController _tabController; + int itemcount = 3; + bool isExtended = false; + bool isExtendedInterested = false; + final ScrollController _scrollController = ScrollController(); + + @override + void initState() { + super.initState(); + _tabController = TabController(length: 2, vsync: this); + WidgetsBinding.instance.addPostFrameCallback((timeStamp) { + init(); + }); + } + + init() async { + await Provider.of(context, listen: false) + .getEventsDetails(widget.event.eventId!); + await Provider.of(context, listen: false) + .getSessionCount(); + await Provider.of(context, listen: false) + .getTopicsCloud(widget.event.eventId!); + setState(() {}); + } + + @override + void dispose() { + _tabController.dispose(); + super.dispose(); + } + + Widget build(BuildContext context) { + return Consumer( + builder: (BuildContext context, provider, Widget? child) { + return DefaultTabController( + length: 4, + //child: SafeArea( + // appBar: CustomAppBar(title: "", backgroundcolor: EventsConstants.bgcolor), + //body: + // NestedScrollView( + // headerSliverBuilder: + // (BuildContext context, bool innerBoxIsScrolled) { + // return [ + // SliverAppBar.medium( + // expandedHeight: MediaQuery.of(context).size.height / 3, + // //expandedHeight: double.minPositive, + + // automaticallyImplyLeading: false, + // floating: false, + // pinned: true, + // stretch: false, + // backgroundColor: EventsConstants.bgcolor, + // flexibleSpace: FlexibleSpaceBar( + // centerTitle: false, + // expandedTitleScale: 2.4, + // collapseMode: CollapseMode.parallax, + // title: const Text("", + // style: TextStyle( + // color: Colors.white, + // fontSize: 2.0, + // )), + // background: buildCardView(context, widget.event, provider) + + // // Image.network( + // // "https://images.pexels.com/photos/417173/pexels-photo-417173.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260", + // // fit: BoxFit.cover, + // // ) + // ), + // ), + // SliverPersistentHeader( + // floating: true, + // delegate: _SliverAppBarDelegate( + // const TabBar( + // indicatorSize: TabBarIndicatorSize.label, + // labelColor: Colors.black, + // unselectedLabelColor: Colors.grey, + // tabs: _tabs, + // ), + // ), + // pinned: true, + // ), + // ]; + // }, + // body: TabBarView( + // //controller: _tabController, + // children: [ + // expandableDetails(), + // speakersList(provider), + // ], + // ), + // ), + child: headerview(context, provider), + // ), + ); + }); + } + + Event buildEvent({Recurrence? recurrence}) { + return Event( + title: widget.event.name1!, + description: widget.event.name1!, + location: widget.event.region, + startDate: CustomDateFormatter().convertStringToDate(widget.event.start!), + endDate: CustomDateFormatter().convertStringToDate(widget.event.end!), + allDay: false, + iosParams: IOSParams( + reminder: Duration(minutes: 40), + url: widget.event.url1, + ), + androidParams: const AndroidParams( + emailInvites: ["test@aissel.com"], + ), + recurrence: recurrence, + ); + } + + Widget headerview(BuildContext context, EventsOfflineProvider provider) { + //return SafeArea( + return Container( + child: Scaffold( + backgroundColor: EventsConstants.bgcolor, + appBar: AppBar( + // title: Text(""), + automaticallyImplyLeading: false, + backgroundColor: EventsConstants.blueColor, + centerTitle: false, + flexibleSpace: Row( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + IconButton( + iconSize: 18, + icon: Icon( + Icons.arrow_back_ios, + size: 18, + color: Colors.white, + ), + onPressed: () { + Navigator.pop(context); + }, + ), + Container( + margin: EdgeInsets.all(5.0), + padding: EdgeInsets.all(3.0), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.all( + Radius.circular(4), + )), + child: Text( + (CustomDateFormatter().convertStringToDate(widget.event.end!)) + .isBefore(DateTime.now()) + ? "Event ended" + : ((CustomDateFormatter() + .convertStringToDate(widget.event.start!)) + .isBefore(DateTime.now()) && + (CustomDateFormatter() + .convertStringToDate(widget.event.end!)) + .isAfter(DateTime.now())) + ? "Ongoing" + : "Starting soon", + style: TextStyle( + // decoration: TextDecoration.underline, + // decorationColor: Colors.blue, + color: EventsConstants.blueColor, + + //fontWeight: FontWeight.bold, + fontSize: isTablet ? 22 : 14, + ), + ), + ), + // const Spacer(), + // widget.event.isfav + // ? RichText( + // text: TextSpan( + // children: [ + // WidgetSpan( + // child: Icon(Icons.check, + // color: Colors.grey[600], + // size: isTablet ? 14 : 12), + // ), + // TextSpan( + // text: ' following', + // style: TextStyle( + // color: Colors.grey[600], + // fontSize: isTablet ? 14 : 12), + // ), + // ], + // ), + // ) + // : Center( + // child: RichText( + // text: TextSpan( + // children: [ + // TextSpan( + // text: 'follow ', + // style: TextStyle( + // color: Colors.grey[600], + // fontSize: isTablet ? 14 : 12), + // ), + // ], + // ), + // ), + // ), + // Expanded( + // child: Text( + // widget.event.name1 ?? "", + // maxLines: 3, + // style: TextStyle( + // // decoration: TextDecoration.underline, + // // decorationColor: Colors.blue, + // color: Colors.white, + + // //fontWeight: FontWeight.bold, + // fontSize: isTablet ? 22 : 16, + // ), + // ), + // ), + ], + ), + ), + floatingActionButtonLocation: FloatingActionButtonLocation.miniEndFloat, + floatingActionButton: FloatingActionButton( + // backgroundColor: const Color.fromARGB(255, 222, 237, 247), + backgroundColor: EventsConstants.blueColor, + tooltip: 'Actions', + // heroTag: "floatbtn232342", + onPressed: () { + showModalBottomSheet( + context: context, + builder: (BuildContext context) { + return Container( + color: EventsConstants.bgcolor, + width: MediaQuery.of(context).size.width, + height: 240, + child: Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + mainAxisSize: MainAxisSize.max, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // Padding( + // padding: const EdgeInsets.all(8.0), + // child: Align( + // alignment: Alignment.topLeft, + // child: const Text( + // 'Actions', + // style: TextStyle(fontSize: 18), + // )), + // ), + InkWell( + onTap: () { + Add2Calendar.addEvent2Cal( + buildEvent(), + ); + Navigator.pop(context); + }, + child: ListTile( + title: Text("Add to my calendar"), + leading: Icon( + Icons.calendar_month, + color: Colors.green, + ), + ), + ), + InkWell( + onTap: () { + SnackBarWidget.displaySnackBar( + "Event saved offline", context); + Navigator.pop(context); + }, + child: ListTile( + title: Text("Save this event offline"), + leading: Icon( + Icons.download, + color: Colors.blue, + ), + ), + ), + InkWell( + onTap: () { + if (widget.event.isAttending) { + widget.event.isAttending = false; + + // if (event.isAttending) { + // SnackBarWidget.displaySnackBar( + // "Attending", context); + // } else { + SnackBarWidget.displaySnackBar( + "Marked as not attending", context); + // } + setState(() {}); + Navigator.pop(context); + } else { + Navigator.pop(context); + } + }, + child: ListTile( + title: Text("Mark as not attending"), + leading: Icon( + Icons.remove_circle, + color: Colors.red, + ), + ), + ), + // Container( + // padding: EdgeInsets.symmetric(horizontal: 8.0), + // width: MediaQuery.of(context).size.width, + // child: ElevatedButton( + // child: const Text( + // 'Add to My Calendar', + // style: TextStyle(color: Colors.black), + // ), + // onPressed: () { + // Add2Calendar.addEvent2Cal( + // buildEvent(), + // ); + // Navigator.pop(context); + // }), + // ), + // Container( + // padding: EdgeInsets.symmetric(horizontal: 8.0), + // width: MediaQuery.of(context).size.width, + // child: ElevatedButton( + // child: const Text('Download excel sheet', + // style: TextStyle(color: Colors.black)), + // onPressed: () => Navigator.pop(context), + // ), + // ), + // Container( + // padding: EdgeInsets.symmetric(horizontal: 8.0), + // width: MediaQuery.of(context).size.width, + // child: ElevatedButton( + // child: const Text('Remove from my events', + // style: TextStyle(color: Colors.black)), + // onPressed: () => Navigator.pop(context), + // ), + // ), + // ElevatedButton( + // child: const Text('Close'), + // onPressed: () => Navigator.pop(context), + // ), + ], + ), + ), + ); + }, + ); + }, + child: const Icon( + Icons.more_horiz, + size: 28, + color: Colors.white, + ), + ), + body: Stack( + children: [ + InkWell( + splashColor: Colors.transparent, + focusColor: Colors.transparent, + highlightColor: Colors.transparent, + hoverColor: Colors.transparent, + onTap: () { + FocusScope.of(context).requestFocus(FocusNode()); + }, + child: NestedScrollView( + controller: _scrollController, + headerSliverBuilder: + (BuildContext context, bool innerBoxIsScrolled) { + return [ + SliverList( + delegate: SliverChildBuilderDelegate( + (BuildContext context, int index) { + return Column( + children: [ + Container( + color: EventsConstants.blueColor, + child: Column( + children: [ + buildCardView( + context, widget.event, provider), + + // getTimeDateUI(), + ], + ), + ), + SizedBox( + height: 10, + ), + _ProfileInfoRow([ + ProfileInfoItem( + "Session(s)", provider.eventSessionCount), + ProfileInfoItem("Speakers(s)", + int.parse(widget.event.speakerscount!)), + //ProfileInfoItem("Note(s)", 1), + ], widget.event, provider), + SizedBox( + height: 5, + ), + ], + ); + }, childCount: 1), + ), + SliverPersistentHeader( + pinned: true, + floating: true, + delegate: ContestTabHeader( + const TabBar( + indicatorSize: TabBarIndicatorSize.tab, + labelColor: Colors.black, + tabAlignment: TabAlignment.fill, + indicatorColor: EventsConstants.blueColor, + unselectedLabelColor: Colors.grey, + labelStyle: TextStyle( + fontWeight: FontWeight.bold, + ), + labelPadding: EdgeInsets.all(2), + tabs: _tabs, + ), + ), + ), + ]; + }, + body: TabBarView( + //controller: _tabController, + children: [ + expandableDetails(), + speakersList(provider), + // EventsInsights( + // eventid: widget.event.eventId!, + // kFlutterHashtags: provider.kFlutterHashtags, affiliations: null, + // ), + SocialMedia(), + ], + ), + ), + ), + ], + ), + ), + // ), + ); + } + + Widget getSearchBarUI() { + return Padding( + padding: const EdgeInsets.only(left: 16, right: 16, top: 8, bottom: 8), + child: Row( + children: [ + Expanded( + child: Padding( + padding: const EdgeInsets.only(right: 16, top: 8, bottom: 8), + child: Container( + decoration: BoxDecoration( + color: EventsConstants.bgcolor, + borderRadius: const BorderRadius.all( + Radius.circular(38.0), + ), + boxShadow: [ + BoxShadow( + color: Colors.grey.withOpacity(0.2), + offset: const Offset(0, 2), + blurRadius: 8.0), + ], + ), + child: Padding( + padding: const EdgeInsets.only( + left: 16, right: 16, top: 4, bottom: 4), + child: TextField( + onChanged: (String txt) {}, + style: const TextStyle( + fontSize: 18, + ), + cursorColor: Colors.blue, + decoration: InputDecoration( + border: InputBorder.none, + hintText: 'Search for events...', + ), + ), + ), + ), + ), + ), + Container( + decoration: BoxDecoration( + color: Colors.blue, + borderRadius: const BorderRadius.all( + Radius.circular(38.0), + ), + boxShadow: [ + BoxShadow( + color: Colors.grey.withOpacity(0.4), + offset: const Offset(0, 2), + blurRadius: 8.0), + ], + ), + child: Material( + color: Colors.transparent, + child: InkWell( + borderRadius: const BorderRadius.all( + Radius.circular(32.0), + ), + onTap: () { + FocusScope.of(context).requestFocus(FocusNode()); + }, + child: Padding( + padding: const EdgeInsets.all(16.0), + child: Icon(FontAwesomeIcons.magnifyingGlass, + size: 20, color: Colors.black), + ), + ), + ), + ), + ], + ), + ); + } + + Widget getAppBarUI(EventsList eventsList) { + return Container( + decoration: BoxDecoration( + color: EventsConstants.blueColor, + boxShadow: [ + BoxShadow( + color: Colors.grey.withOpacity(0.2), + offset: const Offset(0, 2), + blurRadius: 8.0), + ], + ), + child: Padding( + padding: EdgeInsets.only(top: 2, left: 8, right: 8), + child: Row( + children: [ + Container( + alignment: Alignment.topLeft, + // width: AppBar().preferredSize.height, + // height: AppBar().preferredSize.height, + child: Material( + color: Colors.transparent, + child: InkWell( + borderRadius: const BorderRadius.all( + Radius.circular(32.0), + ), + onTap: () { + Navigator.pop(context); + }, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Icon( + Icons.arrow_back_ios_new, + size: 18, + color: Colors.white, + ), + ), + ), + ), + // SizedBox( + // height: 30, + // // width: 100, + // child: FloatingActionButton.extended( + // elevation: 1, + // backgroundColor: Colors.transparent, + // onPressed: () { + // Navigator.pop(context); + // }, + // label: AnimatedSwitcher( + // duration: Duration(seconds: 1), + // transitionBuilder: + // (Widget child, Animation animation) => + // FadeTransition( + // opacity: animation, + // child: SizeTransition( + // child: child, + // sizeFactor: animation, + // axis: Axis.horizontal, + // ), + // ), + // child: Row( + // children: [ + // // Padding( + // // padding: const EdgeInsets.only(right: 4.0), + // // child: Icon(Icons.arrow_back_ios_new), + // // ), + // Text( + // "Back to events", + // style: TextStyle(color: Colors.white), + // ) + // ], + // )), + // )), + ), + Expanded( + child: Text( + "", + maxLines: 1, + softWrap: true, + style: TextStyle( + fontWeight: FontWeight.w600, + fontSize: isTablet ? 18 : 14, + overflow: TextOverflow.ellipsis, + ), + ), + ), + // Container( + // width: AppBar().preferredSize.height, + // height: AppBar().preferredSize.height, + // child: Row( + // crossAxisAlignment: CrossAxisAlignment.center, + // mainAxisAlignment: MainAxisAlignment.end, + // children: [ + // Material( + // color: Colors.transparent, + // child: InkWell( + // borderRadius: const BorderRadius.all( + // Radius.circular(32.0), + // ), + // onTap: () {}, + // child: Padding( + // padding: const EdgeInsets.all(8.0), + // child: Icon( + // Icons.favorite_outlined, + // color: eventsList.isfav ? Colors.red : Colors.black, + // ), + // ), + // ), + // ), + // ], + // ), + // ) + ], + ), + ), + ); + } + + Future _launchUrl(String urlstr) async { + final Uri url = Uri.parse(urlstr); + if (!await launchUrl(url)) { + throw Exception('Could not launch $url'); + } + } + + // @override + // Widget build(BuildContext context) { + // var selecttextEditingController; + // return Scaffold( + // // backgroundColor: Color.fromARGB(179, 248, 238, 238), + // // appBar: CustomAppBar(), + // //backgroundColor: const Color.fromARGB(255, 222, 237, 247), + // body: Column( + // children: [ + // buildCardView(context), + // SizedBox( + // height: 5, + // ), + // Container( + // color: Colors.white, + // height: 50, + // child: TabBar( + // controller: _tabController, + // tabAlignment: TabAlignment.start, + // isScrollable: true, + // indicatorColor: Colors.black, + // indicatorWeight: 0.2, + // tabs: [ + // Padding( + // padding: const EdgeInsets.all(8.0), + // child: Text( + // 'Details', + // style: TextStyle( + // color: Colors.black, + // //fontWeight: FontWeight.bold, + // fontFamily: "SourceSerif", + // letterSpacing: 0.3, + // fontSize: isTablet ? 20 : 16), + // ), + // ), + // Padding( + // padding: const EdgeInsets.all(8.0), + // child: Text( + // 'Speakers', + // style: TextStyle( + // color: Colors.black, + // //fontWeight: FontWeight.bold, + // fontFamily: "SourceSerif", + // fontSize: isTablet ? 20 : 16), + // ), + // ), + // ], + // ), + // ), + // Expanded( + // child: TabBarView( + // controller: _tabController, + // children: [ + // expandableDetails(), + // speakersList(), + // ], + // ), + // ) + // ], + // )); + // } + + buildCardView( + BuildContext context, EventsList event, EventsOfflineProvider provider) { + double height = isTablet + ? MediaQuery.of(context).size.height * 0.35 + : MediaQuery.of(context).size.height / 1.2; + + // return Container( + // decoration: BoxDecoration( + // color: Constants.bgcolor, + // ),x + // //height: 360, + // height: double.infinity, + // padding: isTablet + // ? EdgeInsets.symmetric(horizontal: 8.0, vertical: 2.0) + // : EdgeInsets.symmetric( + // horizontal: 6.0, + // ), + // child: + + return Padding( + padding: const EdgeInsets.only(left: 8.0, right: 8.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + //mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + // Container( + // color: Constants.bgcolor, + // padding: const EdgeInsets.only(left: 8.0), + // height: double.minPositive, + // child: + + // RichText( + // text: TextSpan( + // children: [ + // WidgetSpan( + // child: + Text( + event.name1 ?? "", + maxLines: 3, + style: TextStyle( + // decoration: TextDecoration.underline, + // decorationColor: Colors.blue, + color: Colors.white, + + //fontWeight: FontWeight.bold, + fontSize: isTablet ? 22 : 18, + ), + ), + // ), + + // TextSpan( + // text: event.name1 ?? "", + // style: TextStyle( + // color: Colors.white, + // // fontStyle: FontStyle.italic, + // letterSpacing: 0.3, + // fontSize: isTablet ? 22 : 18), + // // ), + // ], + // ), + // ), + SizedBox( + height: 15, + ), + + RichText( + text: TextSpan( + children: [ + WidgetSpan( + child: Icon( + Icons.calendar_month, + size: 18, + color: Colors.white, + ), + ), + TextSpan( + text: ' ${event.start} to ${event.end}', + style: TextStyle( + color: Colors.white, + // fontStyle: FontStyle.italic, + letterSpacing: 0.3, + fontSize: isTablet ? 20 : 14), + ), + ], + ), + ), + SizedBox( + height: 8.0, + ), + RichText( + text: TextSpan( + children: [ + WidgetSpan( + child: Icon( + Icons.location_on, + size: 18, + color: Colors.white, + ), + ), + TextSpan( + text: + ' ${event.city != null ? "${event.city}, " : ""}${event.region != null ? "${event.region}, " : ""}${event.country != null ? "${event.country}" : ""}', + style: TextStyle( + color: Colors.white, + //fontStyle: FontStyle.italic, + letterSpacing: 0.3, + fontSize: isTablet ? 20 : 14), + ), + ], + ), + ), + SizedBox( + height: 8.0, + ), + InkWell( + onTap: () async { + await _launchUrl(provider.eventdetailList[0].url1!); + }, + child: RichText( + text: TextSpan( + children: [ + WidgetSpan( + child: Icon( + Icons.link, + size: 18, + color: Colors.white, + ), + ), + TextSpan( + text: ' Visit Website', + style: TextStyle( + decoration: TextDecoration.underline, + color: Colors.white, + // fontStyle: FontStyle.italic, + letterSpacing: 0.6, + fontSize: isTablet ? 20 : 14), + ), + ], + ), + ), + ), + + Padding( + padding: const EdgeInsets.only(top: 8.0, right: 8.0, left: 1), + child: Text( + 'Event by: ${event.organizer}', + style: TextStyle( + // decoration: TextDecoration.underline, + // decorationColor: Colors.blue, + color: Colors.white, + //fontWeight: FontWeight.italic, + fontSize: isTablet ? 18 : 14, + + letterSpacing: 0.3, + ), + maxLines: isTablet ? 3 : 3, + softWrap: true, + overflow: TextOverflow.ellipsis, + ), + ), + SizedBox( + height: 10.0, + ), + Align( + alignment: Alignment.bottomCenter, + child: Padding( + padding: const EdgeInsets.only(left: 1.0, right: 8.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + // SizedBox( + // width: 15, + // ), + attendingbtn(widget.event, provider), + // const Spacer(), + favbtn(widget.event, provider) + ], + ), + ), + ), + // SizedBox( + // height: 8.0, + // ), + // RichText( + // text: TextSpan( + // children: [ + // WidgetSpan( + // child: Icon(Icons.person, size: 18), + // ), + // TextSpan( + // text: ' d attendees', + // style: TextStyle( + // color: Colors.black, + // //fontStyle: FontStyle.italic, + // letterSpacing: 0.3, + // fontFamily: "SourceSerif", + // fontSize: isTablet ? 20 : 14), + // ), + // ], + // ), + // ), + // SizedBox( + // height: 10, + // ), + // Positioned( + // child: + + SizedBox( + height: 10, + ), + // Image.asset( + // "assets/images/events2.jpg", + // fit: BoxFit.cover, + // ), + // ), + ], + // ), + ), + ); + } + + Widget favbtn(EventsList event, EventsOfflineProvider provider) { + return event.isfav + ? SizedBox( + height: 40, + child: TextButton( + // elevation: 1, + // : Colors.transparent, + + onPressed: () async { + // String msg = await provider + // .addEventsToFavs(event.eventId!); + setState(() { + event.isfav = !event.isfav; + + if (event.isfav) { + provider.favsEventsData(event); + SnackBarWidget.displaySnackBar( + "You are following the event!", context); + } else { + provider.delateEventsData(event); + SnackBarWidget.displaySnackBar("Not Following", context); + } + }); + }, + child: AnimatedSwitcher( + duration: Duration(seconds: 1), + transitionBuilder: + (Widget child, Animation animation) => + FadeTransition( + opacity: animation, + child: SizeTransition( + child: child, + sizeFactor: animation, + axis: Axis.horizontal, + ), + ), + child: Row( + children: [ + Padding( + padding: const EdgeInsets.only(right: 4.0), + child: Icon( + Icons.favorite, + color: Colors.red, + ), + ), + Text("Following", style: TextStyle(color: Colors.white)) + ], + )))) + : SizedBox( + height: 45, + child: FloatingActionButton.extended( + elevation: 1, + // heroTag: "following45", + backgroundColor: EventsConstants.bgcolor, + //backgroundColor: Colors.red, + onPressed: () async { + // String msg = await provider + // .addEventsToFavs(event.eventId!); + + setState(() { + event.isfav = !event.isfav; + + if (event.isfav) { + provider.favsEventsData(event); + SnackBarWidget.displaySnackBar( + "You are following the event!", context); + } else { + provider.delateEventsData(event); + SnackBarWidget.displaySnackBar("Not Following", context); + } + }); + }, + label: AnimatedSwitcher( + duration: Duration(seconds: 1), + transitionBuilder: + (Widget child, Animation animation) => + FadeTransition( + opacity: animation, + child: SizeTransition( + child: child, + sizeFactor: animation, + axis: Axis.horizontal, + ), + ), + child: Row( + children: [ + // Padding( + // padding: const EdgeInsets.only(right: 4.0), + // child: Icon(Icons.add), + // ), + Icon( + Icons.favorite, + color: event.isfav ? Colors.red : Colors.grey, + size: 14, + ), + const SizedBox( + width: 10, + ), + Text( + event.isfav ? "Following" : "Follow", + style: TextStyle(color: Colors.black), + ) + ], + ))), + ); + } + + Widget attendingbtn(EventsList event, EventsOfflineProvider provider) { + return event.isAttending + ? SizedBox( + height: 40, + child: TextButton( + // elevation: 1, + // : Colors.transparent, + + onPressed: () async { + if (!event.isfav) { + event.isfav = !event.isfav; + // String msg1 = await provider + // .addEventsToFavs(event.eventId!); + } + + // String msg = await provider + // .markAttending(event.eventId!); + setState(() { + event.isAttending = !event.isAttending; + + if (event.isAttending) { + SnackBarWidget.displaySnackBar("Attending", context); + } else { + SnackBarWidget.displaySnackBar("Not Attending", context); + } + }); + }, + child: AnimatedSwitcher( + duration: Duration(seconds: 1), + transitionBuilder: + (Widget child, Animation animation) => + FadeTransition( + opacity: animation, + child: SizeTransition( + child: child, + sizeFactor: animation, + axis: Axis.horizontal, + ), + ), + child: Row( + children: [ + Padding( + padding: const EdgeInsets.only(right: 4.0), + child: Icon( + Icons.check, + color: Colors.white, + ), + ), + Text("I am Attending", + style: TextStyle(color: Colors.white)) + ], + )))) + : SizedBox( + height: 45, + child: FloatingActionButton.extended( + elevation: 1, + backgroundColor: EventsConstants.bgcolor, + onPressed: () async { + if (!event.isfav) { + event.isfav = !event.isfav; + // String msg1 = await provider + // .addEventsToFavs(event.eventId!); + } + + // String msg = await provider + // .markAttending(event.eventId!); + setState(() { + event.isAttending = !event.isAttending; + + if (event.isAttending) { + SnackBarWidget.displaySnackBar("Attending", context); + } else { + SnackBarWidget.displaySnackBar("Not Attending", context); + } + }); + }, + //heroTag: "attending545", + label: AnimatedSwitcher( + duration: Duration(seconds: 1), + transitionBuilder: + (Widget child, Animation animation) => + FadeTransition( + opacity: animation, + child: SizeTransition( + child: child, + sizeFactor: animation, + axis: Axis.horizontal, + ), + ), + child: event.isAttending + ? Row( + children: [ + Padding( + padding: const EdgeInsets.only(right: 4.0), + child: Icon( + Icons.check, + color: Colors.black, + ), + ), + Text( + "I am Attending", + style: TextStyle( + color: Colors.black, + fontWeight: FontWeight.bold), + ) + ], + ) + : Row( + children: [ + // Padding( + // padding: const EdgeInsets.only(right: 4.0), + // child: Icon(Icons.add), + // ), + Text( + "I am Attending", + style: TextStyle( + color: Colors.black, + ), + ) + ], + ))), + ); + } + + Widget expandableDetails() { + return + // isTablet + // ? Container( + // margin: EdgeInsets.symmetric(vertical: 20.0), + // height: 200.0, + // child: Row( + // mainAxisAlignment: MainAxisAlignment.spaceEvenly, + // children: [ + // _topicCard("Top 3 topics", + // " 1. Hematologic Neoplasms \n 2. Antibodies, Bispecific \n 3. Multiple Myeloma"), + // _topicCard("Speakers with most sessions", + // " 1. James A. Davis \n 2. Sandra Cuellar \n 3. Allison Butts"), + // _topicCard("Sponsors", + // " 1. Amgen Inc \n 2. Bristol-Myers Squibb Company \n 3. Genmab A/S") + // ], + // )) + // : + Container( + height: MediaQuery.of(context).size.height, + color: EventsConstants.bgcolor, + padding: EdgeInsets.only(left: 8, right: 8), + child: SingleChildScrollView( + child: Column(children: [ + SizedBox( + height: 5, + ), + listViewTopicCard("Top 3 topics", widget.event.topTopics ?? "", true), + SizedBox( + height: 3, + ), + listViewTopicCard( + "Speakers with most sessions", widget.event.topSpeakers!, true), + SizedBox( + height: 3, + ), + listViewTopicCard("Sponsors", widget.event.sponsors!, true) + ]), + ), + ); + } + + Widget _topicCard(String title, String content) { + return SizedBox( + width: MediaQuery.of(context).size.width / 3.2, + child: Card( + child: Padding( + padding: const EdgeInsets.only(top: 18.0, left: 3.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Center( + child: Text( + title, + style: TextStyle(fontSize: 16), + maxLines: 2, + ), + ), + SizedBox( + height: 20, + ), + Text( + content, + style: TextStyle(fontSize: 16), + maxLines: 6, + ), + ], + ), + ), + ), + ); + } + + Widget listViewTopicCard(String title, String content, bool visible) { + return Visibility( + visible: visible, + child: Card( + // color: Colors.white, + surfaceTintColor: Colors.white, + child: Container( + padding: EdgeInsets.all(8.0), + width: double.maxFinite, + decoration: BoxDecoration( + // color: Color.fromARGB(179, 248, 238, 238, + borderRadius: BorderRadius.all(Radius.circular(20)), + color: Colors.white, + ), + child: Padding( + padding: const EdgeInsets.only(left: 8.0, right: 14.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + title, + style: TextStyle( + fontSize: isTablet ? 22 : 16, + fontWeight: FontWeight.bold, + ), + ), + SizedBox( + height: 5, + ), + Text( + content, + style: TextStyle( + fontSize: isTablet ? 22 : 14, + color: Colors.grey[900], + ), + ), + ], + ), + ), + ), + ), + ); + } + + Widget speakersList(EventsOfflineProvider provider) { + var searchtextEditingController; + return Container( + width: double.maxFinite, + padding: EdgeInsets.only(left: 8), + decoration: BoxDecoration( + // color: Color.fromARGB(179, 248, 238, 238), + color: EventsConstants.bgcolor, + ), + child: Column( + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: Container( + height: 40, + // decoration: BoxDecoration( + // // color: Colors.white, + // borderRadius: BorderRadius.circular(5.0)), + child: TextField( + controller: searchtextEditingController, + onChanged: (String txt) async { + if (txt.length >= 2) { + provider.OnSearchSpeakers(txt); + } + if (txt.length < 2) { + await provider + .onSearchSpeakersReset(widget.event.eventId!); + } + }, + decoration: InputDecoration( + //fillColor: Constants.blueColor, + enabledBorder: UnderlineInputBorder( + // borderRadius: BorderRadius.zero, + borderSide: BorderSide( + width: 1, + style: BorderStyle.solid, + color: Colors.grey)), + border: UnderlineInputBorder( + // borderRadius: BorderRadius.zero, + borderSide: BorderSide( + width: 1, + style: BorderStyle.solid, + color: Colors.grey)), + contentPadding: EdgeInsets.symmetric(vertical: 9.0), + focusedBorder: UnderlineInputBorder( + borderSide: BorderSide( + width: 1, + style: BorderStyle.solid, + color: Colors.grey)), + // border: OutlineInputBorder(), + hintText: "Search...", + // labelText: ' Search', + prefixIcon: Icon( + Icons.search, + ), + ), + ), + ), + ), + Expanded( + child: ListView.separated( + padding: const EdgeInsets.all(8), + itemCount: provider.isSearchSpeakers + ? provider.srcheventdetailList.length + : provider.eventdetailList.length, + itemBuilder: (BuildContext context, int index) { + Eventsdetail detail = provider.isSearchSpeakers + ? provider.srcheventdetailList[index] + : provider.eventdetailList[index]; + return GestureDetector( + onTap: () { + // Navigator.of(context).push( + // MaterialPageRoute( + // builder: (context) => HCPProfileScreen( + // eventsdetail: detail, + // eventid: widget.event.eventId!, + // title: widget.event.name1!, + // ), + // ), + // ); + }, + child: Container( + // height: double.infinity, + child: Column( + children: [ + Row( + children: [ + Center( + child: CircleAvatar( + radius: 24, + backgroundColor: Colors.grey, + // child: Icon( + // Icons.person, + // size: 18, + // color: Colors.white, + // ), + child: Text( + detail.kolFullName![0], + style: TextStyle( + fontWeight: FontWeight.bold, + color: Colors.white), + ), + ), + ), + // Container( + // width: 45, + // height: 45, + // decoration: const BoxDecoration( + // color: Colors.black, + // shape: BoxShape.circle, + // image: DecorationImage( + // fit: BoxFit.cover, + // image: NetworkImage( + // 'https://cardio-staging.konectar.io/images/kol_images/resized/1093755944.jpeg')), + // // 'https://images.unsplash.com/photo-1438761681033-6461ffad8d80?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1470&q=80')), + // ), + // ), + SizedBox( + width: 20, + ), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + detail.kolFullName!, + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 14, + ), + maxLines: 2, + softWrap: true, + overflow: TextOverflow.ellipsis, + ), + SizedBox( + width: isTablet + ? MediaQuery.of(context).size.width * 0.25 + : MediaQuery.of(context).size.width * 0.5, + child: Text( + detail.eventTopics ?? + 'Programmed Cell Death 1 Receptor | Human Epidermal Growth Factor Receptor 2 +6more', + maxLines: 3, + style: TextStyle( + // decoration: TextDecoration.underline, + // decorationColor: Colors.blue, + + color: Colors.black, + + //fontStyle: FontStyle.italic, + fontSize: 14), + ), + ), + ], + ), + // const Spacer(), + // SizedBox( + // height: 30, + // child: OutlinedButton( + // onPressed: () {}, + // child: Icon( + // Icons.add, + // size: 24, + // color: Colors.white, + // ), + // style: OutlinedButton.styleFrom( + // shape: CircleBorder(), + // backgroundColor: Constants.bgcolor, + // ), + // ), + // ), + ], + ), + // SEE ALL BUTTON CODE.. + // index == provider.eventdetailList.length - 1 + // ? Padding( + // padding: const EdgeInsets.all(8.0), + // child: Container( + // height: 30, + // child: OutlinedButton( + // onPressed: () { + // setState(() { + // itemcount = 15; + // }); + // // Navigator.of(context).push( + // // MaterialPageRoute( + // // builder: (context) => HcpListScreen(), + // // ), + // // ); + // }, + // child: Text( + // 'See All', + // style: TextStyle( + // // fontFamily: "SourceSerif", + // fontSize: 14, + // color: Colors.black, + // fontWeight: FontWeight.normal), + // ), + // style: OutlinedButton.styleFrom( + // shape: StadiumBorder(), + // ), + // ), + // ), + // ) + // : SizedBox.shrink() + ], + )), + ); + }, + separatorBuilder: (BuildContext context, int index) { + return Divider(); + }, + ), + ), + ], + )); + } + + Widget _ProfileInfoRow(List countslist, EventsList event, + EventsOfflineProvider provider) { + return Container( + height: 60, + constraints: const BoxConstraints(maxWidth: 400), + child: Center( + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: countslist + .map((item) => Expanded( + child: Row( + children: [ + if (countslist.indexOf(item) != 0) + const VerticalDivider(), + Expanded( + child: _singleItem(context, item, event, provider)), + ], + ))) + .toList(), + ), + ), + ); + } + + Widget _singleItem(BuildContext context, ProfileInfoItem item, + EventsList event, EventsOfflineProvider provider) { + return Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: Text( + item.value.toString(), + style: const TextStyle( + fontWeight: FontWeight.bold, + fontSize: 14, + ), + ), + ), + item.title == "Attending" + ? attendingbtn(event, provider) + : Text( + item.title, + style: Theme.of(context).textTheme.bodyLarge, + ) + ], + ); + } +} + +// class _ProfileInfoRow extends StatelessWidget { +// List countslist; +// _ProfileInfoRow({Key? key, required this.countslist}) : super(key: key); + +// @override +// Widget build(BuildContext context) { +// return Container( +// height: 60, +// constraints: const BoxConstraints(maxWidth: 400), +// child: Center( +// child: Row( +// mainAxisAlignment: MainAxisAlignment.spaceEvenly, +// children: countslist +// .map((item) => Expanded( +// child: Row( +// children: [ +// if (countslist.indexOf(item) != 0) +// const VerticalDivider(), +// Expanded(child: _singleItem(context, item)), +// ], +// ))) +// .toList(), +// ), +// ), +// ); +// } + +// Widget _singleItem(BuildContext context, ProfileInfoItem item) => Column( +// mainAxisAlignment: MainAxisAlignment.center, +// children: [ +// Padding( +// padding: const EdgeInsets.all(8.0), +// child: Text( +// item.value.toString(), +// style: const TextStyle( +// fontWeight: FontWeight.bold, +// fontSize: 14, +// ), +// ), +// ), +// Text( +// item.title, +// style: Theme.of(context).textTheme.bodyLarge, +// ) +// ], +// ); +// } + +class ProfileInfoItem { + final String title; + final int value; + + const ProfileInfoItem( + this.title, + this.value, + ); +} + +const _tabs = [ + Tab(text: "Details"), + Tab(text: "Speakers"), + Tab(text: "Insights"), + Tab(text: "Social Media"), +]; + +class _SliverAppBarDelegate extends SliverPersistentHeaderDelegate { + _SliverAppBarDelegate(this._tabBar); + + final TabBar _tabBar; + + @override + double get minExtent => _tabBar.preferredSize.height; + @override + double get maxExtent => _tabBar.preferredSize.height; + + @override + Widget build( + BuildContext context, double shrinkOffset, bool overlapsContent) { + return Container(color: EventsConstants.tabbgColor, child: _tabBar); + } + + @override + bool shouldRebuild(_SliverAppBarDelegate oldDelegate) { + return true; + } +} diff --git a/lib/view/eventstab.dart b/lib/view/eventstab.dart index cd58ddd..4f579dd 100644 --- a/lib/view/eventstab.dart +++ b/lib/view/eventstab.dart @@ -1,26 +1,12 @@ import 'package:flutter/cupertino.dart'; -import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter/widgets.dart'; -import 'package:konectar_events/model/eventsmodel.dart'; import 'package:konectar_events/model/neweventsmodel.dart'; import 'package:konectar_events/utils/constants.dart'; -import 'package:konectar_events/view/eventdetailstab.dart'; -import 'package:konectar_events/view/eventsdetails.dart'; import 'package:konectar_events/view/eventslist.dart'; -import 'package:konectar_events/view/insights.dart'; -import 'package:konectar_events/view/socialmedia.dart'; -import 'package:konectar_events/widgets/autocompletetags_widget.dart'; -import 'package:konectar_events/widgets/customactionsheet.dart'; -import 'package:konectar_events/widgets/gridview.dart'; -import 'package:konectar_events/widgets/word_cloud.dart'; import 'package:word_cloud/word_cloud_data.dart'; -import 'package:word_cloud/word_cloud_shape.dart'; import 'package:word_cloud/word_cloud_tap.dart'; -import 'package:word_cloud/word_cloud_tap_view.dart'; -import 'package:word_cloud/word_cloud_view.dart'; -import 'package:flutter/material.dart'; import 'package:add_2_calendar/add_2_calendar.dart'; class EventsTab extends StatefulWidget { diff --git a/lib/view/hcplist.dart b/lib/view/hcplist.dart index 5d221e8..7ae022c 100644 --- a/lib/view/hcplist.dart +++ b/lib/view/hcplist.dart @@ -2,7 +2,6 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:konectar_events/utils/util.dart'; import 'package:konectar_events/widgets/customappbar.dart'; -import 'package:konectar_events/widgets/customeventsappbar.dart'; class HcpListScreen extends StatefulWidget { const HcpListScreen({super.key}); diff --git a/lib/view/helpdesk.dart b/lib/view/helpdesk.dart new file mode 100644 index 0000000..c1ab037 --- /dev/null +++ b/lib/view/helpdesk.dart @@ -0,0 +1,226 @@ +import 'dart:convert'; +import 'dart:io'; + +import 'package:file_picker/file_picker.dart'; +import 'package:flutter/foundation.dart'; +import 'package:flutter/material.dart'; +import 'package:konectar_events/contacts_module/ui_screen/interactionform/widget/custombutton.dart'; +import 'package:konectar_events/utils/constants.dart'; +import 'package:konectar_events/widgets/customappbar.dart'; +import 'package:konectar_events/widgets/customtextfield.dart'; +import 'package:path_provider/path_provider.dart'; +import 'package:permission_handler/permission_handler.dart'; +import 'package:path/path.dart' as p; + +class HelpDeskScreen extends StatefulWidget { + const HelpDeskScreen({super.key}); + + @override + State createState() => _HelpDeskScreenState(); +} + +class _HelpDeskScreenState extends State { + TextEditingController subjectTextController = TextEditingController(text: ""); + TextEditingController TextController = TextEditingController(text: ""); + String? _selectedValue; + + final List type = [ + "Question", + "Software Issue", + "Content Issue", + "Training Request", + "Callback Request", + "Feature Request", + ]; + + Widget dropDown({ + Widget? underline, + Widget? icon, + TextStyle? style, + TextStyle? hintStyle, + Color? dropdownColor, + }) => + DropdownButton( + value: _selectedValue, + underline: underline, + icon: Align(alignment: Alignment.centerRight, child: icon), + dropdownColor: dropdownColor, + isExpanded: true, + style: TextStyle( + //fontFamily: "SourceSerif", + color: Colors.black, + fontSize: 14.0, + ), + // iconEnabledColor: iconEnabledColor, + onChanged: (String? newValue) { + setState(() { + _selectedValue = newValue; + }); + }, + hint: Text("Select Type", style: hintStyle), + items: type + .map((session) => DropdownMenuItem( + value: session, child: Text(session))) + .toList()); + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text( + "Help Desk", + style: TextStyle(color: Colors.white), + ), + automaticallyImplyLeading: false, + backgroundColor: EventsConstants.blueColor, + centerTitle: true, + ), + body: Container( + height: MediaQuery.of(context).size.height / 2, + padding: EdgeInsets.symmetric(horizontal: 8.0), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 30, + ), + CustomTextField( + labelText: "Subject*", controller: subjectTextController), + SizedBox( + height: 30, + ), + Container( + padding: const EdgeInsets.all(8.0), + decoration: BoxDecoration( + border: Border.all(color: Colors.grey), + borderRadius: BorderRadius.circular(8.0)), + child: dropDown(underline: Container())), + SizedBox( + height: 30, + ), + TextFormField( + validator: (value) { + // add email validation + if (value == null || value.isEmpty) { + return 'Please enter some text'; + } + + // bool emailValid = RegExp( + // r"^[a-zA-Z0-9.a-zA-Z0-9.!#$%&'*+-/=?^_`{|}~]+@[a-zA-Z0-9]+\.[a-zA-Z]+") + // .hasMatch(value); + // if (!emailValid) { + // return 'Please enter a valid email'; + // } + + return null; + }, + maxLines: 3, + decoration: const InputDecoration( + labelText: 'Description', + hintText: 'Description', + border: OutlineInputBorder(), + ), + ), + SizedBox( + height: 10, + ), + Row( + children: [ + Text("Attach a file :"), + SizedBox( + width: 10, + ), + CustomButton( + backgroundColor: const Color.fromARGB(255, 233, 229, 229), + onPressed: () async { + // sectionItem.selectedValue = []; + // sectionItem.extension = []; + // sectionItem.fileName = []; + await getEncodedFile(); + + setState(() {}); + }, + width: 120, + height: 40, + fontsize: 12, + textColor: Colors.black, + title: "Choose file"), + ], + ), + SizedBox( + height: 30, + ), + Center( + child: CustomButton( + backgroundColor: EventsConstants.blueColor, + onPressed: () => (), + title: "Submit", + textColor: Colors.white, + ), + ) + ], + ), + ), + ); + } + + Future getEncodedFile() async { + String base64Image = ''; + var status = Platform.isAndroid + ? await Permission.manageExternalStorage.status + : await Permission.storage.status; + if (status.isGranted) { + FilePickerResult? result = + await FilePicker.platform.pickFiles(allowMultiple: true); + + if (result != null) { + print(result.files.first.path); + print(result.files.last.path); + for (var files in result.files) { + File file = File(files.path!); + print("check file path : ${file.path}"); + var fileName = file.path.split('/').last; + // Get the application folder directory + Directory? directory = Platform.isAndroid + ? await getExternalStorageDirectory() //FOR ANDROID + : await getApplicationDocumentsDirectory(); + String newPath = ""; //FOR ios + String convertedDirectoryPath = (directory?.path).toString(); + + print("see the converted directory path $convertedDirectoryPath"); + + newPath = "$convertedDirectoryPath/konectar/files"; + print("new path :$newPath"); + directory = Directory(newPath); + if (!await directory.exists()) { + await directory.create(recursive: true); + } + File newFile = await file.copy('${directory.path}/$fileName'); + print("new path is ${newFile.path}"); + final extension = p.extension(newFile.path); + List imageBytes = await newFile.readAsBytes(); + Uint8List imageUint8List = Uint8List.fromList(imageBytes); + base64Image = base64Encode(imageUint8List); + // sectionItem.selectedValue!.add(base64Image); + // sectionItem.extension!.add(extension); + // sectionItem.fileName!.add(fileName); + } + } + } else { + print("not permitted"); + await requestPermission(Platform.isAndroid + ? Permission.manageExternalStorage + : Permission.storage); + } + } + + Future requestPermission(Permission permission) async { + final status = await permission.request(); + + setState(() { + print(status); + // _permissionStatus = status; + // print(_permissionStatus); + }); + } +} diff --git a/lib/view/home.dart b/lib/view/home.dart index 5528224..e3f31af 100644 --- a/lib/view/home.dart +++ b/lib/view/home.dart @@ -1,11 +1,21 @@ +import 'dart:async'; + +import 'package:connectivity_plus/connectivity_plus.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; +import 'package:flutter/painting.dart'; import 'package:flutter/rendering.dart'; +import 'package:flutter/services.dart'; import 'package:flutter/widgets.dart'; + +import 'package:infinite_scroll_pagination/infinite_scroll_pagination.dart'; +import 'package:konectar_events/contacts_module/custom_widget/show_alert.dart'; import 'package:konectar_events/model/keywords_model.dart'; import 'package:konectar_events/model/neweventsmodel.dart'; +import 'package:konectar_events/utils/apicall.dart'; import 'package:konectar_events/utils/constants.dart'; +import 'package:konectar_events/utils/dateformater.dart'; import 'package:konectar_events/utils/util.dart'; import 'package:konectar_events/view/eventslist.dart'; import 'package:konectar_events/view/eventstab.dart'; @@ -43,16 +53,30 @@ class _HomeScreenState extends State with TickerProviderStateMixin { List selectedIndex = []; bool selectedFav = false; bool isExtended = false; - + String search = ""; final ScrollController _scrollController = ScrollController(); final GlobalKey _scaffoldKey = GlobalKey(); AnimationController? animationController; bool _isSearch = false; List therapeuticList = []; + + static const _pageSize = 20; + String filter_startdate = ""; + String filter_enddate = ""; + + final PagingController pagingController = + PagingController(firstPageKey: 0); + + List connectionStatus = [ConnectivityResult.none]; + final Connectivity _connectivity = Connectivity(); + get developer => null; + late StreamSubscription> _connectivitySubscription; + @override void dispose() { animationController?.dispose(); + pagingController.dispose(); super.dispose(); } @@ -61,18 +85,95 @@ class _HomeScreenState extends State with TickerProviderStateMixin { animationController = AnimationController( duration: const Duration(milliseconds: 1000), vsync: this); WidgetsBinding.instance.addPostFrameCallback((timeStamp) { + initConnectivity(); + + _connectivitySubscription = + _connectivity.onConnectivityChanged.listen(_updateConnectionStatus); init(); }); - + pagingController.addPageRequestListener((pageKey) { + _fetchPage(pageKey); + }); super.initState(); } + Future initConnectivity() async { + late List result; + // Platform messages may fail, so we use a try/catch PlatformException. + try { + result = await _connectivity.checkConnectivity(); + } on PlatformException catch (e) { + developer.log('Couldn\'t check connectivity status', error: e); + return; + } + + // If the widget was removed from the tree while the asynchronous platform + // message was in flight, we want to discard the reply rather than calling + // setState to update our non-existent appearance. + if (!mounted) { + return Future.value(null); + } + + return _updateConnectionStatus(result); + } + + Future _updateConnectionStatus(List result) async { + setState(() { + connectionStatus = result; + }); + + // ignore: avoid_print + print('Connectivity changed: $connectionStatus'); + } + + Future _fetchPage(int pageKey) async { + print("DATE SELECTED :$filter_enddate,$filter_startdate"); + await initConnectivity(); + if (connectionStatus.toString().contains("ConnectivityResult.none")) { + try { + final newItems = + await Provider.of(context, listen: false) + .getOfflineMyEvents(); + final isLastPage = newItems.length < _pageSize; + if (isLastPage) { + pagingController.appendLastPage(newItems); + } else { + final nextPageKey = pageKey + newItems.length; + pagingController.appendPage(newItems, nextPageKey); + } + } catch (error) { + pagingController.error = error; + } + } else { + try { + final newItems = + await Provider.of(context, listen: false).getEvents( + pageKey, + searchtxt: search, + startdate: filter_startdate, + enddate: filter_enddate); + // final newItems = + // await Provider.of(context, listen: false) + // .getOfflineMyEvents(); + final isLastPage = newItems.length < _pageSize; + if (isLastPage) { + pagingController.appendLastPage(newItems); + } else { + final nextPageKey = pageKey + newItems.length; + pagingController.appendPage(newItems, nextPageKey); + } + } catch (error) { + pagingController.error = error; + } + } + } + init() async { await Provider.of(context, listen: false).initFiltersData(); - await Provider.of(context, listen: false).getEvents(); + // await Provider.of(context, listen: false).getMyEvents(0); await Provider.of(context, listen: false) .getAddedSessionNotes(); - + //await ApiCall().dummyapi(); setState(() {}); } @@ -228,12 +329,31 @@ class _HomeScreenState extends State with TickerProviderStateMixin { borderRadius: BorderRadius.circular(5.0)), child: TextField( controller: searchtextEditingController, + onEditingComplete: () { + String txt = searchtextEditingController.text; + if (txt.length >= 2) { + search = txt; + provider.isSearch = true; + pagingController.refresh(); + // await provider.OnSearch(txt); + } + if (txt.length == 0) { + provider.isSearch = false; + + pagingController.refresh(); + } + }, onChanged: (String txt) async { if (txt.length >= 2) { - provider.OnSearch(txt); + search = txt; + provider.isSearch = true; + pagingController.refresh(); + // await provider.OnSearch(txt); } - if (txt.length < 2) { - await provider.onSearchReset(); + if (txt.length == 0) { + provider.isSearch = false; + search = txt; + pagingController.refresh(); } }, decoration: InputDecoration( @@ -268,6 +388,8 @@ class _HomeScreenState extends State with TickerProviderStateMixin { _isSearch = !_isSearch; if (!_isSearch) { searchtextEditingController.clear(); + search = ""; + pagingController.refresh(); } }); }, @@ -277,58 +399,58 @@ class _HomeScreenState extends State with TickerProviderStateMixin { )) ], ), - body: Stack( - children: [ - InkWell( - splashColor: Colors.transparent, - focusColor: Colors.transparent, - highlightColor: Colors.transparent, - hoverColor: Colors.transparent, - onTap: () { - FocusScope.of(context).requestFocus(FocusNode()); - }, - child: NestedScrollView( - controller: _scrollController, - headerSliverBuilder: - (BuildContext context, bool innerBoxIsScrolled) { - return [ - // SliverList( - // delegate: SliverChildBuilderDelegate( - // (BuildContext context, int index) { - // return Container( - // color: Constants.blueColor, - // child: Column( - // children: [ - // // CustomAppBar( - // // title: "Events", - // // backgroundcolor: - // // Color.fromARGB(255, 0, 71, 132), - // // ), - // // getSearchBarUI(provider), - // ], - // ), - // ); - // }, childCount: 1), - // ), - SliverPersistentHeader( - pinned: true, - floating: true, - delegate: ContestTabHeader( - getFilterBarUI(provider), - ), + body: Stack(children: [ + InkWell( + splashColor: Colors.transparent, + focusColor: Colors.transparent, + highlightColor: Colors.transparent, + hoverColor: Colors.transparent, + onTap: () { + FocusScope.of(context).requestFocus(FocusNode()); + }, + child: NestedScrollView( + controller: _scrollController, + headerSliverBuilder: + (BuildContext context, bool innerBoxIsScrolled) { + return [ + // SliverList( + // delegate: SliverChildBuilderDelegate( + // (BuildContext context, int index) { + // return Container( + // color: Constants.blueColor, + // child: Column( + // children: [ + // // CustomAppBar( + // // title: "Events", + // // backgroundcolor: + // // Color.fromARGB(255, 0, 71, 132), + // // ), + // // getSearchBarUI(provider), + // ], + // ), + // ); + // }, childCount: 1), + // ), + SliverPersistentHeader( + pinned: true, + floating: true, + delegate: ContestTabHeader( + getFilterBarUI(provider), ), - ]; - }, - body: Container( - color: EventsConstants.bgcolor, - child: buildListView(context, provider)), - ), + ), + ]; + }, + body: Container( + color: EventsConstants.bgcolor, + child: buildPaginationListView(context, provider)), ), - ], - ), + ), + ]), ), - // ), ); + + // ), + // ); } Widget getFilterBarUI(EventsProvider provider) { @@ -422,12 +544,24 @@ class _HomeScreenState extends State with TickerProviderStateMixin { child: CupertinoSwitch( activeColor: Color.fromARGB(255, 0, 71, 132), value: provider.isFavSeleted, - onChanged: (value) async { + onChanged: (value) { provider.isFavSeleted = value; if (provider.isFavSeleted) { - await provider.onSelectMy(); + pagingController.refresh(); + + //_pagingController. + // _pagingController + // .addPageRequestListener((pageKey) { + // await _fetchPage(0); + // }); } else { - await provider.onSelectAll(); + provider.isFavSeleted = false; + provider.isAllSelected = !provider.isAllSelected; + pagingController.refresh(); + // _pagingController + // .addPageRequestListener((pageKey) { + // await _fetchPage(0); + // }); } setState(() {}); }, @@ -551,10 +685,15 @@ class _HomeScreenState extends State with TickerProviderStateMixin { child: TextField( onChanged: (String txt) async { if (txt.length >= 3) { - provider.OnSearch(txt); + search = txt; + provider.isSearch = true; + pagingController.refresh(); + // await provider.OnSearch(txt); } if (txt.length <= 3) { - await provider.onSearchReset(); + provider.isSearch = false; + pagingController.refresh(); + //await provider.onSearchReset(); } }, style: const TextStyle( @@ -591,10 +730,17 @@ class _HomeScreenState extends State with TickerProviderStateMixin { ), onTap: () async { FocusScope.of(context).requestFocus(FocusNode()); - if (searchtextEditingController.text.length >= 3) - provider.OnSearch(searchtextEditingController.text); - else - await provider.onSearchReset(); + if (searchtextEditingController.text.length >= 3) { + search = searchtextEditingController.text; + provider.isSearch = true; + pagingController.refresh(); + // await provider.OnSearch(searchtextEditingController.text); + } else { + //search = searchtextEditingController.text; + provider.isSearch = false; + pagingController.refresh(); + } + // await provider.onSearchReset(); }, child: Padding( padding: const EdgeInsets.all(16.0), @@ -769,7 +915,7 @@ class _HomeScreenState extends State with TickerProviderStateMixin { child: SingleChildScrollView( scrollDirection: Axis.vertical, child: Column( - crossAxisAlignment: CrossAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.end, children: [ // DrawerHeader( // child: Center( @@ -779,7 +925,7 @@ class _HomeScreenState extends State with TickerProviderStateMixin { // ), // ), Container( - //color: Colors.transparent, + color: EventsConstants.bgcolor, padding: EdgeInsets.only(top: 20, left: 5.0), ), @@ -805,37 +951,29 @@ class _HomeScreenState extends State with TickerProviderStateMixin { style: TextStyle(fontSize: 20), ), const Spacer(), - Align( - alignment: Alignment.topRight, - child: Container( - height: 30, - child: OutlinedButton( - onPressed: () { - print("&&&"); - print(provider.selectedTherapeutic); - if (provider.selectedTherapeutic.isNotEmpty) { - provider.OnFilters(); - } + // Align( + // alignment: Alignment.topRight, + // child: Container( + // height: 30, + // child: OutlinedButton( + // onPressed: () { - setState(() { - Navigator.pop(context); - }); - }, - child: Text( - 'Apply', - style: TextStyle( - // fontFamily: "SourceSerif", - fontSize: 14, - color: Colors.white, - fontWeight: FontWeight.normal), - ), - style: OutlinedButton.styleFrom( - shape: StadiumBorder(), - backgroundColor: Colors.green, - ), - ), - ), - ), + // }, + // child: Text( + // 'Apply', + // style: TextStyle( + // // fontFamily: "SourceSerif", + // fontSize: 14, + // color: Colors.white, + // fontWeight: FontWeight.normal), + // ), + // style: OutlinedButton.styleFrom( + // shape: StadiumBorder(), + // backgroundColor: Colors.green, + // ), + // ), + // ), + // ), SizedBox( width: 8.0, ), @@ -994,22 +1132,6 @@ class _HomeScreenState extends State with TickerProviderStateMixin { ], ), - // Center( - // child: SizedBox( - // width: 200, - // height: 40, - // child: ListTile( - // title: Container( - // color: Colors.blue, - // child: Center( - // child: Text( - // 'Apply', - // style: TextStyle(color: Colors.white), - // ))), - // onTap: () {}, - // ), - // ), - // ), Divider( height: 1, color: Colors.black, @@ -1044,72 +1166,68 @@ class _HomeScreenState extends State with TickerProviderStateMixin { ), ], ), - // Row( - // children: [ - // SizedBox( - // width: (MediaQuery.of(context).size.width * 0.99) / 2, - // child: ListTile( - // title: Text('City'), - // subtitle: customAutoCompletedropdown( - // ["Chicago", "Seattle", "San Deigo"]), - // onTap: () {}, - // ), - // ), - // SizedBox( - // width: (MediaQuery.of(context).size.width * 0.99) / 2, - // child: ListTile( - // title: Text('State'), - // subtitle: customAutoCompletedropdown( - // ["California", "Illinois", "New York"]), - // onTap: () {}, - // ), - // ), - // ], - // ), - // Row( - // children: [ - // SizedBox( - // width: (MediaQuery.of(context).size.width * 0.99) / 2, - // child: ListTile( - // title: Text('Country'), - // subtitle: customAutoCompletedropdown([ - // "Netherlands", - // "Switzerland", - // "United States" - // ]), - // onTap: () {}, - // ), - // ), - // SizedBox( - // width: (MediaQuery.of(context).size.width * 0.99) / 2, - // child: ListTile( - // title: Text('Number of Attendees'), - // subtitle: buildTextFieldWidget(), - // onTap: () {}, - // ), - // ), - // ], - // ), - // Row( - // children: [ - // SizedBox( - // width: (MediaQuery.of(context).size.width * 0.99) / 2, - // child: ListTile( - // title: Text('Client Attendees'), - // subtitle: buildTextFieldWidget(), - // onTap: () {}, - // ), - // ), - // SizedBox( - // width: (MediaQuery.of(context).size.width * 0.99) / 2, - // child: ListTile( - // title: Text('New Attendees'), - // subtitle: buildTextFieldWidget(), - // onTap: () {}, - // ), - // ), - // ], - // ), + ], + ), + SizedBox( + height: 20, + ), + Column( + children: [ + Align( + alignment: Alignment.bottomCenter, + child: SizedBox( + width: 200, + height: 50, + child: FloatingActionButton.extended( + backgroundColor: Colors.green, + onPressed: () { + print("&&&"); + print(provider.selectedTherapeutic); + if (provider.selectedTherapeutic.isNotEmpty) { + provider.OnFilters(); + } + pagingController.refresh(); + + setState(() { + Navigator.pop(context); + }); + }, + elevation: 0, + label: const Text("Apply Filters", + style: TextStyle( + color: Colors.white, + )), + ), + ), + ), + SizedBox( + height: 10, + ), + Align( + alignment: Alignment.bottomCenter, + child: SizedBox( + width: 200, + height: 50, + child: FloatingActionButton.extended( + backgroundColor: Colors.blue, + onPressed: () { + startDatetextEditingController.clear(); + endDatetextEditingController.clear(); + filter_enddate = ""; + filter_startdate = ""; + setState(() {}); + + pagingController.refresh(); + Navigator.pop(context); + }, + elevation: 0, + label: const Text("Clear Filters", + style: TextStyle( + color: Colors.white, + )), + ), + ), + ), ], ), ], @@ -1122,21 +1240,24 @@ class _HomeScreenState extends State with TickerProviderStateMixin { Widget buildDateWidget(TextEditingController controller, String hint) { return SizedBox( - width: isTablet ? 200 : MediaQuery.of(context).size.width, + //width: isTablet ? 200 : MediaQuery.of(context).size.width, height: isTablet ? 50 : 40, child: TextField( controller: controller, //editing controller of this TextField decoration: InputDecoration( - // border: OutlineInputBorder(), + border: OutlineInputBorder(), // border: OutlineInputBorder( // borderRadius: BorderRadius.circular(10.0), // ), // labelStyle: const TextStyle(fontSize: 16), - suffixIcon: const Icon(Icons.calendar_today), //icon of text field + suffixIcon: const Icon( + Icons.calendar_today, + size: 16, + ), //icon of text field // labelText: "Enter Date" //label text of field - hintText: hint, + // hintText: hint, ), readOnly: true, //set it true, so that user will not able to edit text @@ -1145,8 +1266,8 @@ class _HomeScreenState extends State with TickerProviderStateMixin { context: context, anchorPoint: Offset(20.0, 30.0), initialDate: DateTime.now(), - firstDate: DateTime( - 2000), //DateTime.now() - not to allow to choose before today. + firstDate: DateTime + .now(), //DateTime.now() - not to allow to choose before today. lastDate: DateTime(2101)); if (pickedDate != null) { @@ -1156,9 +1277,14 @@ class _HomeScreenState extends State with TickerProviderStateMixin { print( formattedDate); //formatted date output using intl package => 2021-03-16 //you can implement different kind of Date Format here according to your requirement - + if (hint == "Start Date") { + filter_startdate = formattedDate; + } else { + filter_enddate = formattedDate; + } setState(() { // output date to TextField value. + controller.text = formattedDate; }); } else { @@ -1316,6 +1442,35 @@ class _HomeScreenState extends State with TickerProviderStateMixin { ); } + Set selectedIndexes = {}; + Widget buildPaginationListView( + BuildContext context, EventsProvider provider) { + return RefreshIndicator( + onRefresh: () async => pagingController.refresh(), + child: PagedListView( + pagingController: pagingController, + builderDelegate: PagedChildBuilderDelegate( + itemBuilder: (BuildContext context, item, int index) { + final int count = provider.eventList.length > 10 + ? 10 + : provider.eventList.length; + final Animation animation = + Tween(begin: 0.0, end: 1.0).animate(CurvedAnimation( + parent: animationController!, + curve: Interval((1 / count) * index, 1.0, + curve: Curves.fastOutSlowIn))); + animationController?.forward(); + return _buildlistCard( + animation: animation, + animationController: animationController!, + provider: provider, + eventsList: provider.isSearch ? item : item, + ); + }, + )), + ); + } + Widget _buildlistCard( {required Animation? animation, required AnimationController? animationController, @@ -1421,8 +1576,7 @@ class _HomeScreenState extends State with TickerProviderStateMixin { ); } - buildCardView( - BuildContext context, EventsList event, EventsProvider provider) { + buildCardView(BuildContext context, dynamic event, EventsProvider provider) { double height = isTablet ? MediaQuery.of(context).size.height * 0.35 : MediaQuery.of(context).size.height * 0.65; @@ -1458,20 +1612,34 @@ class _HomeScreenState extends State with TickerProviderStateMixin { children: [ Align( alignment: FractionalOffset.topLeft, - child: Text( - event.name1 ?? "", - style: TextStyle( - // decoration: TextDecoration.underline, - // decorationColor: Colors.blue, - color: Colors.black, - fontWeight: FontWeight.bold, - fontSize: isTablet ? 22 : 16, - // fontFamily: "SourceSerif", + child: RichText( + text: TextSpan(children: [ + // WidgetSpan( + // child: Icon(Icons.bookmark, + // color: EventsConstants.blueColor, + // size: isTablet ? 14 : 18) + // // provider.ifOfflineExists(event.eventId!) + // // ? Icon(Icons.bookmark, + // // color: EventsConstants.blueColor, + // // size: isTablet ? 14 : 18) + // // : SizedBox.shrink(), + // ), + TextSpan( + text: event.name1 ?? "", + style: TextStyle( + // decoration: TextDecoration.underline, + // decorationColor: Colors.blue, + color: Colors.black, + fontWeight: FontWeight.bold, + fontSize: isTablet ? 22 : 16, + + // fontFamily: "SourceSerif", + ), + // maxLines: isTablet ? 4 : 4, + // softWrap: true, + // overflow: TextOverflow.ellipsis, ), - maxLines: isTablet ? 4 : 4, - softWrap: true, - overflow: TextOverflow.ellipsis, - ), + ])), ), SizedBox( @@ -1496,11 +1664,12 @@ class _HomeScreenState extends State with TickerProviderStateMixin { child: Icon(Icons.calendar_month, size: 16), ), TextSpan( - text: ' ${event.start} to ${event.end}', + text: + ' ${CustomDateFormatter().formatYearDate(CustomDateFormatter().convertStringToDate(event.start))} to ${CustomDateFormatter().formatYearDate(CustomDateFormatter().convertStringToDate(event.end))}', style: TextStyle( color: Colors.black, //fontStyle: FontStyle.italic, - fontSize: isTablet ? 20 : 14), + fontSize: isTablet ? 20 : 12), ), ], ), @@ -1521,7 +1690,8 @@ class _HomeScreenState extends State with TickerProviderStateMixin { style: TextStyle( color: Colors.black, //fontStyle: FontStyle.italic, - fontSize: isTablet ? 20 : 14), + + fontSize: isTablet ? 20 : 12), ), ], ), @@ -1531,101 +1701,115 @@ class _HomeScreenState extends State with TickerProviderStateMixin { Align( alignment: FractionalOffset.bottomRight, - child: Column( - crossAxisAlignment: CrossAxisAlignment.end, - mainAxisAlignment: MainAxisAlignment.spaceBetween, + child: Row( children: [ - SizedBox( - width: 40, - height: 30, - child: FloatingActionButton.extended( - elevation: 1, - shape: CircleBorder(), - backgroundColor: EventsConstants.bgcolor, - onPressed: () async { - // String msg = await provider - // .addEventsToFavs(event.eventId!); + Column( + crossAxisAlignment: CrossAxisAlignment.end, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + provider.ifOfflineExists(event.eventId!) + ? Padding( + padding: EdgeInsets.only(right: 10), + child: Icon(Icons.bookmark, + color: EventsConstants.blueColor, + size: isTablet ? 14 : 18), + ) + : SizedBox.shrink(), + SizedBox( + width: 40, + height: 30, + child: FloatingActionButton.extended( + elevation: 1, + shape: CircleBorder(), + backgroundColor: EventsConstants.bgcolor, + onPressed: () async { + // event.isfav = !event.isfav; - setState(() { - event.isfav = !event.isfav; - - if (event.isfav) { - SnackBarWidget.displaySnackBar( - "Added to favorites!", context); - } else { - SnackBarWidget.displaySnackBar( - "Removed from favorites!", context); - } - }); - if (event.isfav) { - await provider.favsEventsData(event); - } else { - await provider.delateEventsData(event); - } - }, - label: AnimatedSwitcher( - duration: Duration(seconds: 1), - transitionBuilder: (Widget child, - Animation animation) => - FadeTransition( - opacity: animation, - child: SizeTransition( - child: child, - sizeFactor: animation, - axis: Axis.horizontal, - ), - ), - child: event.isfav - ? Column( - children: [ - Icon( - Icons.favorite, - color: Colors.red, - size: 14, + if (event.isfav) { + //If event is added to fav then unfollow + String msg = await provider + .removeEventsToFavs(event.eventId!); + SnackBarWidget.displaySnackBar( + "Removed from My Events!", context); + } else { + String msg = await provider + .addEventsToFavs(event.eventId!); + SnackBarWidget.displaySnackBar( + "Added to My Events", context); + } + pagingController.refresh(); + setState(() {}); + // if (event.isfav) { + // // await provider.favsEventsData(event); + // } else { + // // await provider.delateEventsData(event); + // } + }, + label: AnimatedSwitcher( + duration: Duration(seconds: 1), + transitionBuilder: (Widget child, + Animation animation) => + FadeTransition( + opacity: animation, + child: SizeTransition( + child: child, + sizeFactor: animation, + axis: Axis.horizontal, ), - ], - ) - : Icon( - Icons.favorite, - color: Colors.grey, - size: 14, - ))), - ), - SizedBox( - height: 2, - ), - event.isfav - ? RichText( - text: TextSpan( - children: [ - WidgetSpan( - child: Icon(Icons.check, - color: Colors.grey[600], - size: isTablet ? 14 : 12), + ), + child: event.eventUserInterest! + ? Column( + children: [ + Icon( + Icons.favorite, + color: Colors.red, + size: 14, + ), + ], + ) + : Icon( + Icons.favorite, + color: Colors.grey, + size: 14, + ))), + ), + SizedBox( + height: 2, + ), + event.eventUserInterest + ? RichText( + text: TextSpan( + children: [ + WidgetSpan( + child: Icon(Icons.check, + color: Colors.grey[600], + size: isTablet ? 14 : 10), + ), + TextSpan( + text: ' Following', + style: TextStyle( + color: Colors.grey[600], + fontSize: isTablet ? 14 : 10), + ), + ], ), - TextSpan( - text: ' following', - style: TextStyle( - color: Colors.grey[600], - fontSize: isTablet ? 14 : 12), - ), - ], - ), - ) - : Center( - child: RichText( - text: TextSpan( - children: [ - TextSpan( - text: 'follow ', - style: TextStyle( - color: Colors.grey[600], - fontSize: isTablet ? 14 : 12), + ) + : Center( + child: RichText( + text: TextSpan( + children: [ + TextSpan( + text: 'Follow ', + style: TextStyle( + color: Colors.grey[600], + fontSize: isTablet ? 14 : 10), + ), + ], ), - ], + ), ), - ), - ), + ], + ), ], ), ), diff --git a/lib/view/homeoffline.dart b/lib/view/homeoffline.dart new file mode 100644 index 0000000..68fc5c7 --- /dev/null +++ b/lib/view/homeoffline.dart @@ -0,0 +1,1890 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/gestures.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/rendering.dart'; +import 'package:flutter/widgets.dart'; +import 'package:konectar_events/model/eventsmodel.dart'; +import 'package:konectar_events/model/keywords_model.dart'; +import 'package:konectar_events/model/neweventsmodel.dart'; +import 'package:konectar_events/utils/apicall.dart'; +import 'package:konectar_events/utils/constants.dart'; +import 'package:konectar_events/utils/util.dart'; + +import 'package:konectar_events/view/eventsdetails.dart'; +import 'package:konectar_events/view/eventslist.dart'; +import 'package:konectar_events/view/eventslistoffline.dart'; +import 'package:konectar_events/view/eventstab.dart'; +import 'package:konectar_events/viewmodel/eventsprovider.dart'; +import 'package:konectar_events/viewmodel/offlineeventsprovider.dart'; +import 'package:konectar_events/widgets/autocompletetags_widget.dart'; +import 'package:konectar_events/widgets/customappbar.dart'; +import 'package:konectar_events/widgets/custombutton.dart'; +import 'package:konectar_events/widgets/customdropdown.dart'; + +import 'package:dropdown_button2/dropdown_button2.dart'; +import 'package:intl/intl.dart'; +import 'package:konectar_events/widgets/gridview.dart'; +import 'package:konectar_events/widgets/responsive_utils.dart'; +import 'package:konectar_events/widgets/snackbar.dart'; +import 'package:provider/provider.dart'; +import 'package:font_awesome_flutter/font_awesome_flutter.dart'; + +class OfflineHomeScreen extends StatefulWidget { + const OfflineHomeScreen({super.key}); + + @override + State createState() => _OfflineHomeScreenState(); +} + +class _OfflineHomeScreenState extends State + with TickerProviderStateMixin { + String? dvalue; + final TextEditingController textEditingController = TextEditingController(); + final TextEditingController startDatetextEditingController = + TextEditingController(); + final TextEditingController endDatetextEditingController = + TextEditingController(); + final TextEditingController datetextEditingController = + TextEditingController(); + final TextEditingController selecttextEditingController = + TextEditingController(); + final TextEditingController searchtextEditingController = + TextEditingController(); + Color? iconColor = Colors.blueGrey[300]; + IconData icon = Icons.favorite; + List selectedIndex = []; + bool selectedFav = false; + bool isExtended = false; + + final ScrollController _scrollController = ScrollController(); + final GlobalKey _scaffoldKey = GlobalKey(); + + AnimationController? animationController; + bool _isSearch = false; + List therapeuticList = []; + @override + void dispose() { + animationController?.dispose(); + super.dispose(); + } + + @override + void initState() { + animationController = AnimationController( + duration: const Duration(milliseconds: 1000), vsync: this); + WidgetsBinding.instance.addPostFrameCallback((timeStamp) { + init(); + }); + + super.initState(); + } + + init() async { + await Provider.of(context, listen: false) + .initFiltersData(); + await Provider.of(context, listen: false) + .getEvents(); + await Provider.of(context, listen: false) + .getAddedSessionNotes(); + + setState(() {}); + } + + @override + Widget build(BuildContext context) { + return Consumer( + builder: (BuildContext context, provider, Widget? child) { + // return SafeArea( + // top: false, + // child: Scaffold( + // appBar: CustomAppBar( + // title: "Events", + // backgroundcolor: Color.fromARGB(255, 0, 71, 132), + // ), + // // backgroundColor: const Color.fromARGB(255, 222, 237, 247), + // backgroundColor: Constants.bgcolor, + // // endDrawer: populateDrawer(provider),Color(0xf6f8fc) + // // backgroundColor:Color(0xf6f8fc), + // body: Padding( + // padding: const EdgeInsets.all(8.0), + // child: Column( + // children: [ + // Row( + // children: [ + // Expanded( + // child: Padding( + // padding: const EdgeInsets.only(left: 5.0), + // child: Container( + // padding: const EdgeInsets.all(20.0), + // decoration: BoxDecoration( + // borderRadius: BorderRadius.circular(30.0), + // //color: Color.fromARGB(179, 248, 238, 238), + // color: Colors.white, + // ), + // height: 60, + // child: Center( + // child: Expanded( + // child: TextField( + // textAlignVertical: TextAlignVertical.center, + // cursorHeight: 14.0, + // maxLines: 1, + // controller: + // selecttextEditingController, //editing controller of this TextField + // decoration: InputDecoration( + // // border: OutlineInputBorder(), + // hintText: 'Search Events', + + // enabledBorder: OutlineInputBorder( + // borderRadius: BorderRadius.circular(20.0), + // borderSide: const BorderSide( + // color: Colors.transparent, + // width: 0.0), + // ), + // focusedBorder: OutlineInputBorder( + // borderSide: const BorderSide( + // color: Colors.transparent, + // width: 0.0), + // ), + + // contentPadding: EdgeInsets.symmetric( + // vertical: 10.0, horizontal: 20.0), + // border: OutlineInputBorder( + // borderRadius: + // BorderRadius.circular(20.0), + // borderSide: + // BorderSide(color: Colors.yellow)), + // // prefixIcon: Icon( + // // Icons.search, + // // size: 16, + // // ), + // // suffixIcon: IconButton( + // // onPressed: () {}, + // // icon: Icon( + // // Icons.filter_list_alt, + // // size: 16, + // // ), + // // ), + + // hintStyle: const TextStyle(fontSize: 16), + // ), + // ), + // ), + // ), + // ), + // ), + // ), + // Padding( + // padding: const EdgeInsets.only(right: 5.0), + // child: Align( + // alignment: Alignment.topRight, + // child: IconButton( + // icon: Icon( + // Icons.sort_rounded, + // size: isTablet ? 24 : 20, + // ), + // onPressed: () { + // dialogBuilder(context, provider); + // // showModalBottomSheet( + // // context: context, + // // scrollControlDisabledMaxHeightRatio: 1.0, + // // isScrollControlled: true, + // // builder: (context) { + // // return DraggableScrollableSheet( + // // initialChildSize: 0.5, + // // minChildSize: 0.25, + // // maxChildSize: 0.75, + // // expand: true, + // // builder: (context, scrollController) { + // // return Container(); + // // }); + // // }); + // // return FractionallySizedBox( + // // heightFactor: 0.5, + // // child: populateDrawer(provider), + // // ); + // // }); + // }, + // ), + // ), + // ) + // ], + // ), + // buildListView(context, provider), + // // buildEventsGrid(context, provider), + // ], + // ), + // )), + // ); + return headerview(context, provider); + }); + } + + Widget headerview(BuildContext context, EventsOfflineProvider provider) { + // return SafeArea( + return Container( + child: Scaffold( + key: _scaffoldKey, + endDrawer: populateDrawer(provider), + appBar: AppBar( + automaticallyImplyLeading: false, + backgroundColor: EventsConstants.blueColor, + centerTitle: false, + title: _isSearch + ? Container( + height: 40, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(5.0)), + child: TextField( + controller: searchtextEditingController, + onChanged: (String txt) async { + if (txt.length >= 2) { + provider.OnSearch(txt); + } + if (txt.length < 2) { + await provider.onSearchReset(); + } + }, + decoration: InputDecoration( + fillColor: EventsConstants.blueColor, + contentPadding: EdgeInsets.symmetric(vertical: 9.0), + border: OutlineInputBorder(), + hintText: "Search for events...", + // labelText: ' Search', + prefixIcon: Icon( + Icons.search, + ), + ), + ), + ) + : Text( + "Events", + style: TextStyle(color: Colors.white), + ), + actions: [ + IconButton( + onPressed: () async { + await provider.onSearchReset(); + setState(() { + _isSearch = !_isSearch; + if (!_isSearch) { + searchtextEditingController.clear(); + } + }); + }, + icon: Icon( + _isSearch ? Icons.close : Icons.search, + color: Colors.white, + )) + ], + ), + body: Stack( + children: [ + InkWell( + splashColor: Colors.transparent, + focusColor: Colors.transparent, + highlightColor: Colors.transparent, + hoverColor: Colors.transparent, + onTap: () { + FocusScope.of(context).requestFocus(FocusNode()); + }, + child: NestedScrollView( + controller: _scrollController, + headerSliverBuilder: + (BuildContext context, bool innerBoxIsScrolled) { + return [ + // SliverList( + // delegate: SliverChildBuilderDelegate( + // (BuildContext context, int index) { + // return Container( + // color: Constants.blueColor, + // child: Column( + // children: [ + // // CustomAppBar( + // // title: "Events", + // // backgroundcolor: + // // Color.fromARGB(255, 0, 71, 132), + // // ), + // // getSearchBarUI(provider), + // ], + // ), + // ); + // }, childCount: 1), + // ), + SliverPersistentHeader( + pinned: true, + floating: true, + delegate: ContestTabHeader( + getFilterBarUI(provider), + ), + ), + ]; + }, + body: Container( + color: EventsConstants.bgcolor, + child: buildListView(context, provider)), + ), + ), + ], + ), + ), + // ), + ); + } + + Widget getFilterBarUI(EventsOfflineProvider provider) { + return Stack( + children: [ + Positioned( + top: 0, + left: 0, + right: 0, + child: Container( + height: 24, + decoration: BoxDecoration( + color: EventsConstants.bgcolor, + boxShadow: [ + BoxShadow( + color: Colors.grey.withOpacity(0.2), + offset: const Offset(0, -2), + blurRadius: 8.0), + ], + ), + ), + ), + Container( + color: EventsConstants.bgcolor, + child: Padding( + padding: + const EdgeInsets.only(left: 16, right: 16, top: 8, bottom: 4), + child: Row( + children: [ + // Container( + // height: 40, + // child: OutlinedButton( + // onPressed: () async { + // // setState(() { + // await provider.onSelectAll(); + // // }); + // setState(() {}); + // }, + // child: Text( + // 'All', + // style: TextStyle( + // // fontFamily: "SourceSerif", + // fontSize: 14, + // color: provider.isAllSelected + // ? Colors.white + // : Colors.black, + // fontWeight: FontWeight.normal), + // ), + // style: OutlinedButton.styleFrom( + // shape: StadiumBorder(), + // backgroundColor: + // provider.isAllSelected ? Colors.green : Colors.white, + // ), + // ), + // ), + // const SizedBox( + // width: 8, + // ), + // Container( + // height: 40, + // child: OutlinedButton( + // onPressed: () async { + // // setState(() { + // await provider.onSelectMy(); + // // }); + // setState(() {}); + // }, + // child: Text( + // 'My Events', + // style: TextStyle( + // // fontFamily: "SourceSerif", + // fontSize: 14, + // color: provider.isFavSeleted + // ? Colors.white + // : Colors.grey, + // fontWeight: FontWeight.normal), + // ), + // style: OutlinedButton.styleFrom( + // shape: StadiumBorder(), + // backgroundColor: + // provider.isFavSeleted ? Colors.green : Colors.white, + // ), + // ), + // ), + Container( + child: Wrap( + children: [ + Padding( + padding: const EdgeInsets.only(left: 8.0, right: 2.0), + child: CupertinoSwitch( + activeColor: Color.fromARGB(255, 0, 71, 132), + value: provider.isFavSeleted, + onChanged: (value) async { + provider.isFavSeleted = value; + if (provider.isFavSeleted) { + await provider.onSelectMy(); + } else { + await provider.onSelectAll(); + } + setState(() {}); + }, + ), + ), + Padding( + padding: const EdgeInsets.only(right: 8.0, top: 9.0), + child: !provider.isFavSeleted + ? const Text( + 'My Events', + style: + TextStyle(fontSize: 15, color: Colors.grey), + ) + : const Text( + 'My Events', + style: TextStyle( + fontSize: 15, + ), + ), + ) + ], + ), + ), + + const Spacer(), + // Expanded( + // child: Padding( + // padding: const EdgeInsets.all(8.0), + // child: Text( + // '530 hotels found', + // style: TextStyle( + // fontWeight: FontWeight.w100, + // fontSize: 16, + // ), + // ), + // ), + // ), + Material( + color: Colors.transparent, + child: InkWell( + focusColor: Colors.transparent, + highlightColor: Colors.transparent, + hoverColor: Colors.transparent, + splashColor: Colors.grey.withOpacity(0.2), + borderRadius: const BorderRadius.all( + Radius.circular(4.0), + ), + onTap: () { + FocusScope.of(context).requestFocus(FocusNode()); + // Navigator.push( + // context, + // MaterialPageRoute( + // builder: (BuildContext context) => + // populateDrawer(provider), + // fullscreenDialog: false), + // ); + _scaffoldKey.currentState?.openEndDrawer(); + }, + child: Padding( + padding: const EdgeInsets.only(left: 8), + child: Row( + children: [ + Text( + 'Filters', + style: TextStyle( + fontWeight: FontWeight.w100, + fontSize: 16, + ), + ), + Padding( + padding: const EdgeInsets.all(8.0), + child: Icon( + Icons.sort, + color: Color.fromARGB(255, 0, 71, 132), + ), + ), + ], + ), + ), + ), + ), + ], + ), + ), + ), + const Positioned( + top: 0, + left: 0, + right: 0, + child: Divider( + height: 1, + ), + ) + ], + ); + } + + Widget getSearchBarUI(EventsOfflineProvider provider) { + return Padding( + padding: const EdgeInsets.only(left: 16, right: 16, top: 8, bottom: 8), + child: Row( + children: [ + Padding( + padding: const EdgeInsets.only(right: 12, top: 8, bottom: 8), + child: Container( + decoration: BoxDecoration( + color: EventsConstants.bgcolor, + borderRadius: const BorderRadius.all( + Radius.circular(24.0), + ), + boxShadow: [ + BoxShadow( + color: Colors.grey.withOpacity(0.2), + offset: const Offset(0, 2), + blurRadius: 8.0), + ], + ), + child: Padding( + padding: + const EdgeInsets.only(left: 8, right: 8, top: 1, bottom: 1), + child: TextField( + onChanged: (String txt) async { + if (txt.length >= 3) { + provider.OnSearch(txt); + } + if (txt.length <= 3) { + await provider.onSearchReset(); + } + }, + style: const TextStyle( + fontSize: 14, + ), + cursorColor: Colors.blue, + controller: searchtextEditingController, + decoration: InputDecoration( + border: InputBorder.none, + hintText: ' Search for events...', + ), + ), + ), + ), + ), + Container( + // decoration: BoxDecoration( + // color: Constants.blueColor, + // borderRadius: const BorderRadius.all( + // Radius.circular(24.0), + // ), + // boxShadow: [ + // BoxShadow( + // color: Colors.grey.withOpacity(0.4), + // offset: const Offset(0, 2), + // blurRadius: 8.0), + // ], + // ), + child: Material( + color: Colors.transparent, + child: InkWell( + borderRadius: const BorderRadius.all( + Radius.circular(28.0), + ), + onTap: () async { + FocusScope.of(context).requestFocus(FocusNode()); + if (searchtextEditingController.text.length >= 3) + provider.OnSearch(searchtextEditingController.text); + else + await provider.onSearchReset(); + }, + child: Padding( + padding: const EdgeInsets.all(16.0), + child: Icon(FontAwesomeIcons.magnifyingGlass, + size: 18, color: Colors.white), + ), + ), + ), + ), + ], + ), + ); + } + + Widget getAppBarUI() { + return Container( + decoration: BoxDecoration( + color: Color.fromARGB(255, 0, 71, 132), + boxShadow: [ + BoxShadow( + color: Colors.grey.withOpacity(0.2), + offset: const Offset(0, 2), + blurRadius: 8.0), + ], + ), + child: Padding( + padding: EdgeInsets.only( + top: MediaQuery.of(context).padding.top, left: 8, right: 8), + child: Row( + children: [ + Container( + alignment: Alignment.centerLeft, + width: AppBar().preferredSize.height + 40, + height: AppBar().preferredSize.height, + // child: Material( + // color: Colors.transparent, + // child: InkWell( + // borderRadius: const BorderRadius.all( + // Radius.circular(32.0), + // ), + // onTap: () { + // Navigator.pop(context); + // }, + // child: Padding( + // padding: const EdgeInsets.all(8.0), + // child: Icon(Icons.arrow_back), + // ), + // ), + // ), + ), + Center( + child: Text( + 'Events', + style: TextStyle( + fontWeight: FontWeight.w600, + fontSize: 22, + ), + ), + ), + Container( + width: AppBar().preferredSize.height + 40, + height: AppBar().preferredSize.height, + child: Row( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Material( + color: Colors.transparent, + child: InkWell( + borderRadius: const BorderRadius.all( + Radius.circular(32.0), + ), + onTap: () {}, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Icon(Icons.favorite_border), + ), + ), + ), + Material( + color: Colors.transparent, + child: InkWell( + borderRadius: const BorderRadius.all( + Radius.circular(32.0), + ), + onTap: () {}, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Icon(Icons.local_activity), + ), + ), + ), + ], + ), + ) + ], + ), + ), + ); + } + + Future dialogBuilder( + BuildContext context, EventsOfflineProvider provider) { + return showDialog( + context: context, + builder: (BuildContext context) { + // return AlertDialog( + // title: const Text('Session Notes'), + return populateDrawer(provider); + // actions: [ + // TextButton( + // style: TextButton.styleFrom( + // textStyle: Theme.of(context).textTheme.labelLarge, + // ), + // child: const Text('Submit'), + // onPressed: () { + // Navigator.of(context).pop(); + // }, + // ), + // TextButton( + // style: TextButton.styleFrom( + // textStyle: Theme.of(context).textTheme.labelLarge, + // ), + // child: const Text('Cancel'), + // onPressed: () { + // Navigator.of(context).pop(); + // }, + // ), + // ], + // ); + }, + ); + } + + List sortEvents = ["All Events", "My Events"]; + Widget dropDown({ + Widget? underline, + Widget? icon, + TextStyle? style, + TextStyle? hintStyle, + Color? dropdownColor, + }) => + DropdownButton( + value: dvalue, + underline: underline, + icon: Align(alignment: Alignment.centerRight, child: icon), + dropdownColor: dropdownColor, + isExpanded: true, + style: TextStyle( + fontFamily: "SourceSerif", + color: Colors.black, + fontSize: 12.0, + ), + // iconEnabledColor: iconEnabledColor, + onChanged: (String? newValue) { + setState(() { + dvalue = newValue; + }); + }, + hint: Text("Select", style: hintStyle), + items: sortEvents + .map((session) => DropdownMenuItem( + value: session, child: Text(session))) + .toList()); + + populateDrawer(EventsOfflineProvider provider) { + return Theme( + data: Theme.of(context).copyWith(canvasColor: EventsConstants.bgcolor), + child: Container( + width: MediaQuery.of(context).size.width * 0.60, + color: EventsConstants.bgcolor, + child: Drawer( + child: SingleChildScrollView( + scrollDirection: Axis.vertical, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // DrawerHeader( + // child: Center( + // child: Text('Filters'), + // // child: Image.asset("assets/images/lf_logo.png", + // // height: 100, width: 100), + // ), + // ), + Container( + //color: Colors.transparent, + padding: EdgeInsets.only(top: 20, left: 5.0), + ), + + Padding( + padding: const EdgeInsets.only(left: 8.0), + child: Row( + children: [ + InkWell( + onTap: () { + Navigator.pop(context); + }, + child: Icon( + Icons.arrow_back_ios, + color: Colors.black, + size: isTablet ? 20 : 16, + ), + ), + SizedBox( + width: 8.0, + ), + Text( + 'Filters', + style: TextStyle(fontSize: 20), + ), + const Spacer(), + Align( + alignment: Alignment.topRight, + child: Container( + height: 30, + child: OutlinedButton( + onPressed: () { + print("&&&"); + print(provider.selectedTherapeutic); + if (provider.selectedTherapeutic.isNotEmpty) { + provider.OnFilters(); + } + + setState(() { + Navigator.pop(context); + }); + }, + child: Text( + 'Apply', + style: TextStyle( + // fontFamily: "SourceSerif", + fontSize: 14, + color: Colors.white, + fontWeight: FontWeight.normal), + ), + style: OutlinedButton.styleFrom( + shape: StadiumBorder(), + backgroundColor: Colors.green, + ), + ), + ), + ), + SizedBox( + width: 8.0, + ), + ], + ), + ), + Divider( + height: 7, + color: Colors.black, + ), + // SizedBox( + // width: (MediaQuery.of(context).size.width * 0.99) / 2, + // child: ListTile( + // title: Text('Search Scope'), + // subtitle: customAutoCompletedropdown(), + // onTap: () {}, + // ), + // ), + // StringAutoCompleteTags( + // initialTags: [ + // TagsData(name: "cancer screening ", id: "1"), + // TagsData(name: "cosmetic surgery", id: "2"), + // TagsData(name: "sleep medicine", id: "3"), + // TagsData(name: "ADHD", id: "4"), + // ], + // hintText: "Enter scope", + // ), + // Container( + // padding: const EdgeInsets.all(4.0), + // height: 40, + // width: double.infinity, + // decoration: BoxDecoration( + // border: Border.all(color: Colors.grey), + // borderRadius: BorderRadius.circular(8.0)), + // child: dropDown(underline: Container())), + Wrap( + //spacing: 4, + // runSpacing: 4, + // crossAxisAlignment: WrapCrossAlignment.start, + // runAlignment: WrapAlignment.spaceEvenly, + // alignment: WrapAlignment.spaceEvenly, + // direction: Axis.horizontal, + // mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + SizedBox( + width: isTablet + ? MediaQuery.of(context).size.width / 2 + : MediaQuery.of(context).size.width, + child: ListTile( + //title: Text('Search Scope'), + subtitle: StringAutoCompleteTags( + initialTags: provider.therapeuticList + .map((e) => + TagsData(id: e.id, name: e.therapeuticName)) + .toList(), + hintText: "Enter scope", + filtername: "scope", + getList: (TextEditingValue textEditingValue) { + List taglist = []; + taglist = provider.therapeuticList + .map((e) => + TagsData(id: e.id, name: e.therapeuticName)) + .toList(); + + if (textEditingValue.text == '') { + return const Iterable.empty(); + } + + if (textEditingValue.text.length > 1) { + return taglist.where((TagsData option) { + return option.name.contains( + textEditingValue.text.toLowerCase()); + }); + } + + return taglist.where((TagsData option) { + return option.name.contains( + textEditingValue.text.toLowerCase()); + }); + }, + ), + onTap: () {}, + selectedColor: Colors.white, + selectedTileColor: Colors.white, + ), + ), + SizedBox( + width: isTablet + ? MediaQuery.of(context).size.width / 2 + : MediaQuery.of(context).size.width, + child: ListTile( + // title: Text('Search Keyword'), + subtitle: StringAutoCompleteTags( + initialTags: provider.keywordList + .map((e) => TagsData(id: e.id, name: e.name)) + .toList(), + filtername: "keyword", + hintText: "Enter Keyword", + getList: (TextEditingValue textEditingValue) async { + if (textEditingValue.text == '') { + return const Iterable.empty(); + } + if (textEditingValue.text.length >= 3) { + List keywordlist = await provider + .getKeywordList(textEditingValue.text); + + return keywordlist + .map((e) => TagsData(id: e.id, name: e.name)) + .toList() + .where((TagsData option) { + return option.name.contains( + textEditingValue.text.toLowerCase()); + }); + } else { + return const Iterable.empty(); + } + }, + ), + onTap: () {}, + ), + ), + SizedBox( + width: isTablet + ? MediaQuery.of(context).size.width / 2 + : MediaQuery.of(context).size.width, + child: ListTile( + // title: Text('Search Speakers'), + subtitle: StringAutoCompleteTags( + initialTags: [ + TagsData(name: "Gavino Casu", id: "1"), + TagsData(name: "Calvin Marentz", id: "2"), + TagsData(name: "Vineet Bhandari", id: "3"), + TagsData(name: "Jose Travino", id: "4"), + ], + hintText: "Enter Speakers", + filtername: "speakers", + getList: (TextEditingValue textEditingValue) { + if (textEditingValue.text == '') { + return const Iterable.empty(); + } + + return [ + TagsData(name: "Gavino Casu", id: "1"), + TagsData(name: "Calvin Marentz", id: "2"), + TagsData(name: "Vineet Bhandari", id: "3"), + TagsData(name: "Jose Travino", id: "4"), + ].where((TagsData option) { + return option.name.contains( + textEditingValue.text.toLowerCase()); + }); + }, + ), + onTap: () {}, + ), + ), + ], + ), + + // Center( + // child: SizedBox( + // width: 200, + // height: 40, + // child: ListTile( + // title: Container( + // color: Colors.blue, + // child: Center( + // child: Text( + // 'Apply', + // style: TextStyle(color: Colors.white), + // ))), + // onTap: () {}, + // ), + // ), + // ), + Divider( + height: 1, + color: Colors.black, + ), + ExpansionTile( + shape: Border(), + title: Text("More"), + children: [ + Column( + children: [ + SizedBox( + width: isTablet + ? MediaQuery.of(context).size.width / 2 + : MediaQuery.of(context).size.width, + child: ListTile( + title: Text('Start Date'), + subtitle: buildDateWidget( + startDatetextEditingController, "Start Date"), + onTap: () {}, + ), + ), + SizedBox( + width: isTablet + ? MediaQuery.of(context).size.width / 2 + : MediaQuery.of(context).size.width, + child: ListTile( + title: Text('End Date'), + subtitle: buildDateWidget( + endDatetextEditingController, "End Date"), + onTap: () {}, + ), + ), + ], + ), + // Row( + // children: [ + // SizedBox( + // width: (MediaQuery.of(context).size.width * 0.99) / 2, + // child: ListTile( + // title: Text('City'), + // subtitle: customAutoCompletedropdown( + // ["Chicago", "Seattle", "San Deigo"]), + // onTap: () {}, + // ), + // ), + // SizedBox( + // width: (MediaQuery.of(context).size.width * 0.99) / 2, + // child: ListTile( + // title: Text('State'), + // subtitle: customAutoCompletedropdown( + // ["California", "Illinois", "New York"]), + // onTap: () {}, + // ), + // ), + // ], + // ), + // Row( + // children: [ + // SizedBox( + // width: (MediaQuery.of(context).size.width * 0.99) / 2, + // child: ListTile( + // title: Text('Country'), + // subtitle: customAutoCompletedropdown([ + // "Netherlands", + // "Switzerland", + // "United States" + // ]), + // onTap: () {}, + // ), + // ), + // SizedBox( + // width: (MediaQuery.of(context).size.width * 0.99) / 2, + // child: ListTile( + // title: Text('Number of Attendees'), + // subtitle: buildTextFieldWidget(), + // onTap: () {}, + // ), + // ), + // ], + // ), + // Row( + // children: [ + // SizedBox( + // width: (MediaQuery.of(context).size.width * 0.99) / 2, + // child: ListTile( + // title: Text('Client Attendees'), + // subtitle: buildTextFieldWidget(), + // onTap: () {}, + // ), + // ), + // SizedBox( + // width: (MediaQuery.of(context).size.width * 0.99) / 2, + // child: ListTile( + // title: Text('New Attendees'), + // subtitle: buildTextFieldWidget(), + // onTap: () {}, + // ), + // ), + // ], + // ), + ], + ), + ], + ), + ), + ), + ), + ); + } + + Widget buildDateWidget(TextEditingController controller, String hint) { + return SizedBox( + width: isTablet ? 200 : MediaQuery.of(context).size.width, + height: isTablet ? 50 : 40, + child: TextField( + controller: controller, + + //editing controller of this TextField + decoration: InputDecoration( + // border: OutlineInputBorder(), + // border: OutlineInputBorder( + // borderRadius: BorderRadius.circular(10.0), + // ), + // labelStyle: const TextStyle(fontSize: 16), + suffixIcon: const Icon(Icons.calendar_today), //icon of text field + // labelText: "Enter Date" //label text of field + hintText: hint, + ), + readOnly: true, //set it true, so that user will not able to edit text + + onTap: () async { + DateTime? pickedDate = await showDatePicker( + context: context, + anchorPoint: Offset(20.0, 30.0), + initialDate: DateTime.now(), + firstDate: DateTime( + 2000), //DateTime.now() - not to allow to choose before today. + lastDate: DateTime(2101)); + + if (pickedDate != null) { + print( + pickedDate); //pickedDate output format => 2021-03-10 00:00:00.000 + String formattedDate = DateFormat('yyyy-MM-dd').format(pickedDate); + print( + formattedDate); //formatted date output using intl package => 2021-03-16 + //you can implement different kind of Date Format here according to your requirement + + setState(() { + // output date to TextField value. + controller.text = formattedDate; + }); + } else { + print("Date is not selected"); + } + }, + ), + ); + } + + Widget buildTextFieldWidget() { + return SizedBox( + width: isTablet ? 200 : MediaQuery.of(context).size.width, + height: isTablet ? 50 : 40, + child: TextField( + controller: + selecttextEditingController, //editing controller of this TextField + decoration: InputDecoration( + // border: OutlineInputBorder(), + border: OutlineInputBorder( + borderRadius: BorderRadius.circular(10.0), + ), + labelStyle: const TextStyle(fontSize: 16), + ), + ), + ); + } + + Widget customAutoCompletedropdown(List list) { + // sectionItem.value = list[0].name; + + // if (list.isEmpty) { + // print("list is empty"); + + //} + //InputClass selectedObj = list[0]; + return SizedBox( + width: isTablet ? 200 : MediaQuery.of(context).size.width, + height: isTablet ? 60 : 40, + child: DropdownButtonFormField2( + isExpanded: true, + decoration: InputDecoration( + // Add Horizontal padding using menuItemStyleData.padding so it matches + // the menu padding when button's width is not specified. + contentPadding: const EdgeInsets.symmetric(vertical: 5), + border: OutlineInputBorder( + borderRadius: BorderRadius.circular(15), + ), + // Add more decoration.. + ), + hint: Text( + 'Select Item', + style: TextStyle( + fontSize: 14, + color: Theme.of(context).hintColor, + ), + ), + items: list + .map((item) => DropdownMenuItem( + value: item, + child: Text( + item, + style: const TextStyle( + fontSize: 14, + ), + ), + )) + .toList(), + value: list[0], + onSaved: (value) {}, + onChanged: (value) { + // setState(() { + }, + + buttonStyleData: const ButtonStyleData( + padding: EdgeInsets.symmetric(horizontal: 16), + height: 40, + width: 200, + ), + dropdownStyleData: const DropdownStyleData( + maxHeight: 200, + ), + menuItemStyleData: const MenuItemStyleData( + height: 40, + ), + dropdownSearchData: DropdownSearchData( + searchController: textEditingController, + searchInnerWidgetHeight: 50, + searchInnerWidget: Container( + height: 50, + padding: const EdgeInsets.only( + top: 8, + bottom: 4, + right: 8, + left: 8, + ), + child: TextFormField( + expands: true, + maxLines: null, + controller: textEditingController, + decoration: InputDecoration( + isDense: true, + contentPadding: const EdgeInsets.symmetric( + horizontal: 10, + vertical: 8, + ), + hintText: 'Search...', + hintStyle: const TextStyle(fontSize: 12), + border: OutlineInputBorder( + borderRadius: BorderRadius.circular(8), + ), + ), + ), + ), + searchMatchFn: (item, searchValue) { + return item.value!.toString().contains(searchValue); + }, + ), + //This to clear the search value when you close the menu + onMenuStateChange: (isOpen) { + if (!isOpen) { + textEditingController.clear(); + } + }, + ), + ); + } + + Widget buildListView(BuildContext context, EventsOfflineProvider provider) { + return ListView.builder( + itemCount: provider.isSearch + ? provider.searchList.length + : provider.eventList.length, + padding: const EdgeInsets.only(top: 2), + shrinkWrap: true, + scrollDirection: Axis.vertical, + itemBuilder: (BuildContext context, int index) { + final int count = + provider.eventList.length > 10 ? 10 : provider.eventList.length; + final Animation animation = Tween(begin: 0.0, end: 1.0) + .animate(CurvedAnimation( + parent: animationController!, + curve: Interval((1 / count) * index, 1.0, + curve: Curves.fastOutSlowIn))); + animationController?.forward(); + return ListTile( + contentPadding: EdgeInsets.zero, + onLongPress: () {}, + leading: Checkbox( + onChanged: (value) => () {}, + value: true, + ), + title: _buildlistCard( + animation: animation, + index: index, + animationController: animationController!, + provider: provider, + eventsList: provider.isSearch + ? provider.searchList[index] + : provider.eventList[index], + ), + ); + }, + ); + } + + Widget _buildlistCard( + {required Animation? animation, + required AnimationController? animationController, + required EventsOfflineProvider provider, + required int index, + required EventsList eventsList}) { + return AnimatedBuilder( + animation: animationController!, + builder: (BuildContext context, Widget? child) { + return FadeTransition( + opacity: animation!, + child: Transform( + transform: Matrix4.translationValues( + 0.0, 50 * (1.0 - animation.value), 0.0), + child: Padding( + padding: const EdgeInsets.only( + left: 10, right: 10, top: 8, bottom: 12), + child: InkWell( + splashColor: Colors.transparent, + onTap: () { + // if (index == 0) { + // Navigator.of(context, rootNavigator: true) + // .push(MaterialPageRoute( + // builder: (context) => EventsListingScreen2( + // event: eventsList, + // ), + // )); + // } else { + Navigator.of(context, rootNavigator: true) + .push(MaterialPageRoute( + builder: (context) => EventsListingOfflineScreen( + event: eventsList, + ), + )); + //} + }, + child: Card( + elevation: 4, + surfaceTintColor: Colors.white, + // shadowColor: Constants.bgcolor, + child: buildCardView(context, eventsList, provider), + ), + )))); + }); + } + + Widget buildEventsGrid(BuildContext context, EventsOfflineProvider provider) { + final textTheme = Theme.of(context) + .textTheme + .apply(displayColor: Theme.of(context).colorScheme.onSurface); + + // Set the default number of columns to 3. + int columnsCount = 2; + + // Define the icon size based on the screen width + + // Use the ResponsiveUtils class to determine the device's screen size. + if (ResponsiveUtils.isMobile(context)) { + columnsCount = 1; + } else if (ResponsiveUtils.isDesktop(context)) { + columnsCount = 3; + } + + // Build the grid view using the number of columns. + return Expanded( + child: GridView.builder( + // Set padding and spacing between cards. + padding: const EdgeInsets.symmetric(vertical: 5), + scrollDirection: Axis.vertical, + + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( + // Set the number of columns based on the device's screen size. + crossAxisCount: columnsCount, + + // Set the aspect ratio of each card. + // childAspectRatio: isTablet ? 2 : 2, + // crossAxisSpacing: isTablet ? 30 : 20, + // mainAxisSpacing: isTablet ? 40 : 20, + + childAspectRatio: isTablet ? 2 : 2.2, + crossAxisSpacing: isTablet ? 30 : 1, + mainAxisSpacing: isTablet ? 40 : 4, + ), + // Set the number of items in the grid view. + itemCount: provider.eventList.length, + itemBuilder: (BuildContext context, int index) { + // Build each card in the grid view. + return InkWell( + onTap: () { + Navigator.of(context, rootNavigator: true) + .push(MaterialPageRoute( + builder: (context) => EventsTab( + event: provider.eventList[index], + ), + )); + // Navigator.of(context).push(new MaterialPageRoute( + // builder: (BuildContext context) { + // return new EventsTab(); + // }, + // fullscreenDialog: true)); + }, + child: Card( + elevation: 2, + shadowColor: EventsConstants.bgcolor, + child: buildCardView( + context, provider.eventList[index], provider))); + }, + // Set the grid view to shrink wrap its contents. + shrinkWrap: true, + // Disable scrolling in the grid view. + // physics: const NeverScrollableScrollPhysics(), + ), + ); + } + + buildCardView( + BuildContext context, EventsList event, EventsOfflineProvider provider) { + double height = isTablet + ? MediaQuery.of(context).size.height * 0.35 + : MediaQuery.of(context).size.height * 0.65; + return ConstrainedBox( + constraints: BoxConstraints.tightFor(), + child: Container( + decoration: BoxDecoration( + // color: Color.fromARGB(179, 248, 238, 238), + + color: Colors.white, + borderRadius: BorderRadius.all(Radius.circular(20))), + // height: MediaQuery.of(context).size.height * 0.2, + // height: double.minPositive, + padding: isTablet + ? EdgeInsets.symmetric(horizontal: 8.0, vertical: 2.0) + : EdgeInsets.symmetric(horizontal: 10.0, vertical: 10.0), + child: + // Column( + // crossAxisAlignment: CrossAxisAlignment.end, + // // mainAxisAlignment: MainAxisAlignment.spaceEvenly, + // children: [ + // SizedBox( + // height: isTablet ? 1 : 3, + // ), + // Container( + // // height: isTablet ? height * 0.50 : height * 0.30, + // padding: const EdgeInsets.only(top: 5.0), + // width: double.maxFinite, + // child: + Column( + // crossAxisAlignment: CrossAxisAlignment.end, + // mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + Align( + alignment: FractionalOffset.topLeft, + child: Text( + event.name1 ?? "", + style: TextStyle( + // decoration: TextDecoration.underline, + // decorationColor: Colors.blue, + color: Colors.black, + fontWeight: FontWeight.bold, + fontSize: isTablet ? 22 : 16, + // fontFamily: "SourceSerif", + ), + maxLines: isTablet ? 4 : 4, + softWrap: true, + overflow: TextOverflow.ellipsis, + ), + ), + + SizedBox( + height: 14, + ), + // Positioned( + // child: + Align( + alignment: FractionalOffset.bottomLeft, + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.end, + children: [ + RichText( + text: TextSpan( + children: [ + WidgetSpan( + child: Icon(Icons.calendar_month, size: 16), + ), + TextSpan( + text: ' ${event.start} to ${event.end}', + style: TextStyle( + color: Colors.black, + //fontStyle: FontStyle.italic, + fontSize: isTablet ? 20 : 14), + ), + ], + ), + ), + SizedBox( + height: 5.0, + ), + RichText( + textAlign: TextAlign.justify, + text: TextSpan( + children: [ + WidgetSpan( + child: Icon(Icons.location_on, size: 16), + ), + TextSpan( + text: + ' ${event.city != null ? "${event.city}, " : ""}${event.region != null ? "${event.region}, " : ""}${event.country != null ? "${event.country}" : ""}', + style: TextStyle( + color: Colors.black, + //fontStyle: FontStyle.italic, + fontSize: isTablet ? 20 : 14), + ), + ], + ), + ), + ], + ), + + Align( + alignment: FractionalOffset.bottomRight, + child: Column( + crossAxisAlignment: CrossAxisAlignment.end, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + SizedBox( + width: 40, + height: 30, + child: FloatingActionButton.extended( + elevation: 1, + shape: CircleBorder(), + backgroundColor: EventsConstants.bgcolor, + onPressed: () async { + // String msg = await provider + // .addEventsToFavs(event.eventId!); + + setState(() { + event.isfav = !event.isfav; + + if (event.isfav) { + SnackBarWidget.displaySnackBar( + "Added to favorites!", context); + } else { + SnackBarWidget.displaySnackBar( + "Removed from favorites!", context); + } + }); + if (event.isfav) { + await provider.favsEventsData(event); + } else { + await provider.delateEventsData(event); + } + }, + label: AnimatedSwitcher( + duration: Duration(seconds: 1), + transitionBuilder: (Widget child, + Animation animation) => + FadeTransition( + opacity: animation, + child: SizeTransition( + child: child, + sizeFactor: animation, + axis: Axis.horizontal, + ), + ), + child: event.isfav + ? Column( + children: [ + Icon( + Icons.favorite, + color: Colors.red, + size: 14, + ), + ], + ) + : Icon( + Icons.favorite, + color: Colors.grey, + size: 14, + ))), + ), + SizedBox( + height: 2, + ), + event.isfav + ? RichText( + text: TextSpan( + children: [ + WidgetSpan( + child: Icon(Icons.check, + color: Colors.grey[600], + size: isTablet ? 14 : 12), + ), + TextSpan( + text: ' following', + style: TextStyle( + color: Colors.grey[600], + fontSize: isTablet ? 14 : 12), + ), + ], + ), + ) + : Center( + child: RichText( + text: TextSpan( + children: [ + TextSpan( + text: 'follow ', + style: TextStyle( + color: Colors.grey[600], + fontSize: isTablet ? 14 : 12), + ), + ], + ), + ), + ), + ], + ), + ), + // Align( + // alignment: Alignment.bottomRight, + // child: SizedBox( + // height: 30, + // child: OutlinedButton( + // onPressed: () { + // setState(() { + // // selectedIndex.add(index); + // if (selectedIndex.isNotEmpty) { + // int count = selectedIndex + // .where( + // (element) => element == index, + // ) + // .length; + // if (count >= 1) { + // iconColor = Colors.grey; + // selectedFav = false; + // icon = Icons.favorite; + // selectedIndex.remove(index); + // } else { + // selectedIndex.add(index); + // if (selectedIndex.contains(index)) { + // iconColor = Colors.red; + // icon = Icons.favorite; + // selectedFav = true; + // } + // } + // } else { + // selectedIndex.add(index); + // if (selectedIndex.contains(index)) { + // iconColor = Colors.red; + // icon = Icons.favorite; + // selectedFav = true; + // } + // //} + // } + // }); + // }, + // child: Icon( + // icon, + // size: isTablet ? 20 : 18, + // color: selectedFav && selectedIndex.contains(index) + // ? iconColor + // : Colors.grey, + // ), + // style: OutlinedButton.styleFrom( + // shape: CircleBorder(), + // ), + // ), + // ), + // ), + ], + ), + ), + // ), + ], + ), + + // Image.asset( + // "assets/images/events2.jpg", + // fit: BoxFit.cover, + // ), + //), + // Divider( + // color: Colors.blueGrey, + // thickness: 2, + // height: 2, + // ), + + // SizedBox( + // height: 5, + // ), + // Text( + // 'Organizer: Hematology/Oncology Pharmacy Association (HOPA)', + // style: TextStyle( + // color: Colors.black, + // fontStyle: FontStyle.italic, + // fontFamily: "SourceSerif", + // fontSize: isTablet ? 18 : 14), + // maxLines: 2, + // softWrap: true, + // overflow: TextOverflow.ellipsis, + // ), + // SizedBox( + // // height: 100, + // child: Padding( + // padding: const EdgeInsets.symmetric(vertical: 4.0), + // child: Column( + // mainAxisAlignment: MainAxisAlignment.start, + // crossAxisAlignment: CrossAxisAlignment.start, + // children: [ + // Row( + // children: [], + // ), + + // RichText( + // text: TextSpan( + // children: [ + // WidgetSpan( + // child: SizedBox( + // width: 80, + // height: 18, + // child: WidgetStack( + // stackedWidgets: [ + // for (var n = 0; n < 5; n++) + // CircleAvatar( + // child: Icon( + // Icons.person, + // size: 14, + // color: Colors.blueGrey[300], + // )) + // ], + // positions: RestrictedPositions( + // maxCoverage: 0.3, + // minCoverage: 0.4, + // ), + // buildInfoWidget: (surplus) { + // return Center( + // child: Text( + // '+$surplus', + // style: Theme.of(context).textTheme.headline5, + // )); + // }, + // ), + // ), + // ), + // TextSpan( + // text: '5', + // style: TextStyle( + // color: Colors.black, + // fontFamily: "SourceSerif", + // fontSize: 16), + // ), + // TextSpan( + // text: ' attendees', + // style: TextStyle( + // color: Colors.black, + // fontFamily: "SourceSerif", + // fontSize: 14), + // ), + // ], + // ), + // ), + // RichText( + // text: TextSpan( + // children: [ + // WidgetSpan( + // child: SizedBox( + // width: 50, + // height: 18, + // child: WidgetStack( + // stackedWidgets: [ + // for (var n = 0; n < 3; n++) + // CircleAvatar( + // child: Icon( + // Icons.person, + // size: 14, + // color: Colors.blueGrey[300], + // )) + // ], + // positions: RestrictedPositions( + // maxCoverage: 0.3, + // minCoverage: 0.4, + // ), + // buildInfoWidget: (surplus) { + // return Center( + // child: Text( + // '+$surplus', + // style: Theme.of(context).textTheme.headline5, + // )); + // }, + // ), + // ), + // ), + // TextSpan( + // text: '3', + // style: TextStyle( + // color: Colors.black, + // fontFamily: "SourceSerif", + // fontSize: 16), + // ), + // TextSpan( + // text: ' client attendees', + // style: TextStyle( + // color: Colors.black, + // fontFamily: "SourceSerif", + // fontSize: 14), + // ), + // ], + // ), + // ), + // ], + // ), + // ), + // ), + // Row( + // children: [ + // SizedBox( + // height: 30, + // child: OutlinedButton( + // onPressed: () {}, + // child: Text('Add to My Events'), + // style: OutlinedButton.styleFrom( + // shape: StadiumBorder(), + // ), + // ), + // ), + // ], + // ) + // ], + // ), + ), + ); + } +} + +class ContestTabHeader extends SliverPersistentHeaderDelegate { + ContestTabHeader( + this.searchUI, + ); + final Widget searchUI; + + @override + Widget build( + BuildContext context, double shrinkOffset, bool overlapsContent) { + return Container(color: Colors.white, child: searchUI); + } + + @override + double get maxExtent => 52.0; + + @override + double get minExtent => 52.0; + + @override + bool shouldRebuild(SliverPersistentHeaderDelegate oldDelegate) { + return true; + } +} diff --git a/lib/view/insights.dart b/lib/view/insights.dart index 9264cee..13b763a 100644 --- a/lib/view/insights.dart +++ b/lib/view/insights.dart @@ -1,34 +1,23 @@ import 'dart:math'; import 'package:fl_chart/fl_chart.dart'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/widgets.dart'; import 'package:flutter_scatter/flutter_scatter.dart'; import 'package:konectar_events/model/affiliationsmodel.dart'; -import 'package:konectar_events/model/eventsdetailmodel.dart'; -import 'package:konectar_events/model/neweventsmodel.dart'; import 'package:konectar_events/model/specialtymodel.dart'; import 'package:konectar_events/utils/constants.dart'; -import 'package:konectar_events/utils/util.dart'; -import 'package:konectar_events/viewmodel/eventsprovider.dart'; import 'package:konectar_events/viewmodel/hcpprofprovider.dart'; import 'package:konectar_events/widgets/chartline.dart'; -import 'package:konectar_events/widgets/customappbar.dart'; -import 'package:konectar_events/widgets/customeventsappbar.dart'; -import 'package:konectar_events/widgets/flutter_hashtags.dart'; import 'package:konectar_events/widgets/piechart.dart'; import 'package:konectar_events/widgets/word_cloud.dart'; import 'package:provider/provider.dart'; -import 'package:word_cloud/word_cloud_data.dart'; -import 'package:word_cloud/word_cloud_view.dart'; class EventsInsights extends StatefulWidget { //EventsList eventsdetail; String eventid; List kFlutterHashtags = []; List specialtyList = []; - Affiliations affiliations; + List affiliations; EventsInsights( {super.key, required this.eventid, @@ -67,10 +56,14 @@ class _EventsInsightsState extends State { final screenSize = MediaQuery.of(context).size; final ratio = screenSize.width / (screenSize.height / 2); List affCountList = []; - for (var obj in widget.affiliations.affiliationCount) { - affCountList.add(int.parse(obj)); + int maximum = 0; + if (widget.affiliations.isNotEmpty) { + for (var obj in widget.affiliations) { + affCountList.add(int.parse(obj.orgCount!)); + } + maximum = affCountList.reduce(max); } - int maximum = affCountList.reduce(max); + return Consumer( builder: (BuildContext context, provider, Widget? child) { List widgets = []; @@ -121,28 +114,31 @@ class _EventsInsightsState extends State { // height: 20, // ), labelWidget("Topics Discussed"), - Card( - surfaceTintColor: Colors.white, - child: Container( - padding: EdgeInsets.all(2.0), - margin: EdgeInsets.all(2.0), - height: screenSize.height / 2, - width: screenSize.width, - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.all(Radius.circular(20))), - child: Center( - child: FittedBox( - child: Scatter( - fillGaps: true, - delegate: - ArchimedeanSpiralScatterDelegate(ratio: ratio), - children: widgets, + widgets.isNotEmpty + ? Card( + surfaceTintColor: Colors.white, + child: Container( + padding: EdgeInsets.all(2.0), + margin: EdgeInsets.all(2.0), + height: screenSize.height / 2, + width: screenSize.width, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: + BorderRadius.all(Radius.circular(20))), + child: Center( + child: FittedBox( + child: Scatter( + fillGaps: true, + delegate: ArchimedeanSpiralScatterDelegate( + ratio: ratio), + children: widgets, + ), + ), + ), ), - ), - ), - ), - ), + ) + : SizedBox.shrink(), SizedBox( height: 20, ), @@ -177,37 +173,38 @@ class _EventsInsightsState extends State { height: 20, ), labelWidget("Speaker counts by providers"), - Card( - surfaceTintColor: Colors.white, - child: Container( - padding: EdgeInsets.all(12.0), - // margin: EdgeInsets.all(10.0), - // height: screenSize.height / 3, - width: screenSize.width, - decoration: BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(20)), - color: Colors.white, - ), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: List.generate( - widget.affiliations.affiliationCount.length, - (index) { - return ChartLine( - title: - widget.affiliations.affiliationNames[index], - number: int.parse( - widget.affiliations.affiliationCount[index]), - rate: int.parse(widget.affiliations - .affiliationCount[index]) == - maximum - ? 1 - : int.parse(widget.affiliations - .affiliationCount[index]) / - maximum); - }), - )), - ), + widget.affiliations.isNotEmpty + ? Card( + surfaceTintColor: Colors.white, + child: Container( + padding: EdgeInsets.all(12.0), + // margin: EdgeInsets.all(10.0), + // height: screenSize.height / 3, + width: screenSize.width, + decoration: BoxDecoration( + borderRadius: + BorderRadius.all(Radius.circular(20)), + color: Colors.white, + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: List.generate( + widget.affiliations.length, (index) { + return ChartLine( + title: widget.affiliations[index].orgName!, + number: int.parse( + widget.affiliations[index].orgCount!), + rate: int.parse(widget.affiliations[index] + .orgCount!) == + maximum + ? 1 + : int.parse(widget.affiliations[index] + .orgCount!) / + maximum); + }), + )), + ) + : SizedBox.shrink(), SizedBox( height: 20, ), diff --git a/lib/view/login.dart b/lib/view/login.dart index bbd276f..a56a1cb 100644 --- a/lib/view/login.dart +++ b/lib/view/login.dart @@ -381,7 +381,7 @@ class _LoginScreenState extends State { return isloggedout; }); }); - await SessionManager().setLoggedIn(isloggedin); + // await SessionManager().setLoggedIn(isloggedin); // UserData userData = // UserData(email: email, name: token, domainUrl: domain, secretkey: key); // await provider.saveUserData(userData); diff --git a/lib/view/login_components/care_view.dart b/lib/view/login_components/care_view.dart new file mode 100644 index 0000000..80d3eb2 --- /dev/null +++ b/lib/view/login_components/care_view.dart @@ -0,0 +1,120 @@ +import 'package:flutter/material.dart'; + +class CareView extends StatelessWidget { + final AnimationController animationController; + + const CareView({Key? key, required this.animationController}) + : super(key: key); + + @override + Widget build(BuildContext context) { + final _firstHalfAnimation = + Tween(begin: Offset(1, 0), end: Offset(0, 0)) + .animate(CurvedAnimation( + parent: animationController, + curve: Interval( + 0.2, + 0.4, + curve: Curves.fastOutSlowIn, + ), + )); + final _secondHalfAnimation = + Tween(begin: Offset(0, 0), end: Offset(-1, 0)) + .animate(CurvedAnimation( + parent: animationController, + curve: Interval( + 0.4, + 0.6, + curve: Curves.fastOutSlowIn, + ), + )); + final _relaxFirstHalfAnimation = + Tween(begin: Offset(2, 0), end: Offset(0, 0)) + .animate(CurvedAnimation( + parent: animationController, + curve: Interval( + 0.2, + 0.4, + curve: Curves.fastOutSlowIn, + ), + )); + final _relaxSecondHalfAnimation = + Tween(begin: Offset(0, 0), end: Offset(-2, 0)) + .animate(CurvedAnimation( + parent: animationController, + curve: Interval( + 0.4, + 0.6, + curve: Curves.fastOutSlowIn, + ), + )); + + final _imageFirstHalfAnimation = + Tween(begin: Offset(4, 0), end: Offset(0, 0)) + .animate(CurvedAnimation( + parent: animationController, + curve: Interval( + 0.2, + 0.4, + curve: Curves.fastOutSlowIn, + ), + )); + final _imageSecondHalfAnimation = + Tween(begin: Offset(0, 0), end: Offset(-4, 0)) + .animate(CurvedAnimation( + parent: animationController, + curve: Interval( + 0.4, + 0.6, + curve: Curves.fastOutSlowIn, + ), + )); + + return SlideTransition( + position: _firstHalfAnimation, + child: SlideTransition( + position: _secondHalfAnimation, + child: Padding( + padding: const EdgeInsets.only(bottom: 100), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + SlideTransition( + position: _relaxFirstHalfAnimation, + child: SlideTransition( + position: _relaxSecondHalfAnimation, + child: Text( + "Track Events Everywhere", + style: + TextStyle(fontSize: 26.0, fontWeight: FontWeight.bold), + ), + ), + ), + Padding( + padding: + EdgeInsets.only(left: 64, right: 64, bottom: 16, top: 16), + child: Text( + "Available on your phone,tablet and laptop", + textAlign: TextAlign.center, + ), + ), + SlideTransition( + position: _imageFirstHalfAnimation, + child: SlideTransition( + position: _imageSecondHalfAnimation, + child: Container( + constraints: BoxConstraints(maxWidth: 350, maxHeight: 250), + child: Image.asset( + 'assets/introduction_animation/events3.jpg', + fit: BoxFit.contain, + ), + ), + ), + ), + ], + ), + ), + ), + ); + } +} diff --git a/lib/view/login_components/center_next_button.dart b/lib/view/login_components/center_next_button.dart new file mode 100644 index 0000000..9d9cc7f --- /dev/null +++ b/lib/view/login_components/center_next_button.dart @@ -0,0 +1,202 @@ +import 'package:animations/animations.dart'; +import 'package:flutter/material.dart'; + +class CenterNextButton extends StatelessWidget { + final AnimationController animationController; + final VoidCallback onNextClick; + const CenterNextButton( + {Key? key, required this.animationController, required this.onNextClick}) + : super(key: key); + + @override + Widget build(BuildContext context) { + final _topMoveAnimation = + Tween(begin: Offset(0, 5), end: Offset(0, 0)) + .animate(CurvedAnimation( + parent: animationController, + curve: Interval( + 0.0, + 0.2, + curve: Curves.fastOutSlowIn, + ), + )); + final _signUpMoveAnimation = + Tween(begin: 0, end: 1.0).animate(CurvedAnimation( + parent: animationController, + curve: Interval( + 0.6, + 0.8, + curve: Curves.fastOutSlowIn, + ), + )); + final _loginTextMoveAnimation = + Tween(begin: Offset(0, 5), end: Offset(0, 0)) + .animate(CurvedAnimation( + parent: animationController, + curve: Interval( + 0.6, + 0.8, + curve: Curves.fastOutSlowIn, + ), + )); + + return Padding( + padding: + EdgeInsets.only(bottom: 16 + MediaQuery.of(context).padding.bottom), + child: Column( + mainAxisAlignment: MainAxisAlignment.end, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + SlideTransition( + position: _topMoveAnimation, + child: AnimatedBuilder( + animation: animationController, + builder: (context, child) => AnimatedOpacity( + opacity: animationController.value >= 0.2 && + animationController.value <= 0.6 + ? 1 + : 0, + duration: Duration(milliseconds: 480), + child: _pageView(), + ), + ), + ), + SlideTransition( + position: _topMoveAnimation, + child: AnimatedBuilder( + animation: animationController, + builder: (context, child) => Padding( + padding: EdgeInsets.only( + bottom: 38 - (38 * _signUpMoveAnimation.value)), + child: Container( + height: 58, + width: 58 + (200 * _signUpMoveAnimation.value), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular( + 8 + 32 * (1 - _signUpMoveAnimation.value)), + color: Color(0xff132137), + ), + child: PageTransitionSwitcher( + duration: Duration(milliseconds: 480), + reverse: _signUpMoveAnimation.value < 0.7, + transitionBuilder: ( + Widget child, + Animation animation, + Animation secondaryAnimation, + ) { + return SharedAxisTransition( + fillColor: Colors.transparent, + child: child, + animation: animation, + secondaryAnimation: secondaryAnimation, + transitionType: SharedAxisTransitionType.vertical, + ); + }, + child: _signUpMoveAnimation.value > 0.7 + ? InkWell( + key: ValueKey('Sign Up button'), + onTap: onNextClick, + child: Padding( + padding: EdgeInsets.only(left: 16.0, right: 16.0), + child: Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Text( + 'Sign In', + style: TextStyle( + color: Colors.white, + fontSize: 18, + fontWeight: FontWeight.w500, + ), + ), + Icon(Icons.arrow_forward_rounded, + color: Colors.white), + ], + ), + ), + ) + : InkWell( + key: ValueKey('next button'), + onTap: onNextClick, + child: Padding( + padding: EdgeInsets.all(16.0), + child: Icon(Icons.arrow_forward_ios_rounded, + color: Colors.white), + ), + ), + ), + ), + ), + ), + ), + Padding( + padding: const EdgeInsets.only(top: 8), + child: SlideTransition( + position: _loginTextMoveAnimation, + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + 'Already have an account? ', + style: TextStyle( + color: Colors.grey, + fontSize: 14, + fontWeight: FontWeight.normal, + ), + ), + Text( + 'Login', + style: TextStyle( + color: Color(0xff132137), + fontSize: 16, + fontWeight: FontWeight.bold, + ), + ), + ], + ), + ), + ), + ], + ), + ); + } + + Widget _pageView() { + int _selectedIndex = 0; + + if (animationController.value >= 0.7) { + _selectedIndex = 3; + } else if (animationController.value >= 0.5) { + _selectedIndex = 2; + } else if (animationController.value >= 0.3) { + _selectedIndex = 1; + } else if (animationController.value >= 0.1) { + _selectedIndex = 0; + } + + return Padding( + padding: const EdgeInsets.only(bottom: 16), + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + for (var i = 0; i < 4; i++) + Padding( + padding: const EdgeInsets.all(4), + child: AnimatedContainer( + duration: Duration(milliseconds: 480), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(32), + color: _selectedIndex == i + ? Color(0xff132137) + : Color(0xffE3E4E4), + ), + width: 10, + height: 10, + ), + ) + ], + ), + ); + } +} diff --git a/lib/view/login_components/homescreen.dart b/lib/view/login_components/homescreen.dart new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/lib/view/login_components/homescreen.dart @@ -0,0 +1 @@ + diff --git a/lib/view/login_components/intropaging.dart b/lib/view/login_components/intropaging.dart new file mode 100644 index 0000000..89cbcef --- /dev/null +++ b/lib/view/login_components/intropaging.dart @@ -0,0 +1,137 @@ +import 'package:flutter/material.dart'; +import 'package:konectar_events/utils/constants.dart'; +import 'package:konectar_events/view/login.dart'; +import 'package:konectar_events/view/login_components/care_view.dart'; +import 'package:konectar_events/view/login_components/center_next_button.dart'; +import 'package:konectar_events/view/login_components/mood_diary_vew.dart'; +import 'package:konectar_events/view/login_components/relax_view.dart'; +import 'package:konectar_events/view/login_components/splash_view.dart'; +import 'package:konectar_events/view/login_components/top_back_skip_view.dart'; +import 'package:konectar_events/view/login_components/welcome_view.dart'; +import 'package:konectar_events/view/navigation_home_screen.dart'; + +class IntroductionAnimationScreen extends StatefulWidget { + const IntroductionAnimationScreen({Key? key}) : super(key: key); + + @override + _IntroductionAnimationScreenState createState() => + _IntroductionAnimationScreenState(); +} + +class _IntroductionAnimationScreenState + extends State with TickerProviderStateMixin { + AnimationController? _animationController; + + @override + void initState() { + _animationController = + AnimationController(vsync: this, duration: Duration(seconds: 8)); + _animationController?.animateTo(0.2); + super.initState(); + } + + @override + void dispose() { + _animationController?.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + print(_animationController?.value); + return Scaffold( + appBar: AppBar( + backgroundColor: EventsConstants.bgcolor, + title: Container( + // constraints: BoxConstraints(maxWidth: 350, maxHeight: 350), + child: Image.asset( + 'assets/introduction_animation/introduction_image1.png', + fit: BoxFit.contain, + ), + ), + centerTitle: true, + ), + backgroundColor: EventsConstants.bgcolor, + body: ClipRect( + child: Stack( + children: [ + // SplashView( + // animationController: _animationController!, + // ), + CareView( + animationController: _animationController!, + ), + RelaxView( + animationController: _animationController!, + ), + CareView( + animationController: _animationController!, + ), + // MoodDiaryVew( + // animationController: _animationController!, + // ), + WelcomeView( + animationController: _animationController!, + ), + TopBackSkipView( + onBackClick: _onBackClick, + onSkipClick: _onSkipClick, + animationController: _animationController!, + ), + CenterNextButton( + animationController: _animationController!, + onNextClick: _onNextClick, + ), + ], + ), + ), + ); + } + + void _onSkipClick() { + _animationController?.animateTo(0.8, + duration: Duration(milliseconds: 1200)); + } + + void _onBackClick() { + // if (_animationController!.value >= 0 && + // _animationController!.value <= 0.2) { + // _animationController?.animateTo(0.0); + // } else + if (_animationController!.value > 0.2 && + _animationController!.value <= 0.4) { + _animationController?.animateTo(0.2); + } else if (_animationController!.value > 0.4 && + _animationController!.value <= 0.6) { + _animationController?.animateTo(0.4); + } else if (_animationController!.value > 0.6 && + _animationController!.value <= 0.8) { + _animationController?.animateTo(0.6); + } else if (_animationController!.value > 0.8 && + _animationController!.value <= 1.0) { + _animationController?.animateTo(0.8); + } + } + + void _onNextClick() { + if (_animationController!.value >= 0 && + _animationController!.value <= 0.2) { + _animationController?.animateTo(0.4); + } else if (_animationController!.value > 0.2 && + _animationController!.value <= 0.4) { + _animationController?.animateTo(0.6); + } else if (_animationController!.value > 0.4 && + _animationController!.value <= 0.6) { + _animationController?.animateTo(0.8); + } else if (_animationController!.value > 0.6 && + _animationController!.value <= 0.8) { + _signUpClick(); + } + } + + void _signUpClick() { + Navigator.of(context).pushReplacement( + MaterialPageRoute(builder: (context) => NavigationHomeScreen()), + ); + } +} diff --git a/lib/view/login_components/mood_diary_vew.dart b/lib/view/login_components/mood_diary_vew.dart new file mode 100644 index 0000000..207657c --- /dev/null +++ b/lib/view/login_components/mood_diary_vew.dart @@ -0,0 +1,119 @@ +import 'package:flutter/material.dart'; + +class MoodDiaryVew extends StatelessWidget { + final AnimationController animationController; + + const MoodDiaryVew({Key? key, required this.animationController}) + : super(key: key); + + @override + Widget build(BuildContext context) { + final _firstHalfAnimation = + Tween(begin: Offset(1, 0), end: Offset(0, 0)) + .animate(CurvedAnimation( + parent: animationController, + curve: Interval( + 0.4, + 0.6, + curve: Curves.fastOutSlowIn, + ), + )); + final _secondHalfAnimation = + Tween(begin: Offset(0, 0), end: Offset(-1, 0)) + .animate(CurvedAnimation( + parent: animationController, + curve: Interval( + 0.6, + 0.8, + curve: Curves.fastOutSlowIn, + ), + )); + + final _moodFirstHalfAnimation = + Tween(begin: Offset(2, 0), end: Offset(0, 0)) + .animate(CurvedAnimation( + parent: animationController, + curve: Interval( + 0.4, + 0.6, + curve: Curves.fastOutSlowIn, + ), + )); + final _moodSecondHalfAnimation = + Tween(begin: Offset(0, 0), end: Offset(-2, 0)) + .animate(CurvedAnimation( + parent: animationController, + curve: Interval( + 0.6, + 0.8, + curve: Curves.fastOutSlowIn, + ), + )); + final _imageFirstHalfAnimation = + Tween(begin: Offset(4, 0), end: Offset(0, 0)) + .animate(CurvedAnimation( + parent: animationController, + curve: Interval( + 0.4, + 0.6, + curve: Curves.fastOutSlowIn, + ), + )); + final _imageSecondHalfAnimation = + Tween(begin: Offset(0, 0), end: Offset(-4, 0)) + .animate(CurvedAnimation( + parent: animationController, + curve: Interval( + 0.6, + 0.8, + curve: Curves.fastOutSlowIn, + ), + )); + + return SlideTransition( + position: _firstHalfAnimation, + child: SlideTransition( + position: _secondHalfAnimation, + child: Padding( + padding: const EdgeInsets.only(bottom: 100), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + "Mood Dairy", + style: TextStyle(fontSize: 26.0, fontWeight: FontWeight.bold), + ), + SlideTransition( + position: _moodFirstHalfAnimation, + child: SlideTransition( + position: _moodSecondHalfAnimation, + child: Padding( + padding: EdgeInsets.only( + left: 64, right: 64, top: 16, bottom: 16), + child: Text( + "Lorem ipsum dolor sit amet,consectetur adipiscing elit,sed do eiusmod tempor incididunt ut labore", + textAlign: TextAlign.center, + ), + ), + ), + ), + SlideTransition( + position: _imageFirstHalfAnimation, + child: SlideTransition( + position: _imageSecondHalfAnimation, + child: Container( + constraints: BoxConstraints(maxWidth: 350, maxHeight: 250), + child: Image.asset( + 'assets/introduction_animation/mood_dairy_image.png', + fit: BoxFit.contain, + ), + ), + ), + ), + ], + ), + ), + ), + ); + } +} diff --git a/lib/view/login_components/relax_view.dart b/lib/view/login_components/relax_view.dart new file mode 100644 index 0000000..fa7a796 --- /dev/null +++ b/lib/view/login_components/relax_view.dart @@ -0,0 +1,120 @@ +import 'package:flutter/material.dart'; + +class RelaxView extends StatelessWidget { + final AnimationController animationController; + + const RelaxView({Key? key, required this.animationController}) + : super(key: key); + + @override + Widget build(BuildContext context) { + final _firstHalfAnimation = + Tween(begin: Offset(0, 1), end: Offset(0, 0)).animate( + CurvedAnimation( + parent: animationController, + curve: Interval( + 0.0, + 0.2, + curve: Curves.fastOutSlowIn, + ), + ), + ); + final _secondHalfAnimation = + Tween(begin: Offset(0, 0), end: Offset(-1, 0)).animate( + CurvedAnimation( + parent: animationController, + curve: Interval( + 0.2, + 0.4, + curve: Curves.fastOutSlowIn, + ), + ), + ); + final _textAnimation = + Tween(begin: Offset(0, 0), end: Offset(-2, 0)).animate( + CurvedAnimation( + parent: animationController, + curve: Interval( + 0.2, + 0.4, + curve: Curves.fastOutSlowIn, + ), + ), + ); + final _imageAnimation = + Tween(begin: Offset(0, 0), end: Offset(-4, 0)).animate( + CurvedAnimation( + parent: animationController, + curve: Interval( + 0.2, + 0.4, + curve: Curves.fastOutSlowIn, + ), + ), + ); + + final _relaxAnimation = + Tween(begin: Offset(0, -2), end: Offset(0, 0)).animate( + CurvedAnimation( + parent: animationController, + curve: Interval( + 0.0, + 0.2, + curve: Curves.fastOutSlowIn, + ), + ), + ); + return SlideTransition( + position: _firstHalfAnimation, + child: SlideTransition( + position: _secondHalfAnimation, + child: Padding( + padding: const EdgeInsets.only(bottom: 100), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + // SlideTransition( + // position: _relaxAnimation, + // child: Container( + // constraints: BoxConstraints(maxWidth: 350, maxHeight: 350), + // child: Image.asset( + // 'assets/introduction_animation/introduction_image1.png', + // fit: BoxFit.contain, + // ), + // ), + // ), + SlideTransition( + position: _relaxAnimation, + child: Text( + "There's a plan for every event ", + style: TextStyle(fontSize: 26.0, fontWeight: FontWeight.bold), + ), + ), + SlideTransition( + position: _textAnimation, + child: Padding( + padding: + EdgeInsets.only(left: 64, right: 64, top: 16, bottom: 16), + child: Text( + "Single solution for more impactful event experience", + textAlign: TextAlign.center, + ), + ), + ), + SlideTransition( + position: _imageAnimation, + child: Container( + constraints: BoxConstraints(maxWidth: 350, maxHeight: 250), + child: Image.asset( + 'assets/introduction_animation/events3.jpg', + fit: BoxFit.contain, + ), + ), + ), + ], + ), + ), + ), + ); + } +} diff --git a/lib/view/login_components/slidesview.dart b/lib/view/login_components/slidesview.dart new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/lib/view/login_components/slidesview.dart @@ -0,0 +1 @@ + diff --git a/lib/view/login_components/splash_view.dart b/lib/view/login_components/splash_view.dart new file mode 100644 index 0000000..db5d6f4 --- /dev/null +++ b/lib/view/login_components/splash_view.dart @@ -0,0 +1,105 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +class SplashView extends StatefulWidget { + final AnimationController animationController; + + const SplashView({Key? key, required this.animationController}) + : super(key: key); + + @override + _SplashViewState createState() => _SplashViewState(); +} + +class _SplashViewState extends State { + @override + Widget build(BuildContext context) { + final _introductionanimation = + Tween(begin: Offset(0, 0), end: Offset(0.0, -1.0)) + .animate(CurvedAnimation( + parent: widget.animationController, + curve: Interval( + 0.0, + 0.2, + curve: Curves.fastOutSlowIn, + ), + )); + return SlideTransition( + position: _introductionanimation, + child: SingleChildScrollView( + child: Padding( + padding: const EdgeInsets.only(bottom: 100.0), + child: Column( + children: [ + SizedBox( + height: 40, + ), + // Padding( + // padding: EdgeInsets.all(8.0), + // child: SizedBox( + // //width: MediaQuery.of(context).size.width, + // child: Image.asset( + // 'assets/introduction_animation/introduction_image1.png', + // fit: BoxFit.cover, + // ), + // ), + // ), + SizedBox( + height: 80, + ), + Padding( + padding: EdgeInsets.only(top: 8.0, bottom: 8.0), + child: Text( + "Track Events Everywhere", + style: TextStyle(fontSize: 25.0, fontWeight: FontWeight.bold), + ), + ), + Align( + alignment: Alignment.bottomCenter, + child: Padding( + padding: EdgeInsets.only(left: 64, right: 64), + child: Text( + "Available on your phone,tablet and laptop", + textAlign: TextAlign.center, + ), + ), + ), + SizedBox( + height: 100, + ), + Padding( + padding: EdgeInsets.only( + bottom: MediaQuery.of(context).padding.bottom), + child: InkWell( + onTap: () { + widget.animationController.animateTo(0.2); + }, + child: Container( + height: 58, + padding: EdgeInsets.only( + left: 56.0, + right: 56.0, + top: 16, + bottom: 16, + ), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(38.0), + color: Color(0xff132137), + ), + child: Text( + "Let's begin", + style: TextStyle( + fontSize: 18, + color: Colors.white, + ), + ), + ), + ), + ), + ], + ), + ), + ), + ); + } +} diff --git a/lib/view/login_components/top_back_skip_view.dart b/lib/view/login_components/top_back_skip_view.dart new file mode 100644 index 0000000..5afde6f --- /dev/null +++ b/lib/view/login_components/top_back_skip_view.dart @@ -0,0 +1,81 @@ +import 'package:flutter/material.dart'; + +class TopBackSkipView extends StatelessWidget { + final AnimationController animationController; + final VoidCallback onBackClick; + final VoidCallback onSkipClick; + + const TopBackSkipView({ + Key? key, + required this.onBackClick, + required this.onSkipClick, + required this.animationController, + }) : super(key: key); + + @override + Widget build(BuildContext context) { + final _animation = + Tween(begin: Offset(0, -1), end: Offset(0.0, 0.0)) + .animate(CurvedAnimation( + parent: animationController, + curve: Interval( + 0.0, + 0.2, + curve: Curves.fastOutSlowIn, + ), + )); + + // final _backAnimation = + // Tween(begin: Offset(0, 0), end: Offset(-2, 0)) + // .animate(CurvedAnimation( + // parent: animationController, + // curve: Interval( + // 0.6, + // 0.8, + // curve: Curves.fastOutSlowIn, + // ), + // )); + final _skipAnimation = Tween(begin: Offset(0, 0), end: Offset(2, 0)) + .animate(CurvedAnimation( + parent: animationController, + curve: Interval( + 0.6, + 0.8, + curve: Curves.fastOutSlowIn, + ), + )); + + return SlideTransition( + position: _animation, + child: Padding( + padding: EdgeInsets.only(top: MediaQuery.of(context).padding.top), + child: Container( + height: 58, + child: Padding( + padding: const EdgeInsets.only(left: 8, right: 16), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + // SlideTransition( + // position: _backAnimation, + // child: + IconButton( + onPressed: onBackClick, + icon: Icon(Icons.arrow_back_ios_new_rounded), + // ), + ), + SlideTransition( + position: _skipAnimation, + child: IconButton( + onPressed: onSkipClick, + icon: Text('Skip'), + ), + ), + ], + ), + ), + ), + ), + ); + } +} diff --git a/lib/view/login_components/welcome_view.dart b/lib/view/login_components/welcome_view.dart new file mode 100644 index 0000000..649ed25 --- /dev/null +++ b/lib/view/login_components/welcome_view.dart @@ -0,0 +1,97 @@ +import 'package:flutter/material.dart'; + +class WelcomeView extends StatelessWidget { + final AnimationController animationController; + const WelcomeView({Key? key, required this.animationController}) + : super(key: key); + + @override + Widget build(BuildContext context) { + final _firstHalfAnimation = + Tween(begin: Offset(1, 0), end: Offset(0, 0)).animate( + CurvedAnimation( + parent: animationController, + curve: Interval( + 0.6, + 0.8, + curve: Curves.fastOutSlowIn, + ), + ), + ); + final _secondHalfAnimation = + Tween(begin: Offset(0, 0), end: Offset(-1, 0)).animate( + CurvedAnimation( + parent: animationController, + curve: Interval( + 0.8, + 1.0, + curve: Curves.fastOutSlowIn, + ), + ), + ); + + final _welcomeFirstHalfAnimation = + Tween(begin: Offset(2, 0), end: Offset(0, 0)) + .animate(CurvedAnimation( + parent: animationController, + curve: Interval( + 0.6, + 0.8, + curve: Curves.fastOutSlowIn, + ), + )); + + final _welcomeImageAnimation = + Tween(begin: Offset(4, 0), end: Offset(0, 0)) + .animate(CurvedAnimation( + parent: animationController, + curve: Interval( + 0.6, + 0.8, + curve: Curves.fastOutSlowIn, + ), + )); + return SlideTransition( + position: _firstHalfAnimation, + child: SlideTransition( + position: _secondHalfAnimation, + child: Padding( + padding: const EdgeInsets.only(bottom: 100), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + // SlideTransition( + // position: _welcomeFirstHalfAnimation, + // child: Container( + // constraints: BoxConstraints(maxWidth: 350, maxHeight: 350), + // child: Image.asset( + // 'assets/introduction_animation/introduction_image1.png', + // fit: BoxFit.contain, + // ), + // ), + // ), + SizedBox( + height: 50, + ), + SlideTransition( + position: _welcomeFirstHalfAnimation, + child: Text( + "Welcome", + style: TextStyle(fontSize: 25.0, fontWeight: FontWeight.bold), + ), + ), + Padding( + padding: + EdgeInsets.only(left: 64, right: 64, top: 16, bottom: 16), + child: Text( + "HCP Management Platform Aissel's Cutting-Edge Product Solutions", + textAlign: TextAlign.center, + ), + ), + ], + ), + ), + ), + ); + } +} diff --git a/lib/view/navigation_home_screen.dart b/lib/view/navigation_home_screen.dart index 52c1068..77ba8b6 100644 --- a/lib/view/navigation_home_screen.dart +++ b/lib/view/navigation_home_screen.dart @@ -1,6 +1,7 @@ import 'package:flutter/material.dart'; import 'package:konectar_events/contacts_module/ui_screen/new_contacts.dart'; import 'package:konectar_events/utils/app_theme.dart'; +import 'package:konectar_events/view/helpdesk.dart'; import 'package:konectar_events/view/home.dart'; import 'package:konectar_events/widgets/drawerusercontroller.dart'; import 'package:konectar_events/widgets/home_drawer.dart'; @@ -61,7 +62,7 @@ class _NavigationHomeScreenState extends State { break; case DrawerIndex.FeedBack: setState(() { - screenView = HomeScreen(); + screenView = HelpDeskScreen(); }); break; case DrawerIndex.Invite: diff --git a/lib/view/profileview.dart b/lib/view/profileview.dart index 8cc0a79..bc1b9fc 100644 --- a/lib/view/profileview.dart +++ b/lib/view/profileview.dart @@ -6,7 +6,16 @@ import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; import 'package:flutter/widgets.dart'; import 'package:intl/intl.dart'; +import 'package:konectar_events/contacts_module/model_class/speaker.dart'; +import 'package:konectar_events/contacts_module/ui_screen/interactionform/configprovider.dart'; +import 'package:konectar_events/contacts_module/ui_screen/interactionform/interactionlistscreen.dart'; +import 'package:konectar_events/contacts_module/ui_screen/interactionform/interactionprovider.dart'; +import 'package:konectar_events/contacts_module/ui_screen/interactionform/new_dynamicform.dart'; +import 'package:konectar_events/contacts_module/ui_screen/interactionform/viewinteractionprovider.dart'; +import 'package:konectar_events/contacts_module/ui_screen/new_editinteraction.dart'; +import 'package:konectar_events/contacts_module/ui_screen/new_viewinteraction.dart'; import 'package:konectar_events/model/eventsdetailmodel.dart'; +import 'package:konectar_events/model/eventspeakers.dart'; import 'package:konectar_events/model/sessionnotesmodel.dart'; import 'package:konectar_events/utils/constants.dart'; import 'package:konectar_events/utils/dateformater.dart'; @@ -16,7 +25,7 @@ import 'package:konectar_events/widgets/customdropdown.dart'; import 'package:provider/provider.dart'; class HCPProfileScreen extends StatefulWidget { - Eventsdetail eventsdetail; + SpeakersList eventsdetail; String eventid; String title; HCPProfileScreen( @@ -151,8 +160,19 @@ class _HCPProfileScreenState extends State { init() async { await Provider.of(context, listen: false) .getSessionData(); - await Provider.of(context, listen: false) - .getCounts(widget.eventsdetail); + // await Provider.of(context, listen: false) + // .getCounts(widget.eventsdetail); + + await Provider.of(context, listen: false) + .initConfigData(); + + await Provider.of(context, listen: false).getRecords(); + String formname = Provider.of(context, listen: false) + .intConfigDataList[0] + .name; + + await Provider.of(context, listen: false) + .getRecords(formname, hcp: widget.eventsdetail.hcpFullName); setState(() {}); } @@ -290,7 +310,7 @@ class _HCPProfileScreenState extends State { }); } - buildprofile(BuildContext context, Eventsdetail eventsdetail, String title) { + buildprofile(BuildContext context, SpeakersList eventsdetail, String title) { MediaQuery.of(context).size.height * 0.35; return Container( @@ -323,7 +343,7 @@ class _HCPProfileScreenState extends State { SizedBox( height: 15, ), - Text(eventsdetail.kolFullName!, + Text(eventsdetail.hcpFullName!, style: TextStyle( fontSize: 20, // fontFamily: "SourceSerif", @@ -335,7 +355,7 @@ class _HCPProfileScreenState extends State { // // fontFamily: "SourceSerif", // )), Text( - "${eventsdetail.orgName ?? ""} ${eventsdetail.country ?? ""} ${eventsdetail.city ?? ""}", + "${eventsdetail.organization ?? ""} ${eventsdetail.countryName ?? ""} ${eventsdetail.cityName ?? ""}", softWrap: true, maxLines: 2, textAlign: TextAlign.center, @@ -409,7 +429,7 @@ class _HCPProfileScreenState extends State { )); } - Widget buildCardView(BuildContext context, Eventsdetail eventsdetail, + Widget buildCardView(BuildContext context, SpeakersList eventsdetail, HcpProfileProvider provider) { return Container( // color: Constants.bgcolor, @@ -419,7 +439,7 @@ class _HCPProfileScreenState extends State { // title: eventsdetail.kolFullName!, // eventsdetail: eventsdetail, // ), - buildprofile(context, eventsdetail, eventsdetail.kolFullName!), + buildprofile(context, eventsdetail, eventsdetail.hcpFullName!), // Padding( // padding: const EdgeInsets.all(8.0), // child: Column( @@ -519,8 +539,9 @@ class _HCPProfileScreenState extends State { // const Spacer(), Center( child: _ProfileInfoRow(items: [ - ProfileInfoItem("Topic(s)", provider.totalTopics), - ProfileInfoItem("Session(s)", provider.totalSessions), + ProfileInfoItem("Topic(s)", widget.eventsdetail.topics!.length), + ProfileInfoItem( + "Session(s)", widget.eventsdetail.sessionNames!.length), ProfileInfoItem("Note(s)", provider.totalNotes), ])), // SizedBox( @@ -531,9 +552,9 @@ class _HCPProfileScreenState extends State { ); } - Widget sessionNotes(BuildContext context, Eventsdetail eventsdetail, + Widget sessionNotes(BuildContext context, SpeakersList eventsdetail, HcpProfileProvider provider) { - sessionList = eventsdetail.sessionName!.split(","); + sessionList = eventsdetail.sessionNames!; return Container( color: EventsConstants.bgcolor, child: Column( @@ -604,13 +625,13 @@ class _HCPProfileScreenState extends State { .add("${_selectedFruit} \n\n ${notesController.text}"); // }); print( - " eventid:${widget.eventid},hcp:${widget.eventsdetail.kolId}"); + " eventid:${widget.eventid},hcp:${widget.eventsdetail.uniqueId}"); SessionNotesModel notesModel = SessionNotesModel( notes: notesController.text, addedBy: "user", addedDate: CustomDateFormatter().formatDate(), eventid: widget.eventid, - hcpid: widget.eventsdetail.kolId, + hcpid: widget.eventsdetail.uniqueId, selectedSession: _selectedFruit); print( "${notesModel.addedBy},${notesModel.notes},${notesModel.addedDate},${notesModel.eventid},${notesModel.hcpid},${notesModel.selectedSession}"); @@ -723,9 +744,9 @@ class _HCPProfileScreenState extends State { ); } - Widget topicsTab(Eventsdetail eventsdetail) { - print("${eventsdetail.sessionName!.split(",").length} @@@lengtg"); - List sessions = eventsdetail.sessionName!.split(","); + Widget topicsTab(SpeakersList eventsdetail) { + print("${eventsdetail.sessionNames!.join(",").length} @@@lengtg"); + List sessions = eventsdetail.sessionNames!; return Container( width: double.maxFinite, padding: EdgeInsets.only(left: 8), @@ -737,7 +758,7 @@ class _HCPProfileScreenState extends State { padding: EdgeInsets.only(top: 10.0, left: 4.0), itemCount: sessions.length, itemBuilder: (context, index) { - List topics = eventsdetail.eventTopics!.split("|"); + List topics = eventsdetail.topics!; return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -856,25 +877,156 @@ class _HCPProfileScreenState extends State { } Widget medicalInsights() { - return Container( - color: EventsConstants.bgcolor, - child: Center( - child: FloatingActionButton.extended( - backgroundColor: Colors.green, - onPressed: () {}, - heroTag: 'medicalinsights', - elevation: 0, - label: const Text("Add Medical Insights", - style: TextStyle( - color: Colors.white, - )), - icon: const Icon( - Icons.add, - color: Colors.white, - ), + return Consumer( + builder: (BuildContext context, provider, Widget? child) { + return Container( + color: EventsConstants.bgcolor, + child: Column( + children: [ + SizedBox( + height: 20, + ), + Center( + child: FloatingActionButton.extended( + backgroundColor: Colors.green, + onPressed: () async { + final ConfigDataProvider configDataProvider = + ConfigDataProvider(); + + await configDataProvider.initConfigUIDataMediccalInsight(); + await Provider.of(context, listen: false) + .initConfigData(); + + Navigator.push( + context, + MaterialPageRoute( + builder: (BuildContext context) => InteractionScreen1( + index: 0, + form: Provider.of(context, + listen: false) + .intConfigDataList[0] + .name, + title: "${widget.eventsdetail.hcpFullName}", + ))); + // Navigator.push( + // context, + // MaterialPageRoute( + // builder: (context) => const InteractionListScreen())); + }, + heroTag: 'medicalinsights', + elevation: 0, + label: const Text("Add Medical Insights", + style: TextStyle( + color: Colors.white, + )), + icon: const Icon( + Icons.add, + color: Colors.white, + ), + ), + ), + SizedBox( + height: 20, + ), + provider.savedList.isEmpty + ? SizedBox.shrink() + : ListView.builder( + itemCount: provider.savedList.length, + shrinkWrap: true, + cacheExtent: + double.parse(provider.savedList.length.toString()), + itemBuilder: (context, index) { + return Column( + children: [ + ListTile( + subtitle: Text( + 'Updated on ${CustomDateFormatter().convertDateTimeToDate(provider.savedList[index].updatedTime!)}', + //style: TextStyle(fontStyle: FontStyle.italic), + ), + title: Text( + provider.savedList[index].id, + ), + trailing: SizedBox( + width: 100, + child: Row(children: [ + IconButton( + onPressed: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (BuildContext context) => + ViewInteractionScreen1( + saveInteraction: + provider.savedList[index], + ))); + }, + icon: const Icon( + Icons.info_outline, + size: 24, + color: Color.fromARGB(255, 8, 39, 92), + ), + ), + IconButton( + onPressed: () async { + await provider.initConfigData().then({ + // Navigator.push( + // context, + // MaterialPageRoute( + // builder: (BuildContext context) => + // EditInteractionScreen( + // saveInteraction: provider + // .savedList[index], + // ))) + Navigator.push( + context, + MaterialPageRoute( + builder: (BuildContext context) => + EditInteractionScreen1( + saveInteraction: provider + .savedList[index], + ))) + }); + }, + icon: const Icon( + Icons.edit, + size: 24, + color: Color.fromARGB(255, 8, 39, 92), + ), + ), + // IconButton( + // onPressed: () { + // showDeleteRecordAlertDialog( + // context, + // provider.savedList[index].id, + // provider.savedList[index]); + // }, + // icon: const Icon( + // Icons.delete, + // size: 24, + // color: Color.fromARGB(255, 8, 39, 92), + // ), + // ), + ]), + ), + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (BuildContext context) => + ViewInteractionScreen1( + saveInteraction: + provider.savedList[index], + ))); + }, + ), + const Divider(), + ], + ); + }), + ], ), - ), - ); + ); + }); } } diff --git a/lib/viewmodel/eventsprovider.dart b/lib/viewmodel/eventsprovider.dart index 741c622..19c11af 100644 --- a/lib/viewmodel/eventsprovider.dart +++ b/lib/viewmodel/eventsprovider.dart @@ -1,13 +1,19 @@ import 'dart:async'; import 'dart:math'; +import 'package:connectivity_plus/connectivity_plus.dart'; import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; import 'package:hive_flutter/hive_flutter.dart'; +import 'package:konectar_events/contacts_module/model_class/k2_api_model/kol_event_k2.dart'; import 'package:konectar_events/model/affiliationsmodel.dart'; +import 'package:konectar_events/model/events_list_resp_2.dart'; import 'package:konectar_events/model/eventsdetailmodel.dart'; import 'package:konectar_events/model/eventsmodel.dart'; import 'package:konectar_events/model/eventsoverview.dart'; +import 'package:konectar_events/model/eventspeakers.dart'; import 'package:konectar_events/model/keywords_model.dart'; +import 'package:konectar_events/model/my_events_list_model.dart'; import 'package:konectar_events/model/neweventsmodel.dart'; import 'package:konectar_events/model/scope_model.dart'; import 'package:konectar_events/model/sessionnotesmodel.dart'; @@ -21,43 +27,54 @@ class EventsProvider extends ChangeNotifier { List keywordList = []; List therapeuticList = []; List eventList = []; + List neweventList = []; List searchList = []; List myEvents = []; + List offlineEvents = []; List eventdetailList = []; List srcheventdetailList = []; List selectedTherapeutic = []; List addedSessionNotes = []; + List speakersList = []; + List myEventids = []; + bool showCheckbox = false; + bool offlineExists = false; int eventSessionCount = 0; String message = ""; + int speakercount = 0; late Box box; + // late Box myeventsbox; late Box sessionBox; bool isAllSelected = true; - bool isFavSeleted = false; + bool isFavSeleted = true; bool isSearch = false; bool isSearchSpeakers = false; List kFlutterHashtags = []; List topics = []; List specialtyList = []; OverviewData? overviewData; - Affiliations affiliations = - Affiliations(affiliationCount: [], affiliationNames: []); + List affiliations = []; - onSelectAll() async { - // isFavSeleted = false; - // isAllSelected = !isAllSelected; - eventList = await getEvents(); + late StreamSubscription> connectivitySubscription; + + Future onSelectAll(int page) async { + isFavSeleted = false; + isAllSelected = !isAllSelected; + eventList = await getEvents(page); notifyListeners(); } - onSelectMy() async { - // isFavSeleted = !isFavSeleted; - eventList = await getMyEventsData(); + Future onSelectMy() async { + isFavSeleted = !isFavSeleted; + eventList = []; + eventList = await getMyEvents(1); notifyListeners(); } - OnSearch(String searchtxt) { + OnSearch(String searchtxt) async { + print("Searching......."); // searchtxt = searchtxt.toLowerCase(); isSearch = true; if (isFavSeleted) { @@ -71,25 +88,45 @@ class EventsProvider extends ChangeNotifier { // element.country!.toLowerCase().contains(searchtxt))) .toList(); } else { - searchList = eventList - .where((element) => element.name1!.toLowerCase().contains(searchtxt)) - // element.city!.toLowerCase().contains(searchtxt) || - // element.region!.toLowerCase().contains(searchtxt) || - // element.country!.toLowerCase().contains(searchtxt)) - .toList(); + eventList = + await ApiCall().getSearchedEventsFromK2(1, "event_name", searchtxt); + // searchList = eventList + // .where((element) => element.name1!.toLowerCase().contains(searchtxt)) + // // element.city!.toLowerCase().contains(searchtxt) || + // // element.region!.toLowerCase().contains(searchtxt) || + // // element.country!.toLowerCase().contains(searchtxt)) + // .toList(); } print("###$searchList@@@"); notifyListeners(); } - getSessionCount() { + bool ifOfflineExists(String eventid) { + if (offlineEvents.isNotEmpty) { + offlineEvents.forEach( + (element) { + if (element.eventId == eventid) { + offlineExists = true; + } else { + offlineExists = false; + } + }, + ); + } + + return offlineExists; + } + + Future getSessionCount(String eventid, String event_unique_id) async { List sessions = []; eventSessionCount = 0; - for (var obj in eventdetailList) { - sessions.addAll(obj.sessionName!.split(',')); - - eventSessionCount += int.parse(obj.numSess ?? "0"); + Map data = + (await ApiCall().getSpeakersFromK2(0, eventid, event_unique_id)); + speakercount = data["count"]; + List speakersList = data["list"]; + for (var obj in speakersList) { + sessions.addAll(obj.sessionNames!); } print("Count ${sessions.toSet().toList().length}"); print("Count2 ${sessions.toList().length}"); @@ -118,9 +155,9 @@ class EventsProvider extends ChangeNotifier { onFilterReset() async { if (isFavSeleted) { - eventList = await getMyEventsData(); + myEvents = await getMyEvents(1); } else { - eventList = await getEvents(); + eventList = await getEvents(1); } isSearch = false; @@ -131,9 +168,9 @@ class EventsProvider extends ChangeNotifier { onSearchReset() async { if (isFavSeleted) { - eventList = await getMyEventsData(); + myEvents = await getMyEvents(1); } else { - eventList = await getEvents(); + eventList = await getEvents(1); } isSearch = false; @@ -176,16 +213,53 @@ class EventsProvider extends ChangeNotifier { //notifyListeners(); } - Future> getEvents() async { - eventList = await getAllEventsData(); + Future> getEvents(int page, + {String? searchtxt, String? startdate, String? enddate}) async { + // eventList = await getAllEventsData(); + + eventList.clear(); + eventList = []; + + offlineEvents = await getOfflineMyEvents(); + eventList = isFavSeleted + ? await ApiCall().getEventsFromK1(type: "2") + : await ApiCall().getEventsFromK1(); + print("see the list : $neweventList"); if (eventList.isEmpty) { - eventList = (await ApiCall().getEvents())!; + // eventList = (await ApiCall().getEvents())!; + eventList = isFavSeleted + ? await ApiCall().getEventsFromK1(type: "2") + : await ApiCall().getEventsFromK1(); //eventList = (await ApiCall().getStagingEvents())!; for (var events in eventList) { await saveEventsData(events); } } + if (myEventids.isNotEmpty) { + for (var events in eventList) { + if (myEventids.contains(events.eventId)) { + events.isfav = true; + } + } + } return eventList; + + //notifyListeners(); + } + + Future> getMyEvents(int page) async { + // eventList = await getAllEventsData(); + myEvents = await ApiCall().getEventsFromK1(type: "2"); + print("see the list : $myEvents"); + if (myEvents.isEmpty) { + // eventList = (await ApiCall().getEvents())!; + myEvents = await ApiCall().getEventsFromK1(type: "2"); + //eventList = (await ApiCall().getStagingEvents())!; + } + for (var events in myEvents) { + myEventids.add(events.eventId!); + } + return myEvents; //notifyListeners(); } @@ -209,14 +283,50 @@ class EventsProvider extends ChangeNotifier { } Future> getEventsDetails(String eventid) async { - eventdetailList = (await ApiCall().getLocalEventsDetail(eventid))!; + eventdetailList = (await ApiCall().getLocalEventsDetail("142682"))!; return eventdetailList; //notifyListeners(); } - Future addEventsToFavs(String eventid) async { - message = await ApiCall().addEventsToFav(eventid); + Future> getSpeakersDetails(int page, String eventid, + String event_unique_id, String searchkey) async { + Map data = (await ApiCall().getSpeakersFromK2( + page, eventid, event_unique_id, + searchkey: searchkey)); + // speakercount = data["count"]; + speakersList = data["list"]; + // getSessionCount(); + return speakersList; + //notifyListeners(); + } + Future addEventsToFavs(String eventid) async { + message = await ApiCall().followUnfollowEvent("1", eventid); + if (myEventids.isNotEmpty) { + if (!myEventids.contains(eventid)) { + myEventids.add(eventid); + } + } else { + myEventids.add(eventid); + } + return message; + //notifyListeners(); + } + + Future attendNotAttendEvent(String eventid, String flag) async { + message = await ApiCall().attendNotAttendEvent(flag, eventid); + + return message; + //notifyListeners(); + } + + Future removeEventsToFavs(String eventid) async { + message = await ApiCall().followUnfollowEvent("0", eventid); + if (myEventids.isNotEmpty) { + if (myEventids.contains(eventid)) { + myEventids.remove(eventid); + } + } return message; //notifyListeners(); } @@ -231,7 +341,9 @@ class EventsProvider extends ChangeNotifier { box = await Hive.openBox('EventsListBox'); box.add(eventsData); - List eventsData2 = await getMyEventsData(); + offlineEvents.clear(); + offlineEvents = await getOfflineMyEvents(); + print("OFFLINE TOTAL :${offlineEvents.length}"); notifyListeners(); } @@ -242,26 +354,11 @@ class EventsProvider extends ChangeNotifier { (element) => element.eventId == eventsData.eventId, ); box.putAt(index, eventsData); - List eventsData2 = await getMyEventsData(); + // List eventsData2 = await getMyEventsData(); notifyListeners(); } - Future> getMyEventsData() async { - box = await Hive.openBox('EventsListBox'); - Iterable data = box.values; - myEvents = data - .where( - (element) => element.isfav == true, - ) - .toList(); - // EventsList eventsdata = EventsList(); - // for (var obj in data) { - // eventsdata = new EventsList.fromJson(obj.toJson()); - // } - return myEvents; - } - - Future> getAllEventsData() async { + Future> getOfflineMyEvents() async { box = await Hive.openBox('EventsListBox'); Iterable data = box.values; myEvents = data.toList(); @@ -288,7 +385,7 @@ class EventsProvider extends ChangeNotifier { box.clear(); } - FutureOr delateEventsData(EventsList event) async { + FutureOr delateOfflineEvent(EventsList event) async { //DELETE // box = await Hive.openBox('EventsListBox'); // List data = box.values.toList(); @@ -303,8 +400,11 @@ class EventsProvider extends ChangeNotifier { (element) => element.eventId == event.eventId, ); event.isfav = false; - box.putAt(index, event); - eventList = await getMyEventsData(); + // box.putAt(index, event); + box.deleteAt(index); + //eventList = await getMyEventsData(); + offlineEvents.clear(); + offlineEvents = await getOfflineMyEvents(); notifyListeners(); } @@ -316,9 +416,9 @@ class EventsProvider extends ChangeNotifier { notifyListeners(); } - FutureOr getTopicsCloud(String eventid) async { - List topics = - (await ApiCall().getTopicsCloudData(eventid))!; + FutureOr getTopicsCloud(EventsList event) async { + List topics = (await ApiCall().insightsTopicsCloud( + eventid: event.eventId!, startDate: event.start!, endDate: event.end!)); // for (var events in eventList) { // await saveEventsData(events); // } @@ -332,14 +432,16 @@ class EventsProvider extends ChangeNotifier { notifyListeners(); } - FutureOr getSpecialtyData(String eventid) async { - specialtyList = (await ApiCall().getSpecialty(eventid))!; + FutureOr getSpecialtyData(EventsList event) async { + specialtyList = (await ApiCall().specialtyOfSpeakers( + eventid: event.eventId!, startDate: event.start!, endDate: event.end!)); notifyListeners(); } - FutureOr getAffiliations(String eventid) async { - affiliations = (await ApiCall().getSpeakerCounts(eventid))!; + FutureOr getAffiliations(EventsList event) async { + affiliations = (await ApiCall().insightsBarChart( + eventid: event.eventId!, startDate: event.start!, endDate: event.end!)); notifyListeners(); } @@ -351,4 +453,6 @@ class EventsProvider extends ChangeNotifier { notifyListeners(); } + + //INTERNET CONNECTIVITY } diff --git a/lib/viewmodel/hcpprofprovider.dart b/lib/viewmodel/hcpprofprovider.dart index c549470..28d5a0f 100644 --- a/lib/viewmodel/hcpprofprovider.dart +++ b/lib/viewmodel/hcpprofprovider.dart @@ -4,6 +4,7 @@ import 'dart:math'; import 'package:flutter/cupertino.dart'; import 'package:hive_flutter/hive_flutter.dart'; import 'package:konectar_events/model/eventsdetailmodel.dart'; +import 'package:konectar_events/model/eventspeakers.dart'; import 'package:konectar_events/model/sessionnotesmodel.dart'; import 'package:konectar_events/model/topics_cloud_model.dart'; import 'package:konectar_events/utils/apicall.dart'; @@ -33,9 +34,9 @@ class HcpProfileProvider extends ChangeNotifier { } List getSessionNotesList( - String eid, Eventsdetail eventsdetail) { + String eid, SpeakersList eventsdetail) { print("Check hcp id"); - print("$eid,${eventsdetail.kolId}"); + print("$eid,${eventsdetail.uniqueId}"); sessionNotesList = sessionNotesList .where( (element) => element.eventid == eid, @@ -50,10 +51,10 @@ class HcpProfileProvider extends ChangeNotifier { String fname = element.hcpname!.split(" ")[0]; String lname = element.hcpname!.split(" ").last; print("${element.hcpname}"); - return fname.toLowerCase() == eventsdetail.firstName!.toLowerCase() && - lname.toLowerCase() == eventsdetail.lastName!.toLowerCase(); + return fname.toLowerCase() == eventsdetail.hcpFullName!.toLowerCase() && + lname.toLowerCase() == eventsdetail.hcpFullName!.toLowerCase(); } else { - return element.hcpid == eventsdetail.kolId; + return element.hcpid == eventsdetail.uniqueId; } }).toList(); totalNotes = sessionNotesList.length; diff --git a/lib/viewmodel/offlineeventsprovider.dart b/lib/viewmodel/offlineeventsprovider.dart new file mode 100644 index 0000000..91300d6 --- /dev/null +++ b/lib/viewmodel/offlineeventsprovider.dart @@ -0,0 +1,325 @@ +import 'dart:async'; + +import 'package:flutter/material.dart'; +import 'package:hive_flutter/hive_flutter.dart'; +import 'package:konectar_events/model/eventsdetailmodel.dart'; +import 'package:konectar_events/model/eventsmodel.dart'; +import 'package:konectar_events/model/keywords_model.dart'; +import 'package:konectar_events/model/neweventsmodel.dart'; +import 'package:konectar_events/model/scope_model.dart'; +import 'package:konectar_events/model/sessionnotesmodel.dart'; +import 'package:konectar_events/model/topics_cloud_model.dart'; +import 'package:konectar_events/utils/apicall.dart'; +import 'package:konectar_events/utils/dateformater.dart'; +import 'package:konectar_events/widgets/word_cloud.dart'; + +class EventsOfflineProvider extends ChangeNotifier { + List keywordList = []; + List therapeuticList = []; + List eventList = []; + List searchList = []; + List myEvents = []; + List eventdetailList = []; + List srcheventdetailList = []; + List selectedTherapeutic = []; + List addedSessionNotes = []; + int eventSessionCount = 0; + String message = ""; + late Box box; + late Box sessionBox; + bool isAllSelected = true; + bool isFavSeleted = false; + bool isSearch = false; + bool isSearchSpeakers = false; + List kFlutterHashtags = []; + List topics = []; + + onSelectAll() async { + // isFavSeleted = false; + // isAllSelected = !isAllSelected; + eventList = await getEvents(); + + notifyListeners(); + } + + onSelectMy() async { + // isFavSeleted = !isFavSeleted; + eventList = await getMyEventsData(); + + notifyListeners(); + } + + OnSearch(String searchtxt) { + // searchtxt = searchtxt.toLowerCase(); + isSearch = true; + if (isFavSeleted) { + searchList = eventList + .where((element) => element.name1!.toLowerCase().contains(searchtxt)) + // (element.city != "" && + // element.city!.toLowerCase().contains(searchtxt)) || + // (element.region != "" && + // element.region!.toLowerCase().contains(searchtxt)) || + // (element.country != "" && + // element.country!.toLowerCase().contains(searchtxt))) + .toList(); + } else { + searchList = eventList + .where((element) => element.name1!.toLowerCase().contains(searchtxt)) + // element.city!.toLowerCase().contains(searchtxt) || + // element.region!.toLowerCase().contains(searchtxt) || + // element.country!.toLowerCase().contains(searchtxt)) + .toList(); + } + + print("###$searchList@@@"); + notifyListeners(); + } + + getSessionCount() { + List sessions = []; + eventSessionCount = 0; + for (var obj in eventdetailList) { + sessions.addAll(obj.sessionName!.split(',')); + + eventSessionCount += int.parse(obj.numSess ?? "0"); + } + print("Count ${sessions.toSet().toList().length}"); + print("Count2 ${sessions.toList().length}"); + print("SEE SESSIONS ${sessions.toSet().toList()}"); + eventSessionCount = sessions.toSet().toList().length; + notifyListeners(); + } + + OnFilters() { + isSearch = true; + if (isFavSeleted) { + searchList = myEvents + .where((element) => + selectedTherapeutic.contains(element.therapeuticArea)) + .toList(); + } else { + searchList = myEvents + .where((element) => + selectedTherapeutic.contains(element.therapeuticArea)) + .toList(); + } + + print("###$searchList@@@"); + notifyListeners(); + } + + onFilterReset() async { + if (isFavSeleted) { + eventList = await getMyEventsData(); + } else { + eventList = await getEvents(); + } + + isSearch = false; + + searchList.clear(); + notifyListeners(); + } + + onSearchReset() async { + if (isFavSeleted) { + eventList = await getMyEventsData(); + } else { + eventList = await getEvents(); + } + + isSearch = false; + + searchList.clear(); + notifyListeners(); + } + + OnSearchSpeakers(String searchtxt) { + searchtxt = searchtxt.toLowerCase(); + isSearchSpeakers = true; + + srcheventdetailList = eventdetailList + .where((element) => + element.kolFullName!.toLowerCase().contains(searchtxt) || + element.eventTopics!.toLowerCase().contains(searchtxt)) + .toList(); + + notifyListeners(); + } + + onSearchSpeakersReset(String eventid) async { + eventdetailList = await getEventsDetails(eventid); + + isSearchSpeakers = false; + + srcheventdetailList.clear(); + notifyListeners(); + } + + initFiltersData() async { + // keywordList = await ApiCall().getkeywords(''); + therapeuticList = await ApiCall().getscopes(); + notifyListeners(); + } + + Future> getKeywordList(String keyword) async { + keywordList = await ApiCall().getkeywords(keyword); + return keywordList; + //notifyListeners(); + } + + Future> getEvents() async { + eventList = await getAllEventsData(); + if (eventList.isEmpty) { + eventList = (await ApiCall().getEvents())!; + for (var events in eventList) { + await saveEventsData(events); + } + } + return eventList; + //notifyListeners(); + } + + Future> getAddedSessionNotes() async { + addedSessionNotes = await getAllSessionNotesList(); + if (addedSessionNotes.isEmpty && eventList.isNotEmpty) { + addedSessionNotes = (await ApiCall().getSessionNotes())!; + for (SessionNotesModel notes in addedSessionNotes) { + int i = + eventList.indexWhere((element) => element.name1 == notes.eventname); + if (i != -1) { + notes.eventid = eventList[i].eventId; + } + notes.addedBy = "user"; + notes.addedDate = CustomDateFormatter().formatDate(); + await saveSessionDataFromResp(notes); + } + } + return addedSessionNotes; + //notifyListeners(); + } + + Future> getEventsDetails(String eventid) async { + eventdetailList = (await ApiCall().getLocalEventsDetail(eventid))!; + return eventdetailList; + //notifyListeners(); + } + + Future addEventsToFavs(String eventid) async { + message = await ApiCall().addEventsToFav(eventid); + + return message; + //notifyListeners(); + } + + Future markAttending(String eventid) async { + message = await ApiCall().attendEvents(eventid); + return message; + //notifyListeners(); + } + + FutureOr saveEventsData(EventsList eventsData) async { + box = await Hive.openBox('EventsListBox'); + + box.add(eventsData); + List eventsData2 = await getMyEventsData(); + notifyListeners(); + } + + FutureOr favsEventsData(EventsList eventsData) async { + box = await Hive.openBox('EventsListBox'); + List data = box.values.toList(); + int index = data.indexWhere( + (element) => element.eventId == eventsData.eventId, + ); + box.putAt(index, eventsData); + List eventsData2 = await getMyEventsData(); + notifyListeners(); + } + + Future> getMyEventsData() async { + box = await Hive.openBox('EventsListBox'); + Iterable data = box.values; + myEvents = data + .where( + (element) => element.isfav == true, + ) + .toList(); + // EventsList eventsdata = EventsList(); + // for (var obj in data) { + // eventsdata = new EventsList.fromJson(obj.toJson()); + // } + return myEvents; + } + + Future> getAllEventsData() async { + box = await Hive.openBox('EventsListBox'); + Iterable data = box.values; + myEvents = data.toList(); + // EventsList eventsdata = EventsList(); + // for (var obj in data) { + // eventsdata = new EventsList.fromJson(obj.toJson()); + // } + return myEvents; + } + + Future> getAllSessionNotesList() async { + sessionBox = await Hive.openBox('SessionNotesModelBox'); + Iterable data = sessionBox.values; + addedSessionNotes = data.toList(); + // EventsList eventsdata = EventsList(); + // for (var obj in data) { + // eventsdata = new EventsList.fromJson(obj.toJson()); + // } + return addedSessionNotes; + } + + FutureOr deleteAllEventsData() async { + box = await Hive.openBox('EventsListBox'); + box.clear(); + } + + FutureOr delateEventsData(EventsList event) async { + //DELETE + // box = await Hive.openBox('EventsListBox'); + // List data = box.values.toList(); + // int index = data.indexWhere( + // (element) => element.eventId == eventid, + // ); + // await box.deleteAt(index); + //REMOVE FROM FAVS + box = await Hive.openBox('EventsListBox'); + List data = box.values.toList(); + int index = data.indexWhere( + (element) => element.eventId == event.eventId, + ); + event.isfav = false; + box.putAt(index, event); + eventList = await getMyEventsData(); + notifyListeners(); + } + + FutureOr saveSessionDataFromResp(SessionNotesModel notesModel) async { + sessionBox = await Hive.openBox('SessionNotesModelBox'); + + sessionBox.add(notesModel); + + notifyListeners(); + } + + FutureOr getTopicsCloud(String eventid) async { + List topics = + (await ApiCall().getTopicsCloudData(eventid))!; + // for (var events in eventList) { + // await saveEventsData(events); + // } + //notifyListeners(); + kFlutterHashtags = []; + for (var topic in topics) { + kFlutterHashtags + .add(FlutterHashtag(topic.topic!, int.parse(topic.total!), false)); + } + + notifyListeners(); + } +} diff --git a/lib/widgets/autocompletetags_widget.dart b/lib/widgets/autocompletetags_widget.dart index fd4dc56..0a280f0 100644 --- a/lib/widgets/autocompletetags_widget.dart +++ b/lib/widgets/autocompletetags_widget.dart @@ -196,6 +196,7 @@ class _StringAutoCompleteTagsState extends State { width: 1.0, ), ), + //helperText: 'Enter language...', helperStyle: const TextStyle( color: Colors.black, diff --git a/lib/widgets/home_drawer.dart b/lib/widgets/home_drawer.dart index 7aac0f4..5f33f3f 100644 --- a/lib/widgets/home_drawer.dart +++ b/lib/widgets/home_drawer.dart @@ -42,22 +42,24 @@ class _HomeDrawerState extends State { void setDrawerListArray() { drawerList = [ - DrawerList( - index: DrawerIndex.HOME, - labelName: 'Events', - //icon: Icon(Icons.home), - ), DrawerList( index: DrawerIndex.Help, labelName: 'Contacts', + icon: Icon(Icons.account_circle), // isAssetsImage: true, // imageName: 'assets/images/supportIcon.png', ), - // DrawerList( - // index: DrawerIndex.FeedBack, - // labelName: 'FeedBack', - // icon: Icon(Icons.help), - // ), + DrawerList( + index: DrawerIndex.HOME, + labelName: 'Events', + icon: Icon(Icons.event), + ), + + DrawerList( + index: DrawerIndex.FeedBack, + labelName: 'HelpDesk', + icon: Icon(Icons.help), + ), // DrawerList( // index: DrawerIndex.Invite, // labelName: 'Invite Friend', @@ -95,68 +97,64 @@ class _HomeDrawerState extends State { crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start, children: [ - AnimatedBuilder( - animation: widget.iconAnimationController!, - builder: (BuildContext context, Widget? child) { - return ScaleTransition( - scale: AlwaysStoppedAnimation(1.0 - - (widget.iconAnimationController!.value) * 0.2), - child: RotationTransition( - turns: AlwaysStoppedAnimation(Tween( - begin: 0.0, end: 24.0) - .animate(CurvedAnimation( - parent: widget.iconAnimationController!, - curve: Curves.fastOutSlowIn)) - .value / - 360), - child: Container( - height: 100, - width: 100, - decoration: BoxDecoration( - shape: BoxShape.circle, - boxShadow: [ - BoxShadow( - color: AppTheme.grey.withOpacity(0.6), - offset: const Offset(2.0, 4.0), - blurRadius: 8), - ], - ), - child: ClipRRect( - borderRadius: - const BorderRadius.all(Radius.circular(60.0)), - child: CircleAvatar( - radius: 24, - backgroundColor: EventsConstants.blueColor, - // child: Icon( - // Icons.person, - // size: 18, - // color: Colors.white, - // ), - child: Text( - "S", - style: TextStyle( - fontSize: 24, - fontWeight: FontWeight.bold, - color: Colors.white), - ), - ), - ), - ), - ), - ); - }, - ), - Padding( - padding: const EdgeInsets.only(top: 8, left: 4), - child: Text( - 'Snehalatha Desai', - style: TextStyle( - fontWeight: FontWeight.w600, - color: isLightMode ? AppTheme.grey : AppTheme.white, - fontSize: 18, - ), + SizedBox( + height: 30, + child: Image.asset( + "assets/images/konector_image_logo.png", + fit: BoxFit.cover, ), ), + // AnimatedBuilder( + // animation: widget.iconAnimationController!, + // builder: (BuildContext context, Widget? child) { + // return ScaleTransition( + // scale: AlwaysStoppedAnimation(1.0 - + // (widget.iconAnimationController!.value) * 0.2), + // child: RotationTransition( + // turns: AlwaysStoppedAnimation(Tween( + // begin: 0.0, end: 24.0) + // .animate(CurvedAnimation( + // parent: widget.iconAnimationController!, + // curve: Curves.fastOutSlowIn)) + // .value / + // 360), + // child: Container( + // height: 100, + // width: 100, + // decoration: BoxDecoration( + // shape: BoxShape.circle, + // boxShadow: [ + // BoxShadow( + // color: AppTheme.grey.withOpacity(0.6), + // offset: const Offset(2.0, 4.0), + // blurRadius: 8), + // ], + // ), + // child: ClipRRect( + // borderRadius: + // const BorderRadius.all(Radius.circular(60.0)), + // child: CircleAvatar( + // radius: 24, + // backgroundColor: EventsConstants.blueColor, + // // child: Icon( + // // Icons.person, + // // size: 18, + // // color: Colors.white, + // // ), + // child: Text( + // "S", + // style: TextStyle( + // fontSize: 24, + // fontWeight: FontWeight.bold, + // color: Colors.white), + // ), + // ), + // ), + // ), + // ), + // ); + // }, + // ), ], ), ), @@ -178,6 +176,17 @@ class _HomeDrawerState extends State { }, ), ), + Padding( + padding: const EdgeInsets.only(top: 8, left: 4), + child: Text( + 'Logged in as Snehalatha Desai', + style: TextStyle( + fontWeight: FontWeight.w300, + color: isLightMode ? AppTheme.grey : AppTheme.white, + fontSize: 18, + ), + ), + ), Divider( height: 1, color: AppTheme.grey.withOpacity(0.6), diff --git a/lib/widgets/piechart.dart b/lib/widgets/piechart.dart index cb2e58a..2ad3a2c 100644 --- a/lib/widgets/piechart.dart +++ b/lib/widgets/piechart.dart @@ -66,7 +66,7 @@ class CustomPieChartState extends State { return Indicator( size: 10, color: AppColors().appcolors[i], - text: widget.specialtyList[i].specialtyName, + text: widget.specialtyList[i].specialtyName!, isSquare: true, ); }) @@ -131,7 +131,7 @@ class CustomPieChartState extends State { List showingSections(List specialtyList) { double total = 0.0; for (var obj in specialtyList) { - total += double.parse(obj.specialtyCount); + total += double.parse(obj.specialtyCount!); } return List.generate(specialtyList.length, (i) { @@ -141,10 +141,10 @@ class CustomPieChartState extends State { const shadows = [Shadow(color: Colors.black, blurRadius: 2)]; return PieChartSectionData( color: AppColors().appcolors[i], - value: ((double.parse(specialtyList[i].specialtyCount) / total) * 100) + value: ((double.parse(specialtyList[i].specialtyCount!) / total) * 100) .roundToDouble(), title: - '${((double.parse(specialtyList[i].specialtyCount) / total) * 100).roundToDouble()}%', + '${((double.parse(specialtyList[i].specialtyCount!) / total) * 100).floorToDouble()}%', radius: radius, titleStyle: TextStyle( fontSize: fontSize, diff --git a/macos/Podfile.lock b/macos/Podfile.lock index 7fe40b8..ee757e6 100644 --- a/macos/Podfile.lock +++ b/macos/Podfile.lock @@ -1,75 +1,134 @@ PODS: - connectivity_plus (0.0.1): - - FlutterMacOS - - ReachabilitySwift - - device_info_plus (0.0.1): + - Flutter - FlutterMacOS - file_selector_macos (0.0.1): - FlutterMacOS - - flutter_inappwebview_macos (0.0.1): + - Firebase/CoreOnly (10.25.0): + - FirebaseCore (= 10.25.0) + - Firebase/RemoteConfig (10.25.0): + - Firebase/CoreOnly + - FirebaseRemoteConfig (~> 10.25.0) + - firebase_core (2.31.0): + - Firebase/CoreOnly (~> 10.25.0) - FlutterMacOS - - OrderedSet (~> 5.0) + - firebase_remote_config (4.4.5): + - Firebase/CoreOnly (~> 10.25.0) + - Firebase/RemoteConfig (~> 10.25.0) + - firebase_core + - FlutterMacOS + - FirebaseABTesting (10.28.0): + - FirebaseCore (~> 10.0) + - FirebaseCore (10.25.0): + - FirebaseCoreInternal (~> 10.0) + - GoogleUtilities/Environment (~> 7.12) + - GoogleUtilities/Logger (~> 7.12) + - FirebaseCoreInternal (10.28.0): + - "GoogleUtilities/NSData+zlib (~> 7.8)" + - FirebaseInstallations (10.28.0): + - FirebaseCore (~> 10.0) + - GoogleUtilities/Environment (~> 7.8) + - GoogleUtilities/UserDefaults (~> 7.8) + - PromisesObjC (~> 2.1) + - FirebaseRemoteConfig (10.25.0): + - FirebaseABTesting (~> 10.0) + - FirebaseCore (~> 10.0) + - FirebaseInstallations (~> 10.0) + - FirebaseRemoteConfigInterop (~> 10.23) + - FirebaseSharedSwift (~> 10.0) + - GoogleUtilities/Environment (~> 7.8) + - "GoogleUtilities/NSData+zlib (~> 7.8)" + - FirebaseRemoteConfigInterop (10.28.0) + - FirebaseSharedSwift (10.28.0) - FlutterMacOS (1.0.0) - - OrderedSet (5.0.0) - - package_info_plus (0.0.1): - - FlutterMacOS + - GoogleUtilities/Environment (7.13.3): + - GoogleUtilities/Privacy + - PromisesObjC (< 3.0, >= 1.2) + - GoogleUtilities/Logger (7.13.3): + - GoogleUtilities/Environment + - GoogleUtilities/Privacy + - "GoogleUtilities/NSData+zlib (7.13.3)": + - GoogleUtilities/Privacy + - GoogleUtilities/Privacy (7.13.3) + - GoogleUtilities/UserDefaults (7.13.3): + - GoogleUtilities/Logger + - GoogleUtilities/Privacy - path_provider_foundation (0.0.1): - Flutter - FlutterMacOS - - ReachabilitySwift (5.0.0) + - PromisesObjC (2.4.0) - shared_preferences_foundation (0.0.1): - Flutter - FlutterMacOS + - sqflite (0.0.3): + - Flutter + - FlutterMacOS - url_launcher_macos (0.0.1): - FlutterMacOS DEPENDENCIES: - - connectivity_plus (from `Flutter/ephemeral/.symlinks/plugins/connectivity_plus/macos`) - - device_info_plus (from `Flutter/ephemeral/.symlinks/plugins/device_info_plus/macos`) + - connectivity_plus (from `Flutter/ephemeral/.symlinks/plugins/connectivity_plus/darwin`) - file_selector_macos (from `Flutter/ephemeral/.symlinks/plugins/file_selector_macos/macos`) - - flutter_inappwebview_macos (from `Flutter/ephemeral/.symlinks/plugins/flutter_inappwebview_macos/macos`) + - firebase_core (from `Flutter/ephemeral/.symlinks/plugins/firebase_core/macos`) + - firebase_remote_config (from `Flutter/ephemeral/.symlinks/plugins/firebase_remote_config/macos`) - FlutterMacOS (from `Flutter/ephemeral`) - - package_info_plus (from `Flutter/ephemeral/.symlinks/plugins/package_info_plus/macos`) - path_provider_foundation (from `Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/darwin`) - shared_preferences_foundation (from `Flutter/ephemeral/.symlinks/plugins/shared_preferences_foundation/darwin`) + - sqflite (from `Flutter/ephemeral/.symlinks/plugins/sqflite/darwin`) - url_launcher_macos (from `Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos`) SPEC REPOS: trunk: - - OrderedSet - - ReachabilitySwift + - Firebase + - FirebaseABTesting + - FirebaseCore + - FirebaseCoreInternal + - FirebaseInstallations + - FirebaseRemoteConfig + - FirebaseRemoteConfigInterop + - FirebaseSharedSwift + - GoogleUtilities + - PromisesObjC EXTERNAL SOURCES: connectivity_plus: - :path: Flutter/ephemeral/.symlinks/plugins/connectivity_plus/macos - device_info_plus: - :path: Flutter/ephemeral/.symlinks/plugins/device_info_plus/macos + :path: Flutter/ephemeral/.symlinks/plugins/connectivity_plus/darwin file_selector_macos: :path: Flutter/ephemeral/.symlinks/plugins/file_selector_macos/macos - flutter_inappwebview_macos: - :path: Flutter/ephemeral/.symlinks/plugins/flutter_inappwebview_macos/macos + firebase_core: + :path: Flutter/ephemeral/.symlinks/plugins/firebase_core/macos + firebase_remote_config: + :path: Flutter/ephemeral/.symlinks/plugins/firebase_remote_config/macos FlutterMacOS: :path: Flutter/ephemeral - package_info_plus: - :path: Flutter/ephemeral/.symlinks/plugins/package_info_plus/macos path_provider_foundation: :path: Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/darwin shared_preferences_foundation: :path: Flutter/ephemeral/.symlinks/plugins/shared_preferences_foundation/darwin + sqflite: + :path: Flutter/ephemeral/.symlinks/plugins/sqflite/darwin url_launcher_macos: :path: Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos SPEC CHECKSUMS: - connectivity_plus: 18d3c32514c886e046de60e9c13895109866c747 - device_info_plus: 5401765fde0b8d062a2f8eb65510fb17e77cf07f + connectivity_plus: ddd7f30999e1faaef5967c23d5b6d503d10434db file_selector_macos: 468fb6b81fac7c0e88d71317f3eec34c3b008ff9 - flutter_inappwebview_macos: 9600c9df9fdb346aaa8933812009f8d94304203d + Firebase: 0312a2352584f782ea56f66d91606891d4607f06 + firebase_core: fdf12e0c4349815c2e832d9dcad59fbff0ff394b + firebase_remote_config: 610707ec6f4efbf11225da2c6598e4b092962308 + FirebaseABTesting: 589bc28c0ab3e5554336895a34aa262e24276665 + FirebaseCore: 7ec4d0484817f12c3373955bc87762d96842d483 + FirebaseCoreInternal: 58d07f1362fddeb0feb6a857d1d1d1c5e558e698 + FirebaseInstallations: 60c1d3bc1beef809fd1ad1189a8057a040c59f2e + FirebaseRemoteConfig: 9f3935cefecd85d5b312192117f444957de24a75 + FirebaseRemoteConfigInterop: 70d200c6956ef3b5c3592a95e824c1210682d785 + FirebaseSharedSwift: 48de4aec81a6b79bb30404e5e6db43ea74848fed FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24 - OrderedSet: aaeb196f7fef5a9edf55d89760da9176ad40b93c - package_info_plus: 02d7a575e80f194102bef286361c6c326e4c29ce + GoogleUtilities: ea963c370a38a8069cc5f7ba4ca849a60b6d7d15 path_provider_foundation: 3784922295ac71e43754bd15e0653ccfd36a147c - ReachabilitySwift: 985039c6f7b23a1da463388634119492ff86c825 + PromisesObjC: f5707f49cb48b9636751c5b2e7d227e43fba9f47 shared_preferences_foundation: b4c3b4cddf1c21f02770737f147a3f5da9d39695 + sqflite: 673a0e54cc04b7d6dba8d24fb8095b31c3a99eec url_launcher_macos: d2691c7dd33ed713bf3544850a623080ec693d95 PODFILE CHECKSUM: 236401fc2c932af29a9fcf0e97baeeb2d750d367 diff --git a/pubspec.lock b/pubspec.lock index bda8eb4..9bab846 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -41,6 +41,14 @@ packages: url: "https://pub.dev" source: hosted version: "6.4.1" + animations: + dependency: "direct main" + description: + name: animations + sha256: d3d6dcfb218225bbe68e87ccf6378bbb2e32a94900722c5f81611dad089911cb + url: "https://pub.dev" + source: hosted + version: "2.0.11" archive: dependency: transitive description: @@ -574,6 +582,14 @@ packages: url: "https://pub.dev" source: hosted version: "0.2.0" + flutter_staggered_grid_view: + dependency: transitive + description: + name: flutter_staggered_grid_view + sha256: "19e7abb550c96fbfeb546b23f3ff356ee7c59a019a651f8f102a4ba9b7349395" + url: "https://pub.dev" + source: hosted + version: "0.7.0" flutter_svg: dependency: "direct main" description: @@ -768,6 +784,14 @@ packages: url: "https://pub.dev" source: hosted version: "0.2.1+1" + infinite_scroll_pagination: + dependency: "direct main" + description: + name: infinite_scroll_pagination + sha256: b68bce20752fcf36c7739e60de4175494f74e99e9a69b4dd2fe3a1dd07a7f16a + url: "https://pub.dev" + source: hosted + version: "4.0.0" info_popup: dependency: "direct main" description: @@ -952,6 +976,14 @@ packages: url: "https://pub.dev" source: hosted version: "0.4.8" + overlay_support: + dependency: "direct main" + description: + name: overlay_support + sha256: fc39389bfd94e6985e1e13b2a88a125fc4027608485d2d4e2847afe1b2bb339c + url: "https://pub.dev" + source: hosted + version: "2.1.0" package_config: dependency: transitive description: @@ -1269,6 +1301,14 @@ packages: description: flutter source: sdk version: "0.0.99" + sliver_tools: + dependency: transitive + description: + name: sliver_tools + sha256: eae28220badfb9d0559207badcbbc9ad5331aac829a88cb0964d330d2a4636a6 + url: "https://pub.dev" + source: hosted + version: "0.2.12" source_gen: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index a29e31f..263fe7c 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -90,7 +90,9 @@ dependencies: cached_network_image: ^3.4.0 url_launcher: ^6.3.0 - + infinite_scroll_pagination: ^4.0.0 + animations: ^2.0.11 + overlay_support: ^2.1.0 dev_dependencies: @@ -141,6 +143,8 @@ flutter: - assets/contact.json - assets/section.json - assets/images/ + - assets/icon/ + - assets/introduction_animation/ - assets/response.json - shorebird.yaml - assets/