Skip to content

Commit

Permalink
merges main into casper/hostel_change
Browse files Browse the repository at this point in the history
  • Loading branch information
am-casper committed Feb 16, 2024
2 parents ad5a7c1 + 95056c5 commit a1da3ee
Show file tree
Hide file tree
Showing 35 changed files with 1,307 additions and 517 deletions.
2 changes: 1 addition & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
namespace "in.ac.iitr.mdg.appetizer"
compileSdkVersion 33
compileSdkVersion 34
ndkVersion flutter.ndkVersion

compileOptions {
Expand Down
330 changes: 330 additions & 0 deletions assets/images/meal_card/Snacks.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions lib/data/constants/env_config.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,6 @@ class EnvironmentConfig {
);

static const String SENTRY_DSN = String.fromEnvironment('SENTRY_DSN');
static const String MIXPANEL_PROJECT_KEY =
String.fromEnvironment('MIXPANEL_PROJECT_KEY');
}
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 @@ -17,4 +17,5 @@ class AppPathsRegistry {
static const String leavesAndRebate = 'leavesAndRebate';
static const String feedback = 'feedback';
static const String hostelChange = 'hostelChange';
static const String resetPassword = 'resetPassword';
}
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 @@ -55,6 +55,10 @@ class AppRoutesRegistry {
path: AppPathsRegistry.feedback,
page: FeedbackRoute.page,
),
CustomRoute(
path: AppPathsRegistry.resetPassword,
page: ResetPasswordRoute.page,
),
CustomRoute(
path: AppPathsRegistry.hostelChange,
page: HostelChangeRoute.page,
Expand Down
12 changes: 12 additions & 0 deletions lib/domain/amenity/mixpanel_service.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import 'package:appetizer/data/constants/env_config.dart';
import 'package:mixpanel_flutter/mixpanel_flutter.dart';

class MixpanelManager {
static Mixpanel? instance;

static Future<Mixpanel> init() async {
instance ??= await Mixpanel.init(EnvironmentConfig.MIXPANEL_PROJECT_KEY,
trackAutomaticEvents: true);
return instance!;
}
}
3 changes: 3 additions & 0 deletions lib/presentation/app/bloc/app_bloc.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'dart:async';
import 'package:appetizer/data/constants/constants.dart';
import 'package:appetizer/data/services/local/local_storage_service.dart';
import 'package:appetizer/domain/amenity/mixpanel_service.dart';
import 'package:appetizer/domain/models/user/user.dart';
import 'package:appetizer/domain/repositories/leave/leave_repository.dart';
import 'package:appetizer/domain/repositories/user/user_repository.dart';
Expand Down Expand Up @@ -70,6 +71,8 @@ class AppBloc extends Bloc<AppEvent, AppState> {

FutureOr<void> _onNavigateToHome(
NavigateToHomeScreen event, Emitter<AppState> emit) {
assert(state.user != null);
MixpanelManager.instance?.identify(state.user!.enrNo.toString());
emit(state.copyWith(navigateTo: NavigateTo.showHomeScreen));
}

Expand Down
22 changes: 0 additions & 22 deletions lib/presentation/bottom_navigator/bottom_navigator_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ import 'package:appetizer/data/core/router/intrinsic_router/intrinsic_router.gr.
import 'package:appetizer/domain/repositories/coupon_repository.dart';
import 'package:appetizer/domain/repositories/leave/leave_repository.dart';
import 'package:appetizer/domain/repositories/menu_repository.dart';
import 'package:appetizer/presentation/app/bloc/app_bloc.dart';
import 'package:appetizer/domain/repositories/transaction_repositroy.dart';
import 'package:appetizer/presentation/components/round_edge_container.dart';
import 'package:appetizer/domain/repositories/user/user_repository.dart';
import 'package:appetizer/presentation/leaves_and_rebate/bloc/leaves_and_rebate_bloc.dart';
import 'package:appetizer/presentation/profile/bloc/profile_page_bloc.dart';
Expand Down Expand Up @@ -63,26 +61,6 @@ class BottomNavigatorScreen extends StatelessWidget {
return Scaffold(
backgroundColor: Colors.white,
body: child,
floatingActionButton: Visibility(
visible: tabRouter.activeIndex == 1,
child: BlocSelector<AppBloc, AppState, bool>(
selector: (appState) => appState.user!.isCheckedOut,
builder: (context, isCheckedOut) {
if (isCheckedOut) return const SizedBox();

return GestureDetector(
onTap: () {
context
.read<AppBloc>()
.add(const ToggleCheckOutStatusEvent());
},
child: const RoundEdgeTextOnlyContainer(text: "CHECK OUT"),
);
},
),
),
floatingActionButtonLocation:
FloatingActionButtonLocation.centerFloat,
bottomNavigationBar: BottomNavigationBar(
key: UniqueKey(),
currentIndex: tabRouter.activeIndex,
Expand Down
68 changes: 68 additions & 0 deletions lib/presentation/components/app_formfield.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import 'package:appetizer/data/core/theme/dimensional/dimensional.dart';
import 'package:appetizer/presentation/components/app_textfield.dart';
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';

class AppFormField extends StatelessWidget {
const AppFormField({
super.key,
required this.hintText,
this.controller,
this.onChanged,
this.obscureText,
this.suffix,
this.border,
required this.title,
this.maxLength,
this.maxLines,
this.titleStyle,
}) : assert(
obscureText == null || suffix != null,
'Suffix should be provided if obscureText is provided',
),
assert(
controller != null || onChanged != null,
'Either controller or onChanged should be provided',
);

final String hintText;
final TextEditingController? controller;
final Function(String)? onChanged;
final bool? obscureText;
final Widget? suffix;
final InputBorder? border;
final String title;
final int? maxLength;
final int? maxLines;
final TextStyle? titleStyle;

@override
Widget build(BuildContext context) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
title,
style: titleStyle ??
GoogleFonts.notoSans(
fontSize: 18.toAutoScaledFont,
fontWeight: FontWeight.w600,
),
),
SizedBox(
height: title == "Description" ? 0 : 20.toAutoScaledHeight,
),
AppTextField(
controller: controller,
onChanged: onChanged,
obscureText: obscureText,
hintText: hintText,
suffix: suffix,
border: border,
maxLength: maxLength,
maxLines: maxLines,
),
],
);
}
}
61 changes: 61 additions & 0 deletions lib/presentation/components/app_textfield.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import 'package:appetizer/data/core/theme/dimensional/dimensional.dart';
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';

class AppTextField extends StatelessWidget {
const AppTextField({
super.key,
required this.hintText,
this.controller,
this.onChanged,
this.obscureText,
this.suffix,
this.border,
this.maxLength,
this.maxLines,
}) : assert(
obscureText == null || suffix != null,
'Suffix should be provided if obscureText is provided',
),
assert(
controller != null || onChanged != null,
'Either controller or onChanged should be provided',
);

final String hintText;
final TextEditingController? controller;
final Function(String)? onChanged;
final bool? obscureText;
final Widget? suffix;
final InputBorder? border;
final int? maxLength;
final int? maxLines;

@override
Widget build(BuildContext context) {
return TextField(
controller: controller,
onChanged: onChanged,
obscureText: obscureText ?? false,
decoration: InputDecoration(
hintText: hintText,
hintStyle: GoogleFonts.lato(
fontSize: 12.toAutoScaledFont,
color: const Color(0xFF111111),
fontWeight: FontWeight.w600,
),
border: border ??
OutlineInputBorder(
borderSide: BorderSide(
color: const Color(0xFF111111).withOpacity(0.25)),
borderRadius: BorderRadius.circular(5),
),
contentPadding: EdgeInsets.symmetric(
horizontal: 20.toAutoScaledWidth,
vertical: 15.toAutoScaledHeight),
suffixIcon: suffix),
maxLength: maxLength,
maxLines: maxLines ?? 1,
);
}
}
8 changes: 4 additions & 4 deletions lib/presentation/components/black_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ class BlackButton extends StatelessWidget {
required this.title,
required this.onTap,
required this.width,
Key? key,
}) : super(key: key);
super.key,
});

