2125 lines
82 KiB
Dart
2125 lines
82 KiB
Dart
import 'package:expandable/expandable.dart';
|
|
import 'package:flutter/cupertino.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter/rendering.dart';
|
|
import 'package:flutter/widgets.dart';
|
|
import 'package:infinite_scroll_pagination/infinite_scroll_pagination.dart';
|
|
import 'package:konectar_events/contacts_module/ui_screen/interactionform/configprovider.dart';
|
|
import 'package:konectar_events/contacts_module/ui_screen/interactionform/interactionprovider.dart';
|
|
import 'package:konectar_events/contacts_module/ui_screen/interactionform/new_dynamicform.dart';
|
|
import 'package:konectar_events/contacts_module/ui_screen/interactionform/viewinteractionprovider.dart';
|
|
import 'package:konectar_events/contacts_module/ui_screen/medical_insight.dart';
|
|
import 'package:konectar_events/contacts_module/ui_screen/new_editinteraction.dart';
|
|
import 'package:konectar_events/contacts_module/ui_screen/new_viewinteraction.dart';
|
|
import 'package:konectar_events/model/events_speakers_k1.dart';
|
|
import 'package:konectar_events/model/eventsdetailmodel.dart';
|
|
import 'package:konectar_events/model/eventspeakers.dart';
|
|
import 'package:konectar_events/model/neweventsmodel.dart';
|
|
import 'package:konectar_events/utils/appcolors.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/home.dart';
|
|
import 'package:konectar_events/view/insights.dart';
|
|
import 'package:konectar_events/view/login_components/intropaging.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/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();
|
|
final PagingController<int, EventSpeakersData> pagingController =
|
|
PagingController(firstPageKey: 0);
|
|
static const _pageSize = 20;
|
|
int lastIndex = 0;
|
|
String searchSpeaker = "";
|
|
bool isClientOverview = false;
|
|
bool isLoading = true;
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
tabController = TabController(vsync: this, length: 2);
|
|
final provider = Provider.of<EventsProvider>(context, listen: false);
|
|
|
|
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
|
|
init();
|
|
isLoading = false;
|
|
});
|
|
pagingController.addPageRequestListener((pageKey) {
|
|
_fetchPages(pageKey, provider);
|
|
});
|
|
}
|
|
|
|
Future<void> _fetchPage(int pageKey) async {
|
|
//await initConnectivity();
|
|
// if (connectionStatus.toString().contains("ConnectivityResult.none")) {
|
|
// try {
|
|
// final newItems =
|
|
// await Provider.of<EventsProvider>(context, listen: false)
|
|
// .getOfflineMyEvents();
|
|
// final isLastPage = newItems.length < _pageSize;
|
|
// if (isLastPage) {
|
|
// _pagingController.appendLastPage(newItems);
|
|
// } else {
|
|
// final nextPageKey = pageKey + newItems.length;
|
|
// _pagingController.appendPage(newItems, nextPageKey);
|
|
// }
|
|
// } catch (error) {
|
|
// _pagingController.error = error;
|
|
// }
|
|
// } else {
|
|
print("FIRST PAGINATION");
|
|
try {
|
|
final newItems = await Provider.of<EventsProvider>(context, listen: false)
|
|
.getSpeakersDetails(pageKey, widget.event.id!,
|
|
widget.event.eventUniqueId!, searchSpeaker, lastIndex);
|
|
lastIndex = newItems.length - 1;
|
|
final isLastPage = newItems.isEmpty;
|
|
if (isLastPage) {
|
|
pagingController.appendLastPage(newItems);
|
|
} else {
|
|
final nextPageKey = pageKey + 1;
|
|
|
|
pagingController.appendPage(newItems, nextPageKey);
|
|
}
|
|
} catch (error) {
|
|
pagingController.error = error;
|
|
}
|
|
// }
|
|
}
|
|
|
|
Future<void> _fetchPages(int pageKey, EventsProvider provider) async {
|
|
List<EventSpeakersData> list = await provider
|
|
.getInitialSpeakersDetails(widget.event.id!, searchkey: searchSpeaker);
|
|
print("CHECK LENGTH ${list.length}");
|
|
final isLastPage = pageKey + _pageSize >= list.length;
|
|
final nextItems =
|
|
list.skip(pageKey).take(_pageSize).toList(); // Get next batch of items
|
|
|
|
if (isLastPage) {
|
|
pagingController.appendLastPage(nextItems);
|
|
} else {
|
|
final nextPageKey = pageKey + nextItems.length;
|
|
pagingController.appendPage(nextItems, nextPageKey);
|
|
}
|
|
}
|
|
|
|
init() async {
|
|
String start = CustomDateFormatter().formatYearDate(
|
|
CustomDateFormatter().convertStringToDate(widget.event.start!));
|
|
String end = CustomDateFormatter().formatYearDate(
|
|
CustomDateFormatter().convertStringToDate(widget.event.end!));
|
|
|
|
// pagingController.addPageRequestListener((pageKey) {
|
|
// _fetchPage(pageKey);
|
|
// });
|
|
// 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);
|
|
print("FIRST INITIAL");
|
|
|
|
await Provider.of<EventsProvider>(context, listen: false)
|
|
.getOverviewData(widget.event.id!, start, end);
|
|
await Provider.of<EventsProvider>(context, listen: false)
|
|
.getInitialSpeakersDetails(widget.event.id!, searchkey: searchSpeaker);
|
|
await Provider.of<EventsProvider>(context, listen: false).getSessionCount();
|
|
await Provider.of<EventsProvider>(context, listen: false)
|
|
.getTopicsCloud(widget.event);
|
|
await Provider.of<EventsProvider>(context, listen: false)
|
|
.getSpecialtyData(widget.event);
|
|
await Provider.of<EventsProvider>(context, listen: false)
|
|
.getAffiliations(widget.event);
|
|
await Provider.of<EventsProvider>(context, listen: false)
|
|
.getAllSessionNotesFromApi(widget.event.id!);
|
|
Provider.of<EventsProvider>(context, listen: false).isLoadingInsights =
|
|
false;
|
|
setState(() {});
|
|
}
|
|
|
|
@override
|
|
void dispose() {
|
|
tabController.dispose();
|
|
pagingController.dispose();
|
|
Provider.of<EventsProvider>(context, listen: false).allSessionNotes.clear();
|
|
widget.event = EventsList();
|
|
|
|
super.dispose();
|
|
}
|
|
|
|
Widget build(BuildContext context) {
|
|
return Consumer<EventsProvider>(
|
|
builder: (BuildContext context, provider, Widget? child) {
|
|
return DefaultTabController(
|
|
length: provider.tabs.length,
|
|
//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 medicalInsights() {
|
|
return Consumer<ViewInteractionProvider>(
|
|
builder: (BuildContext context, provider, Widget? child) {
|
|
return Container(
|
|
color: AppColors.bgcolor,
|
|
child: Column(
|
|
children: [
|
|
SizedBox(
|
|
height: 20,
|
|
),
|
|
Center(
|
|
child: FloatingActionButton.extended(
|
|
backgroundColor: Colors.green,
|
|
onPressed: () async {
|
|
final ConfigDataProvider configDataProvider =
|
|
ConfigDataProvider();
|
|
|
|
await configDataProvider.initConfigUIDataMediccalInsight();
|
|
await Provider.of<InteractionProvider>(context, listen: false)
|
|
.initConfigData();
|
|
|
|
Navigator.push(
|
|
context,
|
|
MaterialPageRoute(
|
|
builder: (BuildContext context) => InteractionScreen1(
|
|
index: 0,
|
|
form: Provider.of<InteractionProvider>(context,
|
|
listen: false)
|
|
.intConfigDataList[0]
|
|
.name,
|
|
title: "Hope Nueman",
|
|
)));
|
|
// Navigator.push(
|
|
// context,
|
|
// MaterialPageRoute(
|
|
// builder: (context) => const InteractionListScreen()));
|
|
},
|
|
heroTag: 'medicalinsights',
|
|
elevation: 0,
|
|
label: const Text("Add Medical Insights",
|
|
style: TextStyle(
|
|
color: Colors.white,
|
|
)),
|
|
icon: const Icon(
|
|
Icons.add,
|
|
color: Colors.white,
|
|
),
|
|
),
|
|
),
|
|
SizedBox(
|
|
height: 20,
|
|
),
|
|
provider.savedList.isEmpty
|
|
? SizedBox.shrink()
|
|
: ListView.builder(
|
|
itemCount: provider.savedList.length,
|
|
shrinkWrap: true,
|
|
cacheExtent:
|
|
double.parse(provider.savedList.length.toString()),
|
|
itemBuilder: (context, index) {
|
|
return Column(
|
|
children: [
|
|
ListTile(
|
|
subtitle: Text(
|
|
'Updated on ${CustomDateFormatter().convertDateTimeToDate(provider.savedList[index].updatedTime!)}',
|
|
//style: TextStyle(fontStyle: FontStyle.italic),
|
|
),
|
|
title: Text(
|
|
provider.savedList[index].id,
|
|
),
|
|
trailing: SizedBox(
|
|
width: 100,
|
|
child: Row(children: [
|
|
IconButton(
|
|
onPressed: () {
|
|
Navigator.push(
|
|
context,
|
|
MaterialPageRoute(
|
|
builder: (BuildContext context) =>
|
|
ViewInteractionScreen1(
|
|
saveInteraction:
|
|
provider.savedList[index],
|
|
)));
|
|
},
|
|
icon: const Icon(
|
|
Icons.info_outline,
|
|
size: 24,
|
|
color: Color.fromARGB(255, 8, 39, 92),
|
|
),
|
|
),
|
|
IconButton(
|
|
onPressed: () async {
|
|
await provider.initConfigData().then({
|
|
// Navigator.push(
|
|
// context,
|
|
// MaterialPageRoute(
|
|
// builder: (BuildContext context) =>
|
|
// EditInteractionScreen(
|
|
// saveInteraction: provider
|
|
// .savedList[index],
|
|
// )))
|
|
Navigator.push(
|
|
context,
|
|
MaterialPageRoute(
|
|
builder: (BuildContext context) =>
|
|
EditInteractionScreen1(
|
|
saveInteraction: provider
|
|
.savedList[index],
|
|
)))
|
|
});
|
|
},
|
|
icon: const Icon(
|
|
Icons.edit,
|
|
size: 24,
|
|
color: Color.fromARGB(255, 8, 39, 92),
|
|
),
|
|
),
|
|
// IconButton(
|
|
// onPressed: () {
|
|
// showDeleteRecordAlertDialog(
|
|
// context,
|
|
// provider.savedList[index].id,
|
|
// provider.savedList[index]);
|
|
// },
|
|
// icon: const Icon(
|
|
// Icons.delete,
|
|
// size: 24,
|
|
// color: Color.fromARGB(255, 8, 39, 92),
|
|
// ),
|
|
// ),
|
|
]),
|
|
),
|
|
onTap: () {
|
|
Navigator.push(
|
|
context,
|
|
MaterialPageRoute(
|
|
builder: (BuildContext context) =>
|
|
ViewInteractionScreen1(
|
|
saveInteraction:
|
|
provider.savedList[index],
|
|
)));
|
|
},
|
|
),
|
|
const Divider(),
|
|
],
|
|
);
|
|
}),
|
|
],
|
|
),
|
|
);
|
|
});
|
|
}
|
|
|
|
Widget headerview(BuildContext context, EventsProvider provider) {
|
|
//return SafeArea(
|
|
return Container(
|
|
child: Scaffold(
|
|
backgroundColor: AppColors.bgcolor,
|
|
appBar: AppBar(
|
|
// title: Text(""),
|
|
automaticallyImplyLeading: false,
|
|
backgroundColor: AppColors.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: AppColors.blueColor,
|
|
|
|
//fontWeight: FontWeight.bold,
|
|
fontSize: isTablet ? 22 : 14,
|
|
),
|
|
),
|
|
),
|
|
const Spacer(),
|
|
IconButton(
|
|
icon: Icon(
|
|
provider.ifOfflineExists(widget.event.eventId!)
|
|
? Icons.bookmark
|
|
: Icons.bookmark_add_outlined,
|
|
color: Colors.white,
|
|
size: isTablet ? 14 : 18),
|
|
onPressed: () async {
|
|
setState(() {});
|
|
},
|
|
)
|
|
// 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: AppColors.blueColor,
|
|
tooltip: 'Actions',
|
|
// heroTag: "floatbtn232342",
|
|
onPressed: () {
|
|
if (provider.offlineEvents.isNotEmpty) {
|
|
provider.offlineEvents.forEach(
|
|
(element) {
|
|
if (element.eventId == widget.event.eventId) {
|
|
provider.offlineExists = true;
|
|
} else {
|
|
provider.offlineExists = false;
|
|
}
|
|
},
|
|
);
|
|
}
|
|
showModalBottomSheet<void>(
|
|
//constraints: BoxConstraints(maxHeight: 200, minHeight: 120),
|
|
isScrollControlled: true,
|
|
context: context,
|
|
builder: (BuildContext context) {
|
|
return Wrap(children: [
|
|
// child:
|
|
|
|
Container(
|
|
color: AppColors.bgcolor,
|
|
// width: MediaQuery.of(context).size.width,
|
|
// constraints: BoxConstraints(minHeight: 120, maxHeight: 130),
|
|
//height: 240,
|
|
child: Center(
|
|
child: Column(
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
mainAxisSize: MainAxisSize.min,
|
|
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),
|
|
// )),
|
|
// ),IntroductionAnimationScreen
|
|
// InkWell(
|
|
// onTap: () {
|
|
// Navigator.push<dynamic>(
|
|
// context,
|
|
// MaterialPageRoute<dynamic>(
|
|
// builder: (BuildContext context) =>
|
|
// IntroductionAnimationScreen(),
|
|
// ),
|
|
// );
|
|
// // Navigator.pop(context);
|
|
// },
|
|
// child: ListTile(
|
|
// title: Text("GOTO"),
|
|
// leading: Icon(
|
|
// Icons.calendar_month,
|
|
// color: Colors.green,
|
|
// ),
|
|
// ),
|
|
// ),
|
|
InkWell(
|
|
onTap: () {
|
|
Add2Calendar.addEvent2Cal(
|
|
buildEvent(),
|
|
);
|
|
Navigator.pop(context);
|
|
},
|
|
child: ListTile(
|
|
title: Text("Add to my calendar"),
|
|
leading: Icon(
|
|
Icons.calendar_month,
|
|
color: Colors.green,
|
|
),
|
|
),
|
|
),
|
|
provider.addOffline
|
|
? InkWell(
|
|
onTap: () async {
|
|
if (provider.offlineEvents.isEmpty) {
|
|
await provider
|
|
.saveEventsData(widget.event);
|
|
SnackBarWidget.displaySnackBar(
|
|
"Event Saved Offline", context);
|
|
} else {
|
|
if (!provider.offlineExists) {
|
|
await provider
|
|
.saveEventsData(widget.event);
|
|
SnackBarWidget.displaySnackBar(
|
|
"Event Saved Offline", context);
|
|
} else {
|
|
await provider
|
|
.delateOfflineEvent(widget.event);
|
|
provider.offlineExists = false;
|
|
SnackBarWidget.displaySnackBar(
|
|
"Removed from Offline", context);
|
|
}
|
|
}
|
|
|
|
Navigator.pop(context);
|
|
},
|
|
child: ListTile(
|
|
title: Text(provider.offlineExists
|
|
? "Remove the event from offline"
|
|
: "Save the event offline"),
|
|
leading: Icon(
|
|
Icons.download,
|
|
color: Colors.blue,
|
|
),
|
|
),
|
|
)
|
|
: SizedBox.shrink(),
|
|
provider.enableAttending
|
|
? InkWell(
|
|
onTap: () {
|
|
if (widget.event.eventUserAttendee!) {
|
|
widget.event.eventUserAttendee = 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,
|
|
),
|
|
),
|
|
)
|
|
: SizedBox.shrink(),
|
|
// 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,
|
|
// 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: AppColors.blueColor,
|
|
child: Column(
|
|
children: <Widget>[
|
|
buildCardView(
|
|
context, widget.event, provider),
|
|
|
|
// getTimeDateUI(),
|
|
],
|
|
),
|
|
),
|
|
SizedBox(
|
|
height: 10,
|
|
),
|
|
_ProfileInfoRow([
|
|
ProfileInfoItem(
|
|
"Session(s)", provider.eventSessionCount),
|
|
ProfileInfoItem(
|
|
"Speaker(s)", provider.speakersList.length),
|
|
//ProfileInfoItem("Note(s)", 1),
|
|
], widget.event, provider),
|
|
SizedBox(
|
|
height: 5,
|
|
),
|
|
],
|
|
);
|
|
}, childCount: 1),
|
|
),
|
|
SliverPersistentHeader(
|
|
pinned: true,
|
|
floating: true,
|
|
delegate: ContestTabHeader(
|
|
TabBar(
|
|
indicatorSize: TabBarIndicatorSize.tab,
|
|
labelColor: Colors.black,
|
|
tabAlignment: TabAlignment.fill,
|
|
indicatorColor: AppColors.blueColor,
|
|
unselectedLabelColor: Colors.grey,
|
|
labelStyle: TextStyle(
|
|
fontWeight: FontWeight.bold,
|
|
),
|
|
labelPadding: EdgeInsets.all(2),
|
|
onTap: (index) {
|
|
// print(controller.index);
|
|
// print(index);
|
|
if (index == 1) {
|
|
print('Same Tab Clicked');
|
|
// await provider
|
|
// .getInitialSpeakersDetails(widget.event.id!);
|
|
|
|
pagingController.refresh();
|
|
}
|
|
},
|
|
tabs: provider.tabs,
|
|
),
|
|
),
|
|
),
|
|
];
|
|
},
|
|
body: TabBarView(
|
|
// controller: tabController,
|
|
children: returnTabWidget(provider)
|
|
// [
|
|
// expandableDetails(provider),
|
|
// speakersList(context, provider),
|
|
|
|
// EventsInsights(
|
|
// eid: widget.event.id!,
|
|
// eventsdetail: widget.event,
|
|
// eventid: widget.event.eventId!,
|
|
// kFlutterHashtags: provider.kFlutterHashtags,
|
|
// specialtyList: provider.specialtyList,
|
|
// affiliations: provider.affiliations,
|
|
// allSessionNotes: provider.allSessionNotes,
|
|
// ),
|
|
|
|
// // medicalInsights(),
|
|
// //SocialMedia(),
|
|
// ],
|
|
),
|
|
),
|
|
),
|
|
Visibility(
|
|
visible: isLoading,
|
|
child: Center(
|
|
child: CircularProgressIndicator(
|
|
backgroundColor: AppColors.blueColor,
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
// ),
|
|
);
|
|
}
|
|
|
|
List<Widget> returnTabWidget(EventsProvider provider) {
|
|
List<Widget> widgets = [];
|
|
for (var tabs in provider.tabs) {
|
|
if (tabs.text == "Speakers") {
|
|
widgets.add(speakersList(context, provider));
|
|
}
|
|
if (tabs.text == "Details") {
|
|
widgets.add(expandableDetails(provider));
|
|
}
|
|
if (tabs.text == "Insights") {
|
|
widgets.add(EventsInsights(
|
|
eid: widget.event.id!,
|
|
eventsdetail: widget.event,
|
|
eventid: widget.event.eventId!,
|
|
kFlutterHashtags: provider.kFlutterHashtags,
|
|
specialtyList: provider.specialtyList,
|
|
affiliations: provider.affiliations,
|
|
allSessionNotes: provider.allSessionNotes,
|
|
));
|
|
}
|
|
}
|
|
return widgets;
|
|
}
|
|
|
|
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: AppColors.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: AppColors.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),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
provider.getLocationDetails(event) == ""
|
|
? SizedBox.shrink()
|
|
: SizedBox(
|
|
height: 8.0,
|
|
),
|
|
provider.getLocationDetails(event) == ""
|
|
? SizedBox.shrink()
|
|
: RichText(
|
|
text: TextSpan(
|
|
children: [
|
|
WidgetSpan(
|
|
child: Icon(
|
|
Icons.location_on,
|
|
size: 18,
|
|
color: Colors.white,
|
|
),
|
|
),
|
|
TextSpan(
|
|
text: ' ${provider.getLocationDetails(event)}',
|
|
style: TextStyle(
|
|
color: Colors.white,
|
|
//fontStyle: FontStyle.italic,
|
|
letterSpacing: 0.3,
|
|
fontSize: isTablet ? 20 : 14),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
event.url1 == null
|
|
? SizedBox.shrink()
|
|
: SizedBox(
|
|
height: 8.0,
|
|
),
|
|
event.url1 == null
|
|
? SizedBox.shrink()
|
|
: InkWell(
|
|
onTap: () async {
|
|
print("URL:${event.url1!}");
|
|
await _launchUrl(event.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,
|
|
// ),
|
|
provider.enableAttending
|
|
? attendingbtn(widget.event, provider)
|
|
: SizedBox.shrink(),
|
|
// const Spacer(),
|
|
provider.enableFollow
|
|
? favbtn(widget.event, provider)
|
|
: SizedBox.shrink(),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
// 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.eventUserInterest!
|
|
? SizedBox(
|
|
height: 40,
|
|
child: TextButton(
|
|
// elevation: 1,
|
|
// : Colors.transparent,
|
|
|
|
onPressed: () async {
|
|
// String msg = await provider
|
|
// .addEventsToFavs(event.eventId!);
|
|
|
|
event.eventUserInterest = !event.eventUserInterest!;
|
|
|
|
if (event.eventUserInterest!) {
|
|
await provider.addEventsToFavs(event.eventId!);
|
|
SnackBarWidget.displaySnackBar(
|
|
"You are following the event!", context);
|
|
} else {
|
|
// provider.delateOfflineEvent(event);
|
|
await provider.removeEventsToFavs(event.eventId!);
|
|
SnackBarWidget.displaySnackBar("Not Following", context);
|
|
}
|
|
setState(() {});
|
|
},
|
|
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: AppColors.bgcolor,
|
|
//backgroundColor: Colors.red,
|
|
onPressed: () async {
|
|
// String msg = await provider
|
|
// .addEventsToFavs(event.eventId!);
|
|
|
|
event.eventUserInterest = !event.eventUserInterest!;
|
|
|
|
if (event.eventUserInterest!) {
|
|
await provider.addEventsToFavs(event.eventId!);
|
|
SnackBarWidget.displaySnackBar(
|
|
"You are following the event!", context);
|
|
} else {
|
|
// provider.delateOfflineEvent(event);
|
|
await provider.removeEventsToFavs(event.eventId!);
|
|
SnackBarWidget.displaySnackBar("Not Following", context);
|
|
}
|
|
|
|
setState(() {});
|
|
},
|
|
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.eventUserInterest!
|
|
? Colors.white
|
|
: Colors.grey,
|
|
size: 14,
|
|
),
|
|
const SizedBox(
|
|
width: 10,
|
|
),
|
|
Text(
|
|
event.eventUserInterest! ? "Following" : "Follow",
|
|
style: TextStyle(color: Colors.black),
|
|
)
|
|
],
|
|
))),
|
|
);
|
|
}
|
|
|
|
Widget attendingbtn(EventsList event, EventsProvider provider) {
|
|
return event.eventUserAttendee!
|
|
? SizedBox(
|
|
height: 40,
|
|
child: TextButton(
|
|
// elevation: 1,
|
|
// : Colors.transparent,
|
|
|
|
onPressed: () async {
|
|
event.eventUserAttendee = !event.eventUserAttendee!;
|
|
// String msg = await provider
|
|
// .markAttending(event.eventId!);
|
|
if (event.eventUserAttendee!) {
|
|
await provider.attendNotAttendEvent(event.eventId!, "1");
|
|
SnackBarWidget.displaySnackBar("Attending", context);
|
|
} else {
|
|
await provider.attendNotAttendEvent(event.eventId!, "0");
|
|
SnackBarWidget.displaySnackBar("Not Attending", context);
|
|
}
|
|
setState(() {
|
|
//
|
|
});
|
|
},
|
|
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: AppColors.bgcolor,
|
|
onPressed: () async {
|
|
if (!event.eventUserInterest!) {
|
|
await provider.addEventsToFavs(event.eventId!);
|
|
event.eventUserInterest = !event.eventUserInterest!;
|
|
// String msg1 = await provider
|
|
// .addEventsToFavs(event.eventId!);
|
|
}
|
|
|
|
// String msg = await provider
|
|
// .markAttending(event.eventId!);
|
|
event.eventUserAttendee = !event.eventUserAttendee!;
|
|
// String msg = await provider
|
|
// .markAttending(event.eventId!);
|
|
if (event.eventUserAttendee!) {
|
|
await provider.attendNotAttendEvent(event.eventId!, "1");
|
|
SnackBarWidget.displaySnackBar("Attending", context);
|
|
} else {
|
|
await provider.attendNotAttendEvent(event.eventId!, "0");
|
|
SnackBarWidget.displaySnackBar("Not Attending", context);
|
|
}
|
|
setState(() {});
|
|
},
|
|
//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.eventUserAttendee!
|
|
? 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(EventsProvider provider) {
|
|
List<String> topSpeakers = [];
|
|
List<String> topSponsors = [];
|
|
List<String> topTopics = [];
|
|
|
|
if (provider.overviewData.eventTopics!.length != 0) {
|
|
for (var obj in provider.overviewData.eventTopics!) {
|
|
topTopics.add(obj.eventTopics ?? "-");
|
|
}
|
|
}
|
|
if (provider.overviewData.topSpeakers!.length != 0) {
|
|
for (var obj in provider.overviewData.topSpeakers!) {
|
|
topSpeakers.add(obj.firstName ?? "-");
|
|
}
|
|
}
|
|
if (provider.overviewData.eventSponsers!.length != 0) {
|
|
for (var obj in provider.overviewData.eventSponsers!) {
|
|
topSponsors.add(obj.sessionSponsor!);
|
|
}
|
|
}
|
|
|
|
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: AppColors.bgcolor,
|
|
padding: EdgeInsets.only(left: 8, right: 8),
|
|
child: SingleChildScrollView(
|
|
child: Expanded(
|
|
child: Column(children: [
|
|
SizedBox(
|
|
height: 5,
|
|
),
|
|
listViewTopicCard("Top 3 topics", topTopics, true),
|
|
SizedBox(
|
|
height: 3,
|
|
),
|
|
listViewTopicCard("Speakers with most sessions", topSpeakers, true),
|
|
SizedBox(
|
|
height: 3,
|
|
),
|
|
listViewTopicCard("Sponsors", topSponsors, 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, List<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,
|
|
),
|
|
content.isNotEmpty
|
|
? SizedBox(
|
|
height: 70,
|
|
child: ListView.builder(
|
|
shrinkWrap: true,
|
|
itemCount: content.length,
|
|
itemBuilder: (context, index) {
|
|
return Text(
|
|
"${index + 1}. ${content[index]}",
|
|
style: TextStyle(
|
|
fontSize: isTablet ? 22 : 14,
|
|
color: Colors.grey[900],
|
|
),
|
|
);
|
|
},
|
|
),
|
|
)
|
|
: SizedBox.shrink(),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
void _updateSearchTerm(String searchTerm) {
|
|
setState(() => searchSpeaker = searchTerm);
|
|
pagingController.refresh();
|
|
}
|
|
|
|
Widget speakersList(BuildContext context, EventsProvider provider) {
|
|
var searchtextEditingController;
|
|
// pagingController.refresh();
|
|
return Container(
|
|
width: double.maxFinite,
|
|
padding: EdgeInsets.only(left: 8),
|
|
decoration: BoxDecoration(
|
|
// color: Color.fromARGB(179, 248, 238, 238),
|
|
color: AppColors.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 >= 1) {
|
|
_updateSearchTerm(txt);
|
|
}
|
|
if (txt.length == 0) {
|
|
_updateSearchTerm("");
|
|
}
|
|
},
|
|
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: PagedListView<int, EventSpeakersData>.separated(
|
|
pagingController: pagingController,
|
|
builderDelegate: PagedChildBuilderDelegate<EventSpeakersData>(
|
|
//padding: const EdgeInsets.all(8),
|
|
// itemCount: provider.isSearchSpeakers
|
|
// ? provider.srcheventdetailList.length
|
|
// : provider.eventdetailList.length,
|
|
itemBuilder: (BuildContext context, detail, int index) {
|
|
// Eventsdetail detail = provider.isSearchSpeakers
|
|
// ? provider.srcheventdetailList[index]
|
|
// : provider.eventdetailList[index];
|
|
|
|
return GestureDetector(
|
|
onTap: () {
|
|
if (widget.event.eventUserInterest!) {
|
|
Navigator.of(context).push(
|
|
MaterialPageRoute(
|
|
builder: (context) => HCPProfileScreen(
|
|
eventsdetail: detail,
|
|
eventid: "47336",
|
|
title: widget.event.name1!,
|
|
sessionNames: detail.sessionName != ""
|
|
? detail.sessionName!.split(",")
|
|
: [],
|
|
topics: detail.eventTopics != ""
|
|
? detail.eventTopics!.split("|")
|
|
: [],
|
|
kolFullName: detail.kolFullName!,
|
|
),
|
|
),
|
|
);
|
|
}
|
|
},
|
|
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,
|
|
),
|
|
Padding(
|
|
padding: const EdgeInsets.all(8.0),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text(
|
|
"$index : ${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 ?? "",
|
|
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 Padding(
|
|
padding: const EdgeInsets.symmetric(horizontal: 14.0),
|
|
child: 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() == 0 ? "..." : 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,
|
|
);
|
|
}
|
|
|
|
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: AppColors.tabbgColor, child: _tabBar);
|
|
}
|
|
|
|
@override
|
|
bool shouldRebuild(_SliverAppBarDelegate oldDelegate) {
|
|
return true;
|
|
}
|
|
}
|
|
|
|
class ContestTabHeader extends SliverPersistentHeaderDelegate {
|
|
ContestTabHeader(
|
|
this.searchUI,
|
|
);
|
|
final TabBar 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;
|
|
}
|
|
}
|