Skip to content

Commit

Permalink
chore: Update fest page for INNO 23 (#208)
Browse files Browse the repository at this point in the history
* fix: Update schema of Event

* fix: Update explore page according to new event schema

* fix: Add ability to go back (willpopscope) in web view (webmail)

* fix: Minor fixes

* fix: Update event detail page according to new schema

* fix: View List of Description

* fix: calander for the events between the fesr dates only

* fix: Show only the events which has not been expired

* Fix: Event name in place of subheading in event detail page
  • Loading branch information
Mixel2004 authored Oct 23, 2023
1 parent 722e475 commit e64e599
Show file tree
Hide file tree
Showing 16 changed files with 180 additions and 66 deletions.
2 changes: 1 addition & 1 deletion elaichi/lib/data/remote/graphql/graphql_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ class GraphQLService {
queryString: Queries.getOrgs,
variables: {
//change this to 0, 1 to get latest org after PR merge in backend
'pagination': {'skip': 1, 'take': 1},
'pagination': {'skip': 0, 'take': 1},
'orgType': 'FEST'
},
);
Expand Down
2 changes: 2 additions & 0 deletions elaichi/lib/data/remote/graphql/queries.dart
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ class Queries {
event(orgID: $orgId, id: $eventId) {
id
name
subHeading
prizeMoney
description
poster
startDate
Expand Down
2 changes: 2 additions & 0 deletions elaichi/lib/domain/models/event/event.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ class Event with _$Event {
const factory Event({
required String id,
required String name,
required String subHeading,
required String prizeMoney,
required String description,
required String poster,
required DateTime startDate,
Expand Down
46 changes: 45 additions & 1 deletion elaichi/lib/domain/models/event/event.freezed.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ mixin _$Event {
String get id => throw _privateConstructorUsedError;
String get name => throw _privateConstructorUsedError;
String get description => throw _privateConstructorUsedError;
String get subHeading => throw _privateConstructorUsedError;
String get prizeMoney => throw _privateConstructorUsedError;
String get poster => throw _privateConstructorUsedError;
DateTime get startDate => throw _privateConstructorUsedError;
DateTime get endDate => throw _privateConstructorUsedError;
Expand Down Expand Up @@ -53,6 +55,8 @@ abstract class $EventCopyWith<$Res> {
{String id,
String name,
String description,
String subHeading,
String prizeMoney,
String poster,
DateTime startDate,
DateTime endDate,
Expand Down Expand Up @@ -87,6 +91,8 @@ class _$EventCopyWithImpl<$Res> implements $EventCopyWith<$Res> {
Object? id = freezed,
Object? name = freezed,
Object? description = freezed,
Object? subHeading = freezed,
Object? prizeMoney = freezed,
Object? poster = freezed,
Object? startDate = freezed,
Object? endDate = freezed,
Expand Down Expand Up @@ -117,6 +123,14 @@ class _$EventCopyWithImpl<$Res> implements $EventCopyWith<$Res> {
? _value.description
: description // ignore: cast_nullable_to_non_nullable
as String,
subHeading: subHeading == freezed
? _value.subHeading
: subHeading // ignore: cast_nullable_to_non_nullable
as String,
prizeMoney: prizeMoney == freezed
? _value.prizeMoney
: prizeMoney // ignore: cast_nullable_to_non_nullable
as String,
poster: poster == freezed
? _value.poster
: poster // ignore: cast_nullable_to_non_nullable
Expand Down Expand Up @@ -216,6 +230,8 @@ abstract class _$$_EventCopyWith<$Res> implements $EventCopyWith<$Res> {
{String id,
String name,
String description,
String subHeading,
String prizeMoney,
String poster,
DateTime startDate,
DateTime endDate,
Expand Down Expand Up @@ -253,6 +269,8 @@ class __$$_EventCopyWithImpl<$Res> extends _$EventCopyWithImpl<$Res>
Object? id = freezed,
Object? name = freezed,
Object? description = freezed,
Object? subHeading = freezed,
Object? prizeMoney = freezed,
Object? poster = freezed,
Object? startDate = freezed,
Object? endDate = freezed,
Expand Down Expand Up @@ -283,6 +301,14 @@ class __$$_EventCopyWithImpl<$Res> extends _$EventCopyWithImpl<$Res>
? _value.description
: description // ignore: cast_nullable_to_non_nullable
as String,
subHeading: subHeading == freezed
? _value.subHeading
: subHeading // ignore: cast_nullable_to_non_nullable
as String,
prizeMoney: prizeMoney == freezed
? _value.prizeMoney
: prizeMoney // ignore: cast_nullable_to_non_nullable
as String,
poster: poster == freezed
? _value.poster
: poster // ignore: cast_nullable_to_non_nullable
Expand Down Expand Up @@ -358,6 +384,8 @@ class _$_Event implements _Event {
{required this.id,
required this.name,
required this.description,
required this.subHeading,
required this.prizeMoney,
required this.poster,
required this.startDate,
required this.endDate,
Expand Down Expand Up @@ -389,6 +417,10 @@ class _$_Event implements _Event {
@override
final String description;
@override
final String subHeading;
@override
final String prizeMoney;
@override
final String poster;
@override
final DateTime startDate;
Expand Down Expand Up @@ -451,7 +483,7 @@ class _$_Event implements _Event {

@override
String toString() {
return 'Event(id: $id, name: $name, description: $description, poster: $poster, startDate: $startDate, endDate: $endDate, orgType: $orgType, notes: $notes, weekly: $weekly, repeatDay: $repeatDay, priority: $priority, type: $type, status: $status, locationID: $locationID, pocID: $pocID, orgID: $orgID, org: $org, location: $location, poc: $poc)';
return 'Event(id: $id, name: $name, description: $description, subHeading: $subHeading, prizeMoney: $prizeMoney, poster: $poster, startDate: $startDate, endDate: $endDate, orgType: $orgType, notes: $notes, weekly: $weekly, repeatDay: $repeatDay, priority: $priority, type: $type, status: $status, locationID: $locationID, pocID: $pocID, orgID: $orgID, org: $org, location: $location, poc: $poc)';
}

@override
Expand All @@ -463,6 +495,10 @@ class _$_Event implements _Event {
const DeepCollectionEquality().equals(other.name, name) &&
const DeepCollectionEquality()
.equals(other.description, description) &&
const DeepCollectionEquality()
.equals(other.subHeading, subHeading) &&
const DeepCollectionEquality()
.equals(other.prizeMoney, prizeMoney) &&
const DeepCollectionEquality().equals(other.poster, poster) &&
const DeepCollectionEquality().equals(other.startDate, startDate) &&
const DeepCollectionEquality().equals(other.endDate, endDate) &&
Expand All @@ -489,6 +525,8 @@ class _$_Event implements _Event {
const DeepCollectionEquality().hash(id),
const DeepCollectionEquality().hash(name),
const DeepCollectionEquality().hash(description),
const DeepCollectionEquality().hash(subHeading),
const DeepCollectionEquality().hash(prizeMoney),
const DeepCollectionEquality().hash(poster),
const DeepCollectionEquality().hash(startDate),
const DeepCollectionEquality().hash(endDate),
Expand Down Expand Up @@ -525,6 +563,8 @@ abstract class _Event implements Event {
{required final String id,
required final String name,
required final String description,
required final String subHeading,
required final String prizeMoney,
required final String poster,
required final DateTime startDate,
required final DateTime endDate,
Expand All @@ -551,6 +591,10 @@ abstract class _Event implements Event {
@override
String get description;
@override
String get subHeading;
@override
String get prizeMoney;
@override
String get poster;
@override
DateTime get startDate;
Expand Down
4 changes: 4 additions & 0 deletions elaichi/lib/domain/models/event/event.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions elaichi/lib/domain/repositories/events_repository.dart
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,19 @@ class EventRepository {
);

final format = DateFormat('MMM');
// TODO : Make this dynamic
const startDate = 3;
const endDate = 5;
for (final element in events) {
if (element.startDate.day < startDate) {
continue;
}
if (element.startDate.day > endDate) {
continue;
}
if (element.status == StatusType.EXPIRED) {
continue;
}
if (map.keys.contains(
'${element.startDate.day} ${format.format(element.startDate)}',
)) {
Expand Down
4 changes: 3 additions & 1 deletion elaichi/lib/domain/repositories/user_repository.dart
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ class UserRepository {
final userCredentials =
await _firebaseAuth.signInWithCredential(authCrendential);

await googleAuthenticated(await userCredentials.user!.getIdToken(true));
await googleAuthenticated(
(await userCredentials.user!.getIdToken(true))!,
);
} on firebase_auth.FirebaseException catch (e) {
throw LogInWithGoogleFailure.fromCode(e.code);
} catch (e) {
Expand Down
2 changes: 1 addition & 1 deletion elaichi/lib/presentation/components/custom_app_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import 'package:elaichi/presentation/core/theme/colors.dart';
import 'package:flutter/material.dart';

///Custom App Bar maintained through out the application
class CustomAppBar extends StatelessWidget with PreferredSizeWidget {
class CustomAppBar extends StatelessWidget implements PreferredSizeWidget {
/// Constrcutor for CustomAppBar.
const CustomAppBar({
Key? key,
Expand Down
32 changes: 24 additions & 8 deletions elaichi/lib/presentation/home/fest/explore/event_details_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class EventDetailsPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
final format = DateFormat('MMM');
final description = jsonDecode(event.description) as List<dynamic>;

return SafeArea(
child: Scaffold(
Expand Down Expand Up @@ -124,7 +125,7 @@ class EventDetailsPage extends StatelessWidget {
),
const SizedBox(height: 24),
Text(
jsonDecode(event.name)['heading'].toString(),
event.name,
style: interTextTheme.subtitle2!.copyWith(
color: Colors.white,
),
Expand All @@ -138,14 +139,29 @@ class EventDetailsPage extends StatelessWidget {
),
),
const SizedBox(height: 24),
if (description.isEmpty)
const Text('')
else
ListView.builder(
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
itemCount: description.length,
itemBuilder: (context, index) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
description[index]['desc'].toString(),
style: interTextTheme.bodyText1!.copyWith(
color: AppColors.grey6.withOpacity(0.8)),
),
const SizedBox(height: 14),
],
);
},
),
Text(
jsonDecode(event.description)[0]['desc'].toString(),
style: interTextTheme.bodyText1!
.copyWith(color: AppColors.grey6.withOpacity(0.8)),
),
const SizedBox(height: 24),
Text(
'Prize: ${jsonDecode(event.name)['prizeAmount'].toString()}',
'Prize: ${event.prizeMoney}',
style: interTextTheme.bodyText1!.copyWith(
fontSize: 14,
color: Colors.black,
Expand Down
35 changes: 27 additions & 8 deletions elaichi/lib/presentation/home/fest/explore/explore_page.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// 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/domain/models/event/event.dart';
import 'package:elaichi/domain/models/org/org.dart';
import 'package:elaichi/domain/repositories/events_repository.dart';
Expand Down Expand Up @@ -182,7 +183,7 @@ class _ExplorePageState extends State<ExplorePage>
),
const SizedBox(height: 24),
HighPriorityEventList(
events:
allEvents:
categorisedEvents[categorisedEvents.keys.toList()[0]]!,
),
const SizedBox(height: 80),
Expand All @@ -192,7 +193,7 @@ class _ExplorePageState extends State<ExplorePage>
),
const SizedBox(height: 24),
HighPriorityEventList(
events:
allEvents:
categorisedEvents[categorisedEvents.keys.toList()[1]]!,
),
const SizedBox(height: 80),
Expand Down Expand Up @@ -222,7 +223,7 @@ class _ExplorePageState extends State<ExplorePage>
),
const SizedBox(height: 24),
LowPriorityEventsList(
events:
allEvents:
categorisedEvents[categorisedEvents.keys.toList()[2]]!,
),
const SizedBox(height: 80),
Expand Down Expand Up @@ -252,7 +253,7 @@ class _ExplorePageState extends State<ExplorePage>
),
const SizedBox(height: 24),
LowPriorityEventsList(
events:
allEvents:
categorisedEvents[categorisedEvents.keys.toList()[3]]!,
),
const SizedBox(height: 80),
Expand Down Expand Up @@ -319,13 +320,22 @@ class SpeakerEventList extends StatelessWidget {
class LowPriorityEventsList extends StatelessWidget {
const LowPriorityEventsList({
Key? key,
required this.events,
required this.allEvents,
}) : super(key: key);

final List<Event> events;
final List<Event> allEvents;

@override
Widget build(BuildContext context) {
if (allEvents.isEmpty) {
return const SizedBox();
}
List<Event> events = [];
for (final event in allEvents) {
if (event.status != StatusType.EXPIRED) {
events.add(event);
}
}
final partedList = partition(events, 3).toList();
return SizedBox(
height: 330,
Expand Down Expand Up @@ -357,13 +367,22 @@ class LowPriorityEventsList extends StatelessWidget {
class HighPriorityEventList extends StatelessWidget {
const HighPriorityEventList({
Key? key,
required this.events,
required this.allEvents,
}) : super(key: key);

final List<Event> events;
final List<Event> allEvents;

@override
Widget build(BuildContext context) {
if (allEvents.isEmpty) {
return const SizedBox();
}
List<Event> events = [];
for (final event in allEvents) {
if (event.status != StatusType.EXPIRED) {
events.add(event);
}
}
return SizedBox(
height: 466,
child: ListView.builder(
Expand Down
Loading

0 comments on commit e64e599

Please sign in to comment.