Skip to content

Commit

Permalink
Notification and Coupon Card
Browse files Browse the repository at this point in the history
  • Loading branch information
aman-singh7 committed Sep 24, 2023
2 parents 766f5a0 + bb65fa0 commit be989d1
Show file tree
Hide file tree
Showing 12 changed files with 237 additions and 211 deletions.
1 change: 1 addition & 0 deletions lib/data/core/router/registry/paths.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ class AppPathsRegistry {
static const String coupon = 'coupon';
static const String weekMenu = 'weekMenu';
static const String leavesAndRebate = 'leavesAndRebate';
static const String feedback = 'feedback';
}
4 changes: 4 additions & 0 deletions lib/data/core/router/registry/routes.dart
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ class AppRoutesRegistry {
path: AppPathsRegistry.notification,
page: NotificationRoute.page,
),
CustomRoute(
path: AppPathsRegistry.feedback,
page: FeedbackRoute.page,
),
],
),
];
Expand Down
2 changes: 1 addition & 1 deletion lib/domain/models/menu/week_menu_tmp.dart
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ class Meal {
hostelName: json['hostel_name'],
secretCode: json['secret_code'],
isOutdated:
!DateTimeUtils.getDateTimeFromDateAndTime(date, json['start_time'])
!DateTimeUtils.getDateTimeFromDateAndTime(date, json['end_time'])
.isAfter(DateTime.now()),
isLeaveToggleOutdated:
!DateTimeUtils.getDateTimeFromDateAndTime(date, json['start_time'])
Expand Down
5 changes: 3 additions & 2 deletions lib/presentation/coupons/components/coupon_card.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:appetizer/app_theme.dart';
import 'package:appetizer/data/core/theme/dimensional/dimensional.dart';
import 'package:appetizer/domain/models/coupon/coupon.dart';
import 'package:appetizer/utils/date_time_utils.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';

Expand All @@ -25,7 +26,7 @@ class CouponCard extends StatelessWidget {
child: SvgPicture.asset('assets/images/coupon.svg'),
),
Container(
width: 101.toAutoScaledWidth,
width: 110.toAutoScaledWidth,
padding: EdgeInsets.only(
top: 12.toAutoScaledHeight,
left: 8.toAutoScaledWidth,
Expand Down Expand Up @@ -67,7 +68,7 @@ class CouponCard extends StatelessWidget {
),
6.toVerticalSizedBox,
Text(
coupon.mealType,
"${coupon.mealType}, ${DateTimeUtils.getFormattedDate(coupon.mealDate)}",
style: TextStyle(
color: const Color(0xFF2E2E2E),
fontSize: 10.toAutoScaledFont,
Expand Down
7 changes: 4 additions & 3 deletions lib/presentation/coupons/coupons_view.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:appetizer/data/core/theme/dimensional/dimensional.dart';
import 'package:appetizer/domain/models/coupon/coupon.dart';
import 'package:appetizer/domain/repositories/coupon_repository.dart';
import 'package:appetizer/presentation/components/loading_indicator.dart';
import 'package:appetizer/presentation/components/no_data_found_container.dart';
import 'package:appetizer/presentation/coupons/bloc/coupons_page_bloc.dart';
import 'package:appetizer/presentation/coupons/components/coupon_banner.dart';
Expand All @@ -27,8 +28,8 @@ class CouponsScreen extends StatelessWidget {
child: BlocBuilder<CouponsPageBloc, CouponsPageState>(
builder: (context, state) {
if (state is CouponsPageInitialState) {
return const NoDataFoundContainer(
title: 'Cannot find the user !');
return const Expanded(
child: Center(child: LoadingIndicator()));
}
if (state is CouponsPageFailedState) {
// TODO: add logic to handle fail
Expand Down Expand Up @@ -61,7 +62,7 @@ class CouponsScreen extends StatelessWidget {
);
}
return const NoDataFoundContainer(
title: 'No coupons selected !');
title: 'No coupons selected!');
},
),
),
Expand Down
12 changes: 3 additions & 9 deletions lib/presentation/feedback/components/feedback_banner.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:appetizer/app_theme.dart';
import 'package:appetizer/data/core/theme/dimensional/dimensional.dart';
import 'package:appetizer/presentation/components/app_banner.dart';
import 'package:auto_route/auto_route.dart';
import 'package:flutter/material.dart';

class FeedbackBanner extends StatelessWidget {
Expand All @@ -9,18 +10,11 @@ class FeedbackBanner extends StatelessWidget {
@override
Widget build(BuildContext context) {
return AppBanner(
height: 120.toAutoScaledHeight,
height: 140.toAutoScaledHeight,
child: Row(
children: [
IconButton(
onPressed: () {
// TODO: navigate to menu page
// BaseApp.router.navigateToPage(
// YourWeekMenuRoute(
// weekMenu: const WeekMenu(),
// ),
// );
},
onPressed: context.router.pop,
icon: const Icon(
Icons.arrow_back,
color: Colors.white,
Expand Down
30 changes: 13 additions & 17 deletions lib/presentation/feedback/feedback_view.dart
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
import 'package:appetizer/app_theme.dart';
import 'package:appetizer/data/core/theme/dimensional/dimensional.dart';
import 'package:appetizer/domain/repositories/feedback_repository.dart';
import 'package:appetizer/presentation/components/black_button.dart';
import 'package:appetizer/presentation/feedback/bloc/feedback_page_bloc.dart';
import 'package:appetizer/presentation/feedback/components/FeedbackTile/feedback_tile.dart';
import 'package:appetizer/presentation/feedback/components/feedback_banner.dart';
import 'package:auto_route/auto_route.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';

class FeedbackPage extends StatelessWidget {
FeedbackPage({super.key});
@RoutePage()
class FeedbackScreen extends StatelessWidget {
FeedbackScreen({super.key});
final TextEditingController textController = TextEditingController();
static const List<String> feedbackHeadings = [
"Ambience",
Expand All @@ -21,31 +24,23 @@ class FeedbackPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: AppTheme.white,
body: BlocProvider(
create: (context) =>
FeedbackPageBloc(repo: context.read<FeedbackRepository>()),
child: BlocBuilder<FeedbackPageBloc, FeedbackPageState>(
builder: (context, state) {
if (!state.submitted) {
// TODO: navigate to menu page
// BaseApp.router.navigateToPage(
// YourWeekMenuRoute(
// weekMenu: const WeekMenu(),
// ),
// );
}
return Column(
children: [
const FeedbackBanner(),
// TODO: fix the top edge of SCSV where top elements get hidden
Expanded(
child: SingleChildScrollView(
padding: const EdgeInsets.only(left: 24, right: 26),
padding: 24.toHorizontalPadding,
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
9.toVerticalSizedBox,
Text(
'Kindly provide us with your feedback to improve your mess experienWeekly Menuce.',
style: TextStyle(
Expand All @@ -66,7 +61,7 @@ class FeedbackPage extends StatelessWidget {
index: ind,
),
);
}),
}, growable: false),
2.toVerticalSizedBox,
Text(
'If any other feeback, please describe below',
Expand Down Expand Up @@ -107,10 +102,11 @@ class FeedbackPage extends StatelessWidget {
Align(
alignment: Alignment.bottomRight,
child: BlackIconButton(
onTap: () => context.read<FeedbackPageBloc>().add(
FeedbackPageSubmitEvent(
rating: state.rating,
description: state.description)),
onTap: context.router.pop,
// onTap: () => context.read<FeedbackPageBloc>().add(
// FeedbackPageSubmitEvent(
// rating: state.rating,
// description: state.description)),
title: "SUBMIT",
width: 102,
icon: Icons.keyboard_double_arrow_right_sharp,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:appetizer/data/core/theme/dimensional/dimensional.dart';
import 'package:appetizer/utils/date_time_utils.dart';
import 'package:flutter/material.dart';
import 'package:appetizer/domain/models/user/notification.dart' as notification;

Expand All @@ -12,6 +13,7 @@ class NotificationCard extends StatelessWidget {

@override
Widget build(BuildContext context) {
String date = DateTimeUtils.dateTimeWithoutSeconds(data.dateCreated);
return Container(
height: 127.toAutoScaledHeight,
width: 312.toAutoScaledWidth,
Expand Down Expand Up @@ -56,7 +58,7 @@ class NotificationCard extends StatelessWidget {
),
Expanded(
child: Text(
'${data.dateCreated}',
date,
style: TextStyle(
color: const Color(0xFF2E2E2E),
fontSize: 10.toAutoScaledFont,
Expand Down
7 changes: 4 additions & 3 deletions lib/presentation/notifications/notification_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,11 @@ class NotificationScreen extends StatelessWidget {
Container(
height: 656.toAutoScaledHeight,
padding: EdgeInsets.only(
left: 24.toAutoScaledWidth,
right: 25.toAutoScaledWidth,
top: 32.toAutoScaledHeight),
left: 24.toAutoScaledWidth,
right: 25.toAutoScaledWidth,
),
child: ListView.builder(
padding: EdgeInsets.zero,
itemCount: state.notifications.length,
itemBuilder: (context, index) {
return Column(
Expand Down
Loading

0 comments on commit be989d1

Please sign in to comment.