DiscoverModule/lib/contacts_module/ui_screen/new_new_profile.dart

981 lines
50 KiB
Dart

import 'package:discover_module/contacts_module/constants.dart';
import 'package:discover_module/contacts_module/custom_widget/custom_appbar.dart';
import 'package:discover_module/contacts_module/custom_widget/custom_floatingbutton.dart';
import 'package:discover_module/contacts_module/custom_widget/custom_sizedbox.dart';
import 'package:discover_module/contacts_module/custom_widget/profile_card.dart';
import 'package:discover_module/contacts_module/custom_widget/show_alert.dart';
import 'package:discover_module/contacts_module/custom_widget/text.dart';
import 'package:discover_module/contacts_module/provider_class/k2_provider/kol_add_provider.dart';
import 'package:discover_module/contacts_module/ui_screen/engagementtab.dart';
import 'package:discover_module/contacts_module/ui_screen/hcp_notes/view_notes.dart';
import 'package:discover_module/contacts_module/ui_screen/interactionform/model/save_interaction.dart';
import 'package:discover_module/contacts_module/ui_screen/k2api_integrated_ui/demoActivityTab.dart';
import 'package:discover_module/contacts_module/ui_screen/k2api_integrated_ui/locationk2_tab.dart';
import 'package:flutter/material.dart';
import 'package:flutter_carousel_widget/flutter_carousel_widget.dart';
import 'package:provider/provider.dart';
class NewProfile1 extends StatefulWidget {
const NewProfile1({super.key, required this.text, this.offlinemode});
final Map<dynamic, dynamic> text;
final bool? offlinemode;
@override
State<NewProfile1> createState() => _NewProfileState();
}
class _NewProfileState extends State<NewProfile1>
with TickerProviderStateMixin {
List<SaveInteraction> viewformData = [];
bool _isExpanded = false;
final ScrollController _scrollController = ScrollController();
late final TabController _tabController;
TextEditingController noteController = TextEditingController();
final List<Color> gradients = [
const Color.fromARGB(255, 246, 245, 251),
const Color.fromARGB(255, 245, 249, 249),
const Color.fromARGB(255, 255, 244, 244),
const Color.fromARGB(255, 246, 245, 251),
const Color.fromARGB(255, 245, 249, 249),
];
@override
void initState() {
super.initState();
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
_tabController = TabController(length: 3, vsync: this);
});
}
@override
void dispose() {
_tabController.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return DefaultTabController(
length: 3,
child: SafeArea(
child: headerview(context),
),
);
}
Widget headerview(BuildContext context) {
return SafeArea(
child: Scaffold(
backgroundColor: Constants.bgwhitecolor,
body: Stack(
children: <Widget>[
Column(
children: <Widget>[
const CustomAppbar(title: "Contacts"),
Expanded(
child: NestedScrollView(
controller: _scrollController,
headerSliverBuilder:
(BuildContext context, bool innerBoxIsScrolled) {
return <Widget>[
SliverList(
delegate: SliverChildBuilderDelegate(
(BuildContext context, int index) {
return Column(
children: <Widget>[
buildCardView(
context,
),
const CustomSizedBox(height: 15.0),
profilesummarydata(),
const CustomSizedBox(height: 10.0),
_buidTopCards(),
const CustomSizedBox(height: 10.0),
hcpNotes(),
const CustomSizedBox(height: 10.0),
],
);
}, childCount: 1),
),
SliverPersistentHeader(
pinned: true,
floating: true,
delegate: ContestTabHeader(
Padding(
padding: const EdgeInsets.only(
left: 8.0, right: 8.0),
child: Container(
color: Constants.profilecard,
child: TabBar(
indicatorColor: Colors.white,
labelColor: Colors
.white, // Color of the selected tab text
unselectedLabelColor: Constants.k2color,
tabs: [
Tab(
child: Text1(
title: "Details",
txtfont: 15.0,
),
),
Tab(
child: Text1(
title: "Activities",
txtfont: 15.0,
),
),
Tab(
child: Text1(
title: "Engagements",
txtfont: 15.0,
),
),
],
),
),
),
),
)
];
},
body: TabBarView(
//controller: _tabController,
children: [
// LocationTab(text: widget.text["id"]),
LocationK2Tab(
text: widget.text["id"],
offlineMode: widget.offlinemode),
ActivitiesK2Demo(
text: widget.text["id"],
offlineMode: widget.offlinemode),
// ActivitiesK2(
// text: widget.text["id"],
// offlineMode: widget.offlinemode),
EngagementTab(
text: widget.text["id"],
offlineMode: widget.offlinemode),
],
),
),
)
],
),
],
),
floatingActionButton: const CustomFloatingBtn(
height: 70.0,
width: 70.0,
color: Color.fromARGB(255, 3, 131, 243),
borderRadius: 100,
icon: Icons.add,
iconColor: Constants.bgwhitecolor,
iconsize: 33)));
}
buildCardView(BuildContext context) {
MediaQuery.of(context).size.height * 0.35;
return Padding(
padding: const EdgeInsets.all(12.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
ProfileCard(
name: "Dr ${widget.text["name"]}",
spl: widget.text["speciality"],
imgurl: widget.text["img_path"],
pno: widget.text["phone_no"].toString(),
email: widget.text["email"],
address: widget.text["Country"],
),
],
// ),
),
);
}
_buidTopCards() {
return ExpandableCarousel(
options: CarouselOptions(
showIndicator: false,
slideIndicator: CircularWaveSlideIndicator(
currentIndicatorColor: Constants.k2color1,
indicatorBackgroundColor: Colors.grey,
),
autoPlay: true,
autoPlayInterval: const Duration(seconds: 2),
// enlargeCenterPage: false, // Enlarge the current page (optional)
//aspectRatio: 16 / 9,
viewportFraction: 0.8,
),
items: [1, 2, 3, 4, 5].asMap().entries.map((entry) {
int index = entry.key;
return Builder(
builder: (BuildContext context) {
return Padding(
padding: const EdgeInsets.all(8.0),
child: Card(
// elevation: 6,
margin: EdgeInsets.all(1.0),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(30),
),
child: Container(
// width: MediaQuery.sizeOf(context).width / 1.5,
decoration: BoxDecoration(
color:
gradients[index % gradients.length], // Apply gradient
borderRadius: BorderRadius.circular(20),
),
child: Padding(
padding: EdgeInsets.all(10.0),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
index == 0
? Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Text(
"Top Event Topics",
style: TextStyle(
fontSize: 16.0,
fontWeight: FontWeight.bold,
color:
Color.fromARGB(255, 64, 53, 114)),
),
const CustomSizedBox(height: 10.0),
Row(
children: [
Container(
decoration: BoxDecoration(
color: Constants.cardtext,
borderRadius:
BorderRadius.circular(10),
),
child: const Padding(
padding:
EdgeInsets.only(left: 10.0),
child: Row(
children: [
Text(
"Angina Pectoris",
style: TextStyle(
color: Color.fromARGB(
255, 64, 53, 114)),
),
],
),
),
),
],
),
Row(
children: [
Container(
decoration: BoxDecoration(
color: Constants.cardtext,
borderRadius:
BorderRadius.circular(5),
),
child: const Padding(
padding:
EdgeInsets.only(left: 10.0),
child: Row(
children: [
Text("Coronary Artery Disease",
style: TextStyle(
color: Color.fromARGB(
255, 64, 53, 114)),
softWrap: true),
],
),
),
),
],
),
Row(
children: [
Container(
decoration: BoxDecoration(
color: Constants.cardtext,
borderRadius:
BorderRadius.circular(5),
),
child: const Padding(
padding:
EdgeInsets.only(left: 10.0),
child: Row(
children: [
Text(
"Hypertension",
style: TextStyle(
color: Color.fromARGB(
255, 64, 53, 114)),
),
],
),
),
),
],
),
],
),
)
: index == 1
? Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
mainAxisAlignment:
MainAxisAlignment.start,
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
const Text(
"Top Publication Topics",
style: TextStyle(
fontSize: 16.0,
fontWeight: FontWeight.bold,
color: Color.fromARGB(
255, 71, 150, 150)),
textAlign: TextAlign.left,
),
const CustomSizedBox(height: 10.0),
Row(
children: [
Container(
decoration: BoxDecoration(
color: Constants.cardtext,
borderRadius:
BorderRadius.circular(10),
),
child: const Padding(
padding:
EdgeInsets.only(left: 10.0),
child: Row(
children: [
Text(
"Angina Pectoris",
style: TextStyle(
color: Color.fromARGB(
255,
71,
150,
150)),
),
],
),
),
),
],
),
Row(
children: [
Container(
decoration: BoxDecoration(
color: Constants.cardtext,
borderRadius:
BorderRadius.circular(5),
),
child: const Padding(
padding:
EdgeInsets.only(left: 10.0),
child: Row(
children: [
Text(
"Coronary Artery Disease",
style: TextStyle(
color:
Color.fromARGB(
255,
71,
150,
150)),
softWrap: true),
],
),
),
),
],
),
Row(
children: [
Container(
decoration: BoxDecoration(
color: Constants.cardtext,
borderRadius:
BorderRadius.circular(5),
),
child: const Padding(
padding:
EdgeInsets.only(left: 10.0),
child: Row(
children: [
Text(
"Hypertension",
style: TextStyle(
color: Color.fromARGB(
255,
71,
150,
150)),
),
],
),
),
),
],
),
],
),
)
: index == 2
? Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
const Text(
"Top Products Topics",
style: TextStyle(
fontSize: 16.0,
fontWeight: FontWeight.bold,
color: Color.fromARGB(
255, 255, 86, 72)),
),
const CustomSizedBox(height: 10.0),
Row(
children: [
Container(
decoration: BoxDecoration(
color: Constants.cardtext,
borderRadius:
BorderRadius.circular(
10),
),
child: const Padding(
padding: EdgeInsets.only(
left: 10.0),
child: Row(
children: [
Text(
"Angina Pectoris",
style: TextStyle(
color: Color
.fromARGB(
255,
255,
86,
72)),
),
],
),
),
),
],
),
Row(
children: [
Container(
decoration: BoxDecoration(
color: Constants.cardtext,
borderRadius:
BorderRadius.circular(
5),
),
child: const Padding(
padding: EdgeInsets.only(
left: 10.0),
child: Row(
children: [
Text(
"Coronary Artery Disease",
style: TextStyle(
color: Color
.fromARGB(
255,
255,
86,
72)),
softWrap: true),
],
),
),
),
],
),
Row(
children: [
Container(
decoration: BoxDecoration(
color: Constants.cardtext,
borderRadius:
BorderRadius.circular(
5),
),
child: const Padding(
padding: EdgeInsets.only(
left: 10.0),
child: Row(
children: [
Text(
"Hypertension",
style: TextStyle(
color: Color
.fromARGB(
255,
255,
86,
72)),
),
],
),
),
),
],
),
],
),
)
: index == 3
? Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
const Text(
"Drugs Prescribed",
style: TextStyle(
fontSize: 16.0,
fontWeight:
FontWeight.bold,
color: Color.fromARGB(
255, 64, 53, 114)),
),
const CustomSizedBox(
height: 10.0),
Row(
children: [
Container(
decoration: BoxDecoration(
color:
Constants.cardtext,
borderRadius:
BorderRadius
.circular(10),
),
child: const Padding(
padding:
EdgeInsets.only(
left: 10.0),
child: Row(
children: [
Text(
"Angina Pectoris",
style: TextStyle(
color: Color
.fromARGB(
255,
64,
53,
114)),
),
],
),
),
),
],
),
Row(
children: [
Container(
decoration: BoxDecoration(
color:
Constants.cardtext,
borderRadius:
BorderRadius
.circular(5),
),
child: const Padding(
padding:
EdgeInsets.only(
left: 10.0),
child: Row(
children: [
Text(
"Coronary Artery Disease",
style: TextStyle(
color: Color
.fromARGB(
255,
64,
53,
114)),
softWrap: true),
],
),
),
),
],
),
Row(
children: [
Container(
decoration: BoxDecoration(
color:
Constants.cardtext,
borderRadius:
BorderRadius
.circular(5),
),
child: const Padding(
padding:
EdgeInsets.only(
left: 10.0),
child: Row(
children: [
Text(
"Hypertension",
style: TextStyle(
color: Color
.fromARGB(
255,
64,
53,
114)),
),
],
),
),
),
],
),
],
),
)
: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
children: [
Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
const Text(
"Condition Treated",
style: TextStyle(
fontSize: 16.0,
fontWeight:
FontWeight.bold,
color: Color.fromARGB(
255,
71,
150,
150)),
),
const CustomSizedBox(
height: 10.0),
Row(
children: [
Container(
decoration:
BoxDecoration(
color: Constants
.cardtext,
borderRadius:
BorderRadius
.circular(
10),
),
child: const Padding(
padding:
EdgeInsets.only(
left: 10.0),
child: Row(
children: [
Text(
"Angina Pectoris",
style: TextStyle(
color: Color.fromARGB(
255,
71,
150,
150)),
),
],
),
),
),
],
),
Row(
children: [
Container(
decoration:
BoxDecoration(
color: Constants
.cardtext,
borderRadius:
BorderRadius
.circular(
5),
),
child: const Padding(
padding:
EdgeInsets.only(
left: 10.0),
child: Row(
children: [
Text(
"Coronary Artery Disease",
style: TextStyle(
color: Color.fromARGB(
255,
71,
150,
150)),
softWrap:
true),
],
),
),
),
],
),
Row(
children: [
Container(
decoration:
BoxDecoration(
color: Constants
.cardtext,
borderRadius:
BorderRadius
.circular(
5),
),
child: const Padding(
padding:
EdgeInsets.only(
left: 10.0),
child: Row(
children: [
Text(
"Hypertension",
style: TextStyle(
color: Color.fromARGB(
255,
71,
150,
150)),
),
],
),
),
),
],
),
],
),
],
),
),
],
),
),
),
),
);
},
);
}).toList(),
);
}
profilesummarydata() {
return Column(
children: [
Align(
alignment: Alignment.centerLeft,
child: Padding(
padding: const EdgeInsets.only(left: 8.0),
child: Text1(
title: "Profile Summary",
txtcolor: Colors.black,
fontweight: FontWeight.normal,
txtfont: 18.0),
),
),
const CustomSizedBox(height: 5.0),
Align(
alignment: Alignment.centerLeft,
child: Padding(
padding: const EdgeInsets.only(left: 15.0),
child: Text1(
title: widget.text!["summarry"],
txtcolor: Colors.black,
fontweight: FontWeight.normal,
txtfont: 14.0),
),
),
],
);
}
hcpNotes() {
return ListTileTheme(
dense: true,
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Card(
margin: EdgeInsets.all(1.0),
// elevation: 5,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(0.0),
),
color: Constants.bgwhitecolor,
child: ExpansionTile(
// collapsedBackgroundColor: Color(0xFF2b9af3),
onExpansionChanged: (bool expanded) {
setState(() {
_isExpanded = expanded;
});
},
backgroundColor: Constants.bgwhitecolor,
trailing: Icon(
_isExpanded
? Icons.keyboard_arrow_up
: Icons.keyboard_arrow_down,
color: Colors.black),
title: Row(
mainAxisAlignment: MainAxisAlignment.start,
// mainAxisSize: MainAxisSize.min,
children: [
Text1(
title: "Notes",
txtcolor: Colors.black,
fontweight: FontWeight.normal,
txtfont: 17.0),
const CustomSizedBox(width: 8.0),
Text1(
title: "(0)",
txtcolor: Colors.black,
fontweight: FontWeight.normal,
txtfont: 17.0),
],
),
children: [
Padding(
padding: const EdgeInsets.all(8.0),
child: Row(
children: [
OutlinedButton(
onPressed: () {
Navigator.push(context,
MaterialPageRoute(builder: (_) => ViewNotes()));
},
style: OutlinedButton.styleFrom(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12),
),
),
child: Text1(
title: 'View Notes',
txtcolor: Constants.k2color,
),
),
],
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: TextField(
controller: noteController,
decoration: InputDecoration(
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(8.0),
),
hintText: 'Write your note here',
contentPadding: EdgeInsets.all(16.0),
),
maxLines: null,
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: OutlinedButton(
onPressed: () async {
var addnoteprovider =
Provider.of<AddNotesProvider>(context, listen: false);
await addnoteprovider.addnotes(noteController.text);
showDialog(
context: context,
builder: (_) {
return Alert(
data: "Added ",
onPressed: () {
noteController.clear();
Navigator.of(context).pop();
},
);
});
},
child: Text(
'Save',
style: TextStyle(color: Constants.k2color),
),
style: OutlinedButton.styleFrom(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12),
),
),
),
),
]),
),
),
); // adds spacing between the text and image
}
}
class ContestTabHeader extends SliverPersistentHeaderDelegate {
ContestTabHeader(
this.searchUI,
);
final Widget searchUI;
@override
Widget build(
BuildContext context, double shrinkOffset, bool overlapsContent) {
return Container(color: Colors.white, child: searchUI);
}
@override
double get maxExtent => 52.0;
@override
double get minExtent => 52.0;
@override
bool shouldRebuild(SliverPersistentHeaderDelegate oldDelegate) {
return true;
}
}