final VoidCallback onTap;
final String title;
Expand Down Expand Up @@ -48,8 +48,8 @@ class BlackIconButton extends StatelessWidget {
required this.onTap,
required this.width,
required this.icon,
Key? key,
}) : super(key: key);
super.key,
});

final VoidCallback onTap;
final String title;
Expand Down
58 changes: 26 additions & 32 deletions lib/presentation/components/no_data_found_container.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,44 +3,38 @@ import 'package:flutter/material.dart';
// import 'package:flutter_svg/flutter_svg.dart';

class NoDataFoundContainer extends StatelessWidget {
const NoDataFoundContainer({
required this.title,
Key? key,
}) : super(key: key);
const NoDataFoundContainer({required this.title, super.key});

final String title;

@override
Widget build(BuildContext context) {
return Container(
alignment: Alignment.center,
padding: EdgeInsets.only(top: 150.toAutoScaledHeight),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
// TODO: check why svg doesnt work
// SvgPicture.asset(
// 'assets/images/no_data_image.svg',
// // 'assets/images/no_data_image.svg',
// height: 178.toAutoScaledHeight,
// width: 186.toAutoScaledWidth,
// ),
Image.asset(
'assets/images/no_data_image.png',
height: 178.toAutoScaledHeight,
width: 186.toAutoScaledWidth,
return Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
// TODO: check why svg doesnt work
// SvgPicture.asset(
// 'assets/images/no_data_image.svg',
// // 'assets/images/no_data_image.svg',
// height: 178.toAutoScaledHeight,
// width: 186.toAutoScaledWidth,
// ),
Image.asset(
'assets/images/no_data_image.png',
height: 178.toAutoScaledHeight,
width: 186.toAutoScaledWidth,
),
Text(
title,
style: TextStyle(
color: const Color(0xFF111111),
fontSize: 18.toAutoScaledFont,
fontFamily: 'Noto Sans',
fontWeight: FontWeight.w400,
),
Text(
title,
style: TextStyle(
color: const Color(0xFF111111),
fontSize: 18.toAutoScaledFont,
fontFamily: 'Noto Sans',
fontWeight: FontWeight.w400,
),
),
],
),
),
],
);
}
}
5 changes: 1 addition & 4 deletions lib/presentation/coupons/components/coupon_row.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@ import 'package:appetizer/presentation/coupons/components/coupon_card.dart';
import 'package:flutter/material.dart';

