DiscoverModule/lib/contacts_module/ui_screen/affiliation_data.dart

327 lines
13 KiB
Dart

// import 'package:discover_module/provider_class/affiliationsprovider.dart';
import 'package:discover_module/contacts_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: ListView.builder(
itemCount: hcpaffiliations.length,
itemBuilder: (context, index) {
return Column(
children: [
Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text("Organization Name"),
Text(
hcpaffiliations[index]['org_name'],
style: TextStyle(fontSize: 15.0, color: Colors.black),
),
SizedBox(
height: 10.0,
),
Text("Department"),
Text(hcpaffiliations[index]['dept'],
style:
TextStyle(fontSize: 15.0, color: Colors.black)),
SizedBox(
height: 10.0,
),
Text("Role"),
Text(hcpaffiliations[index]['role'],
style:
TextStyle(fontSize: 15.0, color: Colors.black)),
SizedBox(
height: 10.0,
),
Text("Time Frame"),
Text(hcpaffiliations[index]['time_frame'],
style:
TextStyle(fontSize: 15.0, color: Colors.black)),
SizedBox(
height: 10.0,
),
Text("Organization Type"),
Text(hcpaffiliations[index]['org_type'],
style:
TextStyle(fontSize: 15.0, color: Colors.black)),
SizedBox(
height: 10.0,
),
Text("Engagement Type"),
Text(hcpaffiliations[index]['emg_type'],
style:
TextStyle(fontSize: 15.0, color: Colors.black)),
Divider()
],
),
),
],
);
// ListTile(
// title: Text(hcpaffiliations[index]['org_name'].toString()));
}));
}
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,
),
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]),
),
)
],
),
],
);
},
),
),
],
),
);
},
);
//);
},
);
}
}