Skip to content

Commit

Permalink
Merge pull request #21 from Divyakumar21202/main
Browse files Browse the repository at this point in the history
Resolved the merged APP error
  • Loading branch information
Divyakumar21202 committed Aug 20, 2024
2 parents 7dcc631 + 9916330 commit 545251f
Show file tree
Hide file tree
Showing 11 changed files with 163 additions and 763 deletions.
299 changes: 151 additions & 148 deletions lib/Global/dialogs/edit_coupon_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -75,165 +75,168 @@ class _DialogWidgetState extends State<DialogWidget> {
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
child: SingleChildScrollView(
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
),
),
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,
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,
),
items: MealType.values.map((MealType value) {
return DropdownMenuItem<MealType>(
value: value,
child: Text(
value.intoString(),
style: const TextStyle(color: Colors.white),
const SizedBox(height: 16),
DropdownButtonFormField<MealType>(
value: selectedMealType,
decoration: const InputDecoration(
labelText: "Veg or Non-veg",
labelStyle: 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,
),
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,
),
),
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(() {});
}
},
const SizedBox(height: 16),
TextFormField(
controller: costController,
decoration: const InputDecoration(
labelText: "Cost",
labelStyle: TextStyle(color: Colors.white),
),
FilterChip.elevated(
selected: couponStatus == CouponStatus.sold,
label: Text(CouponStatus.sold.intoString()),
onSelected: (val) {
if (val) {
couponStatus = CouponStatus.sold;
setState(() {});
}
},
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,
),
],
),
const SizedBox(height: 16),
Observer(builder: (context) {
final isLoadingLoally = userProfileStore.isLoadingLocally;
if (isLoadingLoally) {
return const Center(child: AppLoader());
}
return Row(
mainAxisAlignment: MainAxisAlignment.end,
),
Wrap(
spacing: 10,
runSpacing: 5,
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);
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(() {});
}
},
child: const Text("Submit"),
),
],
);
}),
],
),
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"),
),
],
);
}),
],
),
),
),
),
Expand Down
2 changes: 1 addition & 1 deletion lib/Global/widgets/custom_pwd_tile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class _CustomPwdTileState extends State<CustomPwdTile> {
borderRadius: BorderRadius.circular(10),
),
hintText: widget.hintText,
hintStyle: TextStyle(fontSize: 18),
hintStyle:const TextStyle(fontSize: 18),
contentPadding: const EdgeInsets.symmetric(
horizontal: 10.0,
vertical: 5,
Expand Down
1 change: 0 additions & 1 deletion lib/Global/widgets/loader.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

class AppLoader extends StatelessWidget {
const AppLoader({super.key});
Expand Down
3 changes: 1 addition & 2 deletions lib/Global/widgets/mycoupons_view.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import 'dart:ui';

import 'package:flutter/material.dart';
import 'package:mess_mgmt/Global/enums/enums.dart';
import 'package:mess_mgmt/Global/models/coupon_data_model.dart';
import 'package:mess_mgmt/Global/models/user_model.dart';
class MyCouponTile extends StatelessWidget {
Expand Down Expand Up @@ -39,7 +38,7 @@ class MyCouponTile extends StatelessWidget {
)));
});
}

@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.all(8.0),
Expand Down
Loading

0 comments on commit 545251f

Please sign in to comment.