class CouponRow extends StatelessWidget {
const CouponRow({
required this.coupons,
Key? key,
}) : super(key: key);
const CouponRow({required this.coupons, super.key});

final List<Coupon> coupons;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ class FeedbackTile extends StatelessWidget {
required this.title,
required this.parentState,
required this.index,
Key? key,
}) : super(key: key);
super.key,
});

final String title;
final FeedbackPageState parentState;
Expand Down
22 changes: 10 additions & 12 deletions lib/presentation/feedback/feedback_view.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/repositories/feedback_repository.dart';
import 'package:appetizer/presentation/components/app_formfield.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';
Expand Down Expand Up @@ -72,29 +73,26 @@ class FeedbackScreen extends StatelessWidget {
fontWeight: FontWeight.w400,
),
),
Text(
'Description',
style: TextStyle(
AppFormField(
hintText: "",
title: "Description",
controller: textController,
titleStyle: TextStyle(
color: Colors.black.withOpacity(0.5400000214576721),
fontSize: 12.toAutoScaledFont,
fontFamily: 'Open Sans',
fontWeight: FontWeight.w400,
),
),
TextField(
controller: textController,
onChanged: (value) => context
.read<FeedbackPageBloc>()
.add(FeedbackPageDescriptionChangedEvent(
description: value)),
maxLength: 200,
maxLines: 5,
decoration: InputDecoration(
border: OutlineInputBorder(
borderSide: BorderSide(
width: 0.5.toAutoScaledWidth,
color: const Color.fromARGB(37, 0, 0, 0),
),
border: OutlineInputBorder(
borderSide: BorderSide(
width: 0.5.toAutoScaledWidth,
color: const Color.fromARGB(37, 0, 0, 0),
),
),
),
Expand Down
Loading

0 comments on commit a1da3ee

Please sign in to comment.