1871 lines
72 KiB
Dart
1871 lines
72 KiB
Dart
import 'package:flutter/cupertino.dart';
|
|
import 'package:flutter/gestures.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter/rendering.dart';
|
|
import 'package:flutter/widgets.dart';
|
|
import 'package:konectar_events/model/keywords_model.dart';
|
|
import 'package:konectar_events/model/neweventsmodel.dart';
|
|
import 'package:konectar_events/utils/constants.dart';
|
|
import 'package:konectar_events/utils/util.dart';
|
|
import 'package:konectar_events/view/eventslist.dart';
|
|
import 'package:konectar_events/view/eventstab.dart';
|
|
import 'package:konectar_events/viewmodel/eventsprovider.dart';
|
|
import 'package:konectar_events/widgets/autocompletetags_widget.dart';
|
|
import 'package:dropdown_button2/dropdown_button2.dart';
|
|
import 'package:intl/intl.dart';
|
|
import 'package:konectar_events/widgets/responsive_utils.dart';
|
|
import 'package:konectar_events/widgets/snackbar.dart';
|
|
import 'package:provider/provider.dart';
|
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
|
|
|
class HomeScreen extends StatefulWidget {
|
|
const HomeScreen({super.key});
|
|
|
|
@override
|
|
State<HomeScreen> createState() => _HomeScreenState();
|
|
}
|
|
|
|
class _HomeScreenState extends State<HomeScreen> with TickerProviderStateMixin {
|
|
String? dvalue;
|
|
final TextEditingController textEditingController = TextEditingController();
|
|
final TextEditingController startDatetextEditingController =
|
|
TextEditingController();
|
|
final TextEditingController endDatetextEditingController =
|
|
TextEditingController();
|
|
final TextEditingController datetextEditingController =
|
|
TextEditingController();
|
|
final TextEditingController selecttextEditingController =
|
|
TextEditingController();
|
|
final TextEditingController searchtextEditingController =
|
|
TextEditingController();
|
|
Color? iconColor = Colors.blueGrey[300];
|
|
IconData icon = Icons.favorite;
|
|
List<int> selectedIndex = [];
|
|
bool selectedFav = false;
|
|
bool isExtended = false;
|
|
|
|
final ScrollController _scrollController = ScrollController();
|
|
final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
|
|
|
|
AnimationController? animationController;
|
|
bool _isSearch = false;
|
|
List<String> therapeuticList = [];
|
|
@override
|
|
void dispose() {
|
|
animationController?.dispose();
|
|
super.dispose();
|
|
}
|
|
|
|
@override
|
|
void initState() {
|
|
animationController = AnimationController(
|
|
duration: const Duration(milliseconds: 1000), vsync: this);
|
|
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
|
|
init();
|
|
});
|
|
|
|
super.initState();
|
|
}
|
|
|
|
init() async {
|
|
await Provider.of<EventsProvider>(context, listen: false).initFiltersData();
|
|
await Provider.of<EventsProvider>(context, listen: false).getEvents();
|
|
await Provider.of<EventsProvider>(context, listen: false)
|
|
.getAddedSessionNotes();
|
|
|
|
setState(() {});
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Consumer<EventsProvider>(
|
|
builder: (BuildContext context, provider, Widget? child) {
|
|
// return SafeArea(
|
|
// top: false,
|
|
// child: Scaffold(
|
|
// appBar: CustomAppBar(
|
|
// title: "Events",
|
|
// backgroundcolor: Color.fromARGB(255, 0, 71, 132),
|
|
// ),
|
|
// // backgroundColor: const Color.fromARGB(255, 222 , 237, 247),
|
|
// backgroundColor: Constants.bgcolor,
|
|
// // endDrawer: populateDrawer(provider),Color(0xf6f8fc)
|
|
// // backgroundColor:Color(0xf6f8fc),
|
|
// body: Padding(
|
|
// padding: const EdgeInsets.all(8.0),
|
|
// child: Column(
|
|
// children: [
|
|
// Row(
|
|
// children: [
|
|
// Expanded(
|
|
// child: Padding(
|
|
// padding: const EdgeInsets.only(left: 5.0),
|
|
// child: Container(
|
|
// padding: const EdgeInsets.all(20.0),
|
|
// decoration: BoxDecoration(
|
|
// borderRadius: BorderRadius.circular(30.0),
|
|
// //color: Color.fromARGB(179, 248, 238, 238),
|
|
// color: Colors.white,
|
|
// ),
|
|
// height: 60,
|
|
// child: Center(
|
|
// child: Expanded(
|
|
// child: TextField(
|
|
// textAlignVertical: TextAlignVertical.center,
|
|
// cursorHeight: 14.0,
|
|
// maxLines: 1,
|
|
// controller:
|
|
// selecttextEditingController, //editing controller of this TextField
|
|
// decoration: InputDecoration(
|
|
// // border: OutlineInputBorder(),
|
|
// hintText: 'Search Events',
|
|
|
|
// enabledBorder: OutlineInputBorder(
|
|
// borderRadius: BorderRadius.circular(20.0),
|
|
// borderSide: const BorderSide(
|
|
// color: Colors.transparent,
|
|
// width: 0.0),
|
|
// ),
|
|
// focusedBorder: OutlineInputBorder(
|
|
// borderSide: const BorderSide(
|
|
// color: Colors.transparent,
|
|
// width: 0.0),
|
|
// ),
|
|
|
|
// contentPadding: EdgeInsets.symmetric(
|
|
// vertical: 10.0, horizontal: 20.0),
|
|
// border: OutlineInputBorder(
|
|
// borderRadius:
|
|
// BorderRadius.circular(20.0),
|
|
// borderSide:
|
|
// BorderSide(color: Colors.yellow)),
|
|
// // prefixIcon: Icon(
|
|
// // Icons.search,
|
|
// // size: 16,
|
|
// // ),
|
|
// // suffixIcon: IconButton(
|
|
// // onPressed: () {},
|
|
// // icon: Icon(
|
|
// // Icons.filter_list_alt,
|
|
// // size: 16,
|
|
// // ),
|
|
// // ),
|
|
|
|
// hintStyle: const TextStyle(fontSize: 16),
|
|
// ),
|
|
// ),
|
|
// ),
|
|
// ),
|
|
// ),
|
|
// ),
|
|
// ),
|
|
// Padding(
|
|
// padding: const EdgeInsets.only(right: 5.0),
|
|
// child: Align(
|
|
// alignment: Alignment.topRight,
|
|
// child: IconButton(
|
|
// icon: Icon(
|
|
// Icons.sort_rounded,
|
|
// size: isTablet ? 24 : 20,
|
|
// ),
|
|
// onPressed: () {
|
|
// dialogBuilder(context, provider);
|
|
// // showModalBottomSheet(
|
|
// // context: context,
|
|
// // scrollControlDisabledMaxHeightRatio: 1.0,
|
|
// // isScrollControlled: true,
|
|
// // builder: (context) {
|
|
// // return DraggableScrollableSheet(
|
|
// // initialChildSize: 0.5,
|
|
// // minChildSize: 0.25,
|
|
// // maxChildSize: 0.75,
|
|
// // expand: true,
|
|
// // builder: (context, scrollController) {
|
|
// // return Container();
|
|
// // });
|
|
// // });
|
|
// // return FractionallySizedBox(
|
|
// // heightFactor: 0.5,
|
|
// // child: populateDrawer(provider),
|
|
// // );
|
|
// // });
|
|
// },
|
|
// ),
|
|
// ),
|
|
// )
|
|
// ],
|
|
// ),
|
|
// buildListView(context, provider),
|
|
// // buildEventsGrid(context, provider),
|
|
// ],
|
|
// ),
|
|
// )),
|
|
// );
|
|
return headerview(context, provider);
|
|
});
|
|
}
|
|
|
|
Widget headerview(BuildContext context, EventsProvider provider) {
|
|
// return SafeArea(
|
|
return Container(
|
|
child: Scaffold(
|
|
key: _scaffoldKey,
|
|
// drawer: Drawer(
|
|
// child: Text("This will swipe from left to right"),
|
|
// ),
|
|
endDrawer: populateDrawer(provider),
|
|
appBar: AppBar(
|
|
automaticallyImplyLeading: false,
|
|
backgroundColor: EventsConstants.blueColor,
|
|
centerTitle: true,
|
|
title: _isSearch
|
|
? Padding(
|
|
padding: EdgeInsets.only(left: 30),
|
|
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.OnSearch(txt);
|
|
}
|
|
if (txt.length < 2) {
|
|
await provider.onSearchReset();
|
|
}
|
|
},
|
|
decoration: InputDecoration(
|
|
fillColor: EventsConstants.blueColor,
|
|
contentPadding: EdgeInsets.symmetric(vertical: 9.0),
|
|
border: OutlineInputBorder(),
|
|
hintText: "Search for events...",
|
|
// labelText: ' Search',
|
|
prefixIcon: Icon(
|
|
Icons.search,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
)
|
|
: Text(
|
|
"Events",
|
|
style: TextStyle(color: Colors.white),
|
|
),
|
|
// leading: IconButton(
|
|
// onPressed: () {},
|
|
// icon: Icon(
|
|
// Icons.person_4_outlined,
|
|
// size: 20,
|
|
// color: Colors.white,
|
|
// )),
|
|
actions: [
|
|
IconButton(
|
|
onPressed: () async {
|
|
await provider.onSearchReset();
|
|
setState(() {
|
|
_isSearch = !_isSearch;
|
|
if (!_isSearch) {
|
|
searchtextEditingController.clear();
|
|
}
|
|
});
|
|
},
|
|
icon: Icon(
|
|
_isSearch ? Icons.close : Icons.search,
|
|
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 Container(
|
|
// color: Constants.blueColor,
|
|
// child: Column(
|
|
// children: [
|
|
// // CustomAppBar(
|
|
// // title: "Events",
|
|
// // backgroundcolor:
|
|
// // Color.fromARGB(255, 0, 71, 132),
|
|
// // ),
|
|
// // getSearchBarUI(provider),
|
|
// ],
|
|
// ),
|
|
// );
|
|
// }, childCount: 1),
|
|
// ),
|
|
SliverPersistentHeader(
|
|
pinned: true,
|
|
floating: true,
|
|
delegate: ContestTabHeader(
|
|
getFilterBarUI(provider),
|
|
),
|
|
),
|
|
];
|
|
},
|
|
body: Container(
|
|
color: EventsConstants.bgcolor,
|
|
child: buildListView(context, provider)),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
// ),
|
|
);
|
|
}
|
|
|
|
Widget getFilterBarUI(EventsProvider provider) {
|
|
return Stack(
|
|
children: <Widget>[
|
|
Positioned(
|
|
top: 0,
|
|
left: 0,
|
|
right: 0,
|
|
child: Container(
|
|
height: 24,
|
|
decoration: BoxDecoration(
|
|
color: EventsConstants.bgcolor,
|
|
boxShadow: <BoxShadow>[
|
|
BoxShadow(
|
|
color: Colors.grey.withOpacity(0.2),
|
|
offset: const Offset(0, -2),
|
|
blurRadius: 8.0),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
Container(
|
|
color: EventsConstants.bgcolor,
|
|
child: Padding(
|
|
padding:
|
|
const EdgeInsets.only(left: 16, right: 16, top: 8, bottom: 4),
|
|
child: Row(
|
|
children: <Widget>[
|
|
// Container(
|
|
// height: 40,
|
|
// child: OutlinedButton(
|
|
// onPressed: () async {
|
|
// // setState(() {
|
|
// await provider.onSelectAll();
|
|
// // });
|
|
// setState(() {});
|
|
// },
|
|
// child: Text(
|
|
// 'All',
|
|
// style: TextStyle(
|
|
// // fontFamily: "SourceSerif",
|
|
// fontSize: 14,
|
|
// color: provider.isAllSelected
|
|
// ? Colors.white
|
|
// : Colors.black,
|
|
// fontWeight: FontWeight.normal),
|
|
// ),
|
|
// style: OutlinedButton.styleFrom(
|
|
// shape: StadiumBorder(),
|
|
// backgroundColor:
|
|
// provider.isAllSelected ? Colors.green : Colors.white,
|
|
// ),
|
|
// ),
|
|
// ),
|
|
// const SizedBox(
|
|
// width: 8,
|
|
// ),
|
|
// Container(
|
|
// height: 40,
|
|
// child: OutlinedButton(
|
|
// onPressed: () async {
|
|
// // setState(() {
|
|
// await provider.onSelectMy();
|
|
// // });
|
|
// setState(() {});
|
|
// },
|
|
// child: Text(
|
|
// 'My Events',
|
|
// style: TextStyle(
|
|
// // fontFamily: "SourceSerif",
|
|
// fontSize: 14,
|
|
// color: provider.isFavSeleted
|
|
// ? Colors.white
|
|
// : Colors.grey,
|
|
// fontWeight: FontWeight.normal),
|
|
// ),
|
|
// style: OutlinedButton.styleFrom(
|
|
// shape: StadiumBorder(),
|
|
// backgroundColor:
|
|
// provider.isFavSeleted ? Colors.green : Colors.white,
|
|
// ),
|
|
// ),
|
|
// ),
|
|
|
|
Container(
|
|
child: Wrap(
|
|
children: [
|
|
Padding(
|
|
padding: const EdgeInsets.only(left: 8.0, right: 2.0),
|
|
child: CupertinoSwitch(
|
|
activeColor: Color.fromARGB(255, 0, 71, 132),
|
|
value: provider.isFavSeleted,
|
|
onChanged: (value) async {
|
|
provider.isFavSeleted = value;
|
|
if (provider.isFavSeleted) {
|
|
await provider.onSelectMy();
|
|
} else {
|
|
await provider.onSelectAll();
|
|
}
|
|
setState(() {});
|
|
},
|
|
),
|
|
),
|
|
Padding(
|
|
padding: const EdgeInsets.only(right: 8.0, top: 9.0),
|
|
child: !provider.isFavSeleted
|
|
? const Text(
|
|
'My Events',
|
|
style:
|
|
TextStyle(fontSize: 15, color: Colors.grey),
|
|
)
|
|
: const Text(
|
|
'My Events',
|
|
style: TextStyle(
|
|
fontSize: 15,
|
|
),
|
|
),
|
|
)
|
|
],
|
|
),
|
|
),
|
|
|
|
const Spacer(),
|
|
// Expanded(
|
|
// child: Padding(
|
|
// padding: const EdgeInsets.all(8.0),
|
|
// child: Text(
|
|
// '530 hotels found',
|
|
// style: TextStyle(
|
|
// fontWeight: FontWeight.w100,
|
|
// fontSize: 16,
|
|
// ),
|
|
// ),
|
|
// ),
|
|
// ),
|
|
Material(
|
|
color: Colors.transparent,
|
|
child: InkWell(
|
|
focusColor: Colors.transparent,
|
|
highlightColor: Colors.transparent,
|
|
hoverColor: Colors.transparent,
|
|
splashColor: Colors.grey.withOpacity(0.2),
|
|
borderRadius: const BorderRadius.all(
|
|
Radius.circular(4.0),
|
|
),
|
|
onTap: () {
|
|
FocusScope.of(context).requestFocus(FocusNode());
|
|
// Navigator.push<dynamic>(
|
|
// context,
|
|
// MaterialPageRoute<dynamic>(
|
|
// builder: (BuildContext context) =>
|
|
// populateDrawer(provider),
|
|
// fullscreenDialog: false),
|
|
// );
|
|
_scaffoldKey.currentState?.openEndDrawer();
|
|
},
|
|
child: Padding(
|
|
padding: const EdgeInsets.only(left: 8),
|
|
child: Row(
|
|
children: <Widget>[
|
|
Text(
|
|
'Filters',
|
|
style: TextStyle(
|
|
fontWeight: FontWeight.w100,
|
|
fontSize: 16,
|
|
),
|
|
),
|
|
Padding(
|
|
padding: const EdgeInsets.all(8.0),
|
|
child: Icon(
|
|
Icons.sort,
|
|
color: Color.fromARGB(255, 0, 71, 132),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
const Positioned(
|
|
top: 0,
|
|
left: 0,
|
|
right: 0,
|
|
child: Divider(
|
|
height: 1,
|
|
),
|
|
)
|
|
],
|
|
);
|
|
}
|
|
|
|
Widget getSearchBarUI(EventsProvider provider) {
|
|
return Padding(
|
|
padding: const EdgeInsets.only(left: 16, right: 16, top: 8, bottom: 8),
|
|
child: Row(
|
|
children: <Widget>[
|
|
Padding(
|
|
padding: const EdgeInsets.only(right: 12, top: 8, bottom: 8),
|
|
child: Container(
|
|
decoration: BoxDecoration(
|
|
color: EventsConstants.bgcolor,
|
|
borderRadius: const BorderRadius.all(
|
|
Radius.circular(24.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: 8, right: 8, top: 1, bottom: 1),
|
|
child: TextField(
|
|
onChanged: (String txt) async {
|
|
if (txt.length >= 3) {
|
|
provider.OnSearch(txt);
|
|
}
|
|
if (txt.length <= 3) {
|
|
await provider.onSearchReset();
|
|
}
|
|
},
|
|
style: const TextStyle(
|
|
fontSize: 14,
|
|
),
|
|
cursorColor: Colors.blue,
|
|
controller: searchtextEditingController,
|
|
decoration: InputDecoration(
|
|
border: InputBorder.none,
|
|
hintText: ' Search for events...',
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
Container(
|
|
// decoration: BoxDecoration(
|
|
// color: Constants.blueColor,
|
|
// borderRadius: const BorderRadius.all(
|
|
// Radius.circular(24.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(28.0),
|
|
),
|
|
onTap: () async {
|
|
FocusScope.of(context).requestFocus(FocusNode());
|
|
if (searchtextEditingController.text.length >= 3)
|
|
provider.OnSearch(searchtextEditingController.text);
|
|
else
|
|
await provider.onSearchReset();
|
|
},
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(16.0),
|
|
child: Icon(FontAwesomeIcons.magnifyingGlass,
|
|
size: 18, color: Colors.white),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
|
|
Widget getAppBarUI() {
|
|
return Container(
|
|
decoration: BoxDecoration(
|
|
color: Color.fromARGB(255, 0, 71, 132),
|
|
boxShadow: <BoxShadow>[
|
|
BoxShadow(
|
|
color: Colors.grey.withOpacity(0.2),
|
|
offset: const Offset(0, 2),
|
|
blurRadius: 8.0),
|
|
],
|
|
),
|
|
child: Padding(
|
|
padding: EdgeInsets.only(
|
|
top: MediaQuery.of(context).padding.top, left: 8, right: 8),
|
|
child: Row(
|
|
children: <Widget>[
|
|
Container(
|
|
alignment: Alignment.centerLeft,
|
|
width: AppBar().preferredSize.height + 40,
|
|
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),
|
|
// ),
|
|
// ),
|
|
// ),
|
|
),
|
|
Center(
|
|
child: Text(
|
|
'Events',
|
|
style: TextStyle(
|
|
fontWeight: FontWeight.w600,
|
|
fontSize: 22,
|
|
),
|
|
),
|
|
),
|
|
Container(
|
|
width: AppBar().preferredSize.height + 40,
|
|
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_border),
|
|
),
|
|
),
|
|
),
|
|
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.local_activity),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
)
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
Future<void> dialogBuilder(BuildContext context, EventsProvider provider) {
|
|
return showDialog<void>(
|
|
context: context,
|
|
builder: (BuildContext context) {
|
|
// return AlertDialog(
|
|
// title: const Text('Session Notes'),
|
|
return populateDrawer(provider);
|
|
// actions: <Widget>[
|
|
// TextButton(
|
|
// style: TextButton.styleFrom(
|
|
// textStyle: Theme.of(context).textTheme.labelLarge,
|
|
// ),
|
|
// child: const Text('Submit'),
|
|
// onPressed: () {
|
|
// Navigator.of(context).pop();
|
|
// },
|
|
// ),
|
|
// TextButton(
|
|
// style: TextButton.styleFrom(
|
|
// textStyle: Theme.of(context).textTheme.labelLarge,
|
|
// ),
|
|
// child: const Text('Cancel'),
|
|
// onPressed: () {
|
|
// Navigator.of(context).pop();
|
|
// },
|
|
// ),
|
|
// ],
|
|
// );
|
|
},
|
|
);
|
|
}
|
|
|
|
List<String> sortEvents = ["All Events", "My Events"];
|
|
Widget dropDown({
|
|
Widget? underline,
|
|
Widget? icon,
|
|
TextStyle? style,
|
|
TextStyle? hintStyle,
|
|
Color? dropdownColor,
|
|
}) =>
|
|
DropdownButton<String>(
|
|
value: dvalue,
|
|
underline: underline,
|
|
icon: Align(alignment: Alignment.centerRight, child: icon),
|
|
dropdownColor: dropdownColor,
|
|
isExpanded: true,
|
|
style: TextStyle(
|
|
fontFamily: "SourceSerif",
|
|
color: Colors.black,
|
|
fontSize: 12.0,
|
|
),
|
|
// iconEnabledColor: iconEnabledColor,
|
|
onChanged: (String? newValue) {
|
|
setState(() {
|
|
dvalue = newValue;
|
|
});
|
|
},
|
|
hint: Text("Select", style: hintStyle),
|
|
items: sortEvents
|
|
.map((session) => DropdownMenuItem<String>(
|
|
value: session, child: Text(session)))
|
|
.toList());
|
|
|
|
populateDrawer(EventsProvider provider) {
|
|
return Theme(
|
|
data: Theme.of(context).copyWith(canvasColor: EventsConstants.bgcolor),
|
|
child: Container(
|
|
width: MediaQuery.of(context).size.width * 0.60,
|
|
color: EventsConstants.bgcolor,
|
|
child: Drawer(
|
|
child: SingleChildScrollView(
|
|
scrollDirection: Axis.vertical,
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: <Widget>[
|
|
// DrawerHeader(
|
|
// child: Center(
|
|
// child: Text('Filters'),
|
|
// // child: Image.asset("assets/images/lf_logo.png",
|
|
// // height: 100, width: 100),
|
|
// ),
|
|
// ),
|
|
Container(
|
|
//color: Colors.transparent,
|
|
padding: EdgeInsets.only(top: 20, left: 5.0),
|
|
),
|
|
|
|
Padding(
|
|
padding: const EdgeInsets.only(left: 8.0),
|
|
child: Row(
|
|
children: [
|
|
InkWell(
|
|
onTap: () {
|
|
Navigator.pop(context);
|
|
},
|
|
child: Icon(
|
|
Icons.arrow_back_ios,
|
|
color: Colors.black,
|
|
size: isTablet ? 20 : 16,
|
|
),
|
|
),
|
|
SizedBox(
|
|
width: 8.0,
|
|
),
|
|
Text(
|
|
'Filters',
|
|
style: TextStyle(fontSize: 20),
|
|
),
|
|
const Spacer(),
|
|
Align(
|
|
alignment: Alignment.topRight,
|
|
child: Container(
|
|
height: 30,
|
|
child: OutlinedButton(
|
|
onPressed: () {
|
|
print("&&&");
|
|
print(provider.selectedTherapeutic);
|
|
if (provider.selectedTherapeutic.isNotEmpty) {
|
|
provider.OnFilters();
|
|
}
|
|
|
|
setState(() {
|
|
Navigator.pop(context);
|
|
});
|
|
},
|
|
child: Text(
|
|
'Apply',
|
|
style: TextStyle(
|
|
// fontFamily: "SourceSerif",
|
|
fontSize: 14,
|
|
color: Colors.white,
|
|
fontWeight: FontWeight.normal),
|
|
),
|
|
style: OutlinedButton.styleFrom(
|
|
shape: StadiumBorder(),
|
|
backgroundColor: Colors.green,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
SizedBox(
|
|
width: 8.0,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
Divider(
|
|
height: 7,
|
|
color: Colors.black,
|
|
),
|
|
// SizedBox(
|
|
// width: (MediaQuery.of(context).size.width * 0.99) / 2,
|
|
// child: ListTile(
|
|
// title: Text('Search Scope'),
|
|
// subtitle: customAutoCompletedropdown(),
|
|
// onTap: () {},
|
|
// ),
|
|
// ),
|
|
// StringAutoCompleteTags(
|
|
// initialTags: [
|
|
// TagsData(name: "cancer screening ", id: "1"),
|
|
// TagsData(name: "cosmetic surgery", id: "2"),
|
|
// TagsData(name: "sleep medicine", id: "3"),
|
|
// TagsData(name: "ADHD", id: "4"),
|
|
// ],
|
|
// hintText: "Enter scope",
|
|
// ),
|
|
// Container(
|
|
// padding: const EdgeInsets.all(4.0),
|
|
// height: 40,
|
|
// width: double.infinity,
|
|
// decoration: BoxDecoration(
|
|
// border: Border.all(color: Colors.grey),
|
|
// borderRadius: BorderRadius.circular(8.0)),
|
|
// child: dropDown(underline: Container())),
|
|
Wrap(
|
|
//spacing: 4,
|
|
// runSpacing: 4,
|
|
// crossAxisAlignment: WrapCrossAlignment.start,
|
|
// runAlignment: WrapAlignment.spaceEvenly,
|
|
// alignment: WrapAlignment.spaceEvenly,
|
|
// direction: Axis.horizontal,
|
|
// mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
|
children: [
|
|
SizedBox(
|
|
width: isTablet
|
|
? MediaQuery.of(context).size.width / 2
|
|
: MediaQuery.of(context).size.width,
|
|
child: ListTile(
|
|
//title: Text('Search Scope'),
|
|
subtitle: StringAutoCompleteTags(
|
|
initialTags: provider.therapeuticList
|
|
.map((e) =>
|
|
TagsData(id: e.id, name: e.therapeuticName))
|
|
.toList(),
|
|
hintText: "Enter scope",
|
|
filtername: "scope",
|
|
getList: (TextEditingValue textEditingValue) {
|
|
List<TagsData> taglist = [];
|
|
taglist = provider.therapeuticList
|
|
.map((e) =>
|
|
TagsData(id: e.id, name: e.therapeuticName))
|
|
.toList();
|
|
|
|
if (textEditingValue.text == '') {
|
|
return const Iterable<TagsData>.empty();
|
|
}
|
|
|
|
if (textEditingValue.text.length > 1) {
|
|
return taglist.where((TagsData option) {
|
|
return option.name.contains(
|
|
textEditingValue.text.toLowerCase());
|
|
});
|
|
}
|
|
|
|
return taglist.where((TagsData option) {
|
|
return option.name.contains(
|
|
textEditingValue.text.toLowerCase());
|
|
});
|
|
},
|
|
),
|
|
onTap: () {},
|
|
selectedColor: Colors.white,
|
|
selectedTileColor: Colors.white,
|
|
),
|
|
),
|
|
SizedBox(
|
|
width: isTablet
|
|
? MediaQuery.of(context).size.width / 2
|
|
: MediaQuery.of(context).size.width,
|
|
child: ListTile(
|
|
// title: Text('Search Keyword'),
|
|
subtitle: StringAutoCompleteTags(
|
|
initialTags: provider.keywordList
|
|
.map((e) => TagsData(id: e.id, name: e.name))
|
|
.toList(),
|
|
filtername: "keyword",
|
|
hintText: "Enter Keyword",
|
|
getList: (TextEditingValue textEditingValue) async {
|
|
if (textEditingValue.text == '') {
|
|
return const Iterable<TagsData>.empty();
|
|
}
|
|
if (textEditingValue.text.length >= 3) {
|
|
List<Keyword> keywordlist = await provider
|
|
.getKeywordList(textEditingValue.text);
|
|
|
|
return keywordlist
|
|
.map((e) => TagsData(id: e.id, name: e.name))
|
|
.toList()
|
|
.where((TagsData option) {
|
|
return option.name.contains(
|
|
textEditingValue.text.toLowerCase());
|
|
});
|
|
} else {
|
|
return const Iterable<TagsData>.empty();
|
|
}
|
|
},
|
|
),
|
|
onTap: () {},
|
|
),
|
|
),
|
|
SizedBox(
|
|
width: isTablet
|
|
? MediaQuery.of(context).size.width / 2
|
|
: MediaQuery.of(context).size.width,
|
|
child: ListTile(
|
|
// title: Text('Search Speakers'),
|
|
subtitle: StringAutoCompleteTags(
|
|
initialTags: [
|
|
TagsData(name: "Gavino Casu", id: "1"),
|
|
TagsData(name: "Calvin Marentz", id: "2"),
|
|
TagsData(name: "Vineet Bhandari", id: "3"),
|
|
TagsData(name: "Jose Travino", id: "4"),
|
|
],
|
|
hintText: "Enter Speakers",
|
|
filtername: "speakers",
|
|
getList: (TextEditingValue textEditingValue) {
|
|
if (textEditingValue.text == '') {
|
|
return const Iterable<TagsData>.empty();
|
|
}
|
|
|
|
return [
|
|
TagsData(name: "Gavino Casu", id: "1"),
|
|
TagsData(name: "Calvin Marentz", id: "2"),
|
|
TagsData(name: "Vineet Bhandari", id: "3"),
|
|
TagsData(name: "Jose Travino", id: "4"),
|
|
].where((TagsData option) {
|
|
return option.name.contains(
|
|
textEditingValue.text.toLowerCase());
|
|
});
|
|
},
|
|
),
|
|
onTap: () {},
|
|
),
|
|
),
|
|
],
|
|
),
|
|
|
|
// Center(
|
|
// child: SizedBox(
|
|
// width: 200,
|
|
// height: 40,
|
|
// child: ListTile(
|
|
// title: Container(
|
|
// color: Colors.blue,
|
|
// child: Center(
|
|
// child: Text(
|
|
// 'Apply',
|
|
// style: TextStyle(color: Colors.white),
|
|
// ))),
|
|
// onTap: () {},
|
|
// ),
|
|
// ),
|
|
// ),
|
|
Divider(
|
|
height: 1,
|
|
color: Colors.black,
|
|
),
|
|
ExpansionTile(
|
|
shape: Border(),
|
|
title: Text("More"),
|
|
children: [
|
|
Column(
|
|
children: [
|
|
SizedBox(
|
|
width: isTablet
|
|
? MediaQuery.of(context).size.width / 2
|
|
: MediaQuery.of(context).size.width,
|
|
child: ListTile(
|
|
title: Text('Start Date'),
|
|
subtitle: buildDateWidget(
|
|
startDatetextEditingController, "Start Date"),
|
|
onTap: () {},
|
|
),
|
|
),
|
|
SizedBox(
|
|
width: isTablet
|
|
? MediaQuery.of(context).size.width / 2
|
|
: MediaQuery.of(context).size.width,
|
|
child: ListTile(
|
|
title: Text('End Date'),
|
|
subtitle: buildDateWidget(
|
|
endDatetextEditingController, "End Date"),
|
|
onTap: () {},
|
|
),
|
|
),
|
|
],
|
|
),
|
|
// Row(
|
|
// children: [
|
|
// SizedBox(
|
|
// width: (MediaQuery.of(context).size.width * 0.99) / 2,
|
|
// child: ListTile(
|
|
// title: Text('City'),
|
|
// subtitle: customAutoCompletedropdown(
|
|
// ["Chicago", "Seattle", "San Deigo"]),
|
|
// onTap: () {},
|
|
// ),
|
|
// ),
|
|
// SizedBox(
|
|
// width: (MediaQuery.of(context).size.width * 0.99) / 2,
|
|
// child: ListTile(
|
|
// title: Text('State'),
|
|
// subtitle: customAutoCompletedropdown(
|
|
// ["California", "Illinois", "New York"]),
|
|
// onTap: () {},
|
|
// ),
|
|
// ),
|
|
// ],
|
|
// ),
|
|
// Row(
|
|
// children: [
|
|
// SizedBox(
|
|
// width: (MediaQuery.of(context).size.width * 0.99) / 2,
|
|
// child: ListTile(
|
|
// title: Text('Country'),
|
|
// subtitle: customAutoCompletedropdown([
|
|
// "Netherlands",
|
|
// "Switzerland",
|
|
// "United States"
|
|
// ]),
|
|
// onTap: () {},
|
|
// ),
|
|
// ),
|
|
// SizedBox(
|
|
// width: (MediaQuery.of(context).size.width * 0.99) / 2,
|
|
// child: ListTile(
|
|
// title: Text('Number of Attendees'),
|
|
// subtitle: buildTextFieldWidget(),
|
|
// onTap: () {},
|
|
// ),
|
|
// ),
|
|
// ],
|
|
// ),
|
|
// Row(
|
|
// children: [
|
|
// SizedBox(
|
|
// width: (MediaQuery.of(context).size.width * 0.99) / 2,
|
|
// child: ListTile(
|
|
// title: Text('Client Attendees'),
|
|
// subtitle: buildTextFieldWidget(),
|
|
// onTap: () {},
|
|
// ),
|
|
// ),
|
|
// SizedBox(
|
|
// width: (MediaQuery.of(context).size.width * 0.99) / 2,
|
|
// child: ListTile(
|
|
// title: Text('New Attendees'),
|
|
// subtitle: buildTextFieldWidget(),
|
|
// onTap: () {},
|
|
// ),
|
|
// ),
|
|
// ],
|
|
// ),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
Widget buildDateWidget(TextEditingController controller, String hint) {
|
|
return SizedBox(
|
|
width: isTablet ? 200 : MediaQuery.of(context).size.width,
|
|
height: isTablet ? 50 : 40,
|
|
child: TextField(
|
|
controller: controller,
|
|
|
|
//editing controller of this TextField
|
|
decoration: InputDecoration(
|
|
// border: OutlineInputBorder(),
|
|
// border: OutlineInputBorder(
|
|
// borderRadius: BorderRadius.circular(10.0),
|
|
// ),
|
|
// labelStyle: const TextStyle(fontSize: 16),
|
|
suffixIcon: const Icon(Icons.calendar_today), //icon of text field
|
|
// labelText: "Enter Date" //label text of field
|
|
hintText: hint,
|
|
),
|
|
readOnly: true, //set it true, so that user will not able to edit text
|
|
|
|
onTap: () async {
|
|
DateTime? pickedDate = await showDatePicker(
|
|
context: context,
|
|
anchorPoint: Offset(20.0, 30.0),
|
|
initialDate: DateTime.now(),
|
|
firstDate: DateTime(
|
|
2000), //DateTime.now() - not to allow to choose before today.
|
|
lastDate: DateTime(2101));
|
|
|
|
if (pickedDate != null) {
|
|
print(
|
|
pickedDate); //pickedDate output format => 2021-03-10 00:00:00.000
|
|
String formattedDate = DateFormat('yyyy-MM-dd').format(pickedDate);
|
|
print(
|
|
formattedDate); //formatted date output using intl package => 2021-03-16
|
|
//you can implement different kind of Date Format here according to your requirement
|
|
|
|
setState(() {
|
|
// output date to TextField value.
|
|
controller.text = formattedDate;
|
|
});
|
|
} else {
|
|
print("Date is not selected");
|
|
}
|
|
},
|
|
),
|
|
);
|
|
}
|
|
|
|
Widget buildTextFieldWidget() {
|
|
return SizedBox(
|
|
width: isTablet ? 200 : MediaQuery.of(context).size.width,
|
|
height: isTablet ? 50 : 40,
|
|
child: TextField(
|
|
controller:
|
|
selecttextEditingController, //editing controller of this TextField
|
|
decoration: InputDecoration(
|
|
// border: OutlineInputBorder(),
|
|
border: OutlineInputBorder(
|
|
borderRadius: BorderRadius.circular(10.0),
|
|
),
|
|
labelStyle: const TextStyle(fontSize: 16),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
Widget customAutoCompletedropdown(List<String> list) {
|
|
// sectionItem.value = list[0].name;
|
|
|
|
// if (list.isEmpty) {
|
|
// print("list is empty");
|
|
|
|
//}
|
|
//InputClass selectedObj = list[0];
|
|
return SizedBox(
|
|
width: isTablet ? 200 : MediaQuery.of(context).size.width,
|
|
height: isTablet ? 60 : 40,
|
|
child: DropdownButtonFormField2(
|
|
isExpanded: true,
|
|
decoration: InputDecoration(
|
|
// Add Horizontal padding using menuItemStyleData.padding so it matches
|
|
// the menu padding when button's width is not specified.
|
|
contentPadding: const EdgeInsets.symmetric(vertical: 5),
|
|
border: OutlineInputBorder(
|
|
borderRadius: BorderRadius.circular(15),
|
|
),
|
|
// Add more decoration..
|
|
),
|
|
hint: Text(
|
|
'Select Item',
|
|
style: TextStyle(
|
|
fontSize: 14,
|
|
color: Theme.of(context).hintColor,
|
|
),
|
|
),
|
|
items: list
|
|
.map((item) => DropdownMenuItem(
|
|
value: item,
|
|
child: Text(
|
|
item,
|
|
style: const TextStyle(
|
|
fontSize: 14,
|
|
),
|
|
),
|
|
))
|
|
.toList(),
|
|
value: list[0],
|
|
onSaved: (value) {},
|
|
onChanged: (value) {
|
|
// setState(() {
|
|
},
|
|
|
|
buttonStyleData: const ButtonStyleData(
|
|
padding: EdgeInsets.symmetric(horizontal: 16),
|
|
height: 40,
|
|
width: 200,
|
|
),
|
|
dropdownStyleData: const DropdownStyleData(
|
|
maxHeight: 200,
|
|
),
|
|
menuItemStyleData: const MenuItemStyleData(
|
|
height: 40,
|
|
),
|
|
dropdownSearchData: DropdownSearchData(
|
|
searchController: textEditingController,
|
|
searchInnerWidgetHeight: 50,
|
|
searchInnerWidget: Container(
|
|
height: 50,
|
|
padding: const EdgeInsets.only(
|
|
top: 8,
|
|
bottom: 4,
|
|
right: 8,
|
|
left: 8,
|
|
),
|
|
child: TextFormField(
|
|
expands: true,
|
|
maxLines: null,
|
|
controller: textEditingController,
|
|
decoration: InputDecoration(
|
|
isDense: true,
|
|
contentPadding: const EdgeInsets.symmetric(
|
|
horizontal: 10,
|
|
vertical: 8,
|
|
),
|
|
hintText: 'Search...',
|
|
hintStyle: const TextStyle(fontSize: 12),
|
|
border: OutlineInputBorder(
|
|
borderRadius: BorderRadius.circular(8),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
searchMatchFn: (item, searchValue) {
|
|
return item.value!.toString().contains(searchValue);
|
|
},
|
|
),
|
|
//This to clear the search value when you close the menu
|
|
onMenuStateChange: (isOpen) {
|
|
if (!isOpen) {
|
|
textEditingController.clear();
|
|
}
|
|
},
|
|
),
|
|
);
|
|
}
|
|
|
|
Widget buildListView(BuildContext context, EventsProvider provider) {
|
|
return ListView.builder(
|
|
itemCount: provider.isSearch
|
|
? provider.searchList.length
|
|
: provider.eventList.length,
|
|
padding: const EdgeInsets.only(top: 2),
|
|
shrinkWrap: true,
|
|
scrollDirection: Axis.vertical,
|
|
itemBuilder: (BuildContext context, int index) {
|
|
final int count =
|
|
provider.eventList.length > 10 ? 10 : provider.eventList.length;
|
|
final Animation<double> animation = Tween<double>(begin: 0.0, end: 1.0)
|
|
.animate(CurvedAnimation(
|
|
parent: animationController!,
|
|
curve: Interval((1 / count) * index, 1.0,
|
|
curve: Curves.fastOutSlowIn)));
|
|
animationController?.forward();
|
|
return _buildlistCard(
|
|
animation: animation,
|
|
animationController: animationController!,
|
|
provider: provider,
|
|
eventsList: provider.isSearch
|
|
? provider.searchList[index]
|
|
: provider.eventList[index],
|
|
);
|
|
},
|
|
);
|
|
}
|
|
|
|
Widget _buildlistCard(
|
|
{required Animation<double>? animation,
|
|
required AnimationController? animationController,
|
|
required EventsProvider provider,
|
|
required EventsList eventsList}) {
|
|
return AnimatedBuilder(
|
|
animation: animationController!,
|
|
builder: (BuildContext context, Widget? child) {
|
|
return FadeTransition(
|
|
opacity: animation!,
|
|
child: Transform(
|
|
transform: Matrix4.translationValues(
|
|
0.0, 50 * (1.0 - animation.value), 0.0),
|
|
child: Padding(
|
|
padding: const EdgeInsets.only(
|
|
left: 10, right: 10, top: 8, bottom: 12),
|
|
child: InkWell(
|
|
splashColor: Colors.transparent,
|
|
onTap: () {
|
|
Navigator.of(context, rootNavigator: true)
|
|
.push(MaterialPageRoute(
|
|
builder: (context) => EventsListingScreen(
|
|
event: eventsList,
|
|
),
|
|
));
|
|
},
|
|
child: Card(
|
|
elevation: 4,
|
|
surfaceTintColor: Colors.white,
|
|
// shadowColor: Constants.bgcolor,
|
|
child: buildCardView(context, eventsList, provider),
|
|
),
|
|
))));
|
|
});
|
|
}
|
|
|
|
Widget buildEventsGrid(BuildContext context, EventsProvider provider) {
|
|
final textTheme = Theme.of(context)
|
|
.textTheme
|
|
.apply(displayColor: Theme.of(context).colorScheme.onSurface);
|
|
|
|
// Set the default number of columns to 3.
|
|
int columnsCount = 2;
|
|
|
|
// Define the icon size based on the screen width
|
|
|
|
// Use the ResponsiveUtils class to determine the device's screen size.
|
|
if (ResponsiveUtils.isMobile(context)) {
|
|
columnsCount = 1;
|
|
} else if (ResponsiveUtils.isDesktop(context)) {
|
|
columnsCount = 3;
|
|
}
|
|
|
|
// Build the grid view using the number of columns.
|
|
return Expanded(
|
|
child: GridView.builder(
|
|
// Set padding and spacing between cards.
|
|
padding: const EdgeInsets.symmetric(vertical: 5),
|
|
scrollDirection: Axis.vertical,
|
|
|
|
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
|
// Set the number of columns based on the device's screen size.
|
|
crossAxisCount: columnsCount,
|
|
|
|
// Set the aspect ratio of each card.
|
|
// childAspectRatio: isTablet ? 2 : 2,
|
|
// crossAxisSpacing: isTablet ? 30 : 20,
|
|
// mainAxisSpacing: isTablet ? 40 : 20,
|
|
|
|
childAspectRatio: isTablet ? 2 : 2.2,
|
|
crossAxisSpacing: isTablet ? 30 : 1,
|
|
mainAxisSpacing: isTablet ? 40 : 4,
|
|
),
|
|
// Set the number of items in the grid view.
|
|
itemCount: provider.eventList.length,
|
|
itemBuilder: (BuildContext context, int index) {
|
|
// Build each card in the grid view.
|
|
return InkWell(
|
|
onTap: () {
|
|
Navigator.of(context, rootNavigator: true)
|
|
.push(MaterialPageRoute(
|
|
builder: (context) => EventsTab(
|
|
event: provider.eventList[index],
|
|
),
|
|
));
|
|
// Navigator.of(context).push(new MaterialPageRoute<Null>(
|
|
// builder: (BuildContext context) {
|
|
// return new EventsTab();
|
|
// },
|
|
// fullscreenDialog: true));
|
|
},
|
|
child: Card(
|
|
elevation: 2,
|
|
shadowColor: EventsConstants.bgcolor,
|
|
child: buildCardView(
|
|
context, provider.eventList[index], provider)));
|
|
},
|
|
// Set the grid view to shrink wrap its contents.
|
|
shrinkWrap: true,
|
|
// Disable scrolling in the grid view.
|
|
// physics: const NeverScrollableScrollPhysics(),
|
|
),
|
|
);
|
|
}
|
|
|
|
buildCardView(
|
|
BuildContext context, EventsList event, EventsProvider provider) {
|
|
double height = isTablet
|
|
? MediaQuery.of(context).size.height * 0.35
|
|
: MediaQuery.of(context).size.height * 0.65;
|
|
return ConstrainedBox(
|
|
constraints: BoxConstraints.tightFor(),
|
|
child: Container(
|
|
decoration: BoxDecoration(
|
|
// color: Color.fromARGB(179, 248, 238, 238),
|
|
|
|
color: Colors.white,
|
|
borderRadius: BorderRadius.all(Radius.circular(20))),
|
|
// height: MediaQuery.of(context).size.height * 0.2,
|
|
// height: double.minPositive,
|
|
padding: isTablet
|
|
? EdgeInsets.symmetric(horizontal: 8.0, vertical: 2.0)
|
|
: EdgeInsets.symmetric(horizontal: 10.0, vertical: 10.0),
|
|
child:
|
|
// Column(
|
|
// crossAxisAlignment: CrossAxisAlignment.end,
|
|
// // mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
|
// children: [
|
|
// SizedBox(
|
|
// height: isTablet ? 1 : 3,
|
|
// ),
|
|
// Container(
|
|
// // height: isTablet ? height * 0.50 : height * 0.30,
|
|
// padding: const EdgeInsets.only(top: 5.0),
|
|
// width: double.maxFinite,
|
|
// child:
|
|
Column(
|
|
// crossAxisAlignment: CrossAxisAlignment.end,
|
|
// mainAxisAlignment: MainAxisAlignment.spaceAround,
|
|
children: [
|
|
Align(
|
|
alignment: FractionalOffset.topLeft,
|
|
child: Text(
|
|
event.name1 ?? "",
|
|
style: TextStyle(
|
|
// decoration: TextDecoration.underline,
|
|
// decorationColor: Colors.blue,
|
|
color: Colors.black,
|
|
fontWeight: FontWeight.bold,
|
|
fontSize: isTablet ? 22 : 16,
|
|
// fontFamily: "SourceSerif",
|
|
),
|
|
maxLines: isTablet ? 4 : 4,
|
|
softWrap: true,
|
|
overflow: TextOverflow.ellipsis,
|
|
),
|
|
),
|
|
|
|
SizedBox(
|
|
height: 14,
|
|
),
|
|
// Positioned(
|
|
// child:
|
|
Align(
|
|
alignment: FractionalOffset.bottomLeft,
|
|
child: Row(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
mainAxisAlignment: MainAxisAlignment.end,
|
|
children: [
|
|
RichText(
|
|
text: TextSpan(
|
|
children: [
|
|
WidgetSpan(
|
|
child: Icon(Icons.calendar_month, size: 16),
|
|
),
|
|
TextSpan(
|
|
text: ' ${event.start} to ${event.end}',
|
|
style: TextStyle(
|
|
color: Colors.black,
|
|
//fontStyle: FontStyle.italic,
|
|
fontSize: isTablet ? 20 : 14),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
SizedBox(
|
|
height: 5.0,
|
|
),
|
|
RichText(
|
|
textAlign: TextAlign.justify,
|
|
text: TextSpan(
|
|
children: [
|
|
WidgetSpan(
|
|
child: Icon(Icons.location_on, size: 16),
|
|
),
|
|
TextSpan(
|
|
text:
|
|
' ${event.city != null && event.city != "" ? "${event.city}, " : ""}${event.region != null && event.region != "" ? "${event.region}, " : ""}${event.country != null && event.country != "" ? "${event.country}" : ""}',
|
|
style: TextStyle(
|
|
color: Colors.black,
|
|
//fontStyle: FontStyle.italic,
|
|
fontSize: isTablet ? 20 : 14),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
|
|
Align(
|
|
alignment: FractionalOffset.bottomRight,
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.end,
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
SizedBox(
|
|
width: 40,
|
|
height: 30,
|
|
child: FloatingActionButton.extended(
|
|
elevation: 1,
|
|
shape: CircleBorder(),
|
|
backgroundColor: EventsConstants.bgcolor,
|
|
onPressed: () async {
|
|
// String msg = await provider
|
|
// .addEventsToFavs(event.eventId!);
|
|
|
|
setState(() {
|
|
event.isfav = !event.isfav;
|
|
|
|
if (event.isfav) {
|
|
SnackBarWidget.displaySnackBar(
|
|
"Added to favorites!", context);
|
|
} else {
|
|
SnackBarWidget.displaySnackBar(
|
|
"Removed from favorites!", context);
|
|
}
|
|
});
|
|
if (event.isfav) {
|
|
await provider.favsEventsData(event);
|
|
} else {
|
|
await provider.delateEventsData(event);
|
|
}
|
|
},
|
|
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.isfav
|
|
? Column(
|
|
children: [
|
|
Icon(
|
|
Icons.favorite,
|
|
color: Colors.red,
|
|
size: 14,
|
|
),
|
|
],
|
|
)
|
|
: Icon(
|
|
Icons.favorite,
|
|
color: Colors.grey,
|
|
size: 14,
|
|
))),
|
|
),
|
|
SizedBox(
|
|
height: 2,
|
|
),
|
|
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),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
// Align(
|
|
// alignment: Alignment.bottomRight,
|
|
// child: SizedBox(
|
|
// height: 30,
|
|
// child: OutlinedButton(
|
|
// onPressed: () {
|
|
// setState(() {
|
|
// // selectedIndex.add(index);
|
|
// if (selectedIndex.isNotEmpty) {
|
|
// int count = selectedIndex
|
|
// .where(
|
|
// (element) => element == index,
|
|
// )
|
|
// .length;
|
|
// if (count >= 1) {
|
|
// iconColor = Colors.grey;
|
|
// selectedFav = false;
|
|
// icon = Icons.favorite;
|
|
// selectedIndex.remove(index);
|
|
// } else {
|
|
// selectedIndex.add(index);
|
|
// if (selectedIndex.contains(index)) {
|
|
// iconColor = Colors.red;
|
|
// icon = Icons.favorite;
|
|
// selectedFav = true;
|
|
// }
|
|
// }
|
|
// } else {
|
|
// selectedIndex.add(index);
|
|
// if (selectedIndex.contains(index)) {
|
|
// iconColor = Colors.red;
|
|
// icon = Icons.favorite;
|
|
// selectedFav = true;
|
|
// }
|
|
// //}
|
|
// }
|
|
// });
|
|
// },
|
|
// child: Icon(
|
|
// icon,
|
|
// size: isTablet ? 20 : 18,
|
|
// color: selectedFav && selectedIndex.contains(index)
|
|
// ? iconColor
|
|
// : Colors.grey,
|
|
// ),
|
|
// style: OutlinedButton.styleFrom(
|
|
// shape: CircleBorder(),
|
|
// ),
|
|
// ),
|
|
// ),
|
|
// ),
|
|
],
|
|
),
|
|
),
|
|
// ),
|
|
],
|
|
),
|
|
|
|
// Image.asset(
|
|
// "assets/images/events2.jpg",
|
|
// fit: BoxFit.cover,
|
|
// ),
|
|
//),
|
|
// Divider(
|
|
// color: Colors.blueGrey,
|
|
// thickness: 2,
|
|
// height: 2,
|
|
// ),
|
|
|
|
// SizedBox(
|
|
// height: 5,
|
|
// ),
|
|
// Text(
|
|
// 'Organizer: Hematology/Oncology Pharmacy Association (HOPA)',
|
|
// style: TextStyle(
|
|
// color: Colors.black,
|
|
// fontStyle: FontStyle.italic,
|
|
// fontFamily: "SourceSerif",
|
|
// fontSize: isTablet ? 18 : 14),
|
|
// maxLines: 2,
|
|
// softWrap: true,
|
|
// overflow: TextOverflow.ellipsis,
|
|
// ),
|
|
// SizedBox(
|
|
// // height: 100,
|
|
// child: Padding(
|
|
// padding: const EdgeInsets.symmetric(vertical: 4.0),
|
|
// child: Column(
|
|
// mainAxisAlignment: MainAxisAlignment.start,
|
|
// crossAxisAlignment: CrossAxisAlignment.start,
|
|
// children: [
|
|
// Row(
|
|
// children: [],
|
|
// ),
|
|
|
|
// RichText(
|
|
// text: TextSpan(
|
|
// children: [
|
|
// WidgetSpan(
|
|
// child: SizedBox(
|
|
// width: 80,
|
|
// height: 18,
|
|
// child: WidgetStack(
|
|
// stackedWidgets: [
|
|
// for (var n = 0; n < 5; n++)
|
|
// CircleAvatar(
|
|
// child: Icon(
|
|
// Icons.person,
|
|
// size: 14,
|
|
// color: Colors.blueGrey[300],
|
|
// ))
|
|
// ],
|
|
// positions: RestrictedPositions(
|
|
// maxCoverage: 0.3,
|
|
// minCoverage: 0.4,
|
|
// ),
|
|
// buildInfoWidget: (surplus) {
|
|
// return Center(
|
|
// child: Text(
|
|
// '+$surplus',
|
|
// style: Theme.of(context).textTheme.headline5,
|
|
// ));
|
|
// },
|
|
// ),
|
|
// ),
|
|
// ),
|
|
// TextSpan(
|
|
// text: '5',
|
|
// style: TextStyle(
|
|
// color: Colors.black,
|
|
// fontFamily: "SourceSerif",
|
|
// fontSize: 16),
|
|
// ),
|
|
// TextSpan(
|
|
// text: ' attendees',
|
|
// style: TextStyle(
|
|
// color: Colors.black,
|
|
// fontFamily: "SourceSerif",
|
|
// fontSize: 14),
|
|
// ),
|
|
// ],
|
|
// ),
|
|
// ),
|
|
// RichText(
|
|
// text: TextSpan(
|
|
// children: [
|
|
// WidgetSpan(
|
|
// child: SizedBox(
|
|
// width: 50,
|
|
// height: 18,
|
|
// child: WidgetStack(
|
|
// stackedWidgets: [
|
|
// for (var n = 0; n < 3; n++)
|
|
// CircleAvatar(
|
|
// child: Icon(
|
|
// Icons.person,
|
|
// size: 14,
|
|
// color: Colors.blueGrey[300],
|
|
// ))
|
|
// ],
|
|
// positions: RestrictedPositions(
|
|
// maxCoverage: 0.3,
|
|
// minCoverage: 0.4,
|
|
// ),
|
|
// buildInfoWidget: (surplus) {
|
|
// return Center(
|
|
// child: Text(
|
|
// '+$surplus',
|
|
// style: Theme.of(context).textTheme.headline5,
|
|
// ));
|
|
// },
|
|
// ),
|
|
// ),
|
|
// ),
|
|
// TextSpan(
|
|
// text: '3',
|
|
// style: TextStyle(
|
|
// color: Colors.black,
|
|
// fontFamily: "SourceSerif",
|
|
// fontSize: 16),
|
|
// ),
|
|
// TextSpan(
|
|
// text: ' client attendees',
|
|
// style: TextStyle(
|
|
// color: Colors.black,
|
|
// fontFamily: "SourceSerif",
|
|
// fontSize: 14),
|
|
// ),
|
|
// ],
|
|
// ),
|
|
// ),
|
|
// ],
|
|
// ),
|
|
// ),
|
|
// ),
|
|
// Row(
|
|
// children: [
|
|
// SizedBox(
|
|
// height: 30,
|
|
// child: OutlinedButton(
|
|
// onPressed: () {},
|
|
// child: Text('Add to My Events'),
|
|
// style: OutlinedButton.styleFrom(
|
|
// shape: StadiumBorder(),
|
|
// ),
|
|
// ),
|
|
// ),
|
|
// ],
|
|
// )
|
|
// ],
|
|
// ),
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
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;
|
|
}
|
|
}
|