365 lines
15 KiB
Dart
365 lines
15 KiB
Dart
|
import 'package:discover_module/contacts_module/constants.dart';
|
||
|
import 'package:discover_module/contacts_module/provider_class/medicalinsightprovider.dart';
|
||
|
import 'package:discover_module/contacts_module/ui_screen/view_insight.dart';
|
||
|
import 'package:flutter/material.dart';
|
||
|
import 'package:provider/provider.dart';
|
||
|
|
||
|
class MedicalInsight1 extends StatefulWidget {
|
||
|
const MedicalInsight1({super.key});
|
||
|
|
||
|
@override
|
||
|
State<MedicalInsight1> createState() => _MedicalInsightState();
|
||
|
}
|
||
|
|
||
|
class _MedicalInsightState extends State<MedicalInsight1> {
|
||
|
final List<Map<String, dynamic>> cardData = [
|
||
|
{'id': 'ID ', 'number': 'MI1688128025', 'id1': "jjj", 'number1': '265'},
|
||
|
{'id': 'ID ', 'number': 20},
|
||
|
{'id': 'ID ', 'number': 30},
|
||
|
// Add more data entries as needed
|
||
|
];
|
||
|
|
||
|
String selectedOption = 'None';
|
||
|
late GlobalKey actionKey;
|
||
|
// DateTime? pickedDate;
|
||
|
|
||
|
var item;
|
||
|
final TextEditingController textController = TextEditingController();
|
||
|
|
||
|
DateTime? selectedDate;
|
||
|
|
||
|
bool calview = false;
|
||
|
String? start, end;
|
||
|
|
||
|
final TextEditingController startController = TextEditingController();
|
||
|
final TextEditingController endController = TextEditingController();
|
||
|
|
||
|
@override
|
||
|
void initState() {
|
||
|
actionKey = GlobalKey();
|
||
|
super.initState();
|
||
|
getapicall();
|
||
|
}
|
||
|
|
||
|
void getapicall() async {
|
||
|
await Provider.of<MediacalInsightProvider>(context, listen: false)
|
||
|
.medicalinsightdata();
|
||
|
}
|
||
|
|
||
|
// GlobalKey actionKey;
|
||
|
// final List<Map<String, dynamic>> data = [
|
||
|
// {'id': 'Data ID 1', 'number': 10},
|
||
|
// {'id': 'Data ID 2', 'number': 20},
|
||
|
// {'id': 'Data ID 3', 'number': 30},
|
||
|
// // Add more data entries as needed
|
||
|
// ];
|
||
|
@override
|
||
|
Widget build(BuildContext context) {
|
||
|
return Directionality(
|
||
|
textDirection: TextDirection.ltr,
|
||
|
child: SafeArea(
|
||
|
child: Scaffold(
|
||
|
// backgroundColor: const Color.fromARGB(255, 222, 237, 247),
|
||
|
backgroundColor: const Color.fromARGB(255, 246, 248, 252),
|
||
|
|
||
|
appBar: AppBar(
|
||
|
title: const Text('Medical Insight'),
|
||
|
actions: [
|
||
|
GestureDetector(
|
||
|
onTap: () {
|
||
|
setState(() {
|
||
|
calview = true;
|
||
|
});
|
||
|
},
|
||
|
child: Icon(Icons.calendar_month))
|
||
|
],
|
||
|
),
|
||
|
body: Consumer<MediacalInsightProvider>(
|
||
|
builder: (context, value, child) {
|
||
|
return Column(
|
||
|
children: [
|
||
|
// GestureDetector(
|
||
|
// onTap: () => _selectDate(context),
|
||
|
// child: AbsorbPointer(
|
||
|
// child: TextField(
|
||
|
// controller: textController,
|
||
|
// decoration: InputDecoration(
|
||
|
// focusedBorder: InputBorder.none,
|
||
|
// enabledBorder: InputBorder.none,
|
||
|
// contentPadding: EdgeInsets.all(10.0),
|
||
|
// labelText: "date",
|
||
|
// labelStyle:
|
||
|
// TextStyle(color: Colors.black, fontSize: 16),
|
||
|
// // pass the hint text parameter here
|
||
|
// hintStyle: TextStyle(color: Colors.black, fontSize: 16),
|
||
|
// suffixIcon: Icon(Icons.calendar_today),
|
||
|
// ),
|
||
|
// style: TextStyle(color: Colors.black, fontSize: 18),
|
||
|
// ),
|
||
|
// ),
|
||
|
// ),
|
||
|
Visibility(
|
||
|
visible: calview,
|
||
|
child: Row(
|
||
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||
|
children: [
|
||
|
// OutlinedButton(
|
||
|
// onPressed: () {
|
||
|
// _selectDate(context);
|
||
|
// },
|
||
|
// child:
|
||
|
// start == null ? Text('Start Date') : Text(start!),
|
||
|
// ),
|
||
|
Expanded(
|
||
|
flex: 1,
|
||
|
child: Padding(
|
||
|
padding: const EdgeInsets.all(8.0),
|
||
|
child: TextFormField(
|
||
|
controller: startController,
|
||
|
decoration: InputDecoration(
|
||
|
isDense: true,
|
||
|
border: OutlineInputBorder(),
|
||
|
hintText: "ff",
|
||
|
labelText:
|
||
|
startController.text ?? 'Start Date'),
|
||
|
// focusNode: AlwaysDisabledFocusNode(),
|
||
|
onTap: () {
|
||
|
_selectDate(context);
|
||
|
},
|
||
|
),
|
||
|
),
|
||
|
),
|
||
|
Expanded(
|
||
|
flex: 1,
|
||
|
child: OutlinedButton(
|
||
|
onPressed: () {
|
||
|
_selectDate1(context);
|
||
|
},
|
||
|
child: end == null ? Text('Start Date') : Text(end!),
|
||
|
),
|
||
|
),
|
||
|
],
|
||
|
),
|
||
|
),
|
||
|
|
||
|
Padding(
|
||
|
padding: const EdgeInsets.all(8.0),
|
||
|
child: TextField(
|
||
|
//controller: _searchController,
|
||
|
onChanged: (value) {
|
||
|
setState(() {});
|
||
|
},
|
||
|
decoration: InputDecoration(
|
||
|
fillColor: Constants.k2color,
|
||
|
contentPadding: const EdgeInsets.symmetric(vertical: 9.0),
|
||
|
border: const OutlineInputBorder(
|
||
|
borderRadius: BorderRadius.only(
|
||
|
bottomRight: Radius.circular(0))),
|
||
|
labelText: ' Search',
|
||
|
prefixIcon: const Icon(
|
||
|
Icons.search,
|
||
|
),
|
||
|
),
|
||
|
),
|
||
|
),
|
||
|
Row(
|
||
|
mainAxisAlignment: MainAxisAlignment.end,
|
||
|
children: [
|
||
|
// OutlinedButton(
|
||
|
// style: OutlinedButton.styleFrom(
|
||
|
// backgroundColor: Constants.k2color,
|
||
|
// foregroundColor: Colors.white),
|
||
|
// onPressed: () {},
|
||
|
// child: Text("Create Medical Insight"))
|
||
|
],
|
||
|
),
|
||
|
Expanded(
|
||
|
child: ListView.builder(
|
||
|
physics: const ScrollPhysics(),
|
||
|
// scrollDirection: Axis.vertical,
|
||
|
shrinkWrap: true,
|
||
|
itemCount: value.med.length,
|
||
|
itemBuilder: (context, index) {
|
||
|
item = value.med[index];
|
||
|
|
||
|
print(
|
||
|
"Item_Medical_insight ${item['Therapeutic Area']}");
|
||
|
return GestureDetector(
|
||
|
onTap: () {
|
||
|
_showAlertDialog(context);
|
||
|
},
|
||
|
child: Padding(
|
||
|
padding: const EdgeInsets.all(8.0),
|
||
|
child: Card(
|
||
|
margin: EdgeInsets.zero,
|
||
|
|
||
|
elevation: 4,
|
||
|
surfaceTintColor: Colors.white,
|
||
|
shape: RoundedRectangleBorder(
|
||
|
borderRadius: BorderRadius.zero,
|
||
|
),
|
||
|
|
||
|
// shape: RoundedRectangleBorder(
|
||
|
// side: BorderSide(color: Colors.black, width: 1),
|
||
|
// borderRadius: BorderRadius.only(
|
||
|
// bottomRight: Radius.circular(30)),
|
||
|
// ),
|
||
|
child: SizedBox(
|
||
|
width: MediaQuery.sizeOf(context).width,
|
||
|
child: ListTile(
|
||
|
dense: true,
|
||
|
title: Column(
|
||
|
// crossAxisAlignment: CrossAxisAlignment.center,
|
||
|
children: [
|
||
|
// Text(
|
||
|
// "Acute neurology is the <b> therapeutic </b> 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>[
|
||
|
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)),
|
||
|
),
|
||
|
),
|
||
|
);
|
||
|
}),
|
||
|
)
|
||
|
],
|
||
|
);
|
||
|
}),
|
||
|
),
|
||
|
),
|
||
|
);
|
||
|
}
|
||
|
|
||
|
void _showAlertDialog(BuildContext context) {
|
||
|
showDialog(
|
||
|
context: context,
|
||
|
builder: (BuildContext context) {
|
||
|
return AlertDialog(
|
||
|
// title: Text('Alert'),
|
||
|
content: const MyWidget22(),
|
||
|
actions: <Widget>[
|
||
|
TextButton(
|
||
|
child: const Text('Close'),
|
||
|
onPressed: () {
|
||
|
Navigator.of(context).pop();
|
||
|
},
|
||
|
),
|
||
|
],
|
||
|
);
|
||
|
},
|
||
|
);
|
||
|
}
|
||
|
|
||
|
Future<Null> _selectDate(BuildContext context) async {
|
||
|
final DateTime? picked = await showDatePicker(
|
||
|
context: context,
|
||
|
initialDate: selectedDate,
|
||
|
firstDate: DateTime(1901, 1),
|
||
|
lastDate: DateTime(2100));
|
||
|
if (picked != null && picked != selectedDate)
|
||
|
setState(() {
|
||
|
selectedDate = picked;
|
||
|
String convertedDateTime =
|
||
|
"${picked.year.toString()}-${picked.month.toString().padLeft(2, '0')}-${picked.day.toString().padLeft(2, '0')}";
|
||
|
// widget.textController.value = TextEditingValue(text: picked.toString());
|
||
|
startController.value = TextEditingValue(text: convertedDateTime);
|
||
|
|
||
|
start = convertedDateTime;
|
||
|
;
|
||
|
});
|
||
|
}
|
||
|
|
||
|
Future<Null> _selectDate1(BuildContext context) async {
|
||
|
final DateTime? picked = await showDatePicker(
|
||
|
context: context,
|
||
|
initialDate: selectedDate,
|
||
|
firstDate: DateTime(1901, 1),
|
||
|
lastDate: DateTime(2100));
|
||
|
if (picked != null && picked != selectedDate)
|
||
|
setState(() {
|
||
|
selectedDate = picked;
|
||
|
String convertedDateTime =
|
||
|
"${picked.year.toString()}-${picked.month.toString().padLeft(2, '0')}-${picked.day.toString().padLeft(2, '0')}";
|
||
|
// widget.textController.value = TextEditingValue(text: picked.toString());
|
||
|
textController.value = TextEditingValue(text: convertedDateTime);
|
||
|
|
||
|
end = convertedDateTime;
|
||
|
;
|
||
|
});
|
||
|
}
|
||
|
}
|