KonectarEvents/lib/view/eventslist.dart

1659 lines
60 KiB
Dart
Raw Normal View History

2024-09-06 06:30:31 +00:00
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter/widgets.dart';
import 'package:konectar_events/model/eventsdetailmodel.dart';
import 'package:konectar_events/model/eventsmodel.dart';
import 'package:konectar_events/model/neweventsmodel.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/view/hcplist.dart';
import 'package:konectar_events/view/home.dart';
import 'package:konectar_events/view/insights.dart';
import 'package:konectar_events/view/profileview.dart';
import 'package:konectar_events/view/socialmedia.dart';
import 'package:konectar_events/viewmodel/eventsprovider.dart';
import 'package:konectar_events/viewmodel/hcpprofprovider.dart';
import 'package:konectar_events/widgets/customappbar.dart';
import 'package:konectar_events/widgets/gridview.dart';
import 'package:konectar_events/widgets/snackbar.dart';
import 'package:provider/provider.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:add_2_calendar/add_2_calendar.dart';
class EventsListingScreen extends StatefulWidget {
EventsList event;
EventsListingScreen({super.key, required this.event});
@override
State<EventsListingScreen> createState() => _EventsListingScreenState();
}
class _EventsListingScreenState extends State<EventsListingScreen>
with TickerProviderStateMixin {
late final TabController _tabController;
int itemcount = 3;
bool isExtended = false;
bool isExtendedInterested = false;
final ScrollController _scrollController = ScrollController();
@override
void initState() {
super.initState();
_tabController = TabController(length: 2, vsync: this);
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
init();
});
}
init() async {
await Provider.of<EventsProvider>(context, listen: false)
.getEventsDetails(widget.event.eventId!);
await Provider.of<EventsProvider>(context, listen: false).getSessionCount();
await Provider.of<EventsProvider>(context, listen: false)
.getTopicsCloud(widget.event.eventId!);
setState(() {});
}
@override
void dispose() {
_tabController.dispose();
super.dispose();
}
Widget build(BuildContext context) {
return Consumer<EventsProvider>(
builder: (BuildContext context, provider, Widget? child) {
return DefaultTabController(
length: 4,
//child: SafeArea(
// appBar: CustomAppBar(title: "", backgroundcolor: Constants.bgcolor),
//body:
// NestedScrollView(
// headerSliverBuilder:
// (BuildContext context, bool innerBoxIsScrolled) {
// return <Widget>[
// SliverAppBar.medium(
// expandedHeight: MediaQuery.of(context).size.height / 3,
// //expandedHeight: double.minPositive,
// automaticallyImplyLeading: false,
// floating: false,
// pinned: true,
// stretch: false,
// backgroundColor: Constants.bgcolor,
// flexibleSpace: FlexibleSpaceBar(
// centerTitle: false,
// expandedTitleScale: 2.4,
// collapseMode: CollapseMode.parallax,
// title: const Text("",
// style: TextStyle(
// color: Colors.white,
// fontSize: 2.0,
// )),
// background: buildCardView(context, widget.event, 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(
// floating: true,
// delegate: _SliverAppBarDelegate(
// const TabBar(
// indicatorSize: TabBarIndicatorSize.label,
// labelColor: Colors.black,
// unselectedLabelColor: Colors.grey,
// tabs: _tabs,
// ),
// ),
// pinned: true,
// ),
// ];
// },
// body: TabBarView(
// //controller: _tabController,
// children: [
// expandableDetails(),
// speakersList(provider),
// ],
// ),
// ),
child: headerview(context, provider),
// ),
);
});
}
Event buildEvent({Recurrence? recurrence}) {
return Event(
title: widget.event.name1!,
description: widget.event.name1!,
location: widget.event.region,
startDate: CustomDateFormatter().convertStringToDate(widget.event.start!),
endDate: CustomDateFormatter().convertStringToDate(widget.event.end!),
allDay: false,
iosParams: IOSParams(
reminder: Duration(minutes: 40),
url: widget.event.url1,
),
androidParams: const AndroidParams(
emailInvites: ["test@aissel.com"],
),
recurrence: recurrence,
);
}
Widget headerview(BuildContext context, EventsProvider provider) {
//return SafeArea(
return Container(
child: Scaffold(
backgroundColor: Constants.bgcolor,
appBar: AppBar(
// title: Text(""),
automaticallyImplyLeading: false,
backgroundColor: Constants.blueColor,
centerTitle: false,
flexibleSpace: Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.start,
children: [
IconButton(
iconSize: 18,
icon: Icon(
Icons.arrow_back_ios,
size: 18,
color: Colors.white,
),
onPressed: () {
Navigator.pop(context);
},
),
Container(
margin: EdgeInsets.all(5.0),
padding: EdgeInsets.all(3.0),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(
Radius.circular(4),
)),
child: Text(
(CustomDateFormatter().convertStringToDate(widget.event.end!))
.isBefore(DateTime.now())
? "Event ended"
: ((CustomDateFormatter()
.convertStringToDate(widget.event.start!))
.isBefore(DateTime.now()) &&
(CustomDateFormatter()
.convertStringToDate(widget.event.end!))
.isAfter(DateTime.now()))
? "Ongoing"
: "Starting soon",
style: TextStyle(
// decoration: TextDecoration.underline,
// decorationColor: Colors.blue,
color: Constants.blueColor,
//fontWeight: FontWeight.bold,
fontSize: isTablet ? 22 : 14,
),
),
),
// const Spacer(),
// widget.event.isfav
// ? RichText(
// text: TextSpan(
// children: [
// WidgetSpan(
// child: Icon(Icons.check,
// color: Colors.grey[600],
// size: isTablet ? 14 : 12),
// ),
// TextSpan(
// text: ' following',
// style: TextStyle(
// color: Colors.grey[600],
// fontSize: isTablet ? 14 : 12),
// ),
// ],
// ),
// )
// : Center(
// child: RichText(
// text: TextSpan(
// children: [
// TextSpan(
// text: 'follow ',
// style: TextStyle(
// color: Colors.grey[600],
// fontSize: isTablet ? 14 : 12),
// ),
// ],
// ),
// ),
// ),
// Expanded(
// child: Text(
// widget.event.name1 ?? "",
// maxLines: 3,
// style: TextStyle(
// // decoration: TextDecoration.underline,
// // decorationColor: Colors.blue,
// color: Colors.white,
// //fontWeight: FontWeight.bold,
// fontSize: isTablet ? 22 : 16,
// ),
// ),
// ),
],
),
),
floatingActionButtonLocation: FloatingActionButtonLocation.miniEndFloat,
floatingActionButton: FloatingActionButton(
// backgroundColor: const Color.fromARGB(255, 222, 237, 247),
backgroundColor: Constants.blueColor,
tooltip: 'Actions',
// heroTag: "floatbtn232342",
onPressed: () {
showModalBottomSheet<void>(
context: context,
builder: (BuildContext context) {
return Container(
color: Constants.bgcolor,
width: MediaQuery.of(context).size.width,
height: 240,
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
mainAxisSize: MainAxisSize.max,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
// Padding(
// padding: const EdgeInsets.all(8.0),
// child: Align(
// alignment: Alignment.topLeft,
// child: const Text(
// 'Actions',
// style: TextStyle(fontSize: 18),
// )),
// ),
InkWell(
onTap: () {
Add2Calendar.addEvent2Cal(
buildEvent(),
);
Navigator.pop(context);
},
child: ListTile(
title: Text("Add to my calendar"),
leading: Icon(
Icons.calendar_month,
color: Colors.green,
),
),
),
InkWell(
onTap: () {
Navigator.pop(context);
},
child: ListTile(
title: Text("Download Pdf"),
leading: Icon(
Icons.download,
color: Colors.blue,
),
),
),
InkWell(
onTap: () {
if (widget.event.isAttending) {
widget.event.isAttending = false;
// if (event.isAttending) {
// SnackBarWidget.displaySnackBar(
// "Attending", context);
// } else {
SnackBarWidget.displaySnackBar(
"Marked as not attending", context);
// }
setState(() {});
Navigator.pop(context);
} else {
Navigator.pop(context);
}
},
child: ListTile(
title: Text("Mark as not attending"),
leading: Icon(
Icons.remove_circle,
color: Colors.red,
),
),
),
// Container(
// padding: EdgeInsets.symmetric(horizontal: 8.0),
// width: MediaQuery.of(context).size.width,
// child: ElevatedButton(
// child: const Text(
// 'Add to My Calendar',
// style: TextStyle(color: Colors.black),
// ),
// onPressed: () {
// Add2Calendar.addEvent2Cal(
// buildEvent(),
// );
// Navigator.pop(context);
// }),
// ),
// Container(
// padding: EdgeInsets.symmetric(horizontal: 8.0),
// width: MediaQuery.of(context).size.width,
// child: ElevatedButton(
// child: const Text('Download excel sheet',
// style: TextStyle(color: Colors.black)),
// onPressed: () => Navigator.pop(context),
// ),
// ),
// Container(
// padding: EdgeInsets.symmetric(horizontal: 8.0),
// width: MediaQuery.of(context).size.width,
// child: ElevatedButton(
// child: const Text('Remove from my events',
// style: TextStyle(color: Colors.black)),
// onPressed: () => Navigator.pop(context),
// ),
// ),
// ElevatedButton(
// child: const Text('Close'),
// onPressed: () => Navigator.pop(context),
// ),
],
),
),
);
},
);
},
child: const Icon(
Icons.more_horiz,
size: 28,
color: Colors.white,
),
),
body: Stack(
children: <Widget>[
InkWell(
splashColor: Colors.transparent,
focusColor: Colors.transparent,
highlightColor: Colors.transparent,
hoverColor: Colors.transparent,
onTap: () {
FocusScope.of(context).requestFocus(FocusNode());
},
child: NestedScrollView(
controller: _scrollController,
headerSliverBuilder:
(BuildContext context, bool innerBoxIsScrolled) {
return <Widget>[
SliverList(
delegate: SliverChildBuilderDelegate(
(BuildContext context, int index) {
return Column(
children: [
Container(
color: Constants.blueColor,
child: Column(
children: <Widget>[
buildCardView(
context, widget.event, provider),
// getTimeDateUI(),
],
),
),
SizedBox(
height: 10,
),
_ProfileInfoRow([
ProfileInfoItem(
"Session(s)", provider.eventSessionCount),
ProfileInfoItem("Speakers(s)",
int.parse(widget.event.speakerscount!)),
//ProfileInfoItem("Note(s)", 1),
], widget.event, provider),
SizedBox(
height: 5,
),
],
);
}, childCount: 1),
),
SliverPersistentHeader(
pinned: true,
floating: true,
delegate: ContestTabHeader(
const TabBar(
indicatorSize: TabBarIndicatorSize.tab,
labelColor: Colors.black,
tabAlignment: TabAlignment.fill,
indicatorColor: Constants.blueColor,
unselectedLabelColor: Colors.grey,
labelStyle: TextStyle(
fontWeight: FontWeight.bold,
),
labelPadding: EdgeInsets.all(2),
tabs: _tabs,
),
),
),
];
},
body: TabBarView(
//controller: _tabController,
children: [
expandableDetails(),
speakersList(provider),
EventsInsights(
eventid: widget.event.eventId!,
kFlutterHashtags: provider.kFlutterHashtags,
),
SocialMedia(),
],
),
),
),
],
),
),
// ),
);
}
Widget getSearchBarUI() {
return Padding(
padding: const EdgeInsets.only(left: 16, right: 16, top: 8, bottom: 8),
child: Row(
children: <Widget>[
Expanded(
child: Padding(
padding: const EdgeInsets.only(right: 16, top: 8, bottom: 8),
child: Container(
decoration: BoxDecoration(
color: Constants.bgcolor,
borderRadius: const BorderRadius.all(
Radius.circular(38.0),
),
boxShadow: <BoxShadow>[
BoxShadow(
color: Colors.grey.withOpacity(0.2),
offset: const Offset(0, 2),
blurRadius: 8.0),
],
),
child: Padding(
padding: const EdgeInsets.only(
left: 16, right: 16, top: 4, bottom: 4),
child: TextField(
onChanged: (String txt) {},
style: const TextStyle(
fontSize: 18,
),
cursorColor: Colors.blue,
decoration: InputDecoration(
border: InputBorder.none,
hintText: 'Search for events...',
),
),
),
),
),
),
Container(
decoration: BoxDecoration(
color: Colors.blue,
borderRadius: const BorderRadius.all(
Radius.circular(38.0),
),
boxShadow: <BoxShadow>[
BoxShadow(
color: Colors.grey.withOpacity(0.4),
offset: const Offset(0, 2),
blurRadius: 8.0),
],
),
child: Material(
color: Colors.transparent,
child: InkWell(
borderRadius: const BorderRadius.all(
Radius.circular(32.0),
),
onTap: () {
FocusScope.of(context).requestFocus(FocusNode());
},
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Icon(FontAwesomeIcons.magnifyingGlass,
size: 20, color: Colors.black),
),
),
),
),
],
),
);
}
Widget getAppBarUI(EventsList eventsList) {
return Container(
decoration: BoxDecoration(
color: Constants.blueColor,
boxShadow: <BoxShadow>[
BoxShadow(
color: Colors.grey.withOpacity(0.2),
offset: const Offset(0, 2),
blurRadius: 8.0),
],
),
child: Padding(
padding: EdgeInsets.only(top: 2, left: 8, right: 8),
child: Row(
children: <Widget>[
Container(
alignment: Alignment.topLeft,
// width: AppBar().preferredSize.height,
// height: AppBar().preferredSize.height,
child: Material(
color: Colors.transparent,
child: InkWell(
borderRadius: const BorderRadius.all(
Radius.circular(32.0),
),
onTap: () {
Navigator.pop(context);
},
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Icon(
Icons.arrow_back_ios_new,
size: 18,
color: Colors.white,
),
),
),
),
// SizedBox(
// height: 30,
// // width: 100,
// child: FloatingActionButton.extended(
// elevation: 1,
// backgroundColor: Colors.transparent,
// onPressed: () {
// Navigator.pop(context);
// },
// 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: Row(
// children: [
// // Padding(
// // padding: const EdgeInsets.only(right: 4.0),
// // child: Icon(Icons.arrow_back_ios_new),
// // ),
// Text(
// "Back to events",
// style: TextStyle(color: Colors.white),
// )
// ],
// )),
// )),
),
Expanded(
child: Text(
"",
maxLines: 1,
softWrap: true,
style: TextStyle(
fontWeight: FontWeight.w600,
fontSize: isTablet ? 18 : 14,
overflow: TextOverflow.ellipsis,
),
),
),
// Container(
// width: AppBar().preferredSize.height,
// height: AppBar().preferredSize.height,
// child: Row(
// crossAxisAlignment: CrossAxisAlignment.center,
// mainAxisAlignment: MainAxisAlignment.end,
// children: <Widget>[
// Material(
// color: Colors.transparent,
// child: InkWell(
// borderRadius: const BorderRadius.all(
// Radius.circular(32.0),
// ),
// onTap: () {},
// child: Padding(
// padding: const EdgeInsets.all(8.0),
// child: Icon(
// Icons.favorite_outlined,
// color: eventsList.isfav ? Colors.red : Colors.black,
// ),
// ),
// ),
// ),
// ],
// ),
// )
],
),
),
);
}
Future<void> _launchUrl(String urlstr) async {
final Uri url = Uri.parse(urlstr);
if (!await launchUrl(url)) {
throw Exception('Could not launch $url');
}
}
// @override
// Widget build(BuildContext context) {
// var selecttextEditingController;
// return Scaffold(
// // backgroundColor: Color.fromARGB(179, 248, 238, 238),
// // appBar: CustomAppBar(),
// //backgroundColor: const Color.fromARGB(255, 222, 237, 247),
// body: Column(
// children: [
// buildCardView(context),
// SizedBox(
// height: 5,
// ),
// Container(
// color: Colors.white,
// height: 50,
// child: TabBar(
// controller: _tabController,
// tabAlignment: TabAlignment.start,
// isScrollable: true,
// indicatorColor: Colors.black,
// indicatorWeight: 0.2,
// tabs: [
// Padding(
// padding: const EdgeInsets.all(8.0),
// child: Text(
// 'Details',
// style: TextStyle(
// color: Colors.black,
// //fontWeight: FontWeight.bold,
// fontFamily: "SourceSerif",
// letterSpacing: 0.3,
// fontSize: isTablet ? 20 : 16),
// ),
// ),
// Padding(
// padding: const EdgeInsets.all(8.0),
// child: Text(
// 'Speakers',
// style: TextStyle(
// color: Colors.black,
// //fontWeight: FontWeight.bold,
// fontFamily: "SourceSerif",
// fontSize: isTablet ? 20 : 16),
// ),
// ),
// ],
// ),
// ),
// Expanded(
// child: TabBarView(
// controller: _tabController,
// children: [
// expandableDetails(),
// speakersList(),
// ],
// ),
// )
// ],
// ));
// }
buildCardView(
BuildContext context, EventsList event, EventsProvider provider) {
double height = isTablet
? MediaQuery.of(context).size.height * 0.35
: MediaQuery.of(context).size.height / 1.2;
// return Container(
// decoration: BoxDecoration(
// color: Constants.bgcolor,
// ),x
// //height: 360,
// height: double.infinity,
// padding: isTablet
// ? EdgeInsets.symmetric(horizontal: 8.0, vertical: 2.0)
// : EdgeInsets.symmetric(
// horizontal: 6.0,
// ),
// child:
return Padding(
padding: const EdgeInsets.only(left: 8.0, right: 8.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
//mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
// Container(
// color: Constants.bgcolor,
// padding: const EdgeInsets.only(left: 8.0),
// height: double.minPositive,
// child:
// RichText(
// text: TextSpan(
// children: [
// WidgetSpan(
// child:
Text(
event.name1 ?? "",
maxLines: 3,
style: TextStyle(
// decoration: TextDecoration.underline,
// decorationColor: Colors.blue,
color: Colors.white,
//fontWeight: FontWeight.bold,
fontSize: isTablet ? 22 : 18,
),
),
// ),
// TextSpan(
// text: event.name1 ?? "",
// style: TextStyle(
// color: Colors.white,
// // fontStyle: FontStyle.italic,
// letterSpacing: 0.3,
// fontSize: isTablet ? 22 : 18),
// // ),
// ],
// ),
// ),
SizedBox(
height: 15,
),
RichText(
text: TextSpan(
children: [
WidgetSpan(
child: Icon(
Icons.calendar_month,
size: 18,
color: Colors.white,
),
),
TextSpan(
text: ' ${event.start} to ${event.end}',
style: TextStyle(
color: Colors.white,
// fontStyle: FontStyle.italic,
letterSpacing: 0.3,
fontSize: isTablet ? 20 : 14),
),
],
),
),
SizedBox(
height: 8.0,
),
RichText(
text: TextSpan(
children: [
WidgetSpan(
child: Icon(
Icons.location_on,
size: 18,
color: Colors.white,
),
),
TextSpan(
text:
' ${event.city != null ? "${event.city}, " : ""}${event.region != null ? "${event.region}, " : ""}${event.country != null ? "${event.country}" : ""}',
style: TextStyle(
color: Colors.white,
//fontStyle: FontStyle.italic,
letterSpacing: 0.3,
fontSize: isTablet ? 20 : 14),
),
],
),
),
SizedBox(
height: 8.0,
),
InkWell(
onTap: () async {
await _launchUrl(provider.eventdetailList[0].url1!);
},
child: RichText(
text: TextSpan(
children: [
WidgetSpan(
child: Icon(
Icons.link,
size: 18,
color: Colors.white,
),
),
TextSpan(
text: ' Visit Website',
style: TextStyle(
decoration: TextDecoration.underline,
color: Colors.white,
// fontStyle: FontStyle.italic,
letterSpacing: 0.6,
fontSize: isTablet ? 20 : 14),
),
],
),
),
),
Padding(
padding: const EdgeInsets.only(top: 8.0, right: 8.0, left: 1),
child: Text(
'Event by: ${event.organizer}',
style: TextStyle(
// decoration: TextDecoration.underline,
// decorationColor: Colors.blue,
color: Colors.white,
//fontWeight: FontWeight.italic,
fontSize: isTablet ? 18 : 14,
letterSpacing: 0.3,
),
maxLines: isTablet ? 3 : 3,
softWrap: true,
overflow: TextOverflow.ellipsis,
),
),
SizedBox(
height: 10.0,
),
Align(
alignment: Alignment.bottomCenter,
child: Padding(
padding: const EdgeInsets.only(left: 1.0, right: 8.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
// SizedBox(
// width: 15,
// ),
attendingbtn(widget.event, provider),
// const Spacer(),
favbtn(widget.event, provider)
],
),
),
),
// SizedBox(
// height: 8.0,
// ),
// RichText(
// text: TextSpan(
// children: [
// WidgetSpan(
// child: Icon(Icons.person, size: 18),
// ),
// TextSpan(
// text: ' d attendees',
// style: TextStyle(
// color: Colors.black,
// //fontStyle: FontStyle.italic,
// letterSpacing: 0.3,
// fontFamily: "SourceSerif",
// fontSize: isTablet ? 20 : 14),
// ),
// ],
// ),
// ),
// SizedBox(
// height: 10,
// ),
// Positioned(
// child:
SizedBox(
height: 10,
),
// Image.asset(
// "assets/images/events2.jpg",
// fit: BoxFit.cover,
// ),
// ),
],
// ),
),
);
}
Widget favbtn(EventsList event, EventsProvider provider) {
return event.isfav
? SizedBox(
height: 40,
child: TextButton(
// elevation: 1,
// : Colors.transparent,
onPressed: () async {
// String msg = await provider
// .addEventsToFavs(event.eventId!);
setState(() {
event.isfav = !event.isfav;
if (event.isfav) {
provider.favsEventsData(event);
SnackBarWidget.displaySnackBar(
"You are following the event!", context);
} else {
provider.delateEventsData(event);
SnackBarWidget.displaySnackBar("Not Following", context);
}
});
},
child: AnimatedSwitcher(
duration: Duration(seconds: 1),
transitionBuilder:
(Widget child, Animation<double> animation) =>
FadeTransition(
opacity: animation,
child: SizeTransition(
child: child,
sizeFactor: animation,
axis: Axis.horizontal,
),
),
child: Row(
children: [
Padding(
padding: const EdgeInsets.only(right: 4.0),
child: Icon(
Icons.favorite,
color: Colors.red,
),
),
Text("Following", style: TextStyle(color: Colors.white))
],
))))
: SizedBox(
height: 45,
child: FloatingActionButton.extended(
elevation: 1,
// heroTag: "following45",
backgroundColor: Constants.bgcolor,
//backgroundColor: Colors.red,
onPressed: () async {
// String msg = await provider
// .addEventsToFavs(event.eventId!);
setState(() {
event.isfav = !event.isfav;
if (event.isfav) {
provider.favsEventsData(event);
SnackBarWidget.displaySnackBar(
"You are following the event!", context);
} else {
provider.delateEventsData(event);
SnackBarWidget.displaySnackBar("Not Following", context);
}
});
},
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: Row(
children: [
// Padding(
// padding: const EdgeInsets.only(right: 4.0),
// child: Icon(Icons.add),
// ),
Icon(
Icons.favorite,
color: event.isfav ? Colors.red : Colors.grey,
size: 14,
),
const SizedBox(
width: 10,
),
Text(
event.isfav ? "Following" : "Follow",
style: TextStyle(color: Colors.black),
)
],
))),
);
}
Widget attendingbtn(EventsList event, EventsProvider provider) {
return event.isAttending
? SizedBox(
height: 40,
child: TextButton(
// elevation: 1,
// : Colors.transparent,
onPressed: () async {
if (!event.isfav) {
event.isfav = !event.isfav;
// String msg1 = await provider
// .addEventsToFavs(event.eventId!);
}
// String msg = await provider
// .markAttending(event.eventId!);
setState(() {
event.isAttending = !event.isAttending;
if (event.isAttending) {
SnackBarWidget.displaySnackBar("Attending", context);
} else {
SnackBarWidget.displaySnackBar("Not Attending", context);
}
});
},
child: AnimatedSwitcher(
duration: Duration(seconds: 1),
transitionBuilder:
(Widget child, Animation<double> animation) =>
FadeTransition(
opacity: animation,
child: SizeTransition(
child: child,
sizeFactor: animation,
axis: Axis.horizontal,
),
),
child: Row(
children: [
Padding(
padding: const EdgeInsets.only(right: 4.0),
child: Icon(
Icons.check,
color: Colors.white,
),
),
Text("I am Attending",
style: TextStyle(color: Colors.white))
],
))))
: SizedBox(
height: 45,
child: FloatingActionButton.extended(
elevation: 1,
backgroundColor: Constants.bgcolor,
onPressed: () async {
if (!event.isfav) {
event.isfav = !event.isfav;
// String msg1 = await provider
// .addEventsToFavs(event.eventId!);
}
// String msg = await provider
// .markAttending(event.eventId!);
setState(() {
event.isAttending = !event.isAttending;
if (event.isAttending) {
SnackBarWidget.displaySnackBar("Attending", context);
} else {
SnackBarWidget.displaySnackBar("Not Attending", context);
}
});
},
//heroTag: "attending545",
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: event.isAttending
? Row(
children: [
Padding(
padding: const EdgeInsets.only(right: 4.0),
child: Icon(
Icons.check,
color: Colors.black,
),
),
Text(
"I am Attending",
style: TextStyle(
color: Colors.black,
fontWeight: FontWeight.bold),
)
],
)
: Row(
children: [
// Padding(
// padding: const EdgeInsets.only(right: 4.0),
// child: Icon(Icons.add),
// ),
Text(
"I am Attending",
style: TextStyle(
color: Colors.black,
),
)
],
))),
);
}
Widget expandableDetails() {
return
// isTablet
// ? Container(
// margin: EdgeInsets.symmetric(vertical: 20.0),
// height: 200.0,
// child: Row(
// mainAxisAlignment: MainAxisAlignment.spaceEvenly,
// children: <Widget>[
// _topicCard("Top 3 topics",
// " 1. Hematologic Neoplasms \n 2. Antibodies, Bispecific \n 3. Multiple Myeloma"),
// _topicCard("Speakers with most sessions",
// " 1. James A. Davis \n 2. Sandra Cuellar \n 3. Allison Butts"),
// _topicCard("Sponsors",
// " 1. Amgen Inc \n 2. Bristol-Myers Squibb Company \n 3. Genmab A/S")
// ],
// ))
// :
Container(
height: MediaQuery.of(context).size.height,
color: Constants.bgcolor,
padding: EdgeInsets.only(left: 8, right: 8),
child: SingleChildScrollView(
child: Column(children: [
SizedBox(
height: 5,
),
listViewTopicCard("Top 3 topics", widget.event.topTopics ?? "", true),
SizedBox(
height: 3,
),
listViewTopicCard(
"Speakers with most sessions", widget.event.topSpeakers!, true),
SizedBox(
height: 3,
),
listViewTopicCard("Sponsors", widget.event.sponsors!, true)
]),
),
);
}
Widget _topicCard(String title, String content) {
return SizedBox(
width: MediaQuery.of(context).size.width / 3.2,
child: Card(
child: Padding(
padding: const EdgeInsets.only(top: 18.0, left: 3.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Center(
child: Text(
title,
style: TextStyle(fontSize: 16),
maxLines: 2,
),
),
SizedBox(
height: 20,
),
Text(
content,
style: TextStyle(fontSize: 16),
maxLines: 6,
),
],
),
),
),
);
}
Widget listViewTopicCard(String title, String content, bool visible) {
return Visibility(
visible: visible,
child: Card(
// color: Colors.white,
surfaceTintColor: Colors.white,
child: Container(
padding: EdgeInsets.all(8.0),
width: double.maxFinite,
decoration: BoxDecoration(
// color: Color.fromARGB(179, 248, 238, 238,
borderRadius: BorderRadius.all(Radius.circular(20)),
color: Colors.white,
),
child: Padding(
padding: const EdgeInsets.only(left: 8.0, right: 14.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
title,
style: TextStyle(
fontSize: isTablet ? 22 : 16,
fontWeight: FontWeight.bold,
),
),
SizedBox(
height: 5,
),
Text(
content,
style: TextStyle(
fontSize: isTablet ? 22 : 14,
color: Colors.grey[900],
),
),
],
),
),
),
),
);
}
Widget speakersList(EventsProvider provider) {
var searchtextEditingController;
return Container(
width: double.maxFinite,
padding: EdgeInsets.only(left: 8),
decoration: BoxDecoration(
// color: Color.fromARGB(179, 248, 238, 238),
color: Constants.bgcolor,
),
child: Column(
children: [
Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
height: 40,
// decoration: BoxDecoration(
// // color: Colors.white,
// borderRadius: BorderRadius.circular(5.0)),
child: TextField(
controller: searchtextEditingController,
onChanged: (String txt) async {
if (txt.length >= 2) {
provider.OnSearchSpeakers(txt);
}
if (txt.length < 2) {
await provider
.onSearchSpeakersReset(widget.event.eventId!);
}
},
decoration: InputDecoration(
//fillColor: Constants.blueColor,
enabledBorder: UnderlineInputBorder(
// borderRadius: BorderRadius.zero,
borderSide: BorderSide(
width: 1,
style: BorderStyle.solid,
color: Colors.grey)),
border: UnderlineInputBorder(
// borderRadius: BorderRadius.zero,
borderSide: BorderSide(
width: 1,
style: BorderStyle.solid,
color: Colors.grey)),
contentPadding: EdgeInsets.symmetric(vertical: 9.0),
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(
width: 1,
style: BorderStyle.solid,
color: Colors.grey)),
// border: OutlineInputBorder(),
hintText: "Search...",
// labelText: ' Search',
prefixIcon: Icon(
Icons.search,
),
),
),
),
),
Expanded(
child: ListView.separated(
padding: const EdgeInsets.all(8),
itemCount: provider.isSearchSpeakers
? provider.srcheventdetailList.length
: provider.eventdetailList.length,
itemBuilder: (BuildContext context, int index) {
Eventsdetail detail = provider.isSearchSpeakers
? provider.srcheventdetailList[index]
: provider.eventdetailList[index];
return GestureDetector(
onTap: () {
Navigator.of(context).push(
MaterialPageRoute(
builder: (context) => HCPProfileScreen(
eventsdetail: detail,
eventid: widget.event.eventId!,
title: widget.event.name1!,
),
),
);
},
child: Container(
// height: double.infinity,
child: Column(
children: [
Row(
children: [
Center(
child: CircleAvatar(
radius: 24,
backgroundColor: Colors.grey,
// child: Icon(
// Icons.person,
// size: 18,
// color: Colors.white,
// ),
child: Text(
detail.kolFullName![0],
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.white),
),
),
),
// Container(
// width: 45,
// height: 45,
// 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')),
// ),
// ),
SizedBox(
width: 20,
),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
detail.kolFullName!,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 14,
),
maxLines: 2,
softWrap: true,
overflow: TextOverflow.ellipsis,
),
SizedBox(
width: isTablet
? MediaQuery.of(context).size.width * 0.25
: MediaQuery.of(context).size.width * 0.5,
child: Text(
detail.eventTopics ??
'Programmed Cell Death 1 Receptor | Human Epidermal Growth Factor Receptor 2 +6more',
maxLines: 3,
style: TextStyle(
// decoration: TextDecoration.underline,
// decorationColor: Colors.blue,
color: Colors.black,
//fontStyle: FontStyle.italic,
fontSize: 14),
),
),
],
),
// const Spacer(),
// SizedBox(
// height: 30,
// child: OutlinedButton(
// onPressed: () {},
// child: Icon(
// Icons.add,
// size: 24,
// color: Colors.white,
// ),
// style: OutlinedButton.styleFrom(
// shape: CircleBorder(),
// backgroundColor: Constants.bgcolor,
// ),
// ),
// ),
],
),
// SEE ALL BUTTON CODE..
// index == provider.eventdetailList.length - 1
// ? Padding(
// padding: const EdgeInsets.all(8.0),
// child: Container(
// height: 30,
// child: OutlinedButton(
// onPressed: () {
// setState(() {
// itemcount = 15;
// });
// // Navigator.of(context).push(
// // MaterialPageRoute(
// // builder: (context) => HcpListScreen(),
// // ),
// // );
// },
// child: Text(
// 'See All',
// style: TextStyle(
// // fontFamily: "SourceSerif",
// fontSize: 14,
// color: Colors.black,
// fontWeight: FontWeight.normal),
// ),
// style: OutlinedButton.styleFrom(
// shape: StadiumBorder(),
// ),
// ),
// ),
// )
// : SizedBox.shrink()
],
)),
);
},
separatorBuilder: (BuildContext context, int index) {
return Divider();
},
),
),
],
));
}
Widget _ProfileInfoRow(List<ProfileInfoItem> countslist, EventsList event,
EventsProvider provider) {
return Container(
height: 60,
constraints: const BoxConstraints(maxWidth: 400),
child: Center(
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: countslist
.map((item) => Expanded(
child: Row(
children: [
if (countslist.indexOf(item) != 0)
const VerticalDivider(),
Expanded(
child: _singleItem(context, item, event, provider)),
],
)))
.toList(),
),
),
);
}
Widget _singleItem(BuildContext context, ProfileInfoItem item,
EventsList event, EventsProvider provider) {
return 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,
),
),
),
item.title == "Attending"
? attendingbtn(event, provider)
: Text(
item.title,
style: Theme.of(context).textTheme.bodyLarge,
)
],
);
}
}
// class _ProfileInfoRow extends StatelessWidget {
// List<ProfileInfoItem> countslist;
// _ProfileInfoRow({Key? key, required this.countslist}) : 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: countslist
// .map((item) => Expanded(
// child: Row(
// children: [
// if (countslist.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,
);
}
const _tabs = [
Tab(text: "Details"),
Tab(text: "Speakers"),
Tab(text: "Insights"),
Tab(text: "Social Media"),
];
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, child: _tabBar);
}
@override
bool shouldRebuild(_SliverAppBarDelegate oldDelegate) {
return true;
}
}