KonectarEvents/lib/contacts_module/ui_screen/activity_tab.dart

983 lines
46 KiB
Dart
Raw Normal View History

2024-10-08 12:01:59 +00:00
// import 'package:konectar_events/constants.dart';
// import 'package:konectar_events/custom_widget/text.dart';
// import 'package:konectar_events/provider_class/affiliationsprovider.dart';
// import 'package:konectar_events/provider_class/events_provider.dart';
// import 'package:konectar_events/provider_class/publications_provider.dart';
// import 'package:konectar_events/provider_class/trials_provider.dart';
// import 'package:konectar_events/ui_screen/affiliation_data.dart';
// import 'package:konectar_events/ui_screen/bottom_sheet.dart';
// import 'package:konectar_events/ui_screen/events_data.dart';
// import 'package:konectar_events/ui_screen/publication_data.dart';
// import 'package:konectar_events/ui_screen/trials_show_more.dart';
import 'package:konectar_events/contacts_module/constants.dart';
import 'package:konectar_events/contacts_module/custom_widget/text.dart';
import 'package:konectar_events/contacts_module/provider_class/affiliationsprovider.dart';
import 'package:konectar_events/contacts_module/provider_class/events_provider.dart';
import 'package:konectar_events/contacts_module/provider_class/publications_provider.dart';
import 'package:konectar_events/contacts_module/provider_class/trials_provider.dart';
import 'package:konectar_events/contacts_module/ui_screen/affiliation_data.dart';
import 'package:konectar_events/contacts_module/ui_screen/bottom_sheet.dart';
import 'package:konectar_events/contacts_module/ui_screen/events_data.dart';
import 'package:konectar_events/contacts_module/ui_screen/publication_data.dart';
import 'package:konectar_events/contacts_module/ui_screen/trials_show_more.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
class Activities extends StatefulWidget {
//Activities({super.key, required text});
Activities({required this.text, Key? key}) : super(key: key);
final int text;
@override
State<Activities> createState() => _ActivitiesState();
}
class _ActivitiesState extends State<Activities> {
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<AffiliationsProvider>(context, listen: false);
await affiliations.getAffiliationsdata(widget.text);
final affilist = affiliations.adddta;
print("CheckingAfflist: $affilist");
var publication = Provider.of<PublicatioProvider>(context, listen: false);
await publication.publicatininfo(widget.text);
final publist = publication.publicationlist;
var events = Provider.of<EventProvider>(context, listen: false);
await events.geteventdata(widget.text);
final eventlist = events.EventsList;
//var form = Provider.of<ViewInteractionProvider>(context, listen: false);
// form.savedList;
var trials = Provider.of<TrialsProvider>(context, listen: false);
await trials.trialsdata(widget.text);
final trialslist = trials.trialsinfo;
// var med = Provider.of<MediacalInsightProvider>(context, listen: false);
// await med.medicalinsightdata();
// final medlist = med.trialsinfo;
// var speaker11 =
// Provider.of<SpekerEvalutionProvider>(context, listen: false);
// await speaker11.getspeakerdata();
// final speakerlist = speaker11.speaker;
// var engtype = Provider.of<EnagagementProvider>(context, listen: false);
// await engtype.getengagementdata();
// final engtypelist = engtype.engagementdata;
setState(() {
affiliation_data = affilist;
publication_data = publist;
event_data = eventlist;
// viewformData = form.savedList;
trial_data = trialslist;
// medinsightData = medlist;
// speaker = speakerlist;
// eng = engtypelist;
});
print("Affiliations_data_isNewOff123: ${affiliation_data}");
print("Publication_data_isNewOff: $publication_data");
// print("trialslist_data_is: $trialslist");
//final affiliationsss = affiliation_data['Affiliations'] as List<Map<String, dynamic>>;
}
@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.k2color11,
child: ExpansionTile(
initiallyExpanded: false,
maintainState: true,
onExpansionChanged: (bool expanded) async {
print("HeyyyPooja");
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: "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<MaterialState> 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.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: "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]
.articalTitle
.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.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),
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]
.eventName
.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.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: "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]
.trialName
.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<void>(
// 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(),
],
);
},
),
),
],
),
);
},
);
//);
},
);
}
}