Skip to content

Commit

Permalink
Merge pull request #23 from Divyakumar21202/main
Browse files Browse the repository at this point in the history
Business Logic for Pagination for Dashboard View Screen.
  • Loading branch information
Divyakumar21202 authored Aug 25, 2024
2 parents 5d4eea4 + 4787844 commit 440755b
Show file tree
Hide file tree
Showing 29 changed files with 865 additions and 223 deletions.
Binary file modified README.md
Binary file not shown.
1 change: 1 addition & 0 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.INTERNET" />
<application
android:label="mess_mgmt"
android:name="${applicationName}"
Expand Down
2 changes: 1 addition & 1 deletion android/settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pluginManagement {
plugins {
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
id "com.android.application" version "7.3.0" apply false
id "org.jetbrains.kotlin.android" version "1.7.10" apply false
id "org.jetbrains.kotlin.android" version "2.0.10" apply false
}

include ":app"
6 changes: 6 additions & 0 deletions assets/svg_image/isVeg.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed flutter_01.png
Binary file not shown.
Binary file removed flutter_02.png
Binary file not shown.
Binary file removed flutter_03.png
Binary file not shown.
19 changes: 19 additions & 0 deletions lib/Global/enums/pagination_enum.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import 'package:flutter/material.dart';
import 'package:mess_mgmt/Global/widgets/loader.dart';

enum PaginationEnum {
/// when its in initial/success state
initial,
Expand All @@ -8,3 +11,19 @@ enum PaginationEnum {
/// when no more data left
empty,
}

extension PaginationEnumExtension on PaginationEnum {
Widget getPaginationwidget({required VoidCallback onPressed}) {
switch (this) {
case PaginationEnum.empty:
return const SizedBox();
case PaginationEnum.initial:
return ElevatedButton.icon(
onPressed: onPressed,
label: const Text('Load More !'),
);
case PaginationEnum.loading:
return const AppLoader();
}
}
}
20 changes: 10 additions & 10 deletions lib/Global/widgets/custom_filter_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -82,23 +82,23 @@ void showFilterDialog({
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
TextButton(
style: TextButton.styleFrom(
foregroundColor: Colors.white.withOpacity(0.8),
),
onPressed: () {
Navigator.of(context).pop();
},
child: const Text("Cancel"),
),
// TextButton(
// style: TextButton.styleFrom(
// foregroundColor: Colors.white.withOpacity(0.8),
// ),
// onPressed: () {
// Navigator.of(context).pop();
// },
// child: const Text("Cancel"),
// ),
TextButton(
style: TextButton.styleFrom(
foregroundColor: Colors.white.withOpacity(0.8),
),
onPressed: () async {
Navigator.of(context).pop();
},
child: const Text("Apply"),
child: const Text("Done"),
),
],
),
Expand Down
130 changes: 68 additions & 62 deletions lib/Global/widgets/custom_list_tile.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:mess_mgmt/Global/models/coupon_data_model.dart';
import 'package:mess_mgmt/Global/widgets/my_list_tile.dart';

class GlassyListTile extends StatelessWidget {
final CouponDataModel coupon;
Expand All @@ -10,68 +11,73 @@ class GlassyListTile extends StatelessWidget {
required this.coupon,
required this.i,
});

@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.all(8.0),
child: Card(
color: Colors.blueAccent,
elevation: 5,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20),
),
child: Container(
decoration: BoxDecoration(
color: Colors.white.withOpacity(0.2),
borderRadius: BorderRadius.circular(20),
border: Border.all(
color: Colors.white.withOpacity(0.3),
width: 1.5,
),
),
child: ListTile(
contentPadding:
const EdgeInsets.symmetric(vertical: 10.0, horizontal: 20.0),
title: Text(
coupon.createdBy?.fName ?? '',
style: const TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
fontSize: 18,
),
),
subtitle: Text(
"Floor: ${coupon.couponFloor}",
style: const TextStyle(
color: Colors.white70,
),
),
trailing: Column(
crossAxisAlignment: CrossAxisAlignment.end,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
"Rs ${coupon.price}",
style: const TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
fontSize: 16,
),
),
const SizedBox(height: 5),
Text(
coupon.isVeg ? 'Veg' : 'Non-Veg',
style: const TextStyle(
color: Colors.white70,
fontSize: 14,
),
),
],
),
),
),
),
);
return MyListTile(coupon: coupon);
}
}

// @override
// Widget build(BuildContext context) {
// return Padding(
// padding: const EdgeInsets.all(8.0),
// child: Card(
// color: Colors.blueAccent,
// elevation: 5,
// shape: RoundedRectangleBorder(
// borderRadius: BorderRadius.circular(20),
// ),
// child: Container(
// decoration: BoxDecoration(
// color: Colors.white.withOpacity(0.2),
// borderRadius: BorderRadius.circular(20),
// border: Border.all(
// color: Colors.white.withOpacity(0.3),
// width: 1.5,
// ),
// ),
// child: ListTile(
// contentPadding:
// const EdgeInsets.symmetric(vertical: 10.0, horizontal: 20.0),
// title: Text(
// coupon.createdBy?.fName ?? '',
// style: const TextStyle(
// color: Colors.white,
// fontWeight: FontWeight.bold,
// fontSize: 18,
// ),
// ),
// subtitle: Text(
// "Floor: ${coupon.couponFloor}",
// style: const TextStyle(
// color: Colors.white70,
// ),
// ),
// trailing: Column(
// crossAxisAlignment: CrossAxisAlignment.end,
// mainAxisAlignment: MainAxisAlignment.center,
// children: [
// Text(
// "Rs ${coupon.price}",
// style: const TextStyle(
// color: Colors.white,
// fontWeight: FontWeight.bold,
// fontSize: 16,
// ),
// ),
// const SizedBox(height: 5),
// Text(
// coupon.isVeg ? 'Veg' : 'Non-Veg',
// style: const TextStyle(
// color: Colors.white70,
// fontSize: 14,
// ),
// ),
// ],
// ),
// ),
// ),
// ),
// );
// }
// }
}
44 changes: 44 additions & 0 deletions lib/Global/widgets/custom_shimmer_container
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import 'package:flutter/material.dart';
import 'package:shimmer/shimmer.dart';

class ShimmerContainer extends StatelessWidget {
final double? width;
final double? height;
final double? borderRadius;
final EdgeInsetsGeometry? margin;
final Color? baseColor;
final Color? highlightColor;
final BoxShape shape;

const ShimmerContainer({
super.key,
this.width,
this.height,
this.borderRadius,
this.margin,
this.baseColor,
this.highlightColor,
this.shape = BoxShape.rectangle,
});

@override
Widget build(BuildContext context) {
return Shimmer.fromColors(
baseColor: baseColor ?? Colors.grey.shade100, // Default base color
highlightColor:
highlightColor ?? Colors.grey.shade200, // Default highlight color
child: Container(
width: width ?? double.infinity, // Default width (full width)
height: height ?? 100.0, // Default height
margin: margin ?? const EdgeInsets.all(8.0), // Default margin
decoration: BoxDecoration(
color: Colors.grey, // Background color of the container
borderRadius: shape == BoxShape.rectangle
? BorderRadius.circular(borderRadius ?? 8.0)
: null, // Optional rounded corners
shape: shape, // Allow for circular or rectangular shape
),
),
);
}
}
Loading

0 comments on commit 440755b

Please sign in to comment.