Skip to content

Commit

Permalink
feat: added route for event purchase view
Browse files Browse the repository at this point in the history
  • Loading branch information
AhsanRns committed May 27, 2024
1 parent d12d656 commit 139f110
Show file tree
Hide file tree
Showing 6 changed files with 233 additions and 15 deletions.
2 changes: 1 addition & 1 deletion wallet/lib/ipc/handler/handlers/create_recipe_handler.dart
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class CreateRecipeHandler implements BaseHandler {
if (msgObj.cookbookId.contains(kEvently)) {
final events = await Events.eventFromRecipeId(msgObj.cookbookId, msgObj.id);
if (events != null) {
await navigatorKey.currentState!.pushNamed(Routes.eventView.name, arguments: events);
await navigatorKey.currentState!.pushNamed(Routes.eventOwnerView.name, arguments: events);
}
} else {
final nft = await NFT.fromRecipeId(msgObj.cookbookId, msgObj.id);
Expand Down
6 changes: 3 additions & 3 deletions wallet/lib/ipc/ipc_engine.dart
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,9 @@ class IPCEngine {
handleEventlyLink(
link: initialLink,
getEventFromRecipe: getEventsFromRecipe,
showOwnerView: (events) => navigatorKey.currentState!.pushNamed(Routes.eventView.name, arguments: events),
showCreateAccountView: (events) => showCreateAccountView,
showPurchaseView: (events) => showPurchaseView,
showOwnerView: (events) => navigatorKey.currentState!.pushNamed(Routes.eventOwnerView.name, arguments: events),
showCreateAccountView: (events) => {},
showPurchaseView: (events) => navigatorKey.currentState!.pushNamed(Routes.eventPurchaseView.name, arguments: events),
);
} else if (_isEaselUniLink(initialLink)) {
onLogEvent(AnalyticsEventEnum.easelLink);
Expand Down
204 changes: 204 additions & 0 deletions wallet/lib/pages/events/event_purchase_view.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,204 @@
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:pylons_wallet/components/space_widgets.dart';
import 'package:pylons_wallet/model/event.dart';
import 'package:pylons_wallet/utils/constants.dart';

class EventPurchaseView extends StatefulWidget {
const EventPurchaseView({super.key, required this.events});

final Events events;

@override
State<EventPurchaseView> createState() => _EventPurchaseViewState();
}

class _EventPurchaseViewState extends State<EventPurchaseView> {
@override
void initState() {
super.initState();
}

@override
Widget build(BuildContext context) {
return EventPassViewContent(
events: widget.events,
);
}
}

class EventPassViewContent extends StatelessWidget {
const EventPassViewContent({
super.key,
required this.events,
});

final Events events;

@override
Widget build(BuildContext context) {
return ColoredBox(
color: AppColors.kBlack87,
child: SafeArea(
child: Scaffold(
backgroundColor: AppColors.kBlack87,
appBar: AppBar(
backgroundColor: Colors.black,
flexibleSpace: Padding(
padding: EdgeInsets.symmetric(horizontal: 20.w),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
const Icon(
Icons.arrow_back_ios,
color: AppColors.kWhite,
),
Text(
'Event Pass',
style: TextStyle(
fontSize: 18.sp,
fontWeight: FontWeight.w700,
color: AppColors.kWhite,
),
),
GestureDetector(
onTap: () {},
child: SvgPicture.asset(shareIcon),
),
],
),
),
),
body: Column(
children: [
Container(
margin: EdgeInsets.symmetric(horizontal: 20.w),
padding: EdgeInsets.symmetric(horizontal: 20.w, vertical: 20.h),
decoration: BoxDecoration(color: AppColors.kBlue),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
events.eventName,
style: Theme.of(context).textTheme.displayLarge?.copyWith(fontSize: 25.sp, fontWeight: FontWeight.w700, color: AppColors.kWhite),
),
VerticalSpace(20.h),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Date',
style: Theme.of(context).textTheme.displayLarge?.copyWith(fontSize: 11.sp, fontWeight: FontWeight.w400, color: AppColors.kWhite),
),
Text(
events.startDate,
style: Theme.of(context).textTheme.labelSmall?.copyWith(fontSize: 15.sp, fontWeight: FontWeight.w700, color: AppColors.kWhite),
),
],
),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Time',
style: Theme.of(context).textTheme.displayLarge?.copyWith(fontSize: 11.sp, fontWeight: FontWeight.w400, color: AppColors.kWhite),
),
Text(
events.startTime,
style: Theme.of(context).textTheme.labelSmall?.copyWith(fontSize: 15.sp, fontWeight: FontWeight.w700, color: AppColors.kWhite),
),
],
)
],
),
VerticalSpace(20.h),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'LOCATION',
style: Theme.of(context).textTheme.displayLarge?.copyWith(fontSize: 11.sp, fontWeight: FontWeight.w400, color: AppColors.kWhite),
),
Text(
events.location,
style: Theme.of(context).textTheme.labelSmall?.copyWith(fontSize: 15.sp, fontWeight: FontWeight.w700, color: AppColors.kWhite),
),
],
),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'PRICE',
style: Theme.of(context).textTheme.displayLarge?.copyWith(fontSize: 11.sp, fontWeight: FontWeight.w400, color: AppColors.kWhite),
),
Text(
events.price == "0" ? "Free" : events.price,
style: Theme.of(context).textTheme.labelSmall?.copyWith(fontSize: 15.sp, fontWeight: FontWeight.w700, color: AppColors.kWhite),
),
],
)
],
),
VerticalSpace(20.h),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'PERKS',
style: TextStyle(fontSize: 11.sp, fontWeight: FontWeight.w400, color: AppColors.kWhite),
),
SizedBox(height: 1.h),
Row(
children: [
SvgPicture.asset(kDiamondIcon),
SizedBox(width: 5.w),
Text(
'x ${events.listOfPerks?.length}',
style: TextStyle(fontSize: 15.sp, color: AppColors.kWhite, fontWeight: FontWeight.bold),
),
SizedBox(width: 5.w),
Text(
'Redeem',
style: TextStyle(fontSize: 15.sp, color: AppColors.kGreenText, fontWeight: FontWeight.bold),
)
],
)
],
),
],
),
],
),
),
Container(
margin: EdgeInsets.symmetric(horizontal: 20.w),
child: CachedNetworkImage(
fit: BoxFit.fill,
imageUrl: events.thumbnail,
errorWidget: (a, b, c) => const Center(
child: Icon(
Icons.error_outline,
color: AppColors.kWhite,
)),
// placeholder: (context, url) => Shimmer(color: AppColors.kLightGray, child: const SizedBox.expand()),
),
)
],
),
),
),
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@ import 'package:pylons_wallet/model/event.dart';
import 'package:pylons_wallet/pages/detailed_asset_view/owner_view_view_model.dart';
import 'package:pylons_wallet/utils/constants.dart';

