// import 'package:discover_module/constants.dart'; // import 'package:discover_module/custom_widget/text.dart'; // import 'package:discover_module/model_class/speaker.dart'; // import 'package:discover_module/provider_class/medicalinsightprovider.dart'; // import 'package:discover_module/provider_class/nih_provider.dart'; // import 'package:discover_module/provider_class/patent_provider.dart'; // import 'package:discover_module/provider_class/procedureprovider.dart'; // import 'package:discover_module/provider_class/speaker_provider.dart'; // import 'package:discover_module/provider_class/training_provider.dart'; // import 'package:discover_module/storage_hive/nih_grant_data/crud_nih.dart'; // import 'package:discover_module/storage_hive/patent_data/crud_patent.dart'; // import 'package:discover_module/storage_hive/procedure_data/crud_pro.dart'; // import 'package:discover_module/storage_hive/speaker_data/crud.speaker.dart'; // import 'package:discover_module/ui_screen/bottom_sheet.dart'; // import 'package:discover_module/ui_screen/interactionform/interactionprovider.dart'; // import 'package:discover_module/ui_screen/interactionform/model/save_interaction.dart'; // import 'package:discover_module/ui_screen/interactionform/view_forms_list.dart'; // import 'package:discover_module/ui_screen/interactionform/viewinteractionprovider.dart'; // import 'package:discover_module/ui_screen/medical_insight.dart'; // import 'package:discover_module/ui_screen/new_editinteraction.dart'; // import 'package:discover_module/ui_screen/new_viewinteraction.dart'; // import 'package:discover_module/ui_screen/nih_show_more.dart'; // import 'package:discover_module/ui_screen/patent_show_more.dart'; // import 'package:discover_module/ui_screen/pro_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/provider_class/nih_provider.dart'; import 'package:discover_module/contacts_module/provider_class/patent_provider.dart'; import 'package:discover_module/contacts_module/provider_class/procedureprovider.dart'; import 'package:discover_module/contacts_module/provider_class/speaker_provider.dart'; import 'package:discover_module/contacts_module/storage_hive/nih_grant_data/crud_nih.dart'; import 'package:discover_module/contacts_module/storage_hive/patent_data/crud_patent.dart'; import 'package:discover_module/contacts_module/storage_hive/procedure_data/crud_pro.dart'; import 'package:discover_module/contacts_module/storage_hive/speaker_data/crud.speaker.dart'; import 'package:discover_module/contacts_module/ui_screen/bottom_sheet.dart'; import 'package:discover_module/contacts_module/ui_screen/interactionform/interactionprovider.dart'; import 'package:discover_module/contacts_module/ui_screen/interactionform/model/save_interaction.dart'; import 'package:discover_module/contacts_module/ui_screen/interactionform/view_forms_list.dart'; import 'package:discover_module/contacts_module/ui_screen/interactionform/viewinteractionprovider.dart'; import 'package:discover_module/contacts_module/ui_screen/new_editinteraction.dart'; import 'package:discover_module/contacts_module/ui_screen/new_viewinteraction.dart'; import 'package:discover_module/contacts_module/ui_screen/nih_show_more.dart'; import 'package:discover_module/contacts_module/ui_screen/patent_show_more.dart'; import 'package:discover_module/contacts_module/ui_screen/pro_show_more.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; class EngagementTab extends StatefulWidget { EngagementTab({required this.text, this.offline, Key? key}) : super(key: key); final int text; int? offline; @override State createState() => _EngagementTabState(); } class _EngagementTabState extends State { bool _isExpanded = false; List medinsightData = []; List patent = []; List nihgrants = []; List procedure = []; List speakerlistt = []; // List training = []; // List eng = []; var item; @override void initState() { // TODO: implement initState super.initState(); getdata(); } getdata() async { var form = Provider.of(context, listen: false); form.savedList; final patentt1, nih1, pro1, tri1, speakerlist; //var med = Provider.of(context, listen: false); //await med.medicalinsightdata(); // final medlist = med.trialsinfo; if (widget.offline == 1) { patentt1 = await retrieveidpatent(widget.text); print("Savedd_CheckingloclistEdu123: $patentt1"); } else { var patentt = Provider.of(context, listen: false); await patentt.patentinfo(widget.text); patentt1 = patentt.patentlist; } if (widget.offline == 1) { nih1 = await retrieveidnih(widget.text); print("Savedd_CheckingloclistEdu123: $nih1"); } else { var nih = Provider.of(context, listen: false); await nih.nihinfo(widget.text); nih1 = nih.nihgrantslist; } if (widget.offline == 1) { pro1 = await retrieveidpro(widget.text); print("Savedd_CheckingloclistEdupro1123: $pro1"); } else { var pro = Provider.of(context, listen: false); await pro.proinfo(widget.text); pro1 = pro.prolist; } if (widget.offline == 1) { speakerlist = await retrieveidspeaker(widget.text); print("Savedd_CheckingloclistEdupro1123: $pro1"); } else { var speaker1 = Provider.of(context, listen: false); await speaker1.getspeakerdata(); speakerlist = speaker1.speakerlist; } setState(() { // medinsightData = medlist; patent = patentt1; nihgrants = nih1; procedure = pro1; // training = tri1; speakerlistt = speakerlist; // eng = engtypelist; }); // print("CheckingPro: ${pro1.procedure}"); // print("Checkingnihgrants: $nihgrants"); } @override Widget build(BuildContext context) { return Center( child: ListView( children: [ // 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.k2color11, // child: ExpansionTile( // initiallyExpanded: false, // maintainState: true, // onExpansionChanged: (bool expanded) { // setState(() { // _isExpanded = expanded; // }); // }, // backgroundColor: Constants.k2color11, // trailing: Icon( // _isExpanded // ? Icons.keyboard_arrow_up // : Icons.keyboard_arrow_down, // color: Colors.black), // // collapsedBackgroundColor: Color(0xFF2b9af3), // // initiallyExpanded: true, // title: Row( // mainAxisAlignment: MainAxisAlignment.start, // // mainAxisSize: MainAxisSize.min, // children: [ // Text1( // title: "Medical Insights", // txtcolor: Colors.black, // fontweight: FontWeight.normal, // txtfont: 17.0), // const SizedBox( // width: 8.0, // ), // Text1( // title: "(3)", // txtcolor: Colors.black, // fontweight: FontWeight.normal, // txtfont: 17.0), // ], // ), // children: [ // Container( // width: MediaQuery.of(context).size.width, // /// 5, // color: Colors.white, // child: Consumer(builder: // (BuildContext context, value, Widget? child) { // print("med1 : ${value.med.length}"); // if (value.med.length != 0) { // return ListView.builder( // physics: const ScrollPhysics(), // // scrollDirection: Axis.vertical, // shrinkWrap: true, // itemCount: value.med.take(2).length, // itemBuilder: (context, index) { // item = value.med[index]; // print( // "Item_Medical_insight ${item['Therapeutic Area']}"); // return Padding( // padding: const EdgeInsets.all(8.0), // child: Card( // margin: EdgeInsets.zero, // elevation: 4, // surfaceTintColor: Colors.white, // shape: RoundedRectangleBorder( // borderRadius: BorderRadius.zero, // ), // child: SizedBox( // width: MediaQuery.sizeOf(context).width, // child: ListTile( // dense: true, // title: Column( // // crossAxisAlignment: CrossAxisAlignment.center, // children: [ // // Text( // // "Acute neurology is the therapeutic area of the medical insight for Product A. The age of treatment is the topic of interest for this source type publication."), // RichText( // text: TextSpan( // text: '', // style: DefaultTextStyle.of( // context) // .style, // children: const [ // TextSpan( // text: // 'Acute neurology ', // style: TextStyle( // fontWeight: // FontWeight // .bold)), // // TextSpan( // // text: ' therapeutic area ', // // style: TextStyle( // // fontWeight: // // FontWeight.bold)), // TextSpan( // text: // 'is the therapeutic area of the medical insight for '), // TextSpan( // text: // 'Product A. The age of treatment', // style: TextStyle( // fontWeight: // FontWeight // .bold)), // TextSpan( // text: // ' is the topic of interest for this source type'), // TextSpan( // text: ' publication.', // style: TextStyle( // fontWeight: // FontWeight // .bold)), // ], // ), // ), // const Padding( // padding: EdgeInsets.all(8.0), // child: Row( // mainAxisAlignment: // MainAxisAlignment // .spaceBetween, // children: [ // Row( // children: [ // Icon( // Icons.person, // size: 20, // ), // Text( // "pooja", // style: TextStyle( // fontSize: 14.0), // ) // ], // ), // Row( // children: [ // Icon( // Icons.calendar_today, // size: 20, // ), // Text( // "11/11/2022 ", // style: TextStyle( // fontSize: 14.0), // ) // ], // ) // ], // ), // ), // ], // ), // ), // ), // // shape: BorderRadius.only(bottomRight: Radius.circular(50)), // ), // ); // }); // } else { // return Container( // color: Colors.white, // width: MediaQuery.of(context).size.width, // child: Column( // children: [ // Text("No records"), // ], // ), // ); // } // }), // ), // 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: (_) => // const MedicalInsight1())); // }, // child: Text( // 'Show More', // style: TextStyle(color: Constants.k2color), // ), // style: OutlinedButton.styleFrom( // shape: RoundedRectangleBorder( // borderRadius: BorderRadius.circular(12), // ), // ), // ), // ), // ), // ) // ]), // ), // ), // ), 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.k2color11, child: ExpansionTile( initiallyExpanded: false, maintainState: true, onExpansionChanged: (bool expanded) { setState(() { _isExpanded = expanded; }); }, backgroundColor: Constants.k2color11, trailing: Icon( _isExpanded ? Icons.keyboard_arrow_up : Icons.keyboard_arrow_down, color: Colors.black), // collapsedBackgroundColor: Color(0xFF2b9af3), title: Row( //mainAxisSize: MainAxisSize.min, children: [ GestureDetector( onTap: () async { final provider = Provider.of( context, listen: false); if (getCount(provider.intConfigDataList[0].name, provider) != 0) { provider.savedList .where((element) => element.form == provider.intConfigDataList[0].name) .toList(); Navigator.push( context, MaterialPageRoute( builder: (BuildContext context) => SavedFormListScreen( formname: provider .intConfigDataList[0].name, ))); } }, child: Text1( title: "Interactions", txtcolor: Colors.black, fontweight: FontWeight.normal, txtfont: 17.0), ), const SizedBox( width: 8.0, ), ], ), children: [ Container( height: MediaQuery.of(context).size.height / 5, color: Colors.white, child: Consumer(builder: (BuildContext context, provider, Widget? child) { print("P_leangth : ${provider.savedList.length}"); if (provider.savedList.length != 0) { return ListView.builder( shrinkWrap: true, physics: NeverScrollableScrollPhysics(), itemCount: provider.savedList.take(2).length, itemBuilder: (context, index) { print("Indexxxxxx $index"); return Column( children: [ ListTile( subtitle: Text( 'Updated on ${provider.savedList[index].updatedTime}', //style: TextStyle(fontStyle: FontStyle.italic), ), title: Text( provider.savedList[index].id, ), trailing: SizedBox( width: 150, 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) => 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(), ], ); }); } else { return Container( color: Colors.white, width: MediaQuery.of(context).size.width, child: Column( children: [ Text("No records"), ], ), ); } }), ), Container( color: Colors.white, child: Align( alignment: Alignment.center, child: Padding( padding: const EdgeInsets.all(8.0), child: OutlinedButton( onPressed: () { final provider = Provider.of(context, listen: false); if (getCount(provider.intConfigDataList[0].name, provider) != 0) { provider.savedList .where((element) => element.form == provider.intConfigDataList[0].name) .toList(); Navigator.push( context, MaterialPageRoute( builder: (BuildContext context) => SavedFormListScreen( formname: provider .intConfigDataList[0].name, ))); } }, child: Text('Show More'), style: OutlinedButton.styleFrom( shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(12), ), ), ), ), ), ) ]), ), ), ), speakerlistt.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.k2color11, child: ExpansionTile( initiallyExpanded: false, maintainState: true, onExpansionChanged: (bool expanded) { setState(() { _isExpanded = expanded; }); }, backgroundColor: Constants.k2color11, 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: "Speaker Evalution", txtcolor: Colors.black, fontweight: FontWeight.normal, txtfont: 17.0), const SizedBox( width: 8.0, ), Text1( title: "(${speakerlistt.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( 'Program Topic', style: TextStyle( fontWeight: FontWeight.w600), ), )), DataColumn( label: Expanded( child: Text('Speaker Name', style: TextStyle( fontWeight: FontWeight.w600)))), ], rows: List.generate( speakerlistt.take(2).length, (index) => DataRow( onSelectChanged: (value) { // =======> Use onSelectChanged for tab print( "message ${speakerlistt[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( speakerlistt[index]); }, ); }, color: MaterialStateProperty .resolveWith( (Set states) { if (index.isEven) { return Colors.grey.withOpacity(0.1); } return null; }), cells: [ DataCell(Text( speakerlistt[index] .programtopic .toString(), softWrap: true)), DataCell(Text( speakerlistt[index] .speakername .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: (_) => // AffiliationsData())); }, 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 nihgrants.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.k2color11, child: ExpansionTile( initiallyExpanded: false, maintainState: true, // backgroundColor: Colors.white, // collapsedBackgroundColor: Color(0xFF2b9af3), onExpansionChanged: (bool expanded) { setState(() { _isExpanded = expanded; }); }, backgroundColor: Constants.k2color11, 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: "NIH Grants", txtcolor: Colors.black, fontweight: FontWeight.normal, txtfont: 17.0), const SizedBox( width: 8.0, ), Text1( title: "(${nihgrants.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('NIH Center', style: TextStyle( fontWeight: FontWeight.w600), softWrap: true), )), DataColumn( label: Expanded( child: Text('Organization Name', style: TextStyle( fontWeight: FontWeight.w600)))), ], rows: List.generate( nihgrants.take(2).length, (index) => DataRow( onSelectChanged: (value) { print("message ${nihgrants[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(nihgrants[index]); }, ); }, cells: [ DataCell(Text( nihgrants[index] .piNames .toString(), softWrap: true)), DataCell(Text( nihgrants[index] .institute .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: (_) => NIHShowMore( 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 procedure.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.k2color11, child: ExpansionTile( initiallyExpanded: false, maintainState: true, // backgroundColor: Colors.white, // collapsedBackgroundColor: Color(0xFF2b9af3), onExpansionChanged: (bool expanded) { setState(() { _isExpanded = expanded; }); }, backgroundColor: Constants.k2color11, 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: "Procedures", txtcolor: Colors.black, fontweight: FontWeight.normal, txtfont: 17.0), const SizedBox( width: 8.0, ), Text1( title: "(${procedure.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('Program Year', style: TextStyle( fontWeight: FontWeight.w600), softWrap: true), )), DataColumn( label: Expanded( child: Text('Procedure', style: TextStyle( fontWeight: FontWeight.w600)))), ], rows: List.generate( procedure.take(2).length, (index) => DataRow( onSelectChanged: (value) { print("message ${procedure[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(procedure[index]); }, ); }, cells: [ DataCell(Text( procedure[index] .procedure .toString(), softWrap: true)), DataCell(Text( procedure[index] .placeOfService .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: (_) => ProShowMore( 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 patent.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.k2color11, child: ExpansionTile( initiallyExpanded: false, maintainState: true, // backgroundColor: Colors.white, // collapsedBackgroundColor: Color(0xFF2b9af3), onExpansionChanged: (bool expanded) { setState(() { _isExpanded = expanded; }); }, backgroundColor: Constants.k2color11, 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: "Patents", txtcolor: Colors.black, fontweight: FontWeight.normal, txtfont: 17.0), const SizedBox( width: 8.0, ), Text1( title: "(${patent.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('Patent Title', style: TextStyle( fontWeight: FontWeight.w600), softWrap: true), )), DataColumn( label: Expanded( child: Text('Status', style: TextStyle( fontWeight: FontWeight.w600)))), ], rows: List.generate( patent.take(2).length, (index) => DataRow( onSelectChanged: (value) { print("message ${patent[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(patent[index]); }, ); }, cells: [ DataCell(Text( patent[index] .patentTitle .toString(), softWrap: true)), DataCell(Text( patent[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: (_) => PatentShowMore( text: widget.text))); }, child: Text( 'Show More', style: TextStyle(color: Constants.k2color), ), style: OutlinedButton.styleFrom( shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(12), ), ), ), ), ), ) ]), ), ), ) : Container(), ], ), ); } Future getCount(String form, InteractionProvider provider) async { await provider.getRecords(); return provider.savedList.where((element) => element.form == form).length; } showDeleteRecordAlertDialog( BuildContext context, String record, SaveInteraction saveInteraction) { // set up the buttons ViewInteractionProvider provider = Provider.of(context, listen: false); Widget cancelButton = TextButton( child: const Text("YES"), onPressed: () async { await provider.deleteRecord(saveInteraction).then((value) { _displaySnackBar("Deleted sucessfully!"); Navigator.of(context).pop(); }); }, ); Widget continueButton = TextButton( child: const Text("NO"), onPressed: () { Navigator.of(context).pop(); }, ); // set up the AlertDialog AlertDialog alert = AlertDialog( title: const Text(""), content: Text("Are you sure you want to delete the record $record ?"), actions: [ cancelButton, continueButton, ], ); // show the dialog showDialog( context: context, builder: (BuildContext context) { return alert; }, ); } _displaySnackBar(String msg) { final snackBar = SnackBar( content: Text( msg, style: const TextStyle(fontSize: 20.0, fontWeight: FontWeight.bold), )); ScaffoldMessenger.of(context).showSnackBar(snackBar); //scaffoldKeyLogin.currentState!.showSnackBar(snackBar); } }