DiscoverModule/lib/ui_screen/affiliation_data.dart

391 lines
17 KiB
Dart

import 'package:discover_module/provider_class/affiliationsprovider.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:discover_module/ui_screen/new_new_profile.dart';
class AffiliationsData extends StatefulWidget {
final int text;
//PublicationsData(text, {super.key});
// AffiliationsData({required this.text}) : super(key: key);
AffiliationsData({required this.text, Key? key}) : super(key: key);
@override
State<AffiliationsData> createState() => _AffiliationsDataState();
}
class _AffiliationsDataState extends State<AffiliationsData> {
List hcpaffiliations = [];
@override
void initState() {
// TODO: implement initState
super.initState();
print("Checkingg_passing_is: ${widget.text}");
affdata();
}
affdata() async {
final affprovider =
Provider.of<AffiliationsProvider>(context, listen: false);
await affprovider.getAffiliationsdata(widget.text);
// await affprovider.getAffiliationsdata(1447203401);
final affdata = affprovider.adddta;
setState(() {
hcpaffiliations = affdata;
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Affiliations'),
),
body: Scrollbar(
child: SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: SingleChildScrollView(
scrollDirection: Axis.vertical,
child: Container(
constraints:
BoxConstraints(minWidth: MediaQuery.of(context).size.width),
color: Colors.white,
child: DataTable(
showCheckboxColumn: false,
columns: const [
//DataColumn(label: Expanded(child: Text('sl no'))),
DataColumn(
label: Expanded(
child: Text('Organization Name'),
)),
DataColumn(
label: Expanded(
child: Text('Department', softWrap: true))),
DataColumn(
label: Expanded(child: Text('Role', softWrap: true))),
DataColumn(
label: Expanded(
child: Text('Time Frame', softWrap: true))),
DataColumn(
label:
Expanded(child: Text('Org Type', softWrap: true))),
DataColumn(
label:
Expanded(child: Text('Eng Type', softWrap: true))),
// Add more columns as needed
],
rows: List.generate(
hcpaffiliations.length,
(index) => DataRow(
onSelectChanged: (value) {
// =======> Use onSelectChanged for tab
print("message11 ${hcpaffiliations[index]}");
bottomshet(hcpaffiliations[index]);
},
cells: [
// DataCell(Text(hcpaffiliations[index]['id'].toString(),
// softWrap: true)),
DataCell(Text(
hcpaffiliations[index]['org_name'].toString(),
softWrap: true)),
DataCell(Text(hcpaffiliations[index]['dept'].toString(),
softWrap: true)),
DataCell(Text(hcpaffiliations[index]['role'].toString(),
softWrap: true)),
DataCell(Text(
hcpaffiliations[index]['time_frame'].toString(),
softWrap: true)),
DataCell(Text(
hcpaffiliations[index]['org_type'].toString(),
softWrap: true)),
DataCell(Text(
hcpaffiliations[index]['emg_type'].toString(),
softWrap: true)),
// Add more DataCells as needed
],
),
),
),
),
),
),
));
}
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),
),
),
),
// Padding(
// padding: const EdgeInsets.only(left: 18.0),
// child:
// GestureDetector(
// onTap: () async {
// final ConfigDataProvider
// configDataProvider =
// ConfigDataProvider();
// await configDataProvider
// .initConfigUIDataEng();
// final provider =
// Provider.of<InteractionProvider>(
// 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,
// )));
// }
// // Navigator.push(
// // context,
// // MaterialPageRoute(
// // builder: (context) =>
// // const InteractionListScreen()));
// },
// child: Text(
// affiliation_data['org_name'],
// softWrap: true,
// maxLines: 4,
// style: TextStyle(
// fontSize: 18.0,
// color: Colors.grey[700]),
// ),
// ),
// )
],
),
SizedBox(
height: 18.0,
),
Divider(),
SizedBox(
height: 8.0,
),
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'].toString(),
style: TextStyle(
fontSize: 14.0,
color: Colors.grey[700]),
),
)
],
),
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]),
),
)
],
),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.only(
left: 18.0, top: 18.0),
child: Text(
"Time Frame",
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]),
),
)
],
),
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]),
),
)
],
),
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]),
),
)
],
),
],
);
},
),
),
],
),
);
},
);
//);
},
);
}
}