Skip to content

Commit

Permalink
fix: Redirect to website for fest registration (#217)
Browse files Browse the repository at this point in the history
* fix: Redirect to website if not registered to fest

* update: Added boarder to hacknitr event

* chore: add location to query

---------

Co-authored-by: Ashish Padhy <[email protected]>
  • Loading branch information
Mixel2004 and Shurtu-gal authored Nov 1, 2023
1 parent af02714 commit 1449ea3
Show file tree
Hide file tree
Showing 6 changed files with 120 additions and 93 deletions.
6 changes: 6 additions & 0 deletions elaichi/lib/data/remote/graphql/queries.dart
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@ class Queries {
type
status
locationID
location {
name
description
lat
long
}
pocID
orgID
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ class RegistrationCubit extends Cubit<RegistrationState> {

List<EventRegistration> eventRegistrations = [];

Future<void> createEventRegistration({required Event event}) async {
Future<void> createEventRegistration({
required Event event,
required String page,
}) async {
emit(RegistrationState.loading(eventID: event.id));

final user = _userRepository.user;
Expand All @@ -29,7 +32,8 @@ class RegistrationCubit extends Cubit<RegistrationState> {
userID: user.id,
);
eventRegistration.fold(
(exception) => emit(RegistrationState.error(error: exception.message!)),
(exception) =>
emit(RegistrationState.error(error: '${exception.message!} $page')),
(eventRegistration) async {
eventRegistration ??= EventRegistration(
id: 'abc',
Expand All @@ -46,7 +50,7 @@ class RegistrationCubit extends Cubit<RegistrationState> {
},
);
} else {
emit(const RegistrationState.error(error: 'User Not Registered'));
emit(RegistrationState.error(error: 'User Not Registered $page'));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,15 @@ class EventDetailsPage extends StatelessWidget {
child: Scaffold(
bottomNavigationBar: RegisterBottomBar(
child: BlocConsumer<RegistrationCubit, RegistrationState>(
bloc: context.read<RegistrationCubit>(),
listener: (context, state) {
state.whenOrNull(
success: () {},
error: (error) {
if (error == 'User Not Registered') {
Navigator.pushNamed(
context,
AppRouter.registration,
if (error == 'User Not Registered Event_Details') {
toastUtil.showToast(
mode: ToastMode.Error,
title: 'Please Register for Fest First',
);
} else {
toastUtil.showToast(
Expand Down Expand Up @@ -69,6 +70,7 @@ class EventDetailsPage extends StatelessWidget {
.read<RegistrationCubit>()
.createEventRegistration(
event: event,
page: 'Event_Details',
);
},
text: 'Register',
Expand All @@ -80,6 +82,7 @@ class EventDetailsPage extends StatelessWidget {
.read<RegistrationCubit>()
.createEventRegistration(
event: event,
page: 'Event_Details',
);
},
text: 'Register',
Expand All @@ -95,6 +98,7 @@ class EventDetailsPage extends StatelessWidget {
.read<RegistrationCubit>()
.createEventRegistration(
event: event,
page: 'Event_Details',
);
},
text: 'Register',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import 'package:elaichi/presentation/home/fest/explore/widgets/scrolling_text.da
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:intl/intl.dart';
import 'package:url_launcher/url_launcher_string.dart';

class HighPriorityEventCard extends StatelessWidget {
HighPriorityEventCard({
Expand Down Expand Up @@ -134,15 +135,11 @@ class HighPriorityEventCard extends StatelessWidget {
listener: (context, state) {
state.whenOrNull(
error: (error) {
if (error == 'User Not Registered') {
Navigator.pushNamed(
context,
AppRouter.registration,
);
} else {
toastUtil.showToast(
mode: ToastMode.Error,
title: error,
if (error ==
'User Not Registered High_Priority_Event') {
launchUrlString(
'https://inno.nitrkl.in/',
mode: LaunchMode.externalApplication,
);
}
},
Expand All @@ -164,6 +161,7 @@ class HighPriorityEventCard extends StatelessWidget {
.read<RegistrationCubit>()
.createEventRegistration(
event: event,
page: 'High_Priority_Event',
);
},
text: 'Register',
Expand All @@ -176,6 +174,7 @@ class HighPriorityEventCard extends StatelessWidget {
.read<RegistrationCubit>()
.createEventRegistration(
event: event,
page: 'High_Priority_Event',
);
},
text: 'Register',
Expand All @@ -192,6 +191,7 @@ class HighPriorityEventCard extends StatelessWidget {
.read<RegistrationCubit>()
.createEventRegistration(
event: event,
page: 'High_Priority_Event',
);
},
text: 'Register',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import 'package:elaichi/presentation/home/fest/explore/widgets/scrolling_text.da
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:intl/intl.dart';
import 'package:url_launcher/url_launcher_string.dart';

class SpeakerEventCard extends StatelessWidget {
SpeakerEventCard({
Expand Down Expand Up @@ -127,18 +128,14 @@ class SpeakerEventCard extends StatelessWidget {
children: [
const SizedBox(width: 2),
BlocConsumer<RegistrationCubit, RegistrationState>(
bloc: context.read<RegistrationCubit>(),
listener: (context, state) {
state.whenOrNull(
error: (error) {
if (error == 'User Not Registered') {
Navigator.pushNamed(
context,
AppRouter.registration,
);
} else {
toastUtil.showToast(
mode: ToastMode.Error,
title: error,
if (error == 'User Not Registered Speaker') {
launchUrlString(
'https://inno.nitrkl.in/',
mode: LaunchMode.externalApplication,
);
}
},
Expand All @@ -159,6 +156,7 @@ class SpeakerEventCard extends StatelessWidget {
.read<RegistrationCubit>()
.createEventRegistration(
event: event,
page: 'Speaker',
);
},
text: 'Register',
Expand All @@ -171,6 +169,7 @@ class SpeakerEventCard extends StatelessWidget {
.read<RegistrationCubit>()
.createEventRegistration(
event: event,
page: 'Speaker',
);
},
text: 'Register',
Expand All @@ -187,6 +186,7 @@ class SpeakerEventCard extends StatelessWidget {
.read<RegistrationCubit>()
.createEventRegistration(
event: event,
page: 'Speaker',
);
},
text: 'Register',
Expand Down
149 changes: 81 additions & 68 deletions elaichi/lib/presentation/home/fest/widgets/featured_events.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,86 +32,99 @@ class FeaturedEventCard extends StatelessWidget {
@override
Widget build(BuildContext context) {
return SizedBox(
height: 280,
height: 250,
child: PhysicalModel(
elevation: 3,
color: Colors.black,
shadowColor: Colors.grey,
child: Column(
children: [
Image.asset(
Strings.hackNITR,
height: 100,
fit: BoxFit.fill,
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
color: Colors.black,
border: Border.all(
color: AppColors.grey16.withOpacity(0.6),
width: 2,
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const SizedBox(height: 12),
const SizedBox(height: 8),
SizedBox(
height: 32,
child: Text(
'Explore further into your innovation journey with HackNITR 5.0 and manifest your skills.',
style: interTextTheme.bodyMedium!.copyWith(
fontWeight: FontWeight.w500,
color: AppColors.grey,
fontSize: 12,
height: 1.33,
),
),
),
const SizedBox(height: 16),
const Divider(
thickness: 1,
height: 1,
color: AppColors.grey16,
),
const SizedBox(height: 12),
SizedBox(
height: 50,
width: 326,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
const DurationDates(
text: 'Coming Soon.',
),
padding: const EdgeInsets.all(15),
child: Column(
children: [
Image.asset(
Strings.hackNITR,
height: 75,
fit: BoxFit.fill,
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const SizedBox(height: 12),
const SizedBox(height: 8),
SizedBox(
height: 32,
child: Text(
'Explore further into your innovation journey with HackNITR 5.0 and manifest your skills.',
style: interTextTheme.bodyMedium!.copyWith(
fontWeight: FontWeight.w500,
color: AppColors.grey,
fontSize: 14,
fontSize: 12,
height: 1.33,
),
SizedBox(
height: 50,
width: 110,
child: TextButton(
onPressed: () {
launchUrlString('https://hacknitr.com/');
},
style: TextButton.styleFrom(
backgroundColor: AppColors.lightBlue,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(25),
),
),
const SizedBox(height: 16),
const Divider(
thickness: 1,
height: 1,
color: AppColors.grey16,
),
const SizedBox(height: 12),
SizedBox(
height: 50,
width: 326,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
const DurationDates(
text: 'Coming Soon.',
color: AppColors.grey,
fontSize: 14,
),
SizedBox(
height: 50,
width: 110,
child: TextButton(
onPressed: () {
launchUrlString(
'https://hacknitr.com/',
mode: LaunchMode.externalApplication,
);
},
style: TextButton.styleFrom(
backgroundColor: AppColors.lightBlue,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(25),
),
),
),
child: Text(
'Visit Website',
style: interTextTheme.bodyMedium!.copyWith(
fontWeight: FontWeight.w500,
height: 1.28,
color: Colors.white,
letterSpacing: -0.41,
child: Text(
'Visit Website',
style: interTextTheme.bodyMedium!.copyWith(
fontWeight: FontWeight.w500,
height: 1.28,
color: Colors.white,
letterSpacing: -0.41,
),
),
),
),
),
],
],
),
),
),
],
],
),
),
),
],
],
),
),
),
);
Expand Down

0 comments on commit 1449ea3

Please sign in to comment.