// import 'package:discover_module/ui_screen/interactionform/configprovider.dart'; // import 'package:discover_module/ui_screen/interactionform/interactionprovider.dart'; // import 'package:discover_module/ui_screen/interactionform/view_forms_list.dart'; import 'package:discover_module/contacts_module/ui_screen/interactionform/configprovider.dart'; import 'package:discover_module/contacts_module/ui_screen/interactionform/interactionprovider.dart'; import 'package:discover_module/contacts_module/ui_screen/interactionform/view_forms_list.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/widgets.dart'; import 'package:provider/provider.dart'; class bsheet extends StatefulWidget { const bsheet(this.publicationdata, {super.key}); final publicationdata; @override State createState() => _MyWidgetState(); } class _MyWidgetState extends State { String? field1, field2, field3, field4, field5, field6, field7, field8, field9, field10; String? subfield2, subfield3, subfield4, subfield5, subfield6, subfield7, subfield8, subfield9, subfield10; bool? f2, f3, f4, f5, f6, f7, f8, f9, f10; bool engbtn = false; @override void initState() { // TODO: implement initState super.initState(); print("data-isssbottomshett: ${widget.publicationdata}"); if (widget.publicationdata['artical_title'] != null) { setState(() { field1 = widget.publicationdata['artical_title']; subfield2 = "Journal Name"; field2 = widget.publicationdata['journal_name']; f2 = true; subfield3 = "Date"; field3 = widget.publicationdata['date']; f3 = true; subfield4 = "Author"; field4 = widget.publicationdata['author']; f4 = true; subfield5 = "PMID"; field5 = widget.publicationdata['pmid'].toString(); f5 = true; subfield6 = "Auth Position"; field6 = widget.publicationdata['auth_pos'].toString(); f6 = true; subfield7 = "Meshterms"; field7 = widget.publicationdata['meshterms']; f7 = true; subfield8 = ""; field8 = " "; f8 = false; subfield9 = ""; field9 = " "; f9 = false; subfield10 = ""; field10 = " "; f10 = false; }); //print("isssbottomshett123: ${widget.publicationdata['event_name']}"); } else if (widget.publicationdata['event_name'] != null) { setState(() { field1 = widget.publicationdata['event_name']; subfield4 = "Session Type"; field4 = widget.publicationdata['session_type']; f2 = true; subfield3 = "Topic"; field3 = widget.publicationdata['topic']; f3 = true; subfield2 = "Role"; field2 = widget.publicationdata['role']; f4 = true; subfield5 = "Session_Name"; field5 = widget.publicationdata['Session_Name']; f5 = true; subfield6 = "Organizer"; field6 = widget.publicationdata['Organizer']; f6 = true; subfield7 = "Sponsor"; field7 = widget.publicationdata['Sponsor']; f7 = true; subfield8 = "Start Date"; field8 = widget.publicationdata['Start']; f8 = true; subfield9 = "End Date"; field9 = widget.publicationdata['End']; f9 = true; subfield10 = ""; field10 = " "; f10 = false; }); } else if (widget.publicationdata['trial_name'] != null) { setState(() { field1 = widget.publicationdata['trial_name']; subfield2 = "Status"; field2 = widget.publicationdata['status']; f2 = true; subfield3 = "Sponsors"; field3 = widget.publicationdata['sponsors']; f3 = true; subfield4 = "Condtion"; field4 = widget.publicationdata['condition']; f4 = true; subfield5 = "Intervention"; field5 = widget.publicationdata['intervention']; f5 = true; subfield6 = "Phase"; field6 = widget.publicationdata['phase']; f6 = true; subfield7 = "Study_Type"; field7 = widget.publicationdata['Study_Type']; f7 = true; subfield8 = "intervention"; field8 = widget.publicationdata['intervention']; f8 = true; subfield9 = "Start Date"; field9 = widget.publicationdata['Start_Date']; f9 = true; subfield10 = "End Date"; field10 = widget.publicationdata['End_Date']; f10 = true; }); } else if (widget.publicationdata['programtopic'] != null) { setState(() { field1 = widget.publicationdata['programtopic']; subfield2 = "Speaker Name"; field2 = widget.publicationdata['speakername']; f2 = true; subfield3 = "Role"; field3 = widget.publicationdata['role']; f3 = true; subfield4 = "Evalutor Name"; field4 = widget.publicationdata['evaluatorname']; f4 = true; subfield5 = "Date"; field5 = widget.publicationdata['programdate']; f5 = true; subfield6 = ""; field6 = ""; f6 = false; subfield7 = ""; field7 = " "; f7 = false; }); } else if (widget.publicationdata['hcpname'] != null) { setState(() { field1 = widget.publicationdata['hcpname']; subfield2 = "Main Therapeutic Area"; field2 = widget.publicationdata['main thereutic area']; f2 = true; subfield3 = "Relationship with Chiesi"; field3 = widget.publicationdata['relationship with chiesi']; f3 = true; subfield4 = "Level of Engagement"; field4 = widget.publicationdata['level of engagement']; f4 = true; subfield5 = "Date"; field5 = widget.publicationdata['date']; f5 = true; subfield6 = "Plan of Action"; field6 = widget.publicationdata['plan of action']; f6 = true; subfield7 = "Recorded By"; field7 = widget.publicationdata['recorded by']; f7 = true; engbtn = true; }); } else if (widget.publicationdata['Institution'] != null) { setState(() { field1 = widget.publicationdata['Institution']; subfield2 = "Address"; field2 = widget.publicationdata['Address']; f2 = true; subfield3 = "City"; field3 = widget.publicationdata['City']; f3 = true; subfield4 = "State"; field4 = widget.publicationdata['State']; f4 = true; subfield5 = "Postalcode"; field5 = widget.publicationdata['Postalcode'] ?? ""; f5 = true; subfield6 = ""; field6 = ""; f6 = false; subfield7 = ""; field7 = ""; f7 = false; //engbtn = true; subfield8 = ""; field8 = ""; f8 = false; subfield9 = ""; field9 = " "; f9 = false; subfield10 = ""; field10 = " "; f10 = false; }); } else if (widget.publicationdata['Phone type'] != null) { setState(() { field1 = widget.publicationdata['Phone type']; subfield2 = "Locations"; field2 = widget.publicationdata['Locations']; f2 = true; subfield3 = "phone Number"; field3 = widget.publicationdata['phone Number']; f3 = true; subfield4 = ""; field4 = ""; f4 = false; subfield5 = ""; field5 = ""; f5 = false; subfield6 = ""; field6 = ""; f6 = false; subfield7 = ""; field7 = ""; f7 = false; //engbtn = true; subfield8 = ""; field8 = ""; f8 = false; subfield9 = ""; field9 = " "; f9 = false; subfield10 = ""; field10 = " "; f10 = false; }); } else if (widget.publicationdata['Email Type'] != null) { setState(() { field1 = widget.publicationdata['Email Type']; subfield2 = "Email"; field2 = widget.publicationdata['Email']; f2 = true; subfield3 = " "; field3 = ""; f3 = false; subfield4 = ""; field4 = ""; f4 = false; subfield5 = ""; field5 = ""; f5 = false; subfield6 = ""; field6 = ""; f6 = false; subfield7 = ""; field7 = ""; f7 = false; //engbtn = true; subfield8 = ""; field8 = ""; f8 = false; subfield9 = ""; field9 = " "; f9 = false; subfield10 = ""; field10 = " "; f10 = false; }); } else if (widget.publicationdata['Education Type'] != null) { setState(() { field1 = widget.publicationdata['Education Type']; subfield2 = "Institution Name"; field2 = widget.publicationdata['Institution Name']; f2 = true; subfield3 = " Degree"; field3 = widget.publicationdata['Degree']; f3 = true; subfield4 = ""; field4 = ""; f4 = false; subfield5 = ""; field5 = ""; f5 = false; subfield6 = ""; field6 = ""; f6 = false; subfield7 = ""; field7 = ""; f7 = false; //engbtn = true; subfield8 = ""; field8 = ""; f8 = false; subfield9 = ""; field9 = " "; f9 = false; subfield10 = ""; field10 = " "; f10 = false; }); } else if (widget.publicationdata['Patent Title'] != null) { setState(() { field1 = widget.publicationdata['Patent Title']; subfield2 = "Status"; field2 = widget.publicationdata['Status']; f2 = true; subfield3 = " "; field3 = ""; f3 = false; subfield4 = ""; field4 = ""; f4 = false; subfield5 = ""; field5 = ""; f5 = false; subfield6 = ""; field6 = ""; f6 = false; subfield7 = ""; field7 = ""; f7 = false; //engbtn = true; subfield8 = ""; field8 = ""; f8 = false; subfield9 = ""; field9 = " "; f9 = false; subfield10 = ""; field10 = " "; f10 = false; }); } else if (widget.publicationdata['pi_names'] != null) { setState(() { field1 = widget.publicationdata['pi_names']; subfield2 = "Name"; field2 = widget.publicationdata['first_name'] ?? "" + " " + widget.publicationdata['middle_name'] ?? "" + "" + widget.publicationdata['last_name'] ?? ""; f2 = true; subfield3 = "Organization Name"; field3 = widget.publicationdata['Organization Name']; f3 = true; subfield4 = "Org City"; field4 = widget.publicationdata['org_city']; f4 = true; subfield5 = "Org State"; field5 = widget.publicationdata['org_state']; f5 = true; subfield6 = "Study/Purpose"; field6 = widget.publicationdata['Study/Purpose']; f6 = true; subfield7 = "NIH Center/Institute"; field7 = widget.publicationdata['Study/NIH Center/Institute'] ?? ""; f7 = true; //engbtn = true; subfield8 = ""; field8 = ""; f8 = false; subfield9 = ""; field9 = " "; f9 = false; subfield10 = ""; field10 = " "; f10 = false; }); } else if (widget.publicationdata['Procedure'] != null) { setState(() { field1 = widget.publicationdata['Procedure']; subfield2 = "Place of Service"; field2 = widget.publicationdata['Place of Service'] ?? ""; f2 = true; subfield3 = "Total Beneficiaries"; field3 = widget.publicationdata['Total Beneficiaries'].toString(); f3 = true; subfield4 = "Total Services"; field4 = widget.publicationdata['Total Services'].toString(); f4 = true; subfield5 = "Total_bene_day_services"; field5 = widget.publicationdata['Total_bene_day_services'].toString(); f5 = true; subfield6 = "Program year"; field6 = widget.publicationdata['Program year'].toString(); f6 = true; subfield7 = ""; field7 = ""; f7 = false; //engbtn = true; subfield8 = ""; field8 = ""; f8 = false; subfield9 = ""; field9 = " "; f9 = false; subfield10 = ""; field10 = " "; f10 = false; }); } // print("data-isssbottomshett: ${widget.publicationdata['artical_title']}"); } @override Widget build(BuildContext context) { return DraggableScrollableSheet( expand: false, // initialChildSize: // 0.7, // maxChildSize: // 1, // minChildSize: // 0.5, builder: (BuildContext context, ScrollController scrollController) { return Container( width: MediaQuery.of(context).size.width, //color: Color.fromARGB(255, 246, 248, 252), decoration: BoxDecoration(borderRadius: BorderRadius.circular(0)), child: Column( children: [ Expanded( child: ListView.builder( controller: scrollController, itemCount: 1, itemBuilder: (BuildContext context, int index) { return Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, mainAxisAlignment: MainAxisAlignment.center, children: [ SizedBox( height: 18.0, ), Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ Expanded( child: Padding( padding: const EdgeInsets.only(left: 18.0), child: Text( field1!, softWrap: true, style: TextStyle( fontSize: 16.0, color: Colors.grey[700]), ), ), ) ], ), SizedBox( height: 0.0, ), Visibility( visible: engbtn, child: Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ Padding( padding: const EdgeInsets.only(left: 18.0), child: FittedBox( fit: BoxFit.fill, child: GestureDetector( onTap: () async { final ConfigDataProvider configDataProvider = ConfigDataProvider(); await configDataProvider .initConfigUIDataEng(); final provider = Provider.of( context, listen: false); if (getCount( provider .intConfigDataList[index] .name, provider) != 0) { provider.savedList .where((element) => element.form == provider .intConfigDataList[index] .name) .toList(); Navigator.push( context, MaterialPageRoute( builder: (BuildContext context) => SavedFormListScreen( formname: provider .intConfigDataList[ index] .name, ))); } }, child: Text( "View Engagement Form", style: TextStyle( fontSize: 14.0, color: Colors.black), ), ), ), ) ], ), ), SizedBox( height: 18.0, ), Divider(), SizedBox( height: 8.0, ), Visibility( visible: f2!, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Padding( padding: const EdgeInsets.only(left: 18.0), child: Text( subfield2!, style: TextStyle( fontSize: 13.0, color: Colors.grey[700]), ), ), Padding( padding: const EdgeInsets.only(left: 18.0), child: Text( field2!, style: TextStyle( fontSize: 15.0, color: Colors.black), ), ) ], ), ), Visibility( visible: f3!, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Padding( padding: const EdgeInsets.only( left: 18.0, top: 18.0), child: Text( subfield3!, style: TextStyle( fontSize: 13.0, color: Colors.grey[700]), ), ), Padding( padding: const EdgeInsets.only(left: 18.0), child: Text( field3!, style: TextStyle( fontSize: 15.0, color: Colors.black), ), ) ], ), ), Visibility( visible: f4!, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Padding( padding: const EdgeInsets.only( left: 18.0, top: 18.0), child: Text( subfield4!, style: TextStyle( fontSize: 13.0, color: Colors.grey[700]), ), ), Padding( padding: const EdgeInsets.only(left: 18.0), child: Text( field4!, style: TextStyle( fontSize: 15.0, color: Colors.black), ), ) ], ), ), Visibility( visible: f5!, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Padding( padding: const EdgeInsets.only( left: 18.0, top: 18.0), child: Text( subfield5!, style: TextStyle( fontSize: 13.0, color: Colors.grey[700]), ), ), Padding( padding: const EdgeInsets.only(left: 18.0), child: Text( field5!, style: TextStyle( fontSize: 15.0, color: Colors.black), ), ) ], ), ), Visibility( visible: f6!, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Padding( padding: const EdgeInsets.only( left: 18.0, top: 18.0), child: Text( subfield6!, style: TextStyle( fontSize: 13.0, color: Colors.grey[700]), ), ), Padding( padding: const EdgeInsets.only(left: 18.0), child: Text( field6!, style: TextStyle( fontSize: 15.0, color: Colors.black), ), ) ], ), ), Visibility( visible: f7!, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Padding( padding: const EdgeInsets.only( left: 18.0, top: 18.0), child: Text( subfield7!, style: TextStyle( fontSize: 13.0, color: Colors.grey[700]), ), ), Padding( padding: const EdgeInsets.only(left: 18.0), child: Text( field7!, style: TextStyle( fontSize: 15.0, color: Colors.black), ), ) ], ), ), Visibility( visible: f8!, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Padding( padding: const EdgeInsets.only( left: 18.0, top: 18.0), child: Text( subfield8!, style: TextStyle( fontSize: 13.0, color: Colors.grey[700]), ), ), Padding( padding: const EdgeInsets.only(left: 18.0), child: Text( field8!, style: TextStyle( fontSize: 15.0, color: Colors.black), ), ) ], ), ), Visibility( visible: f9!, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Padding( padding: const EdgeInsets.only( left: 18.0, top: 18.0), child: Text( subfield9!, style: TextStyle( fontSize: 13.0, color: Colors.grey[700]), ), ), Padding( padding: const EdgeInsets.only(left: 18.0), child: Text( field9!, style: TextStyle( fontSize: 15.0, color: Colors.black), ), ) ], ), ), Visibility( visible: f10!, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Padding( padding: const EdgeInsets.only( left: 18.0, top: 18.0), child: Text( subfield10!, style: TextStyle( fontSize: 13.0, color: Colors.grey[700]), ), ), Padding( padding: const EdgeInsets.only(left: 18.0), child: Text( field10!, style: TextStyle( fontSize: 15.0, color: Colors.black), ), ) ], ), ), ], ); }), ), ], ), ); }, ); } Future getCount(String form, InteractionProvider provider) async { await provider.getRecords(); return provider.savedList.where((element) => element.form == form).length; } }