462 lines
18 KiB
Dart
462 lines
18 KiB
Dart
|
import 'package:discover_module/ui_screen/interactionform/configprovider.dart';
|
||
|
import 'package:discover_module/ui_screen/interactionform/interactionprovider.dart';
|
||
|
import 'package:discover_module/ui_screen/interactionform/view_forms_list.dart';
|
||
|
import 'package:flutter/cupertino.dart';
|
||
|
import 'package:flutter/material.dart';
|
||
|
import 'package:flutter/widgets.dart';
|
||
|
import 'package:provider/provider.dart';
|
||
|
|
||
|
class bsheet extends StatefulWidget {
|
||
|
const bsheet(this.publicationdata, {super.key});
|
||
|
final publicationdata;
|
||
|
|
||
|
@override
|
||
|
State<bsheet> createState() => _MyWidgetState();
|
||
|
}
|
||
|
|
||
|
class _MyWidgetState extends State<bsheet> {
|
||
|
String? field1, field2, field3, field4, field5, field6, field7;
|
||
|
String? subfield2, subfield3, subfield4, subfield5, subfield6, subfield7;
|
||
|
bool? f2, f3, f4, f5, f6, f7;
|
||
|
bool engbtn = false;
|
||
|
@override
|
||
|
void initState() {
|
||
|
// TODO: implement initState
|
||
|
super.initState();
|
||
|
print("data-isssbottomshett: ${widget.publicationdata}");
|
||
|
if (widget.publicationdata['artical_title'] != null) {
|
||
|
setState(() {
|
||
|
field1 = widget.publicationdata['artical_title'];
|
||
|
|
||
|
subfield2 = "Journal Name";
|
||
|
field2 = widget.publicationdata['journal_name'];
|
||
|
f2 = true;
|
||
|
|
||
|
subfield3 = "Date";
|
||
|
field3 = widget.publicationdata['date'];
|
||
|
f3 = true;
|
||
|
|
||
|
subfield4 = "Author";
|
||
|
field4 = widget.publicationdata['author'];
|
||
|
f4 = true;
|
||
|
|
||
|
subfield5 = "";
|
||
|
field5 = " ";
|
||
|
f5 = false;
|
||
|
|
||
|
subfield6 = "";
|
||
|
field6 = " ";
|
||
|
f6 = false;
|
||
|
|
||
|
subfield7 = "";
|
||
|
field7 = " ";
|
||
|
f7 = false;
|
||
|
});
|
||
|
|
||
|
//print("isssbottomshett123: ${widget.publicationdata['event_name']}");
|
||
|
} else if (widget.publicationdata['event_name'] != null) {
|
||
|
setState(() {
|
||
|
field1 = widget.publicationdata['event_name'];
|
||
|
|
||
|
subfield2 = "Session Type";
|
||
|
field2 = widget.publicationdata['session_type'];
|
||
|
f2 = true;
|
||
|
|
||
|
subfield3 = "Topic";
|
||
|
field3 = widget.publicationdata['topic'];
|
||
|
f3 = true;
|
||
|
|
||
|
subfield4 = "Role";
|
||
|
field4 = widget.publicationdata['role'];
|
||
|
f4 = true;
|
||
|
|
||
|
subfield5 = "";
|
||
|
field5 = " ";
|
||
|
f5 = false;
|
||
|
|
||
|
subfield6 = "";
|
||
|
field6 = " ";
|
||
|
f6 = false;
|
||
|
|
||
|
subfield7 = "";
|
||
|
field7 = " ";
|
||
|
f7 = false;
|
||
|
});
|
||
|
} else if (widget.publicationdata['trial_name'] != null) {
|
||
|
setState(() {
|
||
|
field1 = widget.publicationdata['trial_name'];
|
||
|
|
||
|
subfield2 = "Status";
|
||
|
field2 = widget.publicationdata['status'];
|
||
|
f2 = true;
|
||
|
|
||
|
subfield3 = "Sponsors";
|
||
|
field3 = widget.publicationdata['sponsors'];
|
||
|
f3 = true;
|
||
|
|
||
|
subfield4 = "Condtion";
|
||
|
field4 = widget.publicationdata['condition'];
|
||
|
f4 = true;
|
||
|
|
||
|
subfield5 = "Intervention";
|
||
|
field5 = widget.publicationdata['intervention'];
|
||
|
f5 = true;
|
||
|
|
||
|
subfield6 = "Phase";
|
||
|
field6 = widget.publicationdata['phase'];
|
||
|
f6 = true;
|
||
|
|
||
|
subfield7 = "";
|
||
|
field7 = " ";
|
||
|
f7 = false;
|
||
|
});
|
||
|
} else if (widget.publicationdata['programtopic'] != null) {
|
||
|
setState(() {
|
||
|
field1 = widget.publicationdata['programtopic'];
|
||
|
|
||
|
subfield2 = "Speaker Name";
|
||
|
field2 = widget.publicationdata['speakername'];
|
||
|
f2 = true;
|
||
|
|
||
|
subfield3 = "Role";
|
||
|
field3 = widget.publicationdata['role'];
|
||
|
f3 = true;
|
||
|
|
||
|
subfield4 = "Evalutor Name";
|
||
|
field4 = widget.publicationdata['evaluatorname'];
|
||
|
f4 = true;
|
||
|
|
||
|
subfield5 = "Date";
|
||
|
field5 = widget.publicationdata['programdate'];
|
||
|
f5 = true;
|
||
|
|
||
|
subfield6 = "";
|
||
|
field6 = "";
|
||
|
f6 = false;
|
||
|
|
||
|
subfield7 = "";
|
||
|
field7 = " ";
|
||
|
f7 = false;
|
||
|
});
|
||
|
} else if (widget.publicationdata['hcpname'] != null) {
|
||
|
setState(() {
|
||
|
field1 = widget.publicationdata['hcpname'];
|
||
|
|
||
|
subfield2 = "Main Therapeutic Area";
|
||
|
field2 = widget.publicationdata['main thereutic area'];
|
||
|
f2 = true;
|
||
|
|
||
|
subfield3 = "Relationship with Chiesi";
|
||
|
field3 = widget.publicationdata['relationship with chiesi'];
|
||
|
f3 = true;
|
||
|
|
||
|
subfield4 = "Level of Engagement";
|
||
|
field4 = widget.publicationdata['level of engagement'];
|
||
|
f4 = true;
|
||
|
|
||
|
subfield5 = "Date";
|
||
|
field5 = widget.publicationdata['date'];
|
||
|
f5 = true;
|
||
|
|
||
|
subfield6 = "Plan of Action";
|
||
|
field6 = widget.publicationdata['plan of action'];
|
||
|
f6 = true;
|
||
|
|
||
|
subfield7 = "Recorded By";
|
||
|
field7 = widget.publicationdata['recorded by'];
|
||
|
f7 = true;
|
||
|
|
||
|
engbtn = true;
|
||
|
});
|
||
|
}
|
||
|
// print("data-isssbottomshett: ${widget.publicationdata['artical_title']}");
|
||
|
}
|
||
|
|
||
|
@override
|
||
|
Widget build(BuildContext context) {
|
||
|
return DraggableScrollableSheet(
|
||
|
expand: false,
|
||
|
// initialChildSize:
|
||
|
// 0.7,
|
||
|
// maxChildSize:
|
||
|
// 1,
|
||
|
// minChildSize:
|
||
|
// 0.5,
|
||
|
builder: (BuildContext context, ScrollController scrollController) {
|
||
|
return Container(
|
||
|
width: MediaQuery.of(context).size.width,
|
||
|
//color: Color.fromARGB(255, 246, 248, 252),
|
||
|
decoration: BoxDecoration(borderRadius: BorderRadius.circular(0)),
|
||
|
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: [
|
||
|
SizedBox(
|
||
|
height: 18.0,
|
||
|
),
|
||
|
Row(
|
||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||
|
children: [
|
||
|
Expanded(
|
||
|
child: Padding(
|
||
|
padding: const EdgeInsets.only(left: 18.0),
|
||
|
child: Text(
|
||
|
field1!,
|
||
|
softWrap: true,
|
||
|
style: TextStyle(
|
||
|
fontSize: 16.0, color: Colors.black),
|
||
|
),
|
||
|
),
|
||
|
)
|
||
|
],
|
||
|
),
|
||
|
SizedBox(
|
||
|
height: 0.0,
|
||
|
),
|
||
|
Visibility(
|
||
|
visible: engbtn,
|
||
|
child: Row(
|
||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||
|
children: [
|
||
|
Padding(
|
||
|
padding: const EdgeInsets.only(left: 18.0),
|
||
|
child: FittedBox(
|
||
|
fit: BoxFit.fill,
|
||
|
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(
|
||
|
"View Engagement Form",
|
||
|
style: TextStyle(
|
||
|
fontSize: 14.0,
|
||
|
color: Colors.grey[700]),
|
||
|
),
|
||
|
),
|
||
|
),
|
||
|
)
|
||
|
],
|
||
|
),
|
||
|
),
|
||
|
SizedBox(
|
||
|
height: 18.0,
|
||
|
),
|
||
|
Divider(),
|
||
|
SizedBox(
|
||
|
height: 8.0,
|
||
|
),
|
||
|
Visibility(
|
||
|
visible: f2!,
|
||
|
child: Column(
|
||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||
|
children: [
|
||
|
Padding(
|
||
|
padding: const EdgeInsets.only(left: 18.0),
|
||
|
child: Text(
|
||
|
subfield2!,
|
||
|
style: TextStyle(fontSize: 13.0),
|
||
|
),
|
||
|
),
|
||
|
Padding(
|
||
|
padding: const EdgeInsets.only(left: 18.0),
|
||
|
child: Text(
|
||
|
field2!,
|
||
|
style: TextStyle(
|
||
|
fontSize: 15.0,
|
||
|
color: Colors.grey[700]),
|
||
|
),
|
||
|
)
|
||
|
],
|
||
|
),
|
||
|
),
|
||
|
Visibility(
|
||
|
visible: f3!,
|
||
|
child: Column(
|
||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||
|
children: [
|
||
|
Padding(
|
||
|
padding: const EdgeInsets.only(
|
||
|
left: 18.0, top: 18.0),
|
||
|
child: Text(
|
||
|
subfield3!,
|
||
|
style: TextStyle(fontSize: 13.0),
|
||
|
),
|
||
|
),
|
||
|
Padding(
|
||
|
padding: const EdgeInsets.only(left: 18.0),
|
||
|
child: Text(
|
||
|
field3!,
|
||
|
style: TextStyle(
|
||
|
fontSize: 15.0,
|
||
|
color: Colors.grey[700]),
|
||
|
),
|
||
|
)
|
||
|
],
|
||
|
),
|
||
|
),
|
||
|
Visibility(
|
||
|
visible: f4!,
|
||
|
child: Column(
|
||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||
|
children: [
|
||
|
Padding(
|
||
|
padding: const EdgeInsets.only(
|
||
|
left: 18.0, top: 18.0),
|
||
|
child: Text(
|
||
|
subfield4!,
|
||
|
style: TextStyle(fontSize: 13.0),
|
||
|
),
|
||
|
),
|
||
|
Padding(
|
||
|
padding: const EdgeInsets.only(left: 18.0),
|
||
|
child: Text(
|
||
|
field4!,
|
||
|
style: TextStyle(
|
||
|
fontSize: 15.0,
|
||
|
color: Colors.grey[700]),
|
||
|
),
|
||
|
)
|
||
|
],
|
||
|
),
|
||
|
),
|
||
|
Visibility(
|
||
|
visible: f5!,
|
||
|
child: 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(
|
||
|
"fff",
|
||
|
style: TextStyle(
|
||
|
fontSize: 15.0,
|
||
|
color: Colors.grey[700]),
|
||
|
),
|
||
|
)
|
||
|
],
|
||
|
),
|
||
|
),
|
||
|
Visibility(
|
||
|
visible: f6!,
|
||
|
child: Column(
|
||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||
|
children: [
|
||
|
Padding(
|
||
|
padding: const EdgeInsets.only(
|
||
|
left: 18.0, top: 18.0),
|
||
|
child: Text(
|
||
|
subfield6!,
|
||
|
style: TextStyle(fontSize: 13.0),
|
||
|
),
|
||
|
),
|
||
|
Padding(
|
||
|
padding: const EdgeInsets.only(left: 18.0),
|
||
|
child: Text(
|
||
|
field6!,
|
||
|
style: TextStyle(
|
||
|
fontSize: 15.0,
|
||
|
color: Colors.grey[700]),
|
||
|
),
|
||
|
)
|
||
|
],
|
||
|
),
|
||
|
),
|
||
|
Visibility(
|
||
|
visible: f7!,
|
||
|
child: Column(
|
||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||
|
children: [
|
||
|
Padding(
|
||
|
padding: const EdgeInsets.only(
|
||
|
left: 18.0, top: 18.0),
|
||
|
child: Text(
|
||
|
subfield7!,
|
||
|
style: TextStyle(fontSize: 13.0),
|
||
|
),
|
||
|
),
|
||
|
Padding(
|
||
|
padding: const EdgeInsets.only(left: 18.0),
|
||
|
child: Text(
|
||
|
field7!,
|
||
|
style: TextStyle(
|
||
|
fontSize: 15.0,
|
||
|
color: Colors.grey[700]),
|
||
|
),
|
||
|
)
|
||
|
],
|
||
|
),
|
||
|
),
|
||
|
],
|
||
|
);
|
||
|
}),
|
||
|
),
|
||
|
],
|
||
|
),
|
||
|
);
|
||
|
},
|
||
|
);
|
||
|
}
|
||
|
|
||
|
Future<int> getCount(String form, InteractionProvider provider) async {
|
||
|
await provider.getRecords();
|
||
|
|
||
|
return provider.savedList.where((element) => element.form == form).length;
|
||
|
}
|
||
|
}
|