-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19 from Divyakumar21202/main
Chore : Added Auth Error Business Logic
- Loading branch information
Showing
33 changed files
with
2,036 additions
and
195 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"nm":"Untitled file","ddd":0,"h":500,"w":500,"meta":{"g":"@lottiefiles/creator 1.13.0"},"layers":[{"ty":4,"nm":"Shape Layer - SVG","sr":1,"st":0,"op":37,"ip":0,"hd":false,"ddd":0,"bm":0,"hasMask":false,"ao":0,"ks":{"a":{"a":0,"k":[68.99984979629517,69]},"s":{"a":0,"k":[335.6589147286821,335.6589147286821]},"sk":{"a":0,"k":0},"p":{"a":0,"k":[249.99984979629517,250]},"r":{"a":0,"k":0},"sa":{"a":0,"k":0},"o":{"a":0,"k":100}},"shapes":[{"ty":"gr","bm":0,"hd":false,"nm":"Group 1","it":[{"ty":"sh","bm":0,"hd":false,"nm":"Path 1","d":1,"ks":{"a":0,"k":{"c":false,"i":[[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0]],"v":[[47,66.5],[63.5,83],[91.5,55]]}}},{"ty":"st","bm":0,"hd":false,"nm":"Stroke","lc":1,"lj":1,"ml":4,"o":{"a":0,"k":100},"w":{"a":0,"k":8},"c":{"a":0,"k":[1,1,1]}},{"ty":"tm","bm":0,"hd":false,"nm":"Trim Path","e":{"a":1,"k":[{"o":{"x":0.65,"y":0},"i":{"x":0.36,"y":1},"s":[0],"t":8},{"s":[100],"t":21}]},"o":{"a":0,"k":0},"s":{"a":0,"k":0},"m":1},{"ty":"tr","a":{"a":0,"k":[69.25000000000001,69]},"s":{"a":0,"k":[100,100]},"sk":{"a":0,"k":0},"p":{"a":0,"k":[69.25000000000001,69]},"r":{"a":0,"k":0},"sa":{"a":0,"k":0},"o":{"a":0,"k":100}}]},{"ty":"gr","bm":0,"hd":false,"nm":"Group 2","it":[{"ty":"sh","bm":0,"hd":false,"nm":"Path 2","d":1,"ks":{"a":0,"k":{"c":true,"i":[[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0]],"v":[[69,10],[84.3149,21.8656],[103.679,21.268],[109.095,39.8694],[125.112,50.768],[118.56,69],[125.112,87.232],[109.095,98.1306],[103.679,116.732],[84.3149,116.134],[69,128],[53.6851,116.134],[34.3207,116.732],[28.9051,98.1306],[12.8877,87.232],[19.44,69],[12.8877,50.768],[28.9051,39.8694],[34.3207,21.268],[53.6851,21.8656],[69,10]]}}},{"ty":"fl","bm":0,"hd":false,"nm":"Fill","c":{"a":0,"k":[0.0235,0.7176,0.3216]},"r":1,"o":{"a":0,"k":100}},{"ty":"tr","a":{"a":0,"k":[68.99984979629517,69]},"s":{"a":1,"k":[{"o":{"x":0,"y":0},"i":{"x":0.36,"y":1},"s":[0,0],"t":0},{"s":[100,100],"t":11}]},"sk":{"a":0,"k":0},"p":{"a":0,"k":[68.99984979629517,69]},"r":{"a":1,"k":[{"o":{"x":0,"y":0},"i":{"x":0.36,"y":1},"s":[90],"t":2},{"s":[0],"t":16}]},"sa":{"a":0,"k":0},"o":{"a":0,"k":100}}]}],"ind":1}],"v":"5.7.0","fr":30,"op":30,"ip":0,"assets":[]} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,242 @@ | ||
import 'dart:ui'; | ||
|
||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_mobx/flutter_mobx.dart'; | ||
import 'package:mess_mgmt/features/User%20Profile/store/user_profile_store.dart'; | ||
import 'package:mobx/mobx.dart'; | ||
|
||
import '../enums/enums.dart'; | ||
import '../models/coupon_data_model.dart'; | ||
import '../widgets/loader.dart'; | ||
|
||
void showEditCouponDialog( | ||
{required BuildContext context, required CouponDataModel coupon}) { | ||
userProfileStore.canDialogPop = false; | ||
|
||
showDialog( | ||
context: context, | ||
builder: (BuildContext context) { | ||
return DialogWidget(coupon: coupon); | ||
}, | ||
); | ||
} | ||
|
||
class DialogWidget extends StatefulWidget { | ||
const DialogWidget({ | ||
super.key, | ||
required this.coupon, | ||
}); | ||
|
||
final CouponDataModel coupon; | ||
|
||
@override | ||
State<DialogWidget> createState() => _DialogWidgetState(); | ||
} | ||
|
||
class _DialogWidgetState extends State<DialogWidget> { | ||
late Floor selectedFloor; | ||
late MealType selectedMealType; | ||
late MealTimeType mealTimeType; | ||
late CouponStatus couponStatus; | ||
|
||
@override | ||
void initState() { | ||
super.initState(); | ||
mealTimeType = mealTimeTypeMap[widget.coupon.couponType]!; | ||
selectedFloor = floorMap[widget.coupon.couponFloor]!; | ||
selectedMealType = widget.coupon.isVeg ? MealType.veg : MealType.nonVeg; | ||
costController = | ||
TextEditingController(text: widget.coupon.price.toString()); | ||
couponStatus = couponStatusMap[widget.coupon.status]!; | ||
} | ||
|
||
late final TextEditingController costController; | ||
|
||
@override | ||
void dispose() { | ||
costController.dispose(); | ||
super.dispose(); | ||
} | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Dialog( | ||
backgroundColor: Colors.transparent, | ||
child: BackdropFilter( | ||
filter: ImageFilter.blur(sigmaX: 10, sigmaY: 10), // Apply blur effect | ||
child: Container( | ||
padding: const EdgeInsets.all(16), | ||
decoration: BoxDecoration( | ||
color: Colors.white.withOpacity(0.2), // Slightly opaque background | ||
borderRadius: BorderRadius.circular(20), | ||
border: Border.all( | ||
color: Colors.white | ||
.withOpacity(0.3), // White border with slight opacity | ||
width: 1.5, | ||
), | ||
), | ||
child: Column( | ||
mainAxisSize: MainAxisSize.min, | ||
crossAxisAlignment: CrossAxisAlignment.start, | ||
children: <Widget>[ | ||
const Text( | ||
"Enter coupon details", | ||
style: TextStyle( | ||
fontSize: 18, | ||
fontWeight: FontWeight.bold, | ||
color: Colors.white, // Text color set to white for contrast | ||
), | ||
), | ||
const SizedBox(height: 16), | ||
DropdownButtonFormField<Floor>( | ||
value: selectedFloor, | ||
decoration: const InputDecoration( | ||
labelText: "Floor", | ||
labelStyle: TextStyle( | ||
color: Colors.white, | ||
), // Label color set to white | ||
), | ||
items: Floor.values.map((Floor value) { | ||
return DropdownMenuItem<Floor>( | ||
value: value, | ||
child: Text( | ||
value.intoString(), | ||
style: const TextStyle( | ||
color: | ||
Colors.white), // Dropdown item color set to white | ||
), | ||
); | ||
}).toList(), | ||
onChanged: (newValue) { | ||
setState(() { | ||
selectedFloor = newValue!; | ||
}); | ||
}, | ||
dropdownColor: Colors.blueAccent, | ||
), | ||
const SizedBox(height: 16), | ||
DropdownButtonFormField<MealType>( | ||
value: selectedMealType, | ||
decoration: const InputDecoration( | ||
labelText: "Veg or Non-veg", | ||
labelStyle: TextStyle( | ||
color: Colors.white, | ||
), | ||
), | ||
items: MealType.values.map((MealType value) { | ||
return DropdownMenuItem<MealType>( | ||
value: value, | ||
child: Text( | ||
value.intoString(), | ||
style: const TextStyle(color: Colors.white), | ||
), | ||
); | ||
}).toList(), | ||
onChanged: (newValue) { | ||
setState(() { | ||
selectedMealType = newValue!; | ||
}); | ||
}, | ||
dropdownColor: Colors.blueAccent, | ||
), | ||
const SizedBox(height: 16), | ||
TextFormField( | ||
controller: costController, | ||
decoration: const InputDecoration( | ||
labelText: "Cost", | ||
labelStyle: TextStyle(color: Colors.white), | ||
), | ||
keyboardType: TextInputType.number, | ||
style: const TextStyle(color: Colors.white), | ||
), | ||
const SizedBox(height: 16), | ||
const Text( | ||
'Coupon Status', | ||
style: TextStyle( | ||
fontSize: 18, | ||
fontWeight: FontWeight.bold, | ||
color: Colors.white, | ||
), | ||
), | ||
Wrap( | ||
spacing: 10, | ||
runSpacing: 5, | ||
children: [ | ||
FilterChip.elevated( | ||
selected: couponStatus == CouponStatus.active, | ||
label: Text(CouponStatus.active.intoString()), | ||
onSelected: (val) { | ||
if (val) { | ||
couponStatus = CouponStatus.active; | ||
setState(() {}); | ||
} | ||
}, | ||
), | ||
FilterChip.elevated( | ||
selected: couponStatus == CouponStatus.sold, | ||
label: Text(CouponStatus.sold.intoString()), | ||
onSelected: (val) { | ||
if (val) { | ||
couponStatus = CouponStatus.sold; | ||
setState(() {}); | ||
} | ||
}, | ||
), | ||
], | ||
), | ||
const SizedBox(height: 16), | ||
Observer(builder: (context) { | ||
final isLoadingLoally = userProfileStore.isLoadingLocally; | ||
if (isLoadingLoally) { | ||
return const Center(child: AppLoader()); | ||
} | ||
return Row( | ||
mainAxisAlignment: MainAxisAlignment.end, | ||
children: [ | ||
ReactionBuilder( | ||
child: TextButton( | ||
style: TextButton.styleFrom( | ||
foregroundColor: Colors.white.withOpacity(0.8), | ||
), | ||
onPressed: () { | ||
Navigator.of(context).pop(); | ||
}, | ||
child: const Text("Cancel"), | ||
), | ||
builder: (context) { | ||
return autorun((_) { | ||
final canDialogPop = userProfileStore.canDialogPop; | ||
if (canDialogPop) { | ||
Navigator.pop(context); | ||
} | ||
}); | ||
}), | ||
TextButton( | ||
style: TextButton.styleFrom( | ||
foregroundColor: Colors.white.withOpacity(0.8), | ||
), | ||
onPressed: () async { | ||
Floor floor = selectedFloor; | ||
MealType mealType = selectedMealType; | ||
String cost = costController.text; | ||
final model = widget.coupon.copyWith( | ||
price: int.parse(cost), | ||
couponType: mealTimeType.intoString(), | ||
isVeg: mealType.intoBool(), | ||
couponFloor: floor.intoInt(), | ||
status: couponStatus.intoString(), | ||
); | ||
userProfileStore.updateCoupon(coupon: model); | ||
}, | ||
child: const Text("Submit"), | ||
), | ||
], | ||
); | ||
}), | ||
], | ||
), | ||
), | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
class ShimmerEffect extends StatefulWidget { | ||
final Widget child; | ||
|
||
const ShimmerEffect({super.key, required this.child}); | ||
|
||
@override | ||
_ShimmerEffectState createState() => _ShimmerEffectState(); | ||
} | ||
|
||
class _ShimmerEffectState extends State<ShimmerEffect> with SingleTickerProviderStateMixin { | ||
late AnimationController _controller; | ||
late Animation<double> _animation; | ||
|
||
@override | ||
void initState() { | ||
super.initState(); | ||
_controller = AnimationController( | ||
duration: const Duration(milliseconds: 1500), | ||
vsync: this, | ||
)..repeat(); | ||
_animation = Tween<double>(begin: -2, end: 2).animate(_controller); | ||
} | ||
|
||
@override | ||
void dispose() { | ||
_controller.dispose(); | ||
super.dispose(); | ||
} | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return AnimatedBuilder( | ||
animation: _animation, | ||
builder: (context, child) { | ||
return ShaderMask( | ||
shaderCallback: (bounds) { | ||
return LinearGradient( | ||
begin: Alignment.topLeft, | ||
end: Alignment.bottomRight, | ||
colors: [ | ||
Colors.grey[300]!, | ||
Colors.grey[100]!, | ||
Colors.grey[300]!, | ||
], | ||
stops: [ | ||
0.0, | ||
_animation.value, | ||
1.0, | ||
], | ||
).createShader(bounds); | ||
}, | ||
child: widget.child, | ||
); | ||
}, | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.