class EventPassViewScreen extends StatefulWidget {
const EventPassViewScreen({super.key, required this.events});
class EventOwnerView extends StatefulWidget {
const EventOwnerView({super.key, required this.events});

final Events events;

@override
State<EventPassViewScreen> createState() => _EventPassViewScreenState();
State<EventOwnerView> createState() => _EventOwnerViewState();
}

class _EventPassViewScreenState extends State<EventPassViewScreen> {
class _EventOwnerViewState extends State<EventOwnerView> {
OwnerViewViewModel ownerViewViewModel = GetIt.I.get();

@override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ class NONNftCreations extends StatelessWidget {

if (recipe.cookbookId.contains(kEvently)) {
final events = Events.fromRecipe(recipe);
navigatorKey.currentState!.pushNamed(Routes.eventView.name, arguments: events);
navigatorKey.currentState!.pushNamed(Routes.eventOwnerView.name, arguments: events);
return;
}

Expand Down
26 changes: 20 additions & 6 deletions wallet/lib/utils/route_util.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
// ignore_for_file: cast_nullable_to_non_nullable

import 'package:flutter/material.dart';
import 'package:pylons_wallet/pages/events/events_screen.dart';
import 'package:pylons_wallet/pages/events/event_purchase_view.dart';
import 'package:pylons_wallet/pages/events/events_owner_view.dart';
import 'package:pylons_wallet/pages/settings/screens/general_screen/general_screen.dart';
import 'package:pylons_wallet/pages/settings/screens/recovery_screen/recovery_screen.dart';

Expand Down Expand Up @@ -113,9 +114,19 @@ class RouteUtil {
return createRoute(const SizedBox());
case Routes.transactionHistory:
return createRoute(const TransactionHistoryScreen());
case Routes.eventView:
case Routes.eventOwnerView:
if (settings.arguments != null && settings.arguments is Events) {
return createRoute(EventPassViewScreen(
return createRoute(EventOwnerView(
key: ValueKey(settings.arguments),
events: settings.arguments as Events,
));
}

return createRoute(const SizedBox());

case Routes.eventPurchaseView:
if (settings.arguments != null && settings.arguments is Events) {
return createRoute(EventPurchaseView(
key: ValueKey(settings.arguments),
events: settings.arguments as Events,
));
Expand Down Expand Up @@ -158,7 +169,8 @@ enum Routes {
transactionHistory,
acceptPolicy,
fallback,
eventView;
eventOwnerView,
eventPurchaseView;

static Routes getAppRouteFromString(String routeName) {
switch (routeName) {
Expand Down Expand Up @@ -210,8 +222,10 @@ enum Routes {
return localTransactionDetails;
case 'transactionHistory':
return transactionHistory;
case 'eventView':
return eventView;
case 'eventOwnerView':
return eventOwnerView;
case 'eventPurchaseView':
return eventPurchaseView;
default:
return fallback;
}
Expand Down

0 comments on commit 139f110

Please sign in to comment.