Skip to content

Commit

Permalink
Merge pull request #31 from Divyakumar21202/main
Browse files Browse the repository at this point in the history
I've resolved the issue regarding to Pagination Logic with Applied Filter
  • Loading branch information
Divyakumar21202 authored Sep 21, 2024
2 parents cb90018 + 3013bde commit 594f33a
Show file tree
Hide file tree
Showing 31 changed files with 1,100 additions and 603 deletions.
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ Service made to allow transactions of mess coupons between IIIT-Bh Students.

<h2>To setup locally</h2>

1.Clone or Fork this repository along with [Coupon Aggregator backend](https://github.com/p-society/coupon-aggregator-server).
<h3>1.Clone or Fork this repository along with [Coupon Aggregator backend](https://github.com/p-society/coupon-aggregator-server).</h3>

2.Start the Coupon Aggregator server.
<h3>2.Start the Coupon Aggregator server.</h3>

3.Create a .env file.
<h3>3.Create a .env file.</h3>

4.Place the following in it.
<h3>4.Place the following in it.</h3>
```bash
Base_URL="http://10.0.2.2:3030/"
```
Expand Down Expand Up @@ -81,3 +81,7 @@ Made with [contributors-img](https://contributors-img.web.app).
# License <a name="License"></a>

GC-Server and GC-Client is licensed under [Apache License](https://github.com/p-society/coupon-aggregator-client/blob/master/LICENSE)


# C o n t r i b u t i o n
Contributions are welcome! Feel free to reach out with any queries regarding contributions.
48 changes: 48 additions & 0 deletions lib/Global/Functions/my_error_dialog.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
// import 'package:flutter/material.dart';

// bool _errorDisplayed = false; // Global flag to track the display status

// void showMyMessage({required String message, required BuildContext context}) {
// if (_errorDisplayed) return; // Prevent showing multiple toasts

// _errorDisplayed = true;

// final overlay = Overlay.of(context);
// final overlayEntry = OverlayEntry(
// builder: (context) => Positioned(
// bottom: MediaQuery.of(context).size.height *
// 0.02, // Adjust the position as needed
// left: MediaQuery.of(context).size.width * 0.03,
// right: MediaQuery.of(context).size.width * 0.03,
// child: Material(
// color: Colors.transparent,
// child: Container(
// padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 10.0),
// decoration: BoxDecoration(
// color: Colors.red.withOpacity(0.9),
// borderRadius: BorderRadius.circular(8.0),
// ),
// child: Row(
// mainAxisSize: MainAxisSize.min,
// children: [
// const Icon(Icons.error_outline, color: Colors.white),
// const SizedBox(width: 10),
// Text(
// message,
// style: const TextStyle(
// color: Colors.white, fontWeight: FontWeight.bold),
// ),
// ],
// ),
// ),
// ),
// ),
// );

// overlay.insert(overlayEntry);

// Future.delayed(const Duration(seconds: 1, milliseconds: 10), () {
// overlayEntry.remove();
// _errorDisplayed = false; // Reset the flag after the toast disappears
// });
// }
8 changes: 6 additions & 2 deletions lib/Global/Functions/screen_transition.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ void navigateToNextScreen({
return PageRouteBuilder(
pageBuilder: (context, animation, secondaryAnimation) => nextScreen,
transitionsBuilder: (context, animation, secondaryAnimation, child) {
const begin = Offset(1.0, 0.0); const end = Offset(0.0, 0.0); const curve = Curves.easeInOut;
const begin = Offset(1.0, 0.0);
const end = Offset(0.0, 0.0);
const curve = Curves.easeInOut;

var tween =
Tween(begin: begin, end: end).chain(CurveTween(curve: curve));
Expand All @@ -34,7 +36,9 @@ void navigateAndPopToNextScreen({
return PageRouteBuilder(
pageBuilder: (context, animation, secondaryAnimation) => nextScreen,
transitionsBuilder: (context, animation, secondaryAnimation, child) {
const begin = Offset(1.0, 0.0); const end = Offset(0.0, 0.0); const curve = Curves.easeInOut;
const begin = Offset(1.0, 0.0);
const end = Offset(0.0, 0.0);
const curve = Curves.easeInOut;

var tween =
Tween(begin: begin, end: end).chain(CurveTween(curve: curve));
Expand Down
25 changes: 25 additions & 0 deletions lib/Global/effects/shimmer_widget.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import 'package:flutter/material.dart';
import 'package:mess_mgmt/Global/effects/shimmer_effect.dart';

class ShimmerWidget extends StatelessWidget {
const ShimmerWidget({super.key});

@override
Widget build(BuildContext context) {
return ShimmerEffect(
child: Card(
margin: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(16)),
elevation: 8,
child: Container(
height: 180,
width: double.infinity,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(16),
),
),
),
);
}
}
9 changes: 9 additions & 0 deletions lib/Global/enums/pagination_enum.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,15 @@ extension PaginationEnumExtension on PaginationEnum {
return const SizedBox();
case PaginationEnum.initial:
return ElevatedButton.icon(
style: ButtonStyle(
shape: WidgetStatePropertyAll(
RoundedRectangleBorder(
borderRadius: BorderRadius.circular(
8,
),
),
),
),
onPressed: onPressed,
label: const Text('Load More !'),
);
Expand Down
2 changes: 1 addition & 1 deletion lib/Global/theme/app_theme.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class AppTheme {
static ThemeData lightTheme() {
return ThemeData(
scaffoldBackgroundColor: Colors.white,
primaryColor: primaryColor,
primaryColor: const Color.fromARGB(255, 21, 82, 187),
colorScheme: ColorScheme.fromSwatch().copyWith(
primary: primaryColor,
secondary: Colors.lightBlueAccent,
Expand Down
57 changes: 27 additions & 30 deletions lib/Global/widgets/custom_error_messenger.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:flutter/material.dart';

showError(BuildContext context, String title, String subtitle) {
showError(BuildContext context,
{required String title, required String description}) {
final theme = Theme.of(context);

final snackBar = SnackBar(
Expand All @@ -12,43 +13,39 @@ import 'package:flutter/material.dart';
),
margin: const EdgeInsets.all(16),
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 16),
content: Row(
content: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Icon(Icons.error_outline, color: Colors.red.shade700, size: 28),
const SizedBox(width: 16),
Expanded(
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
title,
style: theme.textTheme.titleMedium?.copyWith(
color: Colors.red.shade700,
fontWeight: FontWeight.bold,
),
),
const SizedBox(height: 6),
Text(
subtitle,
style: theme.textTheme.bodyMedium?.copyWith(
color: Colors.red.shade900,
),
),
],
Text(
title,
style: theme.textTheme.titleMedium?.copyWith(
color: Colors.red.shade700,
fontWeight: FontWeight.bold,
),
),
const SizedBox(height: 16),
Text(
description,
style: theme.textTheme.bodyMedium?.copyWith(
color: Colors.red.shade900,
),
),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
SnackBarAction(
label: 'DISMISS',
textColor: Colors.red.shade700,
onPressed: () {
ScaffoldMessenger.of(context).hideCurrentSnackBar();
},
),
],
),
],
),
duration: const Duration(seconds: 5),
action: SnackBarAction(
label: 'DISMISS',
textColor: Colors.red.shade700,
onPressed: () {
ScaffoldMessenger.of(context).hideCurrentSnackBar();
},
),
);

ScaffoldMessenger.of(context).showSnackBar(snackBar);
Expand Down
74 changes: 49 additions & 25 deletions lib/Global/widgets/custom_pwd_tile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,33 +7,48 @@ class CustomPwdTile extends StatefulWidget {
final TextInputType type;
final IconData icon;
final ValueChanged<String?> onChanged;
final bool isPassword;
final FormFieldValidator? validator;

const CustomPwdTile(
{super.key,
required this.hintText,
required this.controller,
required this.type,
required this.icon,
required this.onChanged,
required bool isPassword,
this.validator});
const CustomPwdTile({
super.key,
required this.hintText,
required this.controller,
required this.type,
required this.icon,
required this.onChanged,
this.isPassword = true, // Default to true since it's a password field
this.validator,
});

@override
State<CustomPwdTile> createState() => _CustomPwdTileState();
}

class _CustomPwdTileState extends State<CustomPwdTile> {
bool isObscure = true;
late bool _isObscure;

void pwdVisibility() {
setState(() {
isObscure = !isObscure;
});
@override
void initState() {
super.initState();
_isObscure = true; // Passwords are obscured by default
}

@override
Widget build(BuildContext context) {
final suffixIcon = widget.isPassword
? IconButton(
icon: _isObscure
? const Icon(Icons.visibility)
: const Icon(Icons.visibility_outlined),
onPressed: () {
setState(() {
_isObscure = !_isObscure;
});
},
)
: null;

return ConstrainedBox(
constraints: const BoxConstraints(
minHeight: 60.0,
Expand All @@ -43,32 +58,41 @@ class _CustomPwdTileState extends State<CustomPwdTile> {
width: 300,
child: TextFormField(
validator: widget.validator,
obscureText: isObscure,
obscureText: _isObscure,
controller: widget.controller,
onChanged: widget.onChanged,
decoration: InputDecoration(
prefixIcon: Icon(
widget.icon,
color: AppTheme.lightTheme().primaryColor,
),
border: OutlineInputBorder(
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(
color: AppTheme.lightTheme().primaryColor,
),
borderRadius: BorderRadius.circular(10),
),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(
color: Colors.grey.shade400,
color: AppTheme.lightTheme().primaryColor,
width: 2.0,
),
borderRadius: BorderRadius.circular(10),
),
errorBorder: OutlineInputBorder(
borderSide: const BorderSide(
color: Colors.red,
width: 2.0,
),
borderRadius: BorderRadius.circular(10),
),
hintText: widget.hintText,
hintStyle:const TextStyle(fontSize: 18),
hintStyle: const TextStyle(fontSize: 15),
contentPadding: const EdgeInsets.symmetric(
horizontal: 10.0,
vertical: 5,
),
suffixIcon: IconButton(
icon: Icon(
isObscure ? Icons.visibility : Icons.visibility_off,
),
onPressed: pwdVisibility,
vertical: 15.0,
),
suffixIcon: suffixIcon,
),
keyboardType: widget.type,
),
Expand Down
Loading

0 comments on commit 594f33a

Please sign in to comment.