diff --git a/elaichi/assets/images/hn_title.png b/elaichi/assets/images/hn_title.png new file mode 100644 index 00000000..3e8fc562 Binary files /dev/null and b/elaichi/assets/images/hn_title.png differ diff --git a/elaichi/lib/data/remote/graphql/graphql_service.dart b/elaichi/lib/data/remote/graphql/graphql_service.dart index cc279b1c..17b86131 100644 --- a/elaichi/lib/data/remote/graphql/graphql_service.dart +++ b/elaichi/lib/data/remote/graphql/graphql_service.dart @@ -1,6 +1,7 @@ // ignore_for_file: avoid_dynamic_calls import 'package:elaichi/data/constants/app_env.dart'; +import 'package:elaichi/data/constants/global_enums.dart'; import 'package:elaichi/data/remote/graphql/mutations.dart'; import 'package:elaichi/data/remote/graphql/queries.dart'; import 'package:elaichi/domain/models/event/event.dart'; @@ -8,6 +9,7 @@ import 'package:elaichi/domain/models/event_registration/event_registration.dart import 'package:elaichi/domain/models/mm_article/mm_article.dart'; import 'package:elaichi/domain/models/org/org.dart'; import 'package:elaichi/domain/models/user/user.dart'; +import 'package:elaichi/presentation/components/toasts/toast_util.dart'; import 'package:flutter/foundation.dart'; import 'package:graphql/client.dart'; @@ -112,7 +114,14 @@ class GraphQLService { .map((e) => Event.fromJson(e as Map)) .toList(); - return events; + final finalEvents = []; + for (final event in events) { + if (event.status == StatusType.ACTIVE) { + finalEvents.add(event); + } + } + + return finalEvents; } catch (e) { rethrow; } @@ -143,7 +152,7 @@ class GraphQLService { final result = await query(queryString: Queries.getUser, variables: {'uid': uid}); - final userList = (result.data!['user'] as List) + final userList = (result.data!["user"]["data"] as List) .map((e) => User.fromJson(e as Map)) .toList(); @@ -186,7 +195,7 @@ class GraphQLService { } } - Future createEventRegistration({ + Future createEventRegistration({ required String eventID, required String userID, }) async { @@ -204,7 +213,12 @@ class GraphQLService { ); return eventRegistration; } catch (e) { - rethrow; + final toastUtil = ToastUtil.getInstance(); + toastUtil.showToast( + mode: ToastMode.Info, + title: 'You have already registerd', + ); + return null; } } diff --git a/elaichi/lib/data/remote/graphql/queries.dart b/elaichi/lib/data/remote/graphql/queries.dart index ad58066a..815e3009 100644 --- a/elaichi/lib/data/remote/graphql/queries.dart +++ b/elaichi/lib/data/remote/graphql/queries.dart @@ -17,9 +17,9 @@ class Queries { } '''; - static const getOrgs = r''' - query Org ($pagination: paginationInputType, $orgType: OrgType){ - org(pagination: $pagination, orgType: $orgType){ + static const getOrgs = ''' + query Org { + org { id name description @@ -42,14 +42,17 @@ class Queries { static const getUser = r''' query User($uid: ID) { user(uid: $uid) { - id - email - uid - name - photo - rollNumber - college - mobile + data { + id + email + uid + name + photo + rollNumber + college + mobile + festID + } } } '''; diff --git a/elaichi/lib/domain/repositories/events_repository.dart b/elaichi/lib/domain/repositories/events_repository.dart index 9e246601..04a4fc9e 100644 --- a/elaichi/lib/domain/repositories/events_repository.dart +++ b/elaichi/lib/domain/repositories/events_repository.dart @@ -43,7 +43,7 @@ class EventRepository { } } - Future> createEventRegistration({ + Future> createEventRegistration({ required String eventID, required String userID, }) async { @@ -82,7 +82,14 @@ class EventRepository { } Map> getCategorisedEvents(List events) { - final map = >{}; + final map = >{ + 'TECHNICAL': [], + 'PRO': [], + 'GUEST-LECTURES': [], + 'EXHIBITIONS': [], + 'FUN': [], + 'WORKSHOP': [], + }; for (final element in events) { if (map.keys.contains(element.type)) { diff --git a/elaichi/lib/domain/repositories/user_repository.dart b/elaichi/lib/domain/repositories/user_repository.dart index 7a1b4d2a..6a555db8 100644 --- a/elaichi/lib/domain/repositories/user_repository.dart +++ b/elaichi/lib/domain/repositories/user_repository.dart @@ -76,7 +76,7 @@ class UserRepository { } } - Future getUser() async { + Future getUser() async { try { final user = await _graphQLService.getUser(_firebaseAuth.currentUser!.uid); @@ -86,13 +86,17 @@ class UserRepository { if (user.rollNumber != null) { _localStorageService.rollNumber = user.rollNumber; } + return user; } catch (e) { debugPrint(e.toString()); } + return null; } - Future getOrCreateUser( - {required String rollNumber, required String mobileNumber,}) async { + Future getOrCreateUser({ + required String rollNumber, + required String mobileNumber, + }) async { try { if (user == null) { final fbUser = _firebaseAuth.currentUser; diff --git a/elaichi/lib/presentation/browse/browse_page.dart b/elaichi/lib/presentation/browse/browse_page.dart index db9636f9..5749bfa4 100644 --- a/elaichi/lib/presentation/browse/browse_page.dart +++ b/elaichi/lib/presentation/browse/browse_page.dart @@ -68,7 +68,7 @@ class EventCard extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - jsonDecode(event.name)['subHeading'].toString(), + event.subHeading, style: interTextTheme.bodyMedium!.copyWith( fontWeight: FontWeight.w700, color: AppColors.grey3, @@ -78,7 +78,7 @@ class EventCard extends StatelessWidget { ), const SizedBox(height: 6), Text( - jsonDecode(event.name)['heading'].toString(), + event.name, style: interTextTheme.bodyMedium!.copyWith( fontWeight: FontWeight.w700, color: AppColors.grey2, diff --git a/elaichi/lib/presentation/core/router/app_router.dart b/elaichi/lib/presentation/core/router/app_router.dart index ae51b75d..d968b27f 100644 --- a/elaichi/lib/presentation/core/router/app_router.dart +++ b/elaichi/lib/presentation/core/router/app_router.dart @@ -68,6 +68,7 @@ class AppRouter { settings: settings, builder: (context) => AllEventsPage( events: map['events'] as Map>>, + controllIndex: map['index'] as int, ), ); @@ -81,7 +82,7 @@ class AppRouter { return AppPageRoute( settings: settings, builder: (context) => const RegistrationDetails(), - ); + ); case privacyPolicy: return AppPageRoute( settings: settings, diff --git a/elaichi/lib/presentation/core/utils/event_type_map.dart b/elaichi/lib/presentation/core/utils/event_type_map.dart index d5be9153..261c8a09 100644 --- a/elaichi/lib/presentation/core/utils/event_type_map.dart +++ b/elaichi/lib/presentation/core/utils/event_type_map.dart @@ -6,4 +6,5 @@ Map get eventTypeMapping => { 'EXHIBITIONS': 'Exhibitions', 'FUN': 'Fun Events', 'WORKSHOP': 'Workshops', + 'OTHER': 'Others', }; diff --git a/elaichi/lib/presentation/core/utils/strings.dart b/elaichi/lib/presentation/core/utils/strings.dart index 669a85a6..fa98a4d6 100644 --- a/elaichi/lib/presentation/core/utils/strings.dart +++ b/elaichi/lib/presentation/core/utils/strings.dart @@ -27,7 +27,7 @@ abstract class Strings { 'https://images.hindustantimes.com/img/2022/06/29/1600x900/NIT_Rourkela_main_entrance_(1)_1656490094321_1656490107321.jpg'; static const String kNitrImage = 'assets/images/nitr.png'; static const String kShaderImage = 'assets/images/shader.png'; - static const String hackNITR = 'assets/images/hack_nitr.png'; + static const String hackNITR = 'assets/images/hn_title.png'; static const String kStoriesthisWeek = ' Stories this week'; static const String kToday = 'Today'; static const String kViewCalendar = 'View Calendar'; diff --git a/elaichi/lib/presentation/core/utils/urlLauncher.dart b/elaichi/lib/presentation/core/utils/urlLauncher.dart index f4438140..a0d1313c 100644 --- a/elaichi/lib/presentation/core/utils/urlLauncher.dart +++ b/elaichi/lib/presentation/core/utils/urlLauncher.dart @@ -1,8 +1,9 @@ import 'package:url_launcher/url_launcher.dart'; -launchURL(String url) async { - if (await canLaunch(url)) { - await launch(url, enableJavaScript: true); +void launchURL(String url) async { + final uri = Uri.parse(url); + if (await canLaunchUrl(uri)) { + await launchUrl(uri); } else { throw 'Could not launch $url'; } diff --git a/elaichi/lib/presentation/home/fest/bloc/fest_bloc.dart b/elaichi/lib/presentation/home/fest/bloc/fest_bloc.dart index 0fab57b9..e646a27f 100644 --- a/elaichi/lib/presentation/home/fest/bloc/fest_bloc.dart +++ b/elaichi/lib/presentation/home/fest/bloc/fest_bloc.dart @@ -23,7 +23,7 @@ class FestBloc extends Bloc { (event, emit) async { await event.when( started: () async { - final status = isVerified(); + final status = await isVerified(); final fests = await _eventRepository.getFests(); @@ -44,8 +44,8 @@ class FestBloc extends Bloc { }, ); }, - webMailLogIn: () { - final status = isVerified(); + webMailLogIn: () async { + final status = await isVerified(); emit( (state as _Initial).copyWith( webMailState: status @@ -82,7 +82,9 @@ class FestBloc extends Bloc { } } - bool isVerified() { + Future isVerified() async { + final user = await _userRepository.getUser(); + if (user == null) return false; if (_userRepository.rollNumber != null) { return true; } else { diff --git a/elaichi/lib/presentation/home/fest/explore/all_events/all_events_page.dart b/elaichi/lib/presentation/home/fest/explore/all_events/all_events_page.dart index 744827ed..5270d1af 100644 --- a/elaichi/lib/presentation/home/fest/explore/all_events/all_events_page.dart +++ b/elaichi/lib/presentation/home/fest/explore/all_events/all_events_page.dart @@ -11,9 +11,14 @@ import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_svg/flutter_svg.dart'; class AllEventsPage extends StatefulWidget { - const AllEventsPage({super.key, required this.events}); + const AllEventsPage({ + super.key, + required this.events, + required this.controllIndex, + }); final Map>> events; + final int controllIndex; @override State createState() => _AllEventsPageState(); @@ -46,6 +51,7 @@ class _AllEventsPageState extends State { setState(() {}); }); _cubit = AllEventsCubit(); + _cubit.selectChip(widget.controllIndex); super.initState(); } diff --git a/elaichi/lib/presentation/home/fest/explore/cubit/registration_cubit.dart b/elaichi/lib/presentation/home/fest/explore/cubit/registration_cubit.dart index 1d53316b..6fd9e933 100644 --- a/elaichi/lib/presentation/home/fest/explore/cubit/registration_cubit.dart +++ b/elaichi/lib/presentation/home/fest/explore/cubit/registration_cubit.dart @@ -31,6 +31,11 @@ class RegistrationCubit extends Cubit { eventRegistration.fold( (exception) => emit(RegistrationState.error(error: exception.message!)), (eventRegistration) async { + eventRegistration ??= EventRegistration( + id: 'abc', + eventID: event.id, + userID: user.id, + ); eventRegistrations.add(eventRegistration); emit(const RegistrationState.success()); emit( diff --git a/elaichi/lib/presentation/home/fest/explore/event_details_page.dart b/elaichi/lib/presentation/home/fest/explore/event_details_page.dart index e8648f5b..918cfc95 100644 --- a/elaichi/lib/presentation/home/fest/explore/event_details_page.dart +++ b/elaichi/lib/presentation/home/fest/explore/event_details_page.dart @@ -153,7 +153,8 @@ class EventDetailsPage extends StatelessWidget { Text( description[index]['desc'].toString(), style: interTextTheme.bodyLarge!.copyWith( - color: AppColors.grey6.withOpacity(0.8),), + color: AppColors.grey6.withOpacity(0.8), + ), ), const SizedBox(height: 14), ], diff --git a/elaichi/lib/presentation/home/fest/explore/explore_page.dart b/elaichi/lib/presentation/home/fest/explore/explore_page.dart index c5a61989..c92e7d37 100644 --- a/elaichi/lib/presentation/home/fest/explore/explore_page.dart +++ b/elaichi/lib/presentation/home/fest/explore/explore_page.dart @@ -1,8 +1,10 @@ // ignore_for_file: avoid_unnecessary_containers, use_decorated_box import 'package:cached_network_image/cached_network_image.dart'; import 'package:elaichi/data/constants/global_enums.dart'; +import 'package:elaichi/data/remote/graphql/graphql_service.dart'; import 'package:elaichi/domain/models/event/event.dart'; import 'package:elaichi/domain/models/org/org.dart'; +import 'package:elaichi/domain/models/user/user.dart'; import 'package:elaichi/domain/repositories/events_repository.dart'; import 'package:elaichi/domain/repositories/user_repository.dart'; import 'package:elaichi/presentation/components/buttons/back_button.dart'; @@ -10,6 +12,7 @@ import 'package:elaichi/presentation/components/buttons/yellow_buttons.dart'; import 'package:elaichi/presentation/core/router/app_router.dart'; import 'package:elaichi/presentation/core/theme/base_theme.dart'; import 'package:elaichi/presentation/core/theme/colors.dart'; +import 'package:elaichi/presentation/core/utils/event_type_map.dart'; import 'package:elaichi/presentation/core/utils/sizeconfig.dart'; import 'package:elaichi/presentation/core/utils/strings.dart'; import 'package:elaichi/presentation/home/fest/bloc/fest_bloc.dart'; @@ -24,6 +27,7 @@ import 'package:elaichi/presentation/home/fest/widgets/header_widget.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:quiver/iterables.dart'; +import 'package:url_launcher/url_launcher_string.dart'; class ExplorePage extends StatefulWidget { const ExplorePage({ @@ -78,8 +82,10 @@ class _ExplorePageState extends State ? RegisterBottomBar( child: YellowFlatButton( text: 'Register Now!', - onTapped: () => - Navigator.pushNamed(context, AppRouter.registration), + onTapped: () => launchUrlString( + "https://inno.nitrkl.in/", + mode: LaunchMode.externalApplication, + ), ), ) : null, @@ -177,9 +183,29 @@ class _ExplorePageState extends State child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text( - '${categorisedEvents!.keys.toList()[0][0].toUpperCase()}${categorisedEvents.keys.toList()[0].substring(1).toLowerCase()}', - style: interTextTheme.displayMedium, + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + eventTypeMapping[categorisedEvents!.keys.toList()[0]]!, + style: interTextTheme.displayMedium, + ), + GestureDetector( + onTap: () => Navigator.pushNamed( + context, + AppRouter.allEvents, + arguments: {'events': widget.events, 'index': 2}, + ), + child: Text( + 'View More', + style: interTextTheme.bodyLarge!.copyWith( + fontSize: 14, + height: 1.21, + decoration: TextDecoration.underline, + ), + ), + ), + ], ), const SizedBox(height: 24), HighPriorityEventList( @@ -187,9 +213,29 @@ class _ExplorePageState extends State categorisedEvents[categorisedEvents.keys.toList()[0]]!, ), const SizedBox(height: 80), - Text( - '${categorisedEvents.keys.toList()[1][0].toUpperCase()}${categorisedEvents.keys.toList()[1].substring(1).toLowerCase()}', - style: interTextTheme.displayMedium, + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + eventTypeMapping[categorisedEvents.keys.toList()[1]]!, + style: interTextTheme.displayMedium, + ), + GestureDetector( + onTap: () => Navigator.pushNamed( + context, + AppRouter.allEvents, + arguments: {'events': widget.events, 'index': 1}, + ), + child: Text( + 'View More', + style: interTextTheme.bodyLarge!.copyWith( + fontSize: 14, + height: 1.21, + decoration: TextDecoration.underline, + ), + ), + ), + ], ), const SizedBox(height: 24), HighPriorityEventList( @@ -197,18 +243,49 @@ class _ExplorePageState extends State categorisedEvents[categorisedEvents.keys.toList()[1]]!, ), const SizedBox(height: 80), + if (categorisedEvents['GUEST-LECTURES']!.isNotEmpty) ...[ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + eventTypeMapping[categorisedEvents.keys.toList()[2]]!, + style: interTextTheme.displayMedium, + ), + GestureDetector( + onTap: () => Navigator.pushNamed( + context, + AppRouter.allEvents, + arguments: {'events': widget.events, 'index': 3}, + ), + child: Text( + 'View More', + style: interTextTheme.bodyLarge!.copyWith( + fontSize: 14, + height: 1.21, + decoration: TextDecoration.underline, + ), + ), + ), + ], + ), + const SizedBox(height: 24), + SpeakerEventList( + events: categorisedEvents['GUEST-LECTURES'] ?? [], + ), + const SizedBox(height: 80), + ], Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( - '${categorisedEvents.keys.toList()[2][0].toUpperCase()}${categorisedEvents.keys.toList()[2].substring(1).toLowerCase()}', + eventTypeMapping[categorisedEvents.keys.toList()[3]]!, style: interTextTheme.displayMedium, ), GestureDetector( onTap: () => Navigator.pushNamed( context, AppRouter.allEvents, - arguments: {'events': widget.events}, + arguments: {'events': widget.events, 'index': 4}, ), child: Text( 'View More', @@ -224,21 +301,21 @@ class _ExplorePageState extends State const SizedBox(height: 24), LowPriorityEventsList( allEvents: - categorisedEvents[categorisedEvents.keys.toList()[2]]!, + categorisedEvents[categorisedEvents.keys.toList()[3]]!, ), const SizedBox(height: 80), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( - '${categorisedEvents.keys.toList()[3][0].toUpperCase()}${categorisedEvents.keys.toList()[3].substring(1).toLowerCase()}', + eventTypeMapping[categorisedEvents.keys.toList()[4]]!, style: interTextTheme.displayMedium, ), GestureDetector( onTap: () => Navigator.pushNamed( context, AppRouter.allEvents, - arguments: {'events': widget.events}, + arguments: {'events': widget.events, 'index': 5}, ), child: Text( 'View More', @@ -254,22 +331,68 @@ class _ExplorePageState extends State const SizedBox(height: 24), LowPriorityEventsList( allEvents: - categorisedEvents[categorisedEvents.keys.toList()[3]]!, + categorisedEvents[categorisedEvents.keys.toList()[4]]!, + ), + const SizedBox(height: 80), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + eventTypeMapping[categorisedEvents.keys.toList()[5]]!, + style: interTextTheme.displayMedium, + ), + GestureDetector( + onTap: () => Navigator.pushNamed( + context, + AppRouter.allEvents, + arguments: {'events': widget.events, 'index': 6}, + ), + child: Text( + 'View More', + style: interTextTheme.bodyLarge!.copyWith( + fontSize: 14, + height: 1.21, + decoration: TextDecoration.underline, + ), + ), + ), + ], + ), + const SizedBox(height: 24), + LowPriorityEventsList( + allEvents: + categorisedEvents[categorisedEvents.keys.toList()[5]]!, ), const SizedBox(height: 80), - if ((categorisedEvents['GUEST-LECTURES '] ?? - categorisedEvents['WORKSHOPS'] ?? - []) - .isNotEmpty) ...[ - Text( - 'Guest Lectures', - style: interTextTheme.displayMedium, + if (categorisedEvents['OTHER']!.isNotEmpty) ...[ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + eventTypeMapping[categorisedEvents.keys.toList()[6]]!, + style: interTextTheme.displayMedium, + ), + GestureDetector( + onTap: () => Navigator.pushNamed( + context, + AppRouter.allEvents, + arguments: {'events': widget.events, 'index': 7}, + ), + child: Text( + 'View More', + style: interTextTheme.bodyLarge!.copyWith( + fontSize: 14, + height: 1.21, + decoration: TextDecoration.underline, + ), + ), + ), + ], ), const SizedBox(height: 24), - SpeakerEventList( - events: categorisedEvents['GUEST-LECTURES '] ?? - categorisedEvents['WORKSHOPS'] ?? - [], + LowPriorityEventsList( + allEvents: categorisedEvents[ + categorisedEvents.keys.toList()[6]]!, ), const SizedBox(height: 80), ], @@ -332,13 +455,14 @@ class LowPriorityEventsList extends StatelessWidget { } final events = []; for (final event in allEvents) { - if (event.status != StatusType.EXPIRED) { + if (event.status == StatusType.ACTIVE) { events.add(event); } } final partedList = partition(events, 3).toList(); + final colLength = events.length > 3 ? 3 : events.length; return SizedBox( - height: 330, + height: 110 * colLength.toDouble(), child: ListView.separated( clipBehavior: Clip.none, scrollDirection: Axis.horizontal, @@ -379,7 +503,7 @@ class HighPriorityEventList extends StatelessWidget { } final events = []; for (final event in allEvents) { - if (event.status != StatusType.EXPIRED) { + if (event.status == StatusType.ACTIVE) { events.add(event); } } diff --git a/elaichi/lib/presentation/home/fest/explore/widgets/scrolling_text.dart b/elaichi/lib/presentation/home/fest/explore/widgets/scrolling_text.dart index 8697db62..ef95fbd8 100644 --- a/elaichi/lib/presentation/home/fest/explore/widgets/scrolling_text.dart +++ b/elaichi/lib/presentation/home/fest/explore/widgets/scrolling_text.dart @@ -17,13 +17,14 @@ class ScrollingText extends StatelessWidget { Widget build(BuildContext context) { if (text.length > condition) { return SizedBox( - height: style.height, - child: Marquee( - text: text, - style: style, - pauseAfterRound: const Duration(seconds: 1), - blankSpace: 90, - ),); + height: style.height, + child: Marquee( + text: text, + style: style, + pauseAfterRound: const Duration(seconds: 1), + blankSpace: 90, + ), + ); } else { return Text(text, style: style); } diff --git a/elaichi/lib/presentation/home/fest/explore/widgets/speaker_event_card.dart b/elaichi/lib/presentation/home/fest/explore/widgets/speaker_event_card.dart index c51f50f2..138a995e 100644 --- a/elaichi/lib/presentation/home/fest/explore/widgets/speaker_event_card.dart +++ b/elaichi/lib/presentation/home/fest/explore/widgets/speaker_event_card.dart @@ -1,5 +1,3 @@ -import 'dart:convert'; - import 'package:elaichi/domain/models/event/event.dart'; import 'package:elaichi/presentation/components/buttons/yellow_buttons.dart'; import 'package:elaichi/presentation/components/toasts/toast_util.dart'; @@ -68,11 +66,11 @@ class SpeakerEventCard extends StatelessWidget { SizedBox( height: 29, child: ScrollingText( - text: jsonDecode(event.name)['heading'].toString(), + text: event.name, style: interTextTheme.titleSmall!.copyWith( color: Colors.black, ), - condition: 28, + condition: 10, ), ), const SizedBox(height: 4), diff --git a/elaichi/lib/presentation/home/fest/fest_page.dart b/elaichi/lib/presentation/home/fest/fest_page.dart index e8bcd895..1fa8f471 100644 --- a/elaichi/lib/presentation/home/fest/fest_page.dart +++ b/elaichi/lib/presentation/home/fest/fest_page.dart @@ -1,5 +1,6 @@ import 'package:cached_network_image/cached_network_image.dart'; import 'package:carousel_slider/carousel_slider.dart'; +import 'package:elaichi/domain/repositories/events_repository.dart'; import 'package:elaichi/presentation/core/router/app_router.dart'; import 'package:elaichi/presentation/core/theme/base_theme.dart'; import 'package:elaichi/presentation/core/utils/sizeconfig.dart'; @@ -51,7 +52,7 @@ class _FestPageState extends State { SizedBox( height: 544, child: CarouselSlider.builder( - itemCount: fests.length, + itemCount: 1, options: CarouselOptions( height: 544, autoPlay: true, @@ -134,12 +135,21 @@ class _FestPageState extends State { padding: const EdgeInsets.symmetric( horizontal: 16, ), - child: Column( - children: [ - if (!_bloc.isVerified()) const WebMailCard(), - if (!_bloc.isVerified()) const SizedBox(height: 36), - // const FeaturedEvents(), - ], + child: FutureBuilder( + future: _bloc.isVerified(), + builder: (context, snapshot) { + if (snapshot.hasData) { + if (!(snapshot.data as bool?)!) { + return const Column( + children: [ + WebMailCard(), + SizedBox(height: 36), + ], + ); + } + } + return const SizedBox(); + }, ), ), Padding( @@ -153,7 +163,9 @@ class _FestPageState extends State { child: Text( 'Featured Events', style: interTextTheme.displayMedium!.copyWith( - letterSpacing: -0.41, color: Colors.white, fontSize: 26, + letterSpacing: -0.41, + color: Colors.white, + fontSize: 26, ), ), ), diff --git a/elaichi/lib/presentation/home/fest/widgets/featured_events.dart b/elaichi/lib/presentation/home/fest/widgets/featured_events.dart index f5003d48..52038d33 100644 --- a/elaichi/lib/presentation/home/fest/widgets/featured_events.dart +++ b/elaichi/lib/presentation/home/fest/widgets/featured_events.dart @@ -1,9 +1,9 @@ import 'package:elaichi/presentation/core/theme/base_theme.dart'; import 'package:elaichi/presentation/core/theme/colors.dart'; import 'package:elaichi/presentation/core/utils/strings.dart'; -import 'package:elaichi/presentation/core/utils/urlLauncher.dart'; import 'package:elaichi/presentation/home/fest/explore/widgets/duration_dates.dart'; import 'package:flutter/material.dart'; +import 'package:url_launcher/url_launcher_string.dart'; class FeaturedEvents extends StatelessWidget { const FeaturedEvents({super.key}); @@ -19,7 +19,6 @@ class FeaturedEvents extends StatelessWidget { ), const SizedBox(height: 20), const FeaturedEventCard(), - const SizedBox(height: 20), ], ); } @@ -33,7 +32,7 @@ class FeaturedEventCard extends StatelessWidget { @override Widget build(BuildContext context) { return SizedBox( - height: 448, + height: 280, child: PhysicalModel( elevation: 3, color: Colors.black, @@ -42,8 +41,8 @@ class FeaturedEventCard extends StatelessWidget { children: [ Image.asset( Strings.hackNITR, - height: 250, - fit: BoxFit.cover, + height: 100, + fit: BoxFit.fill, ), Padding( padding: const EdgeInsets.symmetric(horizontal: 16), @@ -51,30 +50,6 @@ class FeaturedEventCard extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ const SizedBox(height: 12), - SizedBox( - height: 20, - child: Text( - 'Featured Event', - style: interTextTheme.titleMedium!.copyWith( - letterSpacing: -0.41, - color: AppColors.white2, - ), - ), - ), - const SizedBox(height: 4), - SizedBox( - height: 28, - child: Text( - 'HackNITR 5.0', - style: interTextTheme.bodyLarge!.copyWith( - fontSize: 22, - height: 1.27, - letterSpacing: 0.35, - fontWeight: FontWeight.w700, - color: AppColors.grey8, - ), - ), - ), const SizedBox(height: 8), SizedBox( height: 32, @@ -111,7 +86,7 @@ class FeaturedEventCard extends StatelessWidget { width: 110, child: TextButton( onPressed: () { - launchURL('https://hacknitr.com'); + launchUrlString('https://hacknitr.com/'); }, style: TextButton.styleFrom( backgroundColor: AppColors.lightBlue,