// import 'package:discover_module/constants.dart'; // import 'package:discover_module/custom_widget/text.dart'; // import 'package:discover_module/provider_class/affiliationsprovider.dart'; // import 'package:discover_module/provider_class/events_provider.dart'; // import 'package:discover_module/provider_class/publications_provider.dart'; // import 'package:discover_module/provider_class/trials_provider.dart'; // import 'package:discover_module/storage_hive/aff_data/insert_aff.dart'; // import 'package:discover_module/storage_hive/events_data/crud_event.dart'; // import 'package:discover_module/storage_hive/pub_data/curd_pub.dart'; // import 'package:discover_module/storage_hive/trials_data/crud_trials.dart'; // import 'package:discover_module/ui_screen/affiliation_data.dart'; // import 'package:discover_module/ui_screen/bottom_sheet.dart'; // import 'package:discover_module/ui_screen/events_data.dart'; // import 'package:discover_module/ui_screen/publication_data.dart'; // import 'package:discover_module/ui_screen/trials_show_more.dart'; import 'package:discover_module/contacts_module/constants.dart'; import 'package:discover_module/contacts_module/custom_widget/text.dart'; import 'package:discover_module/contacts_module/storage_hive/aff_data/insert_aff.dart'; import 'package:discover_module/contacts_module/storage_hive/events_data/crud_event.dart'; import 'package:discover_module/contacts_module/storage_hive/pub_data/curd_pub.dart'; import 'package:discover_module/contacts_module/storage_hive/trials_data/crud_trials.dart'; import 'package:discover_module/contacts_module/ui_screen/affiliation_data.dart'; import 'package:discover_module/contacts_module/ui_screen/bottom_sheet.dart'; import 'package:discover_module/contacts_module/ui_screen/events_data.dart'; import 'package:discover_module/contacts_module/ui_screen/publication_data.dart'; import 'package:discover_module/contacts_module/ui_screen/trials_show_more.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; class SavedActivities extends StatefulWidget { //Activities({super.key, required text}); SavedActivities({required this.text, Key? key}) : super(key: key); final int text; @override State createState() => _SavedActivitiesState(); } class _SavedActivitiesState extends State { bool _isExpanded = false; List affiliation_data = []; List publication_data = []; List event_data = []; List trial_data = []; List medinsightData = []; List speaker = []; List eng = []; @override void initState() { // TODO: implement initState super.initState(); getaffiliations(); } getaffiliations() async { // var affiliations = // Provider.of(context, listen: false); // await affiliations.getAffiliationsdata(widget.text); // final affilist = affiliations.adddta; // print("CheckingAfflist: $affilist"); final affilist = await retrieveidAffiliations(widget.text); print("Savedd_CheckingAfflist: $affilist"); // var publication = Provider.of(context, listen: false); // await publication.publicatininfo(widget.text); // final publist = publication.publicationlist; final publist = await retrieveidPublications(widget.text); print("Savedd_CheckingAfflist: $affilist"); // var events = Provider.of(context, listen: false); // await events.geteventdata(widget.text); // final eventlist = events.EventsList; final eventlist = await retrieveidEvent(widget.text); print("Savedd_CheckingAfflist: $affilist"); // var trials = Provider.of(context, listen: false); // await trials.trialsdata(widget.text); // final trialslist = trials.trialsinfo; final trialslist = await retrieveidTrials(widget.text); print("Savedd_CheckingAfflist: $affilist"); setState(() { affiliation_data = affilist; publication_data = publist; event_data = eventlist; trial_data = trialslist; // medinsightData = medlist; // speaker = speakerlist; // eng = engtypelist; }); print("Affiliations_data_isNewOff: $affiliation_data"); print("Publication_data_isNewOff: $publication_data"); // print("trialslist_data_is: $trialslist"); //final affiliationsss = affiliation_data['Affiliations'] as List>; } @override Widget build(BuildContext context) { return Center( child: ListView(children: [ affiliation_data.length != 0 ? ListTileTheme( dense: true, child: Padding( padding: const EdgeInsets.only(left: 8.0, right: 8.0), child: Card( margin: EdgeInsets.all(1.0), // elevation: 5, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(0.0), ), color: Constants.bgwhitecolor, child: ExpansionTile( initiallyExpanded: false, maintainState: true, onExpansionChanged: (bool expanded) async { print("HeyyyPooja"); setState(() { _isExpanded = expanded; }); }, backgroundColor: Constants.bgwhitecolor, trailing: Icon( _isExpanded ? Icons.keyboard_arrow_up : Icons.keyboard_arrow_down, color: Colors.black), // backgroundColor: Colors.white, // collapsedBackgroundColor: Color(0xFF2b9af3), title: Row( mainAxisAlignment: MainAxisAlignment.start, // mainAxisSize: MainAxisSize.min, children: [ Text1( title: "Affiliations", txtcolor: Colors.black, fontweight: FontWeight.normal, txtfont: 17.0), const SizedBox( width: 8.0, ), Text1( title: "(${affiliation_data.length.toString()})", txtcolor: Colors.black, fontweight: FontWeight.normal, txtfont: 17.0), ], ), children: [ Scrollbar( child: SingleChildScrollView( scrollDirection: Axis.horizontal, child: Container( // width: // MediaQuery.of(context) // .size // .width, constraints: BoxConstraints( minWidth: MediaQuery.of(context).size.width), color: Colors.white, child: DataTable( showCheckboxColumn: false, columns: const [ DataColumn( label: Expanded( child: Text( 'Organization Name', style: TextStyle( fontWeight: FontWeight.w600), ), )), DataColumn( label: Expanded( child: Text('Time Frame', style: TextStyle( fontWeight: FontWeight.w600)))), ], rows: List.generate( affiliation_data.take(2).length, (index) => DataRow( onSelectChanged: (value) { // =======> Use onSelectChanged for tab print( "message11 ${affiliation_data[index]}"); bottomshet(affiliation_data[index]); }, color: MaterialStateProperty.resolveWith< Color?>((Set states) { if (index.isEven) { return Colors.grey.withOpacity(0.1); } return null; }), cells: [ DataCell(Text( affiliation_data[index] .orgName .toString(), softWrap: true)), DataCell(Text( affiliation_data[index] .timeFrame .toString(), softWrap: true)), // Add more DataCells as needed ], ), ), ), ), ), ), Container( color: Colors.white, child: Align( alignment: Alignment.center, child: Padding( padding: const EdgeInsets.all(8.0), child: OutlinedButton( onPressed: () { print("Passing_Id_isss: ${widget.text}"); Navigator.push( context, MaterialPageRoute( builder: (_) => AffiliationsData( text: widget.text))); }, child: Text( 'Show More', style: TextStyle(color: Constants.k2color), ), style: OutlinedButton.styleFrom( shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(12), ), ), ), ), ), ) ]), ), ), ) : Container(), // adds spacing between the text and image publication_data.length != 0 ? ListTileTheme( dense: true, child: Padding( padding: const EdgeInsets.only(left: 8.0, right: 8.0), child: Card( margin: EdgeInsets.all(1.0), // elevation: 5, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(0.0), ), color: Constants.bgwhitecolor, child: ExpansionTile( initiallyExpanded: false, maintainState: true, // backgroundColor: Colors.white, // collapsedBackgroundColor: Color(0xFF2b9af3), onExpansionChanged: (bool expanded) { setState(() { _isExpanded = expanded; }); }, backgroundColor: Constants.bgwhitecolor, trailing: Icon( _isExpanded ? Icons.keyboard_arrow_up : Icons.keyboard_arrow_down, color: Colors.black), title: Row( mainAxisAlignment: MainAxisAlignment.start, // mainAxisSize: MainAxisSize.min, children: [ Text1( title: "Publications", txtcolor: Colors.black, fontweight: FontWeight.normal, txtfont: 17.0), const SizedBox( width: 8.0, ), Text1( title: "(${publication_data.length.toString()})", txtcolor: Colors.black, fontweight: FontWeight.normal, txtfont: 17.0), ], ), children: [ Scrollbar( //isAlwaysShown: true, child: SingleChildScrollView( scrollDirection: Axis.horizontal, child: Container( constraints: BoxConstraints( minWidth: MediaQuery.of(context).size.width), color: Colors.white, child: DataTable( showCheckboxColumn: false, columns: const [ DataColumn( label: Expanded( child: Text('Article Title', style: TextStyle( fontWeight: FontWeight.w600), softWrap: true), )), DataColumn( label: Expanded( child: Text('Authors', style: TextStyle( fontWeight: FontWeight.w600)))), // Add more columns as needed ], rows: List.generate( publication_data.take(2).length, (index) => DataRow( onSelectChanged: (value) { // =======> Use onSelectChanged for tab print( "message ${publication_data[index]}"); showModalBottomSheet( useRootNavigator: true, isScrollControlled: false, enableDrag: true, useSafeArea: true, constraints: const BoxConstraints( maxWidth: double.infinity, ), shape: RoundedRectangleBorder( borderRadius: BorderRadius.vertical( top: Radius.circular(0), ), ), clipBehavior: Clip.antiAliasWithSaveLayer, context: context, builder: (context) { return bsheet( publication_data[index]); }, ); }, cells: [ DataCell(Text( publication_data[index] .artical_title .toString(), softWrap: true)), DataCell(Text( publication_data[index] .author .toString(), softWrap: true)), // Add more DataCells as needed ], ), ), ), ), ), ), Container( color: Colors.white, child: Align( alignment: Alignment.center, child: Padding( padding: const EdgeInsets.all(8.0), child: OutlinedButton( onPressed: () { Navigator.push( context, MaterialPageRoute( builder: (_) => PublicationsData( text: widget.text))); }, child: Text( 'Show More', style: TextStyle(color: Constants.k2color), ), style: OutlinedButton.styleFrom( shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(12), ), ), ), ), ), ) ]), ), ), ) : Container(), // adds spacing between the text and image event_data.length != 0 ? ListTileTheme( dense: true, child: Padding( padding: const EdgeInsets.only(left: 8.0, right: 8.0), child: Card( margin: EdgeInsets.all(1.0), // elevation: 5, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(0.0), ), color: Constants.bgwhitecolor, child: ExpansionTile( initiallyExpanded: false, maintainState: true, onExpansionChanged: (bool expanded) { setState(() { _isExpanded = expanded; }); }, backgroundColor: Constants.bgwhitecolor, trailing: Icon( _isExpanded ? Icons.keyboard_arrow_up : Icons.keyboard_arrow_down, color: Colors.black), title: Row( mainAxisAlignment: MainAxisAlignment.start, // mainAxisSize: MainAxisSize.min, children: [ Text1( title: "Events", txtcolor: Colors.black, fontweight: FontWeight.normal, txtfont: 17.0), const SizedBox( width: 8.0, ), Text1( title: "(${event_data.length.toString()})", txtcolor: Colors.black, fontweight: FontWeight.normal, txtfont: 17.0), ], ), children: [ Scrollbar( child: SingleChildScrollView( scrollDirection: Axis.horizontal, child: Container( constraints: BoxConstraints( minWidth: MediaQuery.of(context).size.width, ), color: Colors.white, child: DataTable( showCheckboxColumn: false, columns: const [ DataColumn( label: Expanded( child: Text('Event Name', softWrap: true, style: TextStyle( fontWeight: FontWeight.w600)), )), DataColumn( label: Expanded( child: Text('Role', softWrap: true, style: TextStyle( fontWeight: FontWeight.w600)))), // Add more columns as needed ], rows: List.generate( event_data.take(2).length, (index) => DataRow( onSelectChanged: (value) { // =======> Use onSelectChanged for tab print("message ${event_data[index]}"); showModalBottomSheet( useRootNavigator: true, isScrollControlled: false, enableDrag: true, useSafeArea: true, constraints: const BoxConstraints( maxWidth: double.infinity, ), shape: RoundedRectangleBorder( borderRadius: BorderRadius.vertical( top: Radius.circular(0), ), ), clipBehavior: Clip.antiAliasWithSaveLayer, context: context, builder: (context) { return bsheet(event_data[index]); }, ); }, cells: [ DataCell(Text( event_data[index] .event_name .toString(), softWrap: true)), DataCell(Text( event_data[index].role.toString(), softWrap: true)), // Add more DataCells as needed ], ), ), ), ), ), ), Container( color: Colors.white, child: Align( alignment: Alignment.center, child: Padding( padding: const EdgeInsets.all(8.0), child: OutlinedButton( onPressed: () { Navigator.push( context, MaterialPageRoute( builder: (_) => EventsData( text: widget.text, ))); }, child: Text( 'Show More', style: TextStyle(color: Constants.k2color), ), style: OutlinedButton.styleFrom( shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(12), ), ), ), ), ), ) ]), ), ), ) : Container(), // adds spacing between the text and image trial_data.length != 0 ? ListTileTheme( dense: true, child: Padding( padding: const EdgeInsets.only(left: 8.0, right: 8.0), child: Card( margin: EdgeInsets.all(1.0), //elevation: 5, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(0.0), ), color: Constants.bgwhitecolor, child: ExpansionTile( initiallyExpanded: false, maintainState: true, onExpansionChanged: (bool expanded) { setState(() { _isExpanded = expanded; }); }, backgroundColor: Constants.bgwhitecolor, trailing: Icon( _isExpanded ? Icons.keyboard_arrow_up : Icons.keyboard_arrow_down, color: Colors.black), // backgroundColor: Colors.white, // collapsedBackgroundColor: Color(0xFF2b9af3), title: Row( mainAxisAlignment: MainAxisAlignment.start, // mainAxisSize: MainAxisSize.min, children: [ Text1( title: "Trials", txtcolor: Colors.black, fontweight: FontWeight.normal, txtfont: 17.0), const SizedBox( width: 8.0, ), Text1( title: "(${trial_data.length.toString()})", txtcolor: Colors.black, fontweight: FontWeight.normal, txtfont: 17.0), ], ), children: [ Scrollbar( child: SingleChildScrollView( scrollDirection: Axis.horizontal, child: Container( constraints: BoxConstraints( minWidth: MediaQuery.of(context).size.width), color: Colors.white, child: DataTable( showCheckboxColumn: false, columns: const [ DataColumn( label: Expanded( child: Text('Trial Name', softWrap: true, style: TextStyle( fontWeight: FontWeight.w600)), )), DataColumn( label: Expanded( child: Text('Status', softWrap: true, style: TextStyle( fontWeight: FontWeight.w600)))), ], rows: List.generate( trial_data.take(2).length, (index) => DataRow( onSelectChanged: (value) { // =======> Use onSelectChanged for tab print("message ${trial_data[index]}"); // bsheet( // publication_data[ // index]); showModalBottomSheet( useRootNavigator: true, isScrollControlled: false, enableDrag: true, useSafeArea: true, constraints: const BoxConstraints( maxWidth: double.infinity, ), shape: RoundedRectangleBorder( borderRadius: BorderRadius.vertical( top: Radius.circular(0), ), ), clipBehavior: Clip.antiAliasWithSaveLayer, context: context, builder: (context) { return bsheet(trial_data[index]); }, ); }, cells: [ DataCell(Text( trial_data[index] .trial_name .toString(), softWrap: true)), DataCell(Text( trial_data[index].status.toString(), softWrap: true)), ], ), ), ), ), ), ), Container( color: Colors.white, child: Align( alignment: Alignment.center, child: Padding( padding: const EdgeInsets.all(8.0), child: OutlinedButton( onPressed: () { Navigator.push( context, MaterialPageRoute( builder: (_) => TrialsShowmore( text: widget.text))); }, style: OutlinedButton.styleFrom( shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(12), ), ), child: Text( 'Show More', style: TextStyle(color: Constants.k2color), ), ), ), ), ) ]), ), ), ) : Container(), // adds spacing between the text and image ]), ); } void bottomshet(affiliation_data) { // print("Aff_index_data: ${affiliation_data}"); showModalBottomSheet( // isScrollControlled: // true, context: context, useRootNavigator: true, isScrollControlled: false, enableDrag: true, useSafeArea: true, constraints: const BoxConstraints( maxWidth: double.infinity, ), shape: RoundedRectangleBorder( borderRadius: BorderRadius.vertical( top: Radius.circular(0), ), ), clipBehavior: Clip.antiAliasWithSaveLayer, // sheetAnimationStyle: _animationStyle, builder: (BuildContext context) { return // makeDismissible( // child: DraggableScrollableSheet( expand: false, builder: (BuildContext context, ScrollController scrollController) { return Container( width: MediaQuery.of(context).size.width, //color: Colors.white, color: Color.fromARGB(255, 246, 248, 252), // decoration: // BoxDecoration(borderRadius: BorderRadius.circular(10)), // child: ListView( // children: [ // ], // ), 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: [ // Row( // children: [ // Text( // "Affiliation", // style: TextStyle(fontSize: 20.0), // ) // ], // ), SizedBox( height: 18.0, ), Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ Expanded( child: Padding( padding: const EdgeInsets.all(18.0), child: Text( affiliation_data['org_name'], softWrap: true, maxLines: 4, style: TextStyle( fontSize: 16.0, color: Colors.black), ), ), ), ], ), SizedBox( height: 18.0, ), Divider(), SizedBox( height: 8.0, ), affiliation_data['dept'] != "" ? Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Padding( padding: const EdgeInsets.only(left: 18.0), child: Text( "Department", style: TextStyle(fontSize: 13.0), ), ), Padding( padding: const EdgeInsets.only(left: 18.0), child: Text( affiliation_data['dept'], style: TextStyle( fontSize: 14.0, color: Colors.grey[700]), ), ) ], ) : Container(), affiliation_data['role'] != "" ? Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Padding( padding: const EdgeInsets.only( left: 18.0, top: 18.0), child: Text( "Role", style: TextStyle(fontSize: 13.0), ), ), Padding( padding: const EdgeInsets.only(left: 18.0), child: Text( affiliation_data['role'], style: TextStyle( fontSize: 14.0, color: Colors.grey[700]), ), ) ], ) : Container(), affiliation_data['time_frame'] != "" ? Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Padding( padding: const EdgeInsets.only( left: 18.0, top: 18.0), child: Text( "Time Frame".toString(), style: TextStyle(fontSize: 13.0), ), ), Padding( padding: const EdgeInsets.only(left: 18.0), child: Text( affiliation_data['time_frame'] .toString(), style: TextStyle( fontSize: 14.0, color: Colors.grey[700]), ), ) ], ) : Container(), affiliation_data['org_type'] != "" ? Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Padding( padding: const EdgeInsets.only( left: 18.0, top: 18.0), child: Text( "Oraganization Type", style: TextStyle(fontSize: 13.0), ), ), Padding( padding: const EdgeInsets.only(left: 18.0), child: Text( affiliation_data['org_type'], style: TextStyle( fontSize: 14.0, color: Colors.grey[700]), ), ) ], ) : Container(), affiliation_data['emg_type'] != "" ? Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Padding( padding: const EdgeInsets.only( left: 18.0, top: 18.0), child: Text( "Eng Type", style: TextStyle(fontSize: 13.0), ), ), Padding( padding: const EdgeInsets.only(left: 18.0), child: Text( affiliation_data['emg_type'], style: TextStyle( fontSize: 14.0, color: Colors.grey[700]), ), ) ], ) : Container(), ], ); }, ), ), ], ), ); }, ); //); }, ); } }