Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save shivam-cgm/4934887c216ae6887023a8e6ace833f4 to your computer and use it in GitHub Desktop.
Save shivam-cgm/4934887c216ae6887023a8e6ace833f4 to your computer and use it in GitHub Desktop.
// ignore_for_file: unused_local_variable
import 'package:artistfinal/components/LogoAnimater.dart';
import 'package:artistfinal/components/close_app.dart';
import 'package:artistfinal/components/colors/constants.dart';
import 'package:artistfinal/components/under_maintenance_page.dart';
import 'package:artistfinal/controllers/chat_tab_controller.dart';
import 'package:artistfinal/controllers/search_tab_controller.dart';
import 'package:artistfinal/provider/profileNcommon_provider.dart';
import 'package:artistfinal/screens/chat/view/chat_list_widget.dart';
import 'package:artistfinal/screens/home/widgets/candidate_tile.dart';
import 'package:artistfinal/screens/home/widgets/custom_drawer.dart';
import 'package:artistfinal/screens/home/widgets/post_tile.dart';
import 'package:artistfinal/screens/home/widgets/recruiter_other_profile.dart';
import 'package:artistfinal/screens/other_profile/artist/other_profile_page.dart';
import 'package:artistfinal/screens/post/create_jobs_screen.dart';
import 'package:artistfinal/utils/helper.dart';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import 'package:get/get.dart';
import 'package:provider/provider.dart';
import 'package:badges/badges.dart' as badges;
import 'package:flutter_animated_icons/lottiefiles.dart';
import 'package:lottie/lottie.dart';
import '../../components/notification_page.dart';
import '../../provider/bottom_provider.dart';
import '../../provider/titleWiseCandidateTab_provider.dart';
import 'package:collection/collection.dart';
import '../search/search.dart';
class HomePageRecruiter extends StatefulWidget {
const HomePageRecruiter({Key? key}) : super(key: key);
@override
State<HomePageRecruiter> createState() => _HomePageRecruiterState();
}
class _HomePageRecruiterState extends State<HomePageRecruiter>
with SingleTickerProviderStateMixin {
late AnimationController _bellController;
ChatTabController chatTabController = Get.put(ChatTabController());
SearchTabController searchTabController = Get.put(SearchTabController());
// final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
@override
void initState() {
super.initState();
_bellController =
AnimationController(vsync: this, duration: const Duration(seconds: 1))
..repeat();
}
@override
void dispose() {
// _tabController.dispose();
_bellController.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
double width = MediaQuery.of(context).size.width;
double height = MediaQuery.of(context).size.height;
final dark = MHelper.isDarkMode(context);
return Consumer<profileNcommon_provider>(
builder: (context, value, child) {
return DefaultTabController(
length: 3,
child: SafeArea(
child: Scaffold(
// appBar: AppBar(
// //backgroundColor: dark ? Colors.black : Colors.white,
// toolbarHeight: 40,
// elevation: 0,
// scrolledUnderElevation: 0,
// centerTitle: true,
// title: Row(
// mainAxisAlignment: MainAxisAlignment.center,
// children: [
// // SizedBox(
// // width: 30,
// // ),
// LogoAnimater()
// ],
// ),
// actions: [
// IconButton(
// // splashRadius: 50,
// // iconSize: 10,
// onPressed: () {
// chatTabController.onTabChanger(1);
// //chatTabController.tabIndex.value = 2;
// // Get.to(() => const ChatListWidget());
// Provider.of<ScreenIndexProvider>(context, listen: false)
// .updateScreenIndex(2);
// //Get.to(()=>NotificationPage());
// // print(_bellController.status);
// // if (_bellController.isAnimating) {
// // _bellController.stop();
// // // _bellController.reset();
// // } else {
// // _bellController.repeat();
// // }
// },
// icon: Lottie.asset(LottieFiles.$63128_bell_icon,
// controller: _bellController, fit: BoxFit.cover),
// ),
//
// // IconButton(
// // padding: EdgeInsets.zero,
// // onPressed: () {
// // //notificationController.FetchMyNotifications();
// // // Get.to(() => NotificationPage());
// // // print(
// // // "Notification length is :${notificationController.myNotifications.length}");
// // // themeController.changeMode();
// // // Get.isDarkMode ? Get.changeTheme(ThemeData.light()) :Get.changeTheme(ThemeData.dark());
// // // Get.to(() => const ActivityView());
// // },
// // icon: badges.Badge(
// // position: badges.BadgePosition.topEnd(top: -10, end: -12),
// // showBadge: true,
// // // notificationController.myNotifications.value.length > 0
// // // ? true
// // // : false,
// // ignorePointer: false,
// // onTap: () {
// // //GetNotificationDetails().FetchMyNotifications();
// // },
// // badgeContent: const Text(
// // "10",
// // style: TextStyle(fontSize: 9),
// // ),
// // child: const Icon(
// // Icons.notifications_none,
// // size: 25,
// // ),
// // ),
// // ),
// ],
// ),
drawer: customDrawer(context),
body: CustomScrollView(
slivers: [
SliverAppBar(
toolbarHeight: 40,
//pinned: true,
floating: true,
elevation: 0,
scrolledUnderElevation: 0,
centerTitle: true,
title: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const SizedBox(
width: 30,
),
LogoAnimater()
],
),
actions: [
IconButton(
onPressed: () {
Provider.of<ScreenIndexProvider>(context,
listen: false)
.updateScreenIndex(1);
},
icon: const Icon(Icons.search),
),
IconButton(
// splashRadius: 50,
// iconSize: 10,
onPressed: () {
chatTabController.onTabChanger(1);
//chatTabController.tabIndex.value = 2;
// Get.to(() => const ChatListWidget());
Provider.of<ScreenIndexProvider>(context,
listen: false)
.updateScreenIndex(2);
//Get.to(()=>NotificationPage());
// print(_bellController.status);
// if (_bellController.isAnimating) {
// _bellController.stop();
// // _bellController.reset();
// } else {
// _bellController.repeat();
// }
},
icon: Image.asset('assets/images/notifications.png',
width: 20, height: 20),
// Lottie.asset(LottieFiles.$63128_bell_icon,
// width: 25,
// height: 25,
// controller: _bellController, fit: BoxFit.cover),
),
// IconButton(
// padding: EdgeInsets.zero,
// onPressed: () {
// //notificationController.FetchMyNotifications();
// // Get.to(() => NotificationPage());
// // print(
// // "Notification length is :${notificationController.myNotifications.length}");
// // themeController.changeMode();
// // Get.isDarkMode ? Get.changeTheme(ThemeData.light()) :Get.changeTheme(ThemeData.dark());
// // Get.to(() => const ActivityView());
// },
// icon: badges.Badge(
// position: badges.BadgePosition.topEnd(top: -10, end: -12),
// showBadge: true,
// // notificationController.myNotifications.value.length > 0
// // ? true
// // : false,
// ignorePointer: false,
// onTap: () {
// //GetNotificationDetails().FetchMyNotifications();
// },
// badgeContent: const Text(
// "10",
// style: TextStyle(fontSize: 9),
// ),
// child: const Icon(
// Icons.notifications_none,
// size: 25,
// ),
// ),
// ),
],
),
// SliverToBoxAdapter(
// child: LinearProgressIndicator(
// color: Colors.blue,
// minHeight: 2,
// // backgroundColor: Colors.blue,
// )
// ),
SliverToBoxAdapter(
child: Column(
children: [
// Padding(
// padding: const EdgeInsets.only(
// left: 15, right: 15, top: 5),
// child: Row(
// children: [
// // value.myProfile['profile_picture'] != '' ? ClipRRect(
// // borderRadius: BorderRadius.circular(250),
// // child: CachedNetworkImage(
// // imageUrl: '${value.myProfile['profile_picture']}',
// // fit: BoxFit.cover,
// // width: 30,
// // height: 30,
// // placeholder: (context, url) => SizedBox(
// // height: 10,
// // width: 10,
// // child: SvgPicture.asset(
// // 'assets/images/loading.svg'),
// // ),
// // errorWidget: (context, url, error) =>
// // Image.asset('assets/images/profile.png'),
// // fadeInDuration: const Duration(seconds: 1),
// // ),
// // ) : ClipRRect(
// // borderRadius: const BorderRadius.all(Radius.circular(15)),
// // child: Image.asset('assets/images/profile.png', width: 30, height: 30,),
// // ),
// // // NetworkImage(
// // // 'https://images.pexels.com/photos/15511196/pexels-photo-15511196/free-photo-of-close-up-of-cat-lying-down.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=1'),
// //
// // const SizedBox(width: 10),
// Expanded(
// child: InkWell(
// splashColor: Colors.transparent,
// onTap: () {
// // Get.to(() => const SearchView());
// Provider.of<ScreenIndexProvider>(context,
// listen: false)
// .updateScreenIndex(1);
// },
// child: Container(
// height: 43,
// decoration: BoxDecoration(
// color: const Color(0xFF121417),
// borderRadius: BorderRadius.circular(7),
// border: Border.all(
// color: Color(0xFF2B303F),
// width: 1)),
// child: Row(
// children: [
// Padding(
// padding:
// const EdgeInsets.only(left: 10),
// child: Icon(Icons.search,
// color: whiteTextColor),
// ),
// const SizedBox(width: 120),
// Center(
// child: Text(
// 'Search...',
// style: TextStyle(
// color: whiteTextColor),
// ),
// ),
// ],
// ),
// ),
// ),
// ),
// ],
// ),
// // child: TextField(
// // decoration: const InputDecoration(
// // prefixIcon: Icon(
// // Icons.search,
// // size: 30,
// // color: Colors.white,
// // ),
// // label: Text('Search for a Job'),
// // ),
// // onTap: () {},
// // ),
// ),
// const SizedBox(height: 20),
Padding(
padding: const EdgeInsets.only(left: 15, right: 15),
child: Container(
padding: const EdgeInsets.only(left: 15, right: 15),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(4),
image: const DecorationImage(
image: AssetImage(
"assets/images/color_component.png"),
fit: BoxFit.fill,
),
),
child: Padding(
padding: const EdgeInsets.all(10),
child: Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Expanded(
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
const Text(
'See how you can\nFind a candidate quickly!',
style: TextStyle(
color: Colors.white,
fontSize: 15,
fontWeight: FontWeight.w600,
),
),
const SizedBox(height: 20),
GestureDetector(
onTap: () {},
child: Container(
width: 120,
padding: const EdgeInsets.only(
left: 16,
right: 16,
top: 10,
bottom: 10),
decoration: BoxDecoration(
color: Colors.white,
borderRadius:
BorderRadius.circular(20),
),
child: const Center(
child: Text(
'Read more',
style: TextStyle(
color: Colors.blue,
fontSize: 15,
fontWeight:
FontWeight.bold),
),
),
),
),
],
),
),
Image.asset(
"assets/images/person.png",
width: 100,
height: 150,
),
],
),
),
),
),
// value.artistProfileUpdate == 100
// ? Container()
// : GestureDetector(
// onTap: () {},
// child: Padding(
// padding:
// const EdgeInsets.only(left: 15, right: 15),
// child: Container(
// // height: MediaQuery.of(context).size.height * 0.22,
// padding:
// const EdgeInsets.symmetric(horizontal: 8),
// decoration: const BoxDecoration(
// image: DecorationImage(
// image: AssetImage(
// "assets/images/color_component.png"),
// fit: BoxFit.fill,
// ),
// ),
// child: Padding(
// padding: const EdgeInsets.all(10),
// child: Row(
// children: [
// Stack(
// children: [
// CircleAvatar(
// backgroundColor:
// Colors.transparent,
// radius: 35,
// child: Text(
// "${value.artistProfileUpdate}%",
// style: const TextStyle(
// fontSize: 18,
// color: Colors.white),
// ),
// ),
// const SizedBox(
// width: 70,
// height: 70,
// child: CircularProgressIndicator(
// color: Colors.white,
// value: 1,
// ),
// ),
// SizedBox(
// width: 70,
// height: 70,
// child: CircularProgressIndicator(
// color: Colors.blue,
// value:
// value.artistProfileUpdate /
// 100,
// ),
// ),
// ],
// ),
// const SizedBox(width: 10),
// const Expanded(
// child: Column(
// crossAxisAlignment:
// CrossAxisAlignment.start,
// children: [
// SizedBox(height: 10),
// Text(
// 'Profile Completed!',
// style: TextStyle(
// color: Colors.white,
// fontSize: 20,
// fontWeight: FontWeight.w700,
// ),
// ),
// SizedBox(height: 2),
// Text(
// 'A complete profile increases the chances\nof a recruiter being more interestedin\nrecruiting you.',
// style: TextStyle(
// color: Colors.white,
// fontSize: 11,
// fontWeight: FontWeight.w600,
// ),
// ),
// ],
// ),
// ),
// ],
// ),
// ),
// ),
// ),
// ),
],
),
),
SliverToBoxAdapter(
child: value.isRecCadLoading
? const SizedBox()
: !value.isBlankRecCand
? Container(
padding: const EdgeInsets.only(
left: 15, right: 15, top: 10),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
const Text(
'Recommendation',
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold),
),
GestureDetector(
onTap: () {
searchTabController.onTabChanger(2);
Provider.of<ScreenIndexProvider>(
context,
listen: false)
.updateScreenIndex(1);
},
child: const Text(
'See All',
style:
TextStyle(color: Colors.blue),
),
),
],
),
const SizedBox(height: 10),
SizedBox(
height: 215,
width: 650,
child: ListView.builder(
scrollDirection: Axis.horizontal,
itemCount:
value.recommendedCandidates.length,
itemBuilder: (context, index) {
return RecruiterOtherArtistProfile(
rData: value
.recommendedCandidates[index],
);
},
),
),
],
),
)
: Container(),
),
SliverToBoxAdapter(
child: Container(
padding:
const EdgeInsets.only(left: 15, right: 15, top: 5),
child: Column(
children: [
// Row(
// mainAxisAlignment: MainAxisAlignment.end,
// children: [
// InkWell(
// onTap: () {},
// child: const Text(
// 'See All',
// style:
// TextStyle(fontSize: 13, color: Colors.blue),
// ),
// )
// ],
// ),
const SizedBox(height: 10),
// TabBar(
// unselectedLabelColor: Colors.blue,
// // controller: _tabController,
// indicator: BoxDecoration(
// borderRadius: BorderRadius.circular(50),
// color: Colors.blue),
// indicatorColor: Colors.transparent,
// dividerColor: Colors.transparent,
// splashFactory: NoSplash.splashFactory,
// tabs: [
// Tab(
// child: GestureDetector(
// onTap: () {
// print("Tab 0 ");
// },
// child: Container(
// decoration: BoxDecoration(
// borderRadius: BorderRadius.circular(50),
// border: Border.all(
// color: Colors.blue, width: 1)),
// child: const Align(
// alignment: Alignment.center,
// child: Text("ALL"),
// ),
// ),
// ),
// ),
// Tab(
// child: Container(
// decoration: BoxDecoration(
// borderRadius: BorderRadius.circular(50),
// border: Border.all(
// color: Colors.blue, width: 1)),
// child: const Align(
// alignment: Alignment.center,
// child: Text("Backend"),
// ),
// ),
// ),
// Tab(
// child: Container(
// decoration: BoxDecoration(
// borderRadius: BorderRadius.circular(50),
// border: Border.all(
// color: Colors.blue, width: 1)),
// child: const Align(
// alignment: Alignment.center,
// child: Text("FrontEnd"),
// ),
// ),
// ),
// ],
// ),
Consumer<TitleWiseJobCandidatesTab_Provider>(
builder: (context, titleTab, child) {
return Column(
children: [
SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Row(children: [
...value.titleWiseCandidates
.mapIndexed((ind, e) {
return GestureDetector(
onTap: () {
// titleTab.test();
titleTab.tabChanger(ind);
// print('Getting ind : ${ind}');
},
child: Container(
margin: const EdgeInsets.only(
right: 10),
padding: const EdgeInsets.only(
left: 12,
right: 12,
top: 6,
bottom: 6),
decoration: BoxDecoration(
color:
titleTab.currentTab == ind
? mainColor
: Colors.transparent,
borderRadius:
BorderRadius.circular(5),
border: Border.all(
color: Colors.blue.shade600,
width: 1)),
child: Align(
alignment: Alignment.center,
child: Text(
"${e['job_title']}",
style: TextStyle(
fontSize: 16,
fontFamily: 'Open Sans',
fontWeight: FontWeight.w600,
color:
titleTab.currentTab ==
ind
? Colors.white
: Colors.white70),
),
),
),
);
}).toList(),
GestureDetector(
onTap: () {
Get.to(() => const CreateJobScreen());
},
child: Container(
margin:
const EdgeInsets.only(right: 10),
padding: const EdgeInsets.only(
left: 18,
right: 18,
top: 6,
bottom: 6),
decoration: BoxDecoration(
borderRadius:
BorderRadius.circular(5),
border: Border.all(
color: Colors.blue.shade600,
width: 1)),
child: const Align(
alignment: Alignment.center,
child: Row(
children: [
Icon(
Icons.work_history_outlined,
size: 20),
Icon(Icons.add, size: 20)
],
),
),
),
)
]),
),
const SizedBox(height: 10),
],
);
},
)
// value.myJobs.length != 0 ? SingleChildScrollView(
// scrollDirection: Axis.horizontal,
// child: Padding(
// padding: const EdgeInsets.only(left: 10, right: 10),
// child: Row(
// mainAxisAlignment: MainAxisAlignment.spaceEvenly,
// children: List.generate(value.myJobs.length, (index) {
// return GestureDetector(
// onTap: () {
// setState(() {
// _currentIndex = index;
// });
// },
// child: AnimatedContainer(height: 40,
// padding: const EdgeInsets.symmetric(horizontal: 16),
// alignment: Alignment.center,
// duration: const Duration(milliseconds: 400),
// curve: Curves.easeIn,
// decoration: BoxDecoration(
// borderRadius: BorderRadius.circular(10),
// border: _currentIndex == index
// ? Border.all(color: const Color(0xFF00BAAB))
// : null,
// ),
// child: Text(
// value.myJobs[0]['skills'][index],
// style: const TextStyle(fontSize: 18),
// ),
// ),
// );
// }),
// ),
// ),
// ) : Container(
// width: 80,
// height: 40,
// decoration: BoxDecoration(
// borderRadius: BorderRadius.circular(50),
// border: Border.all(
// color: Colors.blue, width: 1)),
// child: const Align(
// alignment: Alignment.center,
// child: Text("ALL"),
// ),
// ),
],
),
),
),
Consumer2<TitleWiseJobCandidatesTab_Provider,
profileNcommon_provider>(
builder: (context, titleTabs, profile, child) {
return SliverList(
delegate: SliverChildBuilderDelegate(
(context, index) {
// print(
// "Injecting props to the candidate tile : ${profile.titleWiseCandidates[titleTabs.currentTab]}");
if (titleTabs.currentTab == 0) {
return Column(
children: [
Container(
padding: const EdgeInsets.only(top: 0),
),
PostTileWidget(
data: value.feedPosts[index],
)
],
);
} else {
return Column(
children: [
Container(
padding: const EdgeInsets.only(top: 10),
),
Candidate_Tile(
artistData: profile.titleWiseCandidates[
titleTabs.currentTab]
['usersRecords'][index]),
],
);
}
},
childCount: titleTabs.currentTab == 0
? profile.feedPosts.length
: profile
.titleWiseCandidates[titleTabs.currentTab]
['usersRecords']
.length,
),
);
},
),
SliverToBoxAdapter(
child: Consumer2<profileNcommon_provider,
TitleWiseJobCandidatesTab_Provider>(
builder: (context, profile, titleTab, child) {
// print("Test Null Array Issue : ${profile.titleWiseCandidates[titleTab.currentTab]['usersRecords'].length}");
return Container(
margin: const EdgeInsets.only(top: 40),
child: Visibility(
visible: titleTab.currentTab != 0
? profile
.titleWiseCandidates[titleTab
.currentTab]['usersRecords']
.length ==
0
? true
: false
: false,
child: const Text(
"Did not found any candidate on this preference, edit this preference or try after some time",
textAlign: TextAlign.center,
style: TextStyle(color: Colors.red),
),
),
);
},
),
)
// SliverList(
// delegate: SliverChildBuilderDelegate(
// (context, index) {
// //log("The tab controller is *****${value.myJobs.length}");
// if(_tabController.index == 1) {
// return Column(
// children: [
// Container(
// padding: const EdgeInsets.only(top: 10),
// ),
// ArtistProfile(artistData: value.feedPosts[index]),
// ],
// );
// }
// return null;
// },
// childCount: 10,
// ),
// ),
// SliverList(
// delegate: SliverChildBuilderDelegate(
// (context, index) {
// if(_tabController.index == 2) {
// return Padding(
// padding: const EdgeInsets.only(top: 10),
// child: ArtistProfile(artistData: value.feedPosts[index]),
// );
// }
// return null;
// },
// childCount: 10,
// ),
// ),
],
),
),
),
);
},
);
}
}
@shivam-cgm
Copy link
Author

Home

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment