1122 lines
40 KiB
Dart
1122 lines
40 KiB
Dart
|
import 'dart:math';
|
||
|
|
||
|
import 'package:avatar_stack/avatar_stack.dart';
|
||
|
import 'package:flutter/cupertino.dart';
|
||
|
import 'package:flutter/material.dart';
|
||
|
import 'package:flutter/rendering.dart';
|
||
|
import 'package:flutter/widgets.dart';
|
||
|
import 'package:intl/intl.dart';
|
||
|
import 'package:konectar_events/model/eventsdetailmodel.dart';
|
||
|
import 'package:konectar_events/model/sessionnotesmodel.dart';
|
||
|
import 'package:konectar_events/utils/constants.dart';
|
||
|
import 'package:konectar_events/utils/dateformater.dart';
|
||
|
import 'package:konectar_events/utils/util.dart';
|
||
|
import 'package:konectar_events/viewmodel/hcpprofprovider.dart';
|
||
|
import 'package:konectar_events/widgets/customdropdown.dart';
|
||
|
import 'package:provider/provider.dart';
|
||
|
|
||
|
class HCPProfileScreen extends StatefulWidget {
|
||
|
Eventsdetail eventsdetail;
|
||
|
String eventid;
|
||
|
String title;
|
||
|
HCPProfileScreen(
|
||
|
{super.key,
|
||
|
required this.eventsdetail,
|
||
|
required this.eventid,
|
||
|
required this.title});
|
||
|
|
||
|
@override
|
||
|
State<HCPProfileScreen> createState() => _HCPProfileScreenState();
|
||
|
}
|
||
|
|
||
|
class _HCPProfileScreenState extends State<HCPProfileScreen> {
|
||
|
String? _selectedFruit;
|
||
|
bool isExtended = false;
|
||
|
List<String> sessionList = [];
|
||
|
final List<String> _fruits = ['Events', 'Sessions'];
|
||
|
final List<String> topics = [
|
||
|
" Admin. & Managemente",
|
||
|
"Cyclin-Dependent Kinase 4 | Cyclin-Dependent Kinase 6 | Breast Neoplasms"
|
||
|
];
|
||
|
final List<String> sessions = [
|
||
|
"Program Committee",
|
||
|
"Practical Application of CDK 4/6 Inhibitor"
|
||
|
];
|
||
|
TextEditingController notesController = TextEditingController(text: "");
|
||
|
List<String> sessionNotesList = [];
|
||
|
Future<void> dialogBuilder(BuildContext context, Eventsdetail eventsdetail) {
|
||
|
return showDialog<void>(
|
||
|
context: context,
|
||
|
builder: (BuildContext context) {
|
||
|
return AlertDialog(
|
||
|
title: const Text('Session Notes'),
|
||
|
content: Column(
|
||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||
|
children: [
|
||
|
Container(
|
||
|
padding: const EdgeInsets.all(8.0),
|
||
|
decoration: BoxDecoration(
|
||
|
border: Border.all(color: Colors.grey),
|
||
|
borderRadius: BorderRadius.circular(8.0)),
|
||
|
child: dropDown(underline: Container())),
|
||
|
TextFormField(
|
||
|
validator: (value) {
|
||
|
// add email validation
|
||
|
if (value == null || value.isEmpty) {
|
||
|
return 'Please enter some text';
|
||
|
}
|
||
|
|
||
|
// bool emailValid = RegExp(
|
||
|
// r"^[a-zA-Z0-9.a-zA-Z0-9.!#$%&'*+-/=?^_`{|}~]+@[a-zA-Z0-9]+\.[a-zA-Z]+")
|
||
|
// .hasMatch(value);
|
||
|
// if (!emailValid) {
|
||
|
// return 'Please enter a valid email';
|
||
|
// }
|
||
|
|
||
|
return null;
|
||
|
},
|
||
|
decoration: const InputDecoration(
|
||
|
labelText: 'Notes',
|
||
|
hintText: 'Notes',
|
||
|
prefixIcon: Icon(Icons.email_outlined),
|
||
|
border: OutlineInputBorder(),
|
||
|
),
|
||
|
),
|
||
|
],
|
||
|
),
|
||
|
actions: <Widget>[
|
||
|
TextButton(
|
||
|
style: TextButton.styleFrom(
|
||
|
textStyle: Theme.of(context).textTheme.labelLarge,
|
||
|
),
|
||
|
child: const Text('Submit'),
|
||
|
onPressed: () {
|
||
|
Navigator.of(context).pop();
|
||
|
},
|
||
|
),
|
||
|
TextButton(
|
||
|
style: TextButton.styleFrom(
|
||
|
textStyle: Theme.of(context).textTheme.labelLarge,
|
||
|
),
|
||
|
child: const Text('Cancel'),
|
||
|
onPressed: () {
|
||
|
Navigator.of(context).pop();
|
||
|
},
|
||
|
),
|
||
|
],
|
||
|
);
|
||
|
},
|
||
|
);
|
||
|
}
|
||
|
|
||
|
Widget dropDown({
|
||
|
Widget? underline,
|
||
|
Widget? icon,
|
||
|
TextStyle? style,
|
||
|
TextStyle? hintStyle,
|
||
|
Color? dropdownColor,
|
||
|
}) =>
|
||
|
DropdownButton<String>(
|
||
|
value: _selectedFruit,
|
||
|
underline: underline,
|
||
|
icon: Align(alignment: Alignment.centerRight, child: icon),
|
||
|
dropdownColor: dropdownColor,
|
||
|
isExpanded: true,
|
||
|
style: TextStyle(
|
||
|
//fontFamily: "SourceSerif",
|
||
|
color: Colors.black,
|
||
|
fontSize: 14.0,
|
||
|
),
|
||
|
// iconEnabledColor: iconEnabledColor,
|
||
|
onChanged: (String? newValue) {
|
||
|
setState(() {
|
||
|
_selectedFruit = newValue;
|
||
|
});
|
||
|
},
|
||
|
hint: Text("Select Session", style: hintStyle),
|
||
|
items: sessionList
|
||
|
.map((session) => DropdownMenuItem<String>(
|
||
|
value: session, child: Text(session)))
|
||
|
.toList());
|
||
|
|
||
|
@override
|
||
|
void initState() {
|
||
|
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
|
||
|
init();
|
||
|
});
|
||
|
|
||
|
super.initState();
|
||
|
}
|
||
|
|
||
|
init() async {
|
||
|
await Provider.of<HcpProfileProvider>(context, listen: false)
|
||
|
.getSessionData();
|
||
|
await Provider.of<HcpProfileProvider>(context, listen: false)
|
||
|
.getCounts(widget.eventsdetail);
|
||
|
setState(() {});
|
||
|
}
|
||
|
|
||
|
Widget build(BuildContext context) {
|
||
|
return Consumer<HcpProfileProvider>(
|
||
|
builder: (BuildContext context, provider, Widget? child) {
|
||
|
return DefaultTabController(
|
||
|
length: 3,
|
||
|
child: Scaffold(
|
||
|
appBar: AppBar(
|
||
|
// title: Text(""),
|
||
|
automaticallyImplyLeading: false,
|
||
|
backgroundColor: Constants.blueColor,
|
||
|
centerTitle: false,
|
||
|
flexibleSpace: FlexibleSpaceBar(
|
||
|
background: Padding(
|
||
|
padding: const EdgeInsets.only(top: 2.0, right: 2.0),
|
||
|
child: Row(
|
||
|
// alignment: Alignment.center,
|
||
|
// fit: StackFit.expand,
|
||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||
|
// mainAxisAlignment: MainAxisAlignment.center,
|
||
|
children: [
|
||
|
IconButton(
|
||
|
icon: Icon(
|
||
|
Icons.arrow_back_ios,
|
||
|
size: 18,
|
||
|
color: Colors.white,
|
||
|
),
|
||
|
onPressed: () {
|
||
|
Navigator.pop(context);
|
||
|
},
|
||
|
),
|
||
|
// SizedBox(
|
||
|
// width: 40,
|
||
|
// ),
|
||
|
Expanded(
|
||
|
child: Text(
|
||
|
"${widget.title}",
|
||
|
//maxLines: 4,
|
||
|
//softWrap: true,
|
||
|
style: TextStyle(
|
||
|
overflow: TextOverflow.ellipsis,
|
||
|
// decoration: TextDecoration.underline,
|
||
|
// decorationColor: Colors.blue,
|
||
|
color: Colors.white,
|
||
|
|
||
|
//fontWeight: FontWeight.bold,
|
||
|
fontSize: isTablet ? 22 : 14,
|
||
|
),
|
||
|
),
|
||
|
),
|
||
|
],
|
||
|
),
|
||
|
),
|
||
|
),
|
||
|
),
|
||
|
body: NestedScrollView(
|
||
|
headerSliverBuilder:
|
||
|
(BuildContext context, bool innerBoxIsScrolled) {
|
||
|
return <Widget>[
|
||
|
SliverAppBar(
|
||
|
expandedHeight: 280.0,
|
||
|
// expandedHeight: MediaQuery.of(context).size.height * 0.25,
|
||
|
backgroundColor: Constants.bgcolor,
|
||
|
automaticallyImplyLeading: false,
|
||
|
floating: false,
|
||
|
pinned: false,
|
||
|
stretch: true,
|
||
|
flexibleSpace: FlexibleSpaceBar(
|
||
|
centerTitle: true,
|
||
|
collapseMode: CollapseMode.parallax,
|
||
|
// title: Text("",
|
||
|
// style: TextStyle(
|
||
|
// color: Colors.black,
|
||
|
// fontSize: 16.0,
|
||
|
// )),
|
||
|
title: SizedBox.shrink(),
|
||
|
background: buildCardView(
|
||
|
context, widget.eventsdetail, provider)
|
||
|
|
||
|
// Image.network(
|
||
|
// "https://images.pexels.com/photos/417173/pexels-photo-417173.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260",
|
||
|
// fit: BoxFit.cover,
|
||
|
// )
|
||
|
),
|
||
|
),
|
||
|
SliverPersistentHeader(
|
||
|
pinned: true,
|
||
|
floating: true,
|
||
|
delegate: _SliverAppBarDelegate(
|
||
|
const TabBar(
|
||
|
isScrollable: false,
|
||
|
|
||
|
indicatorSize: TabBarIndicatorSize.tab,
|
||
|
tabAlignment: TabAlignment.fill,
|
||
|
labelColor: Colors.white,
|
||
|
indicatorColor: Colors.white,
|
||
|
labelStyle: TextStyle(
|
||
|
fontWeight: FontWeight.bold,
|
||
|
),
|
||
|
labelPadding: EdgeInsets.all(2),
|
||
|
indicatorWeight: 4.0,
|
||
|
//Color.fromARGB(255, 5, 36, 62)
|
||
|
unselectedLabelColor: Colors.grey,
|
||
|
tabs: _tabs,
|
||
|
),
|
||
|
),
|
||
|
),
|
||
|
];
|
||
|
},
|
||
|
body: TabBarView(children: [
|
||
|
topicsTab(widget.eventsdetail),
|
||
|
sessionNotes(context, widget.eventsdetail, provider),
|
||
|
medicalInsights(),
|
||
|
// sessionNotes(context)
|
||
|
]
|
||
|
// _tabs
|
||
|
// .map((e) => Center(
|
||
|
// child: FloatingActionButton.extended(
|
||
|
// backgroundColor:
|
||
|
// const Color.fromARGB(255, 222, 237, 247),
|
||
|
// onPressed: () {},
|
||
|
// heroTag: 'follow',
|
||
|
// elevation: 0,
|
||
|
// label: const Text("Add Notes"),
|
||
|
// icon: const Icon(Icons.add),
|
||
|
// ),
|
||
|
// // Text("${e.text}", textAlign: TextAlign.center),
|
||
|
// ))
|
||
|
// .toList()),
|
||
|
),
|
||
|
),
|
||
|
));
|
||
|
});
|
||
|
}
|
||
|
|
||
|
buildprofile(BuildContext context, Eventsdetail eventsdetail, String title) {
|
||
|
MediaQuery.of(context).size.height * 0.35;
|
||
|
|
||
|
return Container(
|
||
|
//color: Colors.yellowAccent,
|
||
|
child: Column(
|
||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||
|
mainAxisSize: MainAxisSize.min,
|
||
|
//mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||
|
children: [
|
||
|
Stack(clipBehavior: Clip.none, alignment: Alignment.center, children: [
|
||
|
Container(
|
||
|
width: MediaQuery.of(context).size.width, // Adjust width as needed
|
||
|
height: 140, // Adjust height as needed
|
||
|
decoration: BoxDecoration(
|
||
|
gradient: LinearGradient(
|
||
|
begin: Alignment.bottomCenter,
|
||
|
end: Alignment.topCenter,
|
||
|
colors: [
|
||
|
Constants.blueColor,
|
||
|
Constants.blueColor,
|
||
|
Constants.blueColor,
|
||
|
// const Color.fromARGB(255, 222, 237, 247),
|
||
|
// const Color.fromARGB(255, 222, 237, 247),
|
||
|
// Color(0xff006df1)
|
||
|
]),
|
||
|
),
|
||
|
child: Column(
|
||
|
mainAxisAlignment: MainAxisAlignment.start,
|
||
|
children: [
|
||
|
SizedBox(
|
||
|
height: 15,
|
||
|
),
|
||
|
Text(eventsdetail.kolFullName!,
|
||
|
style: TextStyle(
|
||
|
fontSize: 20,
|
||
|
// fontFamily: "SourceSerif",
|
||
|
color: Colors.white,
|
||
|
fontWeight: FontWeight.bold)),
|
||
|
// Text("Hematology/Oncology",
|
||
|
// style: TextStyle(
|
||
|
// color: Colors.white,
|
||
|
// // fontFamily: "SourceSerif",
|
||
|
// )),
|
||
|
Text(
|
||
|
"${eventsdetail.orgName ?? ""} ${eventsdetail.country ?? ""} ${eventsdetail.city ?? ""}",
|
||
|
softWrap: true,
|
||
|
maxLines: 2,
|
||
|
textAlign: TextAlign.center,
|
||
|
style: TextStyle(
|
||
|
color: Colors.white,
|
||
|
// fontFamily: "SourceSerif",
|
||
|
fontSize: 14,
|
||
|
)),
|
||
|
],
|
||
|
),
|
||
|
),
|
||
|
// Column(
|
||
|
// mainAxisAlignment: MainAxisAlignment.start,
|
||
|
// children: [
|
||
|
// Text1(
|
||
|
// title: "Dr " + widget.text!["name"],
|
||
|
// txtcolor: Colors.white,
|
||
|
// fontweight: FontWeight.normal,
|
||
|
// txtfont: 22.0),
|
||
|
// Text1(
|
||
|
// title: widget.text!["speciality"],
|
||
|
// txtcolor: Colors.white,
|
||
|
// fontweight: FontWeight.normal,
|
||
|
// txtfont: 15.0),
|
||
|
// ],
|
||
|
// ),
|
||
|
Positioned(
|
||
|
bottom: -45,
|
||
|
child: Container(
|
||
|
// child: widget.text["img_path"] == null
|
||
|
// ? ProfilePicture(
|
||
|
// name: widget.text!["name"],
|
||
|
// radius: 38,
|
||
|
// fontsize: 21,
|
||
|
// )
|
||
|
child: ClipOval(
|
||
|
child: SizedBox.fromSize(
|
||
|
size: Size.fromRadius(48),
|
||
|
child: SizedBox(
|
||
|
width: 120,
|
||
|
height: 120,
|
||
|
child: BorderedCircleAvatar(
|
||
|
// radius: 24,
|
||
|
backgroundColor: Colors.grey,
|
||
|
border: BorderSide(color: Colors.white),
|
||
|
|
||
|
// child: Icon(
|
||
|
// Icons.person,
|
||
|
// size: 18,
|
||
|
// color: Colors.white,
|
||
|
// ),
|
||
|
child: Text(
|
||
|
title[0],
|
||
|
style: TextStyle(
|
||
|
fontWeight: FontWeight.bold,
|
||
|
fontSize: 34,
|
||
|
color: Colors.white),
|
||
|
),
|
||
|
),
|
||
|
),
|
||
|
),
|
||
|
),
|
||
|
),
|
||
|
),
|
||
|
|
||
|
// SizedBox(
|
||
|
// height: 55.0,
|
||
|
// ),
|
||
|
]),
|
||
|
],
|
||
|
));
|
||
|
}
|
||
|
|
||
|
Widget buildCardView(BuildContext context, Eventsdetail eventsdetail,
|
||
|
HcpProfileProvider provider) {
|
||
|
return Container(
|
||
|
// color: Constants.bgcolor,
|
||
|
child: Column(
|
||
|
children: [
|
||
|
// _TopPortion(
|
||
|
// title: eventsdetail.kolFullName!,
|
||
|
// eventsdetail: eventsdetail,
|
||
|
// ),
|
||
|
buildprofile(context, eventsdetail, eventsdetail.kolFullName!),
|
||
|
// Padding(
|
||
|
// padding: const EdgeInsets.all(8.0),
|
||
|
// child: Column(
|
||
|
// children: [
|
||
|
// Text(eventsdetail.kolFullName!,
|
||
|
// style: TextStyle(
|
||
|
// fontSize: 20,
|
||
|
// // fontFamily: "SourceSerif",
|
||
|
// fontWeight: FontWeight.bold)),
|
||
|
// Text("Hematology/Oncology",
|
||
|
// style: TextStyle(
|
||
|
// // fontFamily: "SourceSerif",
|
||
|
// )),
|
||
|
// Text(
|
||
|
// "${eventsdetail.orgName ?? ""} ${eventsdetail.country ?? ""} ${eventsdetail.city ?? ""}",
|
||
|
// softWrap: true,
|
||
|
// maxLines: 2,
|
||
|
// textAlign: TextAlign.center,
|
||
|
// style: TextStyle(
|
||
|
// // fontFamily: "SourceSerif",
|
||
|
// fontSize: 12,
|
||
|
// )),
|
||
|
// const SizedBox(height: 20),
|
||
|
// Row(
|
||
|
// mainAxisAlignment: MainAxisAlignment.center,
|
||
|
// children: [
|
||
|
// SizedBox(
|
||
|
// height: 45,
|
||
|
// child: FloatingActionButton.extended(
|
||
|
// elevation: 1,
|
||
|
// // backgroundColor: Color.fromARGB(255, 166, 217, 250),
|
||
|
// backgroundColor: Colors.grey,
|
||
|
// onPressed: () {
|
||
|
// setState(() {
|
||
|
// isExtended = !isExtended;
|
||
|
// });
|
||
|
// },
|
||
|
// label: AnimatedSwitcher(
|
||
|
// duration: Duration(seconds: 1),
|
||
|
// transitionBuilder: (Widget child,
|
||
|
// Animation<double> animation) =>
|
||
|
// FadeTransition(
|
||
|
// opacity: animation,
|
||
|
// child: SizeTransition(
|
||
|
// child: child,
|
||
|
// sizeFactor: animation,
|
||
|
// axis: Axis.horizontal,
|
||
|
// ),
|
||
|
// ),
|
||
|
// child: isExtended
|
||
|
// ? Row(
|
||
|
// children: [
|
||
|
// Padding(
|
||
|
// padding: const EdgeInsets.only(
|
||
|
// right: 4.0),
|
||
|
// child: Icon(Icons.check),
|
||
|
// ),
|
||
|
// Text("Added to Contacts")
|
||
|
// ],
|
||
|
// )
|
||
|
// : Row(
|
||
|
// children: [
|
||
|
// Padding(
|
||
|
// padding: const EdgeInsets.only(
|
||
|
// right: 4.0),
|
||
|
// child: Icon(Icons.add,
|
||
|
// color: Colors.white),
|
||
|
// ),
|
||
|
// Text(
|
||
|
// "Add to Contacts",
|
||
|
// style:
|
||
|
// TextStyle(color: Colors.white),
|
||
|
// )
|
||
|
// ],
|
||
|
// ))),
|
||
|
// ),
|
||
|
// const SizedBox(width: 16.0),
|
||
|
// FloatingActionButton.extended(
|
||
|
// onPressed: () {},
|
||
|
// heroTag: 'mesage',
|
||
|
// elevation: 0,
|
||
|
// backgroundColor: Colors.red,
|
||
|
// label: const Text("Message"),
|
||
|
// icon: const Icon(Icons.message_rounded),
|
||
|
// ),
|
||
|
// ],
|
||
|
// ),
|
||
|
// const SizedBox(height: 15),
|
||
|
|
||
|
// const SizedBox(height: 5),
|
||
|
// ],
|
||
|
// ),
|
||
|
// ),
|
||
|
SizedBox(
|
||
|
height: 60,
|
||
|
),
|
||
|
// const Spacer(),
|
||
|
Center(
|
||
|
child: _ProfileInfoRow(items: [
|
||
|
ProfileInfoItem("Topic(s)", provider.totalTopics),
|
||
|
ProfileInfoItem("Session(s)", provider.totalSessions),
|
||
|
ProfileInfoItem("Note(s)", provider.totalNotes),
|
||
|
])),
|
||
|
// SizedBox(
|
||
|
// height: 20,
|
||
|
// ),
|
||
|
],
|
||
|
),
|
||
|
);
|
||
|
}
|
||
|
|
||
|
Widget sessionNotes(BuildContext context, Eventsdetail eventsdetail,
|
||
|
HcpProfileProvider provider) {
|
||
|
sessionList = eventsdetail.sessionName!.split(",");
|
||
|
return Container(
|
||
|
color: Constants.bgcolor,
|
||
|
child: Column(
|
||
|
children: [
|
||
|
Container(
|
||
|
padding: const EdgeInsets.all(15.0),
|
||
|
// decoration: BoxDecoration(
|
||
|
// border: Border.all(color: Colors.grey),
|
||
|
// borderRadius: BorderRadius.circular(8.0)),
|
||
|
child: Column(
|
||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||
|
children: [
|
||
|
Container(
|
||
|
padding: const EdgeInsets.all(4.0),
|
||
|
// height: 40,
|
||
|
|
||
|
width: double.infinity,
|
||
|
decoration: BoxDecoration(
|
||
|
border: Border.all(color: Colors.grey),
|
||
|
borderRadius: BorderRadius.circular(4.0)),
|
||
|
child: dropDown(underline: Container())),
|
||
|
SizedBox(
|
||
|
height: 15,
|
||
|
),
|
||
|
TextFormField(
|
||
|
controller: notesController,
|
||
|
maxLines: 3,
|
||
|
validator: (value) {
|
||
|
// add email validation
|
||
|
if (value == null || value.isEmpty) {
|
||
|
return 'Please enter some text';
|
||
|
}
|
||
|
|
||
|
// bool emailValid = RegExp(
|
||
|
// r"^[a-zA-Z0-9.a-zA-Z0-9.!#$%&'*+-/=?^_`{|}~]+@[a-zA-Z0-9]+\.[a-zA-Z]+")
|
||
|
// .hasMatch(value);
|
||
|
// if (!emailValid) {
|
||
|
// return 'Please enter a valid email';
|
||
|
// }
|
||
|
|
||
|
return null;
|
||
|
},
|
||
|
decoration: const InputDecoration(
|
||
|
labelText: 'Notes',
|
||
|
hintText: 'Notes',
|
||
|
// prefixIcon: Icon(Icons.note),
|
||
|
border: OutlineInputBorder(),
|
||
|
focusedBorder: OutlineInputBorder(),
|
||
|
),
|
||
|
),
|
||
|
],
|
||
|
)),
|
||
|
Align(
|
||
|
alignment: Alignment.center,
|
||
|
child: SizedBox(
|
||
|
height: 45,
|
||
|
child: FloatingActionButton.extended(
|
||
|
// backgroundColor: const Color.fromARGB(255, 222, 237, 247),
|
||
|
backgroundColor: Colors.green,
|
||
|
onPressed: () async {
|
||
|
//"Program Committee Admin. & Management"
|
||
|
//setState(() {
|
||
|
if (notesController.text.length != 0 ||
|
||
|
notesController.text != "" ||
|
||
|
_selectedFruit != "" ||
|
||
|
_selectedFruit != null) {
|
||
|
sessionNotesList
|
||
|
.add("${_selectedFruit} \n\n ${notesController.text}");
|
||
|
// });
|
||
|
print(
|
||
|
" eventid:${widget.eventid},hcp:${widget.eventsdetail.kolId}");
|
||
|
SessionNotesModel notesModel = SessionNotesModel(
|
||
|
notes: notesController.text,
|
||
|
addedBy: "user",
|
||
|
addedDate: CustomDateFormatter().formatDate(),
|
||
|
eventid: widget.eventid,
|
||
|
hcpid: widget.eventsdetail.kolId,
|
||
|
selectedSession: _selectedFruit);
|
||
|
print(
|
||
|
"${notesModel.addedBy},${notesModel.notes},${notesModel.addedDate},${notesModel.eventid},${notesModel.hcpid},${notesModel.selectedSession}");
|
||
|
await provider.addSessionNotes(notesModel);
|
||
|
_selectedFruit = null;
|
||
|
notesController.clear();
|
||
|
}
|
||
|
},
|
||
|
heroTag: 'addnotes',
|
||
|
elevation: 0,
|
||
|
label: const Text(
|
||
|
"Submit",
|
||
|
style: TextStyle(color: Colors.white),
|
||
|
),
|
||
|
// icon: const Icon(
|
||
|
// Icons.add,
|
||
|
// color: Colors.black,
|
||
|
// ),
|
||
|
),
|
||
|
),
|
||
|
),
|
||
|
Divider(),
|
||
|
Expanded(
|
||
|
//height: 200,
|
||
|
child: ListView.separated(
|
||
|
padding: EdgeInsets.all(2.0),
|
||
|
itemCount: provider
|
||
|
.getSessionNotesList(widget.eventid, widget.eventsdetail)
|
||
|
.length,
|
||
|
itemBuilder: (context, index) {
|
||
|
return SizedBox(
|
||
|
width: isTablet
|
||
|
? MediaQuery.of(context).size.width * 0.25
|
||
|
: MediaQuery.of(context).size.width * 0.5,
|
||
|
child: ListTile(
|
||
|
title: Text(
|
||
|
"\"${provider.sessionNotesList[index].notes}\"",
|
||
|
// maxLines: 3,
|
||
|
style: TextStyle(
|
||
|
// decoration: TextDecoration.underline,
|
||
|
// decorationColor: Colors.blue,
|
||
|
//fontFamily: "SourceSerif",
|
||
|
color: Colors.black,
|
||
|
fontStyle: FontStyle.italic,
|
||
|
fontSize: 15),
|
||
|
),
|
||
|
subtitle: Column(
|
||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||
|
children: [
|
||
|
SizedBox(
|
||
|
height: 10,
|
||
|
),
|
||
|
Text(
|
||
|
"Session: ${provider.sessionNotesList[index].selectedSession}",
|
||
|
// maxLines: 3,
|
||
|
style: TextStyle(
|
||
|
// decoration: TextDecoration.underline,
|
||
|
// decorationColor: Colors.blue,
|
||
|
//fontFamily: "SourceSerif",
|
||
|
color: const Color.fromARGB(255, 66, 65, 65),
|
||
|
|
||
|
//fontStyle: FontStyle.italic,
|
||
|
fontSize: 14),
|
||
|
),
|
||
|
SizedBox(
|
||
|
height: 5,
|
||
|
),
|
||
|
Row(
|
||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||
|
children: [
|
||
|
Text(
|
||
|
"Added By: ${provider.sessionNotesList[index].addedBy}",
|
||
|
// maxLines: 3,
|
||
|
style: TextStyle(
|
||
|
// decoration: TextDecoration.underline,
|
||
|
// decorationColor: Colors.blue,
|
||
|
//fontFamily: "SourceSerif",
|
||
|
color: const Color.fromARGB(255, 66, 65, 65),
|
||
|
|
||
|
//fontStyle: FontStyle.italic,
|
||
|
fontSize: 12),
|
||
|
),
|
||
|
Text(
|
||
|
"On: ${provider.sessionNotesList[index].addedDate}",
|
||
|
// maxLines: 3,
|
||
|
style: TextStyle(
|
||
|
// decoration: TextDecoration.underline,
|
||
|
// decorationColor: Colors.blue,
|
||
|
//fontFamily: "SourceSerif",
|
||
|
color: const Color.fromARGB(255, 66, 65, 65),
|
||
|
|
||
|
//fontStyle: FontStyle.italic,
|
||
|
fontSize: 12),
|
||
|
),
|
||
|
],
|
||
|
),
|
||
|
],
|
||
|
),
|
||
|
),
|
||
|
);
|
||
|
},
|
||
|
separatorBuilder: (context, index) {
|
||
|
return Divider();
|
||
|
},
|
||
|
),
|
||
|
)
|
||
|
],
|
||
|
),
|
||
|
);
|
||
|
}
|
||
|
|
||
|
Widget topicsTab(Eventsdetail eventsdetail) {
|
||
|
print("${eventsdetail.sessionName!.split(",").length} @@@lengtg");
|
||
|
List<String> sessions = eventsdetail.sessionName!.split(",");
|
||
|
return Container(
|
||
|
width: double.maxFinite,
|
||
|
padding: EdgeInsets.only(left: 8),
|
||
|
decoration: BoxDecoration(
|
||
|
// color: Color.fromARGB(179, 248, 238, 238),
|
||
|
color: Constants.bgcolor,
|
||
|
),
|
||
|
child: ListView.separated(
|
||
|
padding: EdgeInsets.only(top: 10.0, left: 4.0),
|
||
|
itemCount: sessions.length,
|
||
|
itemBuilder: (context, index) {
|
||
|
List<String> topics = eventsdetail.eventTopics!.split("|");
|
||
|
return Column(
|
||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||
|
children: [
|
||
|
// Text(
|
||
|
// "",
|
||
|
// style: TextStyle(
|
||
|
// //fontFamily: "SourceSerif",
|
||
|
// fontSize: 16,
|
||
|
// fontWeight: FontWeight.bold,
|
||
|
// ),
|
||
|
|
||
|
// //softWrap: true,
|
||
|
// overflow: TextOverflow.ellipsis,
|
||
|
// ),
|
||
|
Text(
|
||
|
"${index + 1}.${sessions[index]}",
|
||
|
|
||
|
style: TextStyle(
|
||
|
// fontFamily: "SourceSerif",
|
||
|
fontSize: 14,
|
||
|
color: Colors.black,
|
||
|
fontWeight: FontWeight.bold,
|
||
|
),
|
||
|
maxLines: 3,
|
||
|
//softWrap: true,
|
||
|
),
|
||
|
SizedBox(
|
||
|
height: 10,
|
||
|
),
|
||
|
SizedBox(
|
||
|
width: isTablet
|
||
|
? MediaQuery.of(context).size.width * 0.25
|
||
|
: MediaQuery.of(context).size.width * 0.5,
|
||
|
child: Text(
|
||
|
"Topics",
|
||
|
style: TextStyle(
|
||
|
// decoration: TextDecoration.underline,
|
||
|
// decorationColor: Colors.blue,
|
||
|
fontSize: 14,
|
||
|
// fontWeight: FontWeight.bold,
|
||
|
color: Colors.grey[900],
|
||
|
|
||
|
//fontStyle: FontStyle.italic,
|
||
|
),
|
||
|
),
|
||
|
),
|
||
|
buildTopicsCard(topics),
|
||
|
// SizedBox(
|
||
|
// width: isTablet
|
||
|
// ? MediaQuery.of(context).size.width * 0.25
|
||
|
// : MediaQuery.of(context).size.width * 0.5,
|
||
|
// child: Text(
|
||
|
// "${topics.join(" \n ")}",
|
||
|
// // maxLines: 3,
|
||
|
// style: TextStyle(
|
||
|
// // decoration: TextDecoration.underline,
|
||
|
// // decorationColor: Colors.blue,
|
||
|
// //fontFamily: "SourceSerif",
|
||
|
// color: Colors.grey[700],
|
||
|
|
||
|
// //fontStyle: FontStyle.italic,
|
||
|
// fontSize: 16),
|
||
|
// ),
|
||
|
// ),
|
||
|
],
|
||
|
);
|
||
|
},
|
||
|
separatorBuilder: (context, index) {
|
||
|
return Divider();
|
||
|
},
|
||
|
));
|
||
|
}
|
||
|
|
||
|
Widget buildTopicsCard(List<String> tags) {
|
||
|
return Container(
|
||
|
child: Padding(
|
||
|
padding: const EdgeInsets.only(
|
||
|
top: 8,
|
||
|
bottom: 8,
|
||
|
),
|
||
|
child: Wrap(
|
||
|
runSpacing: 12.0,
|
||
|
spacing: 12.0,
|
||
|
children: tags.map((String tag) {
|
||
|
return Container(
|
||
|
constraints: BoxConstraints(
|
||
|
// minWidth: MediaQuery.of(context).size.width * 0.34,
|
||
|
maxWidth: MediaQuery.of(context).size.width),
|
||
|
decoration: BoxDecoration(
|
||
|
color: Constants.bgtopic,
|
||
|
border: Border.all(color: Colors.grey),
|
||
|
borderRadius: BorderRadius.all(
|
||
|
Radius.circular(10.0),
|
||
|
),
|
||
|
// color: Colors.grey
|
||
|
),
|
||
|
margin: const EdgeInsets.symmetric(horizontal: 3.0),
|
||
|
padding:
|
||
|
const EdgeInsets.symmetric(horizontal: 1.6, vertical: 5.0),
|
||
|
child: Text(
|
||
|
'$tag',
|
||
|
// overflow: TextOverflow.ellipsis,
|
||
|
//textWidthBasis: TextWidthBasis.longestLine,
|
||
|
// softWrap: false,
|
||
|
maxLines: 2,
|
||
|
|
||
|
style: TextStyle(
|
||
|
overflow: TextOverflow.clip,
|
||
|
color: Constants.fonttopic,
|
||
|
fontSize: isTablet ? 16 : 14),
|
||
|
),
|
||
|
);
|
||
|
}).toList()),
|
||
|
),
|
||
|
);
|
||
|
}
|
||
|
|
||
|
Widget medicalInsights() {
|
||
|
return Container(
|
||
|
color: Constants.bgcolor,
|
||
|
child: Center(
|
||
|
child: FloatingActionButton.extended(
|
||
|
backgroundColor: Colors.green,
|
||
|
onPressed: () {},
|
||
|
heroTag: 'medicalinsights',
|
||
|
elevation: 0,
|
||
|
label: const Text("Add Medical Insights",
|
||
|
style: TextStyle(
|
||
|
color: Colors.white,
|
||
|
)),
|
||
|
icon: const Icon(
|
||
|
Icons.add,
|
||
|
color: Colors.white,
|
||
|
),
|
||
|
),
|
||
|
),
|
||
|
);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
const _tabs = [
|
||
|
Tab(text: "Sessions"),
|
||
|
Tab(text: "Notes"),
|
||
|
Tab(text: "Medical Insights"),
|
||
|
// Tab(text: "Survey"),
|
||
|
];
|
||
|
|
||
|
class _SliverAppBarDelegate extends SliverPersistentHeaderDelegate {
|
||
|
_SliverAppBarDelegate(this._tabBar);
|
||
|
|
||
|
final TabBar _tabBar;
|
||
|
|
||
|
@override
|
||
|
double get minExtent => _tabBar.preferredSize.height;
|
||
|
@override
|
||
|
double get maxExtent => _tabBar.preferredSize.height;
|
||
|
|
||
|
@override
|
||
|
Widget build(
|
||
|
BuildContext context, double shrinkOffset, bool overlapsContent) {
|
||
|
return Container(
|
||
|
//color: Constants.tabbgColor,
|
||
|
decoration: BoxDecoration(
|
||
|
gradient: LinearGradient(
|
||
|
begin: Alignment.bottomCenter,
|
||
|
end: Alignment.topCenter,
|
||
|
colors: [
|
||
|
// Constants.blueColor,
|
||
|
Constants.tabbgColor,
|
||
|
Constants.blueColor,
|
||
|
// Constants.tabbgColor,
|
||
|
// const Color.fromARGB(255, 222, 237, 247),
|
||
|
// const Color.fromARGB(255, 222, 237, 247),
|
||
|
// Color(0xff006df1)
|
||
|
]),
|
||
|
),
|
||
|
// color: Colors.white,
|
||
|
//249, 103, 49
|
||
|
// color: const Color.fromARGB(255, 239, 71, 49),
|
||
|
child: _tabBar);
|
||
|
}
|
||
|
|
||
|
@override
|
||
|
bool shouldRebuild(_SliverAppBarDelegate oldDelegate) {
|
||
|
return true;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
class _ProfileInfoRow extends StatelessWidget {
|
||
|
List<ProfileInfoItem> items;
|
||
|
_ProfileInfoRow({Key? key, required this.items}) : super(key: key);
|
||
|
|
||
|
@override
|
||
|
Widget build(BuildContext context) {
|
||
|
return Container(
|
||
|
height: 60,
|
||
|
constraints: const BoxConstraints(maxWidth: 400),
|
||
|
child: Center(
|
||
|
child: Row(
|
||
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||
|
children: items
|
||
|
.map((item) => Expanded(
|
||
|
child: Row(
|
||
|
children: [
|
||
|
if (items.indexOf(item) != 0) const VerticalDivider(),
|
||
|
Expanded(child: _singleItem(context, item)),
|
||
|
],
|
||
|
)))
|
||
|
.toList(),
|
||
|
),
|
||
|
),
|
||
|
);
|
||
|
}
|
||
|
|
||
|
Widget _singleItem(BuildContext context, ProfileInfoItem item) => Column(
|
||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||
|
children: [
|
||
|
Padding(
|
||
|
padding: const EdgeInsets.all(8.0),
|
||
|
child: Text(
|
||
|
item.value.toString(),
|
||
|
style: const TextStyle(
|
||
|
fontWeight: FontWeight.bold,
|
||
|
fontSize: 14,
|
||
|
),
|
||
|
),
|
||
|
),
|
||
|
Text(
|
||
|
item.title,
|
||
|
style: Theme.of(context).textTheme.bodyLarge,
|
||
|
)
|
||
|
],
|
||
|
);
|
||
|
}
|
||
|
|
||
|
class ProfileInfoItem {
|
||
|
final String title;
|
||
|
final int value;
|
||
|
|
||
|
const ProfileInfoItem(
|
||
|
this.title,
|
||
|
this.value,
|
||
|
);
|
||
|
}
|
||
|
|
||
|
class _TopPortion extends StatelessWidget {
|
||
|
final String title;
|
||
|
final Eventsdetail eventsdetail;
|
||
|
const _TopPortion({Key? key, required this.title, required this.eventsdetail})
|
||
|
: super(key: key);
|
||
|
|
||
|
@override
|
||
|
Widget build(BuildContext context) {
|
||
|
return Stack(
|
||
|
//fit: StackFit.expand,
|
||
|
// alignment: Alignment.center,
|
||
|
children: [
|
||
|
Align(
|
||
|
alignment: Alignment.topCenter,
|
||
|
child: Container(
|
||
|
margin: const EdgeInsets.only(bottom: 30),
|
||
|
decoration: const BoxDecoration(
|
||
|
gradient: LinearGradient(
|
||
|
begin: Alignment.bottomCenter,
|
||
|
end: Alignment.topCenter,
|
||
|
colors: [
|
||
|
Constants.blueColor,
|
||
|
Constants.blueColor,
|
||
|
Constants.blueColor,
|
||
|
// const Color.fromARGB(255, 222, 237, 247),
|
||
|
// const Color.fromARGB(255, 222, 237, 247),
|
||
|
// Color(0xff006df1)
|
||
|
]),
|
||
|
// borderRadius: BorderRadius.only(
|
||
|
// bottomLeft: Radius.circular(20),
|
||
|
// bottomRight: Radius.circular(20),
|
||
|
// )
|
||
|
),
|
||
|
child: Align(
|
||
|
alignment: Alignment.topCenter,
|
||
|
child: Column(
|
||
|
children: [
|
||
|
SizedBox(
|
||
|
height: 15,
|
||
|
),
|
||
|
Text(eventsdetail.kolFullName!,
|
||
|
style: TextStyle(
|
||
|
fontSize: 20,
|
||
|
// fontFamily: "SourceSerif",
|
||
|
color: Colors.white,
|
||
|
fontWeight: FontWeight.bold)),
|
||
|
Text("Hematology/Oncology",
|
||
|
style: TextStyle(
|
||
|
color: Colors.white,
|
||
|
// fontFamily: "SourceSerif",
|
||
|
)),
|
||
|
Text(
|
||
|
"${eventsdetail.orgName ?? ""} ${eventsdetail.country ?? ""} ${eventsdetail.city ?? ""}",
|
||
|
softWrap: true,
|
||
|
maxLines: 2,
|
||
|
textAlign: TextAlign.center,
|
||
|
style: TextStyle(
|
||
|
color: Colors.white,
|
||
|
// fontFamily: "SourceSerif",
|
||
|
fontSize: 12,
|
||
|
)),
|
||
|
],
|
||
|
),
|
||
|
),
|
||
|
),
|
||
|
),
|
||
|
Positioned(
|
||
|
bottom: -30,
|
||
|
child: CircleAvatar(
|
||
|
radius: 20,
|
||
|
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
|
||
|
child: Container(
|
||
|
margin: const EdgeInsets.all(8.0),
|
||
|
decoration: const BoxDecoration(
|
||
|
color: Colors.green, shape: BoxShape.circle),
|
||
|
),
|
||
|
),
|
||
|
),
|
||
|
// Align(
|
||
|
// alignment: Alignment.bottomCenter,
|
||
|
// child: SizedBox(
|
||
|
// width: 120,
|
||
|
// height: 120,
|
||
|
// child: Stack(
|
||
|
// fit: StackFit.expand,
|
||
|
// children: [
|
||
|
// BorderedCircleAvatar(
|
||
|
// // radius: 24,
|
||
|
// backgroundColor: Colors.grey,
|
||
|
// border: BorderSide(color: Colors.white),
|
||
|
|
||
|
// // child: Icon(
|
||
|
// // Icons.person,
|
||
|
// // size: 18,
|
||
|
// // color: Colors.white,
|
||
|
// // ),
|
||
|
// child: Text(
|
||
|
// title[0],
|
||
|
// style: TextStyle(
|
||
|
// fontWeight: FontWeight.bold,
|
||
|
// fontSize: 34,
|
||
|
// color: Colors.white),
|
||
|
// ),
|
||
|
// ),
|
||
|
// Container(
|
||
|
// decoration: const BoxDecoration(
|
||
|
// color: Colors.black,
|
||
|
// shape: BoxShape.circle,
|
||
|
// image: DecorationImage(
|
||
|
// fit: BoxFit.cover,
|
||
|
// image: NetworkImage(
|
||
|
// 'https://cardio-staging.konectar.io/images/kol_images/resized/1093755944.jpeg')),
|
||
|
// // 'https://images.unsplash.com/photo-1438761681033-6461ffad8d80?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1470&q=80')),
|
||
|
// ),
|
||
|
// ),
|
||
|
// Positioned(
|
||
|
// bottom: 0,
|
||
|
// right: 0,
|
||
|
// child: CircleAvatar(
|
||
|
// radius: 20,
|
||
|
// backgroundColor: Theme.of(context).scaffoldBackgroundColor,
|
||
|
// child: Container(
|
||
|
// margin: const EdgeInsets.all(8.0),
|
||
|
// decoration: const BoxDecoration(
|
||
|
// color: Colors.green, shape: BoxShape.circle),
|
||
|
// ),
|
||
|
// ),
|
||
|
// ),
|
||
|
// ],
|
||
|
// ),
|
||
|
//),
|
||
|
// )
|
||
|
],
|
||
|
);
|
||
|
}
|
||
|
}
|