fixed ui changes
This commit is contained in:
@@ -1118,7 +1118,7 @@
|
|||||||
"languageVersion": "3.4"
|
"languageVersion": "3.4"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"generated": "2025-05-04T18:54:05.217340Z",
|
"generated": "2025-05-04T20:38:53.504097Z",
|
||||||
"generator": "pub",
|
"generator": "pub",
|
||||||
"generatorVersion": "3.5.3",
|
"generatorVersion": "3.5.3",
|
||||||
"flutterRoot": "file:///Users/apple/Documents/development/flutter",
|
"flutterRoot": "file:///Users/apple/Documents/development/flutter",
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -23,7 +23,8 @@ import 'package:provider/provider.dart';
|
|||||||
|
|
||||||
|
|
||||||
@pragma('vm:entry-point')
|
@pragma('vm:entry-point')
|
||||||
Future<void> _firebaseMessagingBackgroundHandler(RemoteMessage message) async {
|
Future<void> _firebaseMessagingBackgroundHandler(RemoteMessage message) async
|
||||||
|
{
|
||||||
await Firebase.initializeApp();
|
await Firebase.initializeApp();
|
||||||
print("💬 Background Message Received: ${message.notification?.title}");
|
print("💬 Background Message Received: ${message.notification?.title}");
|
||||||
if (message.notification != null) {
|
if (message.notification != null) {
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ import 'package:grocery_app/utils/extensions/extensions.dart';
|
|||||||
|
|
||||||
import 'package:http/http.dart' as http;
|
import 'package:http/http.dart' as http;
|
||||||
|
|
||||||
|
|
||||||
class ProductProvider extends ChangeNotifier {
|
class ProductProvider extends ChangeNotifier {
|
||||||
final _homeRepo = getIt<ProductRepo>();
|
final _homeRepo = getIt<ProductRepo>();
|
||||||
|
|
||||||
@@ -109,7 +108,6 @@ class ProductProvider extends ChangeNotifier {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Future<bool> updateDeviceToken(BuildContext context) async {
|
Future<bool> updateDeviceToken(BuildContext context) async {
|
||||||
var fcm = await FirebaseMessaging.instance.getToken();
|
var fcm = await FirebaseMessaging.instance.getToken();
|
||||||
var data = {"deviceToken": fcm, "deviceTpe": "android"};
|
var data = {"deviceToken": fcm, "deviceTpe": "android"};
|
||||||
@@ -119,7 +117,6 @@ class ProductProvider extends ChangeNotifier {
|
|||||||
var result = await _homeRepo.updateDeviceToken(data, context);
|
var result = await _homeRepo.updateDeviceToken(data, context);
|
||||||
return result.fold(
|
return result.fold(
|
||||||
(error) {
|
(error) {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
(response) {
|
(response) {
|
||||||
@@ -142,13 +139,23 @@ class ProductProvider extends ChangeNotifier {
|
|||||||
|
|
||||||
if (maxprice.isNotEmpty) {
|
if (maxprice.isNotEmpty) {
|
||||||
data = {
|
data = {
|
||||||
|
"page": 1,
|
||||||
|
"limit": 12,
|
||||||
"minPrice": "${minPrice}",
|
"minPrice": "${minPrice}",
|
||||||
"maxPrice": maxprice,
|
"maxPrice": maxprice,
|
||||||
"search": search,
|
"search": search,
|
||||||
"sortBy": orderby
|
"sortBy": orderby,
|
||||||
|
"sortOrder": "asc"
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
data = {"minPrice": "${minPrice}", "search": search, "sortBy": orderby};
|
data = {
|
||||||
|
"page": 1,
|
||||||
|
"limit": 12,
|
||||||
|
"minPrice": "${minPrice}",
|
||||||
|
"search": search,
|
||||||
|
"sortBy": orderby,
|
||||||
|
"sortOrder": "asc"
|
||||||
|
};
|
||||||
}
|
}
|
||||||
var result = await _homeRepo.getAllProduct(data, context, id);
|
var result = await _homeRepo.getAllProduct(data, context, id);
|
||||||
|
|
||||||
@@ -160,6 +167,8 @@ class ProductProvider extends ChangeNotifier {
|
|||||||
(response) {
|
(response) {
|
||||||
homeproducts = response.data!;
|
homeproducts = response.data!;
|
||||||
|
|
||||||
|
print("kdsjfjklghjdkf ${homeproducts.length}");
|
||||||
|
|
||||||
isHomeLoadingg = false;
|
isHomeLoadingg = false;
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -373,7 +373,7 @@ class _BestDealScreenState extends State<BestDealScreen> {
|
|||||||
Text(
|
Text(
|
||||||
bestdealproduct.name ?? "",
|
bestdealproduct.name ?? "",
|
||||||
textAlign: TextAlign.left,
|
textAlign: TextAlign.left,
|
||||||
maxLines: 2,
|
maxLines: 1,
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
style: context.customMedium(
|
style: context.customMedium(
|
||||||
APPCOLOR.balck1A1A1A, 16),
|
APPCOLOR.balck1A1A1A, 16),
|
||||||
|
|||||||
@@ -30,7 +30,8 @@ class _MycartState extends State<Mycart> {
|
|||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
Future.microtask(() {
|
Future.microtask(() {
|
||||||
final addToCartProvider = Provider.of<AddtocartProvider>(context, listen: false);
|
final addToCartProvider =
|
||||||
|
Provider.of<AddtocartProvider>(context, listen: false);
|
||||||
addToCartProvider.getItemCards(context);
|
addToCartProvider.getItemCards(context);
|
||||||
addToCartProvider.offerCoupon(context);
|
addToCartProvider.offerCoupon(context);
|
||||||
addToCartProvider.getCurrentLocation(context);
|
addToCartProvider.getCurrentLocation(context);
|
||||||
@@ -91,10 +92,10 @@ class _MycartState extends State<Mycart> {
|
|||||||
return const Center(child: Text(''));
|
return const Center(child: Text(''));
|
||||||
} else {
|
} else {
|
||||||
return SizedBox(
|
return SizedBox(
|
||||||
height: MediaQuery.of(context).size.height * 0.28,
|
height: MediaQuery.of(context).size.height * 0.3,
|
||||||
child: ListView.builder(
|
child: ListView.builder(
|
||||||
scrollDirection: Axis.horizontal,
|
|
||||||
itemCount: provider.bestdeal.length,
|
itemCount: provider.bestdeal.length,
|
||||||
|
scrollDirection: Axis.horizontal,
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
var bestdealproduct = provider.bestdeal[index];
|
var bestdealproduct = provider.bestdeal[index];
|
||||||
double cardWidth = MediaQuery.of(context).size.width * 0.4;
|
double cardWidth = MediaQuery.of(context).size.width * 0.4;
|
||||||
@@ -111,58 +112,50 @@ class _MycartState extends State<Mycart> {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.only(right: 5, bottom: 5, top: 5),
|
padding: const EdgeInsets.all(8.0),
|
||||||
child: Container(
|
child: Container(
|
||||||
width: cardWidth,
|
width: cardWidth,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
borderRadius: BorderRadius.circular(15),
|
borderRadius: BorderRadius.circular(15),
|
||||||
boxShadow: [
|
|
||||||
BoxShadow(
|
|
||||||
color: Colors.grey.withOpacity(0.1),
|
|
||||||
blurRadius: 1,
|
|
||||||
offset: const Offset(5, 5),
|
|
||||||
),
|
),
|
||||||
],
|
|
||||||
),
|
|
||||||
child: Padding(
|
|
||||||
padding: const EdgeInsets.all(5),
|
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Center(
|
Center(
|
||||||
child: Container(
|
child: Container(
|
||||||
height: MediaQuery.of(context).size.height * 0.12,
|
height: MediaQuery.of(context).size.height * 0.17,
|
||||||
width: cardWidth * 0.9,
|
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: APPCOLOR.bgGrey,
|
color: APPCOLOR.bgGrey,
|
||||||
borderRadius: BorderRadius.circular(15),
|
borderRadius: BorderRadius.circular(15),
|
||||||
),
|
),
|
||||||
child: Stack(
|
child: Stack(
|
||||||
alignment: Alignment.center,
|
|
||||||
children: [
|
children: [
|
||||||
AppNetworkImage(
|
AppNetworkImage(
|
||||||
imageUrl: bestdealproduct
|
imageUrl: bestdealproduct
|
||||||
.productImages?.first?.url ??
|
.productImages?.first?.url ??
|
||||||
"",
|
"",
|
||||||
|
radius: 10,
|
||||||
backGroundColor: Colors.transparent,
|
backGroundColor: Colors.transparent,
|
||||||
radius: 10),
|
),
|
||||||
Positioned(
|
Positioned(
|
||||||
right: 1,
|
right: 0,
|
||||||
bottom: 0,
|
bottom: 0,
|
||||||
child: Container(
|
child: Container(
|
||||||
padding: EdgeInsets.symmetric(
|
width: 40,
|
||||||
horizontal: 10, vertical: 10),
|
height: 40,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Colors.red,
|
color: Colors.red,
|
||||||
borderRadius: BorderRadius.circular(5),
|
borderRadius: BorderRadius.circular(100),
|
||||||
),
|
),
|
||||||
child: Center(
|
child: Center(
|
||||||
child: Text(
|
child: Text(
|
||||||
"${calculateDiscountPercentage(double.parse(bestdealproduct!.basePrice), double.parse(bestdealproduct!.discountPrice))}% OFF",
|
"${calculateDiscountPercentage(double.parse(bestdealproduct.basePrice), double.parse(bestdealproduct.discountPrice))}% \nOFF",
|
||||||
style: TextStyle(
|
textAlign: TextAlign.center,
|
||||||
|
style: const TextStyle(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
fontSize: 15)),
|
fontWeight: FontWeight.bold,
|
||||||
|
fontSize: 10)),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
@@ -171,31 +164,23 @@ class _MycartState extends State<Mycart> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: MediaQuery.of(context).size.height * 0.01,
|
height: MediaQuery.of(context).size.height * 0.01),
|
||||||
),
|
|
||||||
Text(
|
Text(
|
||||||
bestdealproduct.name ?? "",
|
bestdealproduct.name ?? "",
|
||||||
textAlign: TextAlign.left,
|
textAlign: TextAlign.left,
|
||||||
maxLines: 2,
|
maxLines: 1,
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
style:
|
style: context.customMedium(APPCOLOR.balck1A1A1A, 14),
|
||||||
context.customMedium(APPCOLOR.balck1A1A1A, 14),
|
|
||||||
),
|
),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: MediaQuery.of(context).size.height * 0.005,
|
height: MediaQuery.of(context).size.height * 0.005),
|
||||||
),
|
|
||||||
Text(
|
Text(
|
||||||
bestdealproduct.unit ?? "",
|
bestdealproduct.unit ?? "",
|
||||||
textAlign: TextAlign.left,
|
textAlign: TextAlign.left,
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
style: context.customMedium(
|
style: context.customMedium(
|
||||||
Colors.grey.withOpacity(0.8),
|
Colors.grey.withOpacity(0.8), 12),
|
||||||
12,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
height: MediaQuery.of(context).size.height * 0.005,
|
|
||||||
),
|
),
|
||||||
const Spacer(),
|
const Spacer(),
|
||||||
Row(
|
Row(
|
||||||
@@ -207,22 +192,20 @@ class _MycartState extends State<Mycart> {
|
|||||||
textAlign: TextAlign.left,
|
textAlign: TextAlign.left,
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
style: context.customSemiBold(
|
style:
|
||||||
Colors.black, 15),
|
context.customSemiBold(Colors.black, 15),
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
"₹${bestdealproduct.basePrice ?? ""}",
|
"₹${bestdealproduct.basePrice ?? ""}",
|
||||||
|
textAlign: TextAlign.left,
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
style: context
|
style: context
|
||||||
.customMedium(
|
.customMedium(
|
||||||
Colors.grey.withOpacity(0.8),
|
Colors.grey.withOpacity(0.8), 15)
|
||||||
15,
|
|
||||||
)
|
|
||||||
.copyWith(
|
.copyWith(
|
||||||
decoration:
|
decoration:
|
||||||
TextDecoration.lineThrough,
|
TextDecoration.lineThrough),
|
||||||
),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@@ -235,19 +218,15 @@ class _MycartState extends State<Mycart> {
|
|||||||
null) {
|
null) {
|
||||||
await provider.addToCart(
|
await provider.addToCart(
|
||||||
context, bestdealproduct.id!, 1);
|
context, bestdealproduct.id!, 1);
|
||||||
|
|
||||||
context
|
|
||||||
.read<AddtocartProvider>()
|
|
||||||
.getItemCards(context);
|
|
||||||
} else {
|
} else {
|
||||||
context.push(MyRoutes.SIGNUP);
|
context.push(MyRoutes.SIGNUP);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
height: MediaQuery.of(context).size.height *
|
height: MediaQuery.of(context).size.height *
|
||||||
0.028,
|
0.035,
|
||||||
// width:
|
width:
|
||||||
// MediaQuery.of(context).size.width * 0.1,
|
MediaQuery.of(context).size.width * 0.1,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: APPCOLOR.lightGreen,
|
color: APPCOLOR.lightGreen,
|
||||||
borderRadius: BorderRadius.circular(5),
|
borderRadius: BorderRadius.circular(5),
|
||||||
@@ -256,20 +235,18 @@ class _MycartState extends State<Mycart> {
|
|||||||
child: provider.isLoading[
|
child: provider.isLoading[
|
||||||
bestdealproduct.id] ??
|
bestdealproduct.id] ??
|
||||||
false
|
false
|
||||||
? Padding(
|
? const Padding(
|
||||||
padding:
|
padding: const EdgeInsets.all(8.0),
|
||||||
const EdgeInsets.all(8.0),
|
child: SizedBox(
|
||||||
child: Container(
|
|
||||||
height: 10,
|
height: 10,
|
||||||
width: 10,
|
width: 10,
|
||||||
child:
|
child: CircularProgressIndicator(
|
||||||
CircularProgressIndicator(
|
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
strokeWidth: 2),
|
strokeWidth: 2),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
: Text(
|
: Text(
|
||||||
' Add ',
|
'Add',
|
||||||
style: context.customRegular(
|
style: context.customRegular(
|
||||||
Colors.white, 12),
|
Colors.white, 12),
|
||||||
),
|
),
|
||||||
@@ -283,11 +260,11 @@ class _MycartState extends State<Mycart> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ class DataNotFound extends StatelessWidget {
|
|||||||
const SizedBox(height: 5),
|
const SizedBox(height: 5),
|
||||||
Text(
|
Text(
|
||||||
message,
|
message,
|
||||||
style: const TextStyle(fontSize: 10, fontWeight: FontWeight.w500),
|
style: const TextStyle(fontSize: 15, fontWeight: FontWeight.w500),
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -146,12 +146,47 @@ class _FavouriteScreenState extends State<FavouriteScreen>
|
|||||||
return Expanded(
|
return Expanded(
|
||||||
child: _buildSkeletonLoader()); // Show Skeleton while loading
|
child: _buildSkeletonLoader()); // Show Skeleton while loading
|
||||||
} else if (provider.wishListItem.isEmpty) {
|
} else if (provider.wishListItem.isEmpty) {
|
||||||
return Expanded(
|
return Center(
|
||||||
child: DataNotFound(
|
child: Column(
|
||||||
|
children: [
|
||||||
|
SizedBox(
|
||||||
|
height: 150.h,
|
||||||
|
),
|
||||||
|
DataNotFound(
|
||||||
imagePath: 'assets/images/wishlist.jpg',
|
imagePath: 'assets/images/wishlist.jpg',
|
||||||
message: "Data Not Found",
|
message: "Your Order is empty",
|
||||||
width: 250.w,
|
),
|
||||||
height: 200.h,
|
InkWell(
|
||||||
|
onTap: () {
|
||||||
|
context.push(MyRoutes.FRUITVEGGIEDETAIL);
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
margin: const EdgeInsets.only(top: 30, bottom: 10),
|
||||||
|
height: 40,
|
||||||
|
width: MediaQuery.sizeOf(context).width / 2.8,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: APPCOLOR.lightGreen,
|
||||||
|
borderRadius: BorderRadius.circular(10)),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Icon(
|
||||||
|
Icons.search,
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
width: 10,
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
"Shoping",
|
||||||
|
style: context.customMedium(Colors.white, 16),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
));
|
));
|
||||||
} else {
|
} else {
|
||||||
return Expanded(
|
return Expanded(
|
||||||
|
|||||||
@@ -104,9 +104,19 @@ class _HomeScreenState extends State<HomeScreen> {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
_searchController.text = suggestion.name;
|
// _searchController.text = suggestion.name;
|
||||||
searchProvider.getHomeProduct(
|
// searchProvider.getHomeProduct(
|
||||||
context, "", suggestion.name, '', '', '');
|
// context, "", suggestion.name, '', '', '');
|
||||||
|
|
||||||
|
context.push(
|
||||||
|
MyRoutes.PRODUCTDETAILS,
|
||||||
|
extra: {
|
||||||
|
"id": suggestion.id,
|
||||||
|
"quantity": 1,
|
||||||
|
"price": suggestion.discountPrice,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
_clearOverlay();
|
_clearOverlay();
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@@ -143,8 +153,7 @@ class _HomeScreenState extends State<HomeScreen> {
|
|||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Consumer<ProductProvider>(
|
child: Consumer<ProductProvider>(
|
||||||
builder: (context, provider, child)
|
builder: (context, provider, child) {
|
||||||
{
|
|
||||||
return CompositedTransformTarget(
|
return CompositedTransformTarget(
|
||||||
link: _layerLink,
|
link: _layerLink,
|
||||||
child: Container(
|
child: Container(
|
||||||
@@ -452,10 +461,12 @@ class _HomeScreenState extends State<HomeScreen> {
|
|||||||
SizedBox(
|
SizedBox(
|
||||||
height: MediaQuery.of(context).size.height *
|
height: MediaQuery.of(context).size.height *
|
||||||
0.01),
|
0.01),
|
||||||
|
|
||||||
|
|
||||||
Text(
|
Text(
|
||||||
bestdealproduct.name ?? "",
|
bestdealproduct.name ?? "",
|
||||||
textAlign: TextAlign.left,
|
textAlign: TextAlign.left,
|
||||||
maxLines: 2,
|
maxLines: 1,
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
style: context.customMedium(
|
style: context.customMedium(
|
||||||
APPCOLOR.balck1A1A1A, 14),
|
APPCOLOR.balck1A1A1A, 14),
|
||||||
|
|||||||
@@ -1,14 +1,18 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:flutter_svg/svg.dart';
|
import 'package:flutter_svg/svg.dart';
|
||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
import 'package:grocery_app/src/common_widget/network_image.dart';
|
import 'package:grocery_app/src/common_widget/network_image.dart';
|
||||||
import 'package:grocery_app/src/core/routes/routes.dart';
|
import 'package:grocery_app/src/core/routes/routes.dart';
|
||||||
|
import 'package:grocery_app/src/logic/provider/home_provider.dart';
|
||||||
import 'package:grocery_app/src/logic/provider/order_provider.dart';
|
import 'package:grocery_app/src/logic/provider/order_provider.dart';
|
||||||
import 'package:grocery_app/src/ui/data_notfound.dart';
|
import 'package:grocery_app/src/ui/data_notfound.dart';
|
||||||
import 'package:grocery_app/utils/constants/assets_constant.dart';
|
import 'package:grocery_app/utils/constants/assets_constant.dart';
|
||||||
import 'package:grocery_app/utils/constants/color_constant.dart';
|
import 'package:grocery_app/utils/constants/color_constant.dart';
|
||||||
import 'package:grocery_app/utils/extensions/extensions.dart';
|
import 'package:grocery_app/utils/extensions/extensions.dart';
|
||||||
|
import 'package:grocery_app/utils/extensions/uicontext.dart';
|
||||||
import 'package:intl/intl.dart';
|
import 'package:intl/intl.dart';
|
||||||
|
import 'package:material_design_icons_flutter/material_design_icons_flutter.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
import 'package:url_launcher/url_launcher.dart';
|
import 'package:url_launcher/url_launcher.dart';
|
||||||
|
|
||||||
@@ -81,10 +85,47 @@ class _MyOrderScreenState extends State<MyOrderScreen> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (orderProvider.orderList.isEmpty) {
|
if (orderProvider.orderList.isEmpty) {
|
||||||
return const Center(
|
return Center(
|
||||||
child: DataNotFound(
|
child: Column(
|
||||||
|
children: [
|
||||||
|
SizedBox(
|
||||||
|
height: 150.h,
|
||||||
|
),
|
||||||
|
DataNotFound(
|
||||||
imagePath: 'assets/images/wishlist.jpg',
|
imagePath: 'assets/images/wishlist.jpg',
|
||||||
message: "No Order!",
|
message: "Your Order is empty",
|
||||||
|
),
|
||||||
|
InkWell(
|
||||||
|
onTap: () {
|
||||||
|
context.push(MyRoutes.FRUITVEGGIEDETAIL);
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
margin: const EdgeInsets.only(top: 30, bottom: 10),
|
||||||
|
height: 40,
|
||||||
|
width: MediaQuery.sizeOf(context).width / 2.8,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: APPCOLOR.lightGreen,
|
||||||
|
borderRadius: BorderRadius.circular(10)),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Icon(
|
||||||
|
Icons.search,
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
width: 10,
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
"Shoping",
|
||||||
|
style: context.customMedium(Colors.white, 16),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -142,7 +183,6 @@ class _MyOrderScreenState extends State<MyOrderScreen> {
|
|||||||
Text(order.orderNumber,
|
Text(order.orderNumber,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontWeight: FontWeight.bold)),
|
fontWeight: FontWeight.bold)),
|
||||||
|
|
||||||
Text(
|
Text(
|
||||||
order.totalItems.toString() +
|
order.totalItems.toString() +
|
||||||
" items",
|
" items",
|
||||||
@@ -151,8 +191,6 @@ class _MyOrderScreenState extends State<MyOrderScreen> {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
Spacer(),
|
Spacer(),
|
||||||
|
|
||||||
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
SizedBox(height: 10),
|
SizedBox(height: 10),
|
||||||
|
|||||||
@@ -148,7 +148,6 @@ class _ProductDetailsState extends State<ProductDetails> {
|
|||||||
var productImage =
|
var productImage =
|
||||||
provider.productDetails.data!.productImages![index];
|
provider.productDetails.data!.productImages![index];
|
||||||
return AppNetworkImage(
|
return AppNetworkImage(
|
||||||
|
|
||||||
imageUrl: productImage.url,
|
imageUrl: productImage.url,
|
||||||
backGroundColor: Colors.transparent,
|
backGroundColor: Colors.transparent,
|
||||||
radius: 10,
|
radius: 10,
|
||||||
@@ -952,7 +951,6 @@ class _ProductDetailsState extends State<ProductDetails> {
|
|||||||
borderRadius: BorderRadius.circular(15),
|
borderRadius: BorderRadius.circular(15),
|
||||||
),
|
),
|
||||||
child: AppNetworkImage(
|
child: AppNetworkImage(
|
||||||
|
|
||||||
imageUrl: "",
|
imageUrl: "",
|
||||||
backGroundColor: Colors.transparent,
|
backGroundColor: Colors.transparent,
|
||||||
),
|
),
|
||||||
@@ -980,75 +978,70 @@ class _ProductDetailsState extends State<ProductDetails> {
|
|||||||
return Center(child: Text('No products available'));
|
return Center(child: Text('No products available'));
|
||||||
} else {
|
} else {
|
||||||
return SizedBox(
|
return SizedBox(
|
||||||
height: MediaQuery.of(context).size.height * 0.28,
|
height: MediaQuery.of(context).size.height * 0.3,
|
||||||
child: ListView.builder(
|
child: ListView.builder(
|
||||||
itemCount: provider.bestdeal.length,
|
itemCount: provider.bestdeal.length,
|
||||||
scrollDirection: Axis.horizontal,
|
scrollDirection: Axis.horizontal,
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
var bestdealproduct = provider.bestdeal[index];
|
var bestdealproduct = provider.bestdeal[index];
|
||||||
double cardWidth =
|
double cardWidth = MediaQuery.of(context).size.width * 0.4;
|
||||||
MediaQuery.of(context).size.width * 0.4; // Dynamic width
|
|
||||||
|
|
||||||
return InkWell(
|
return InkWell(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
provider.getProduuctDetails(
|
context.push(
|
||||||
context, bestdealproduct.id, 0, "0");
|
MyRoutes.PRODUCTDETAILS,
|
||||||
|
extra: {
|
||||||
|
"id": bestdealproduct.id,
|
||||||
|
"quantity": 1,
|
||||||
|
"price": bestdealproduct.discountPrice,
|
||||||
|
},
|
||||||
|
);
|
||||||
},
|
},
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.only(right: 10, bottom: 5, top: 5),
|
padding: const EdgeInsets.all(8.0),
|
||||||
child: Container(
|
child: Container(
|
||||||
width: cardWidth,
|
width: cardWidth,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
borderRadius: BorderRadius.circular(15),
|
borderRadius: BorderRadius.circular(15),
|
||||||
boxShadow: [
|
|
||||||
BoxShadow(
|
|
||||||
color: Colors.grey.withOpacity(0.1),
|
|
||||||
blurRadius: 1,
|
|
||||||
offset: const Offset(5, 5),
|
|
||||||
),
|
),
|
||||||
],
|
|
||||||
),
|
|
||||||
child: Padding(
|
|
||||||
padding: const EdgeInsets.all(5),
|
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Center(
|
Center(
|
||||||
child: Container(
|
child: Container(
|
||||||
height: MediaQuery.of(context).size.height * 0.12,
|
height: MediaQuery.of(context).size.height * 0.17,
|
||||||
width: cardWidth * 0.9,
|
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: APPCOLOR.bgGrey,
|
color: APPCOLOR.bgGrey,
|
||||||
borderRadius: BorderRadius.circular(15),
|
borderRadius: BorderRadius.circular(15),
|
||||||
),
|
),
|
||||||
child: Stack(
|
child: Stack(
|
||||||
alignment: Alignment.center,
|
|
||||||
children: [
|
children: [
|
||||||
AppNetworkImage(
|
AppNetworkImage(
|
||||||
|
|
||||||
imageUrl: bestdealproduct
|
imageUrl: bestdealproduct
|
||||||
.productImages?.first?.url ??
|
.productImages?.first?.url ??
|
||||||
"",
|
"",
|
||||||
backGroundColor: Colors.transparent,
|
|
||||||
radius: 10,
|
radius: 10,
|
||||||
|
backGroundColor: Colors.transparent,
|
||||||
),
|
),
|
||||||
Positioned(
|
Positioned(
|
||||||
right: 1,
|
right: 0,
|
||||||
bottom: 0,
|
bottom: 0,
|
||||||
child: Container(
|
child: Container(
|
||||||
padding: EdgeInsets.symmetric(
|
width: 40,
|
||||||
horizontal: 10, vertical: 10),
|
height: 40,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Colors.red,
|
color: Colors.red,
|
||||||
borderRadius: BorderRadius.circular(5),
|
borderRadius: BorderRadius.circular(100),
|
||||||
),
|
),
|
||||||
child: Center(
|
child: Center(
|
||||||
child: Text(
|
child: Text(
|
||||||
"${calculateDiscountPercentage(double.parse(bestdealproduct.basePrice), double.parse(bestdealproduct!.discountPrice))}% OFF",
|
"${calculateDiscountPercentage(double.parse(bestdealproduct.basePrice), double.parse(bestdealproduct.discountPrice))}% \nOFF",
|
||||||
style: TextStyle(
|
textAlign: TextAlign.center,
|
||||||
|
style: const TextStyle(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
fontSize: 15)),
|
fontWeight: FontWeight.bold,
|
||||||
|
fontSize: 10)),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
@@ -1057,31 +1050,23 @@ class _ProductDetailsState extends State<ProductDetails> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: MediaQuery.of(context).size.height * 0.01,
|
height: MediaQuery.of(context).size.height * 0.01),
|
||||||
),
|
|
||||||
Text(
|
Text(
|
||||||
bestdealproduct.name ?? "",
|
bestdealproduct.name ?? "",
|
||||||
textAlign: TextAlign.left,
|
textAlign: TextAlign.left,
|
||||||
maxLines: 2,
|
maxLines: 1,
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
style:
|
style: context.customMedium(APPCOLOR.balck1A1A1A, 14),
|
||||||
context.customMedium(APPCOLOR.balck1A1A1A, 14),
|
|
||||||
),
|
),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: MediaQuery.of(context).size.height * 0.005,
|
height: MediaQuery.of(context).size.height * 0.005),
|
||||||
),
|
|
||||||
Text(
|
Text(
|
||||||
bestdealproduct.unit ?? "",
|
bestdealproduct.unit ?? "",
|
||||||
textAlign: TextAlign.left,
|
textAlign: TextAlign.left,
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
style: context.customMedium(
|
style: context.customMedium(
|
||||||
Colors.grey.withOpacity(0.8),
|
Colors.grey.withOpacity(0.8), 12),
|
||||||
12,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
height: MediaQuery.of(context).size.height * 0.005,
|
|
||||||
),
|
),
|
||||||
const Spacer(),
|
const Spacer(),
|
||||||
Row(
|
Row(
|
||||||
@@ -1093,8 +1078,8 @@ class _ProductDetailsState extends State<ProductDetails> {
|
|||||||
textAlign: TextAlign.left,
|
textAlign: TextAlign.left,
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
style: context.customSemiBold(
|
style:
|
||||||
Colors.black, 15),
|
context.customSemiBold(Colors.black, 15),
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
"₹${bestdealproduct.basePrice ?? ""}",
|
"₹${bestdealproduct.basePrice ?? ""}",
|
||||||
@@ -1103,52 +1088,13 @@ class _ProductDetailsState extends State<ProductDetails> {
|
|||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
style: context
|
style: context
|
||||||
.customMedium(
|
.customMedium(
|
||||||
Colors.grey.withOpacity(0.8),
|
Colors.grey.withOpacity(0.8), 15)
|
||||||
15,
|
|
||||||
)
|
|
||||||
.copyWith(
|
.copyWith(
|
||||||
decoration:
|
decoration:
|
||||||
TextDecoration.lineThrough,
|
TextDecoration.lineThrough),
|
||||||
),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|
||||||
// Align(
|
|
||||||
// alignment: Alignment.centerRight,
|
|
||||||
// child: InkWell(
|
|
||||||
// onTap: () async {
|
|
||||||
// bool success = await provider.addToCart(context, bestdealproduct.id!);
|
|
||||||
// if (success) {
|
|
||||||
// Fluttertoast.showToast(
|
|
||||||
// msg: "Product added to cart!",
|
|
||||||
// toastLength: Toast.LENGTH_SHORT,
|
|
||||||
// gravity: ToastGravity.BOTTOM,
|
|
||||||
// backgroundColor: Colors.green,
|
|
||||||
// textColor: Colors.white,
|
|
||||||
// fontSize: 14.0,
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
|
|
||||||
// },
|
|
||||||
// child: Container(
|
|
||||||
// height:
|
|
||||||
// MediaQuery.of(context).size.height * 0.035,
|
|
||||||
// width: MediaQuery.of(context).size.width * 0.1,
|
|
||||||
// decoration: BoxDecoration(
|
|
||||||
// color: APPCOLOR.lightGreen,
|
|
||||||
// borderRadius: BorderRadius.circular(5),
|
|
||||||
// ),
|
|
||||||
// child: Center(
|
|
||||||
// child: Text(
|
|
||||||
// 'Add',
|
|
||||||
// style:
|
|
||||||
// context.customRegular(Colors.white, 12),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
const Spacer(),
|
const Spacer(),
|
||||||
Align(
|
Align(
|
||||||
alignment: Alignment.centerRight,
|
alignment: Alignment.centerRight,
|
||||||
@@ -1156,10 +1102,7 @@ class _ProductDetailsState extends State<ProductDetails> {
|
|||||||
onTap: () async {
|
onTap: () async {
|
||||||
if (await SharedPrefUtils.getToken() !=
|
if (await SharedPrefUtils.getToken() !=
|
||||||
null) {
|
null) {
|
||||||
provider.isLoading[bestdealproduct.id] ??
|
await provider.addToCart(
|
||||||
false
|
|
||||||
? null
|
|
||||||
: () => provider.addToCart(
|
|
||||||
context, bestdealproduct.id!, 1);
|
context, bestdealproduct.id!, 1);
|
||||||
} else {
|
} else {
|
||||||
context.push(MyRoutes.SIGNUP);
|
context.push(MyRoutes.SIGNUP);
|
||||||
@@ -1171,24 +1114,25 @@ class _ProductDetailsState extends State<ProductDetails> {
|
|||||||
width:
|
width:
|
||||||
MediaQuery.of(context).size.width * 0.1,
|
MediaQuery.of(context).size.width * 0.1,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: provider.cartItems
|
color: APPCOLOR.lightGreen,
|
||||||
.contains(bestdealproduct.id)
|
|
||||||
? Colors.grey
|
|
||||||
: APPCOLOR.lightGreen,
|
|
||||||
borderRadius: BorderRadius.circular(5),
|
borderRadius: BorderRadius.circular(5),
|
||||||
),
|
),
|
||||||
child: Center(
|
child: Center(
|
||||||
child: provider.isLoading[
|
child: provider.isLoading[
|
||||||
bestdealproduct.id] ??
|
bestdealproduct.id] ??
|
||||||
false
|
false
|
||||||
? CircularProgressIndicator(
|
? const Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: SizedBox(
|
||||||
|
height: 10,
|
||||||
|
width: 10,
|
||||||
|
child: CircularProgressIndicator(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
strokeWidth: 2)
|
strokeWidth: 2),
|
||||||
|
),
|
||||||
|
)
|
||||||
: Text(
|
: Text(
|
||||||
provider.cartItems.contains(
|
'Add',
|
||||||
bestdealproduct.id)
|
|
||||||
? 'Added'
|
|
||||||
: 'Add',
|
|
||||||
style: context.customRegular(
|
style: context.customRegular(
|
||||||
Colors.white, 12),
|
Colors.white, 12),
|
||||||
),
|
),
|
||||||
@@ -1202,7 +1146,6 @@ class _ProductDetailsState extends State<ProductDetails> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -65,8 +65,8 @@ class _ProfileScreenState extends State<ProfileScreen> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context)
|
Widget build(BuildContext context) {
|
||||||
{
|
print("lkdjflkjhjkg ${APPSTRING.isToken}");
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
body: NestedScrollView(
|
body: NestedScrollView(
|
||||||
headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) {
|
headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) {
|
||||||
@@ -113,7 +113,7 @@ class _ProfileScreenState extends State<ProfileScreen> {
|
|||||||
imageUrl: provider.profile ?? "",
|
imageUrl: provider.profile ?? "",
|
||||||
radius: 90,
|
radius: 90,
|
||||||
backGroundColor: Colors.white,
|
backGroundColor: Colors.white,
|
||||||
boxFit: BoxFit.fill,
|
boxFit: BoxFit.cover,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -228,9 +228,13 @@ class _ProfileScreenState extends State<ProfileScreen> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
InkWell(
|
InkWell(
|
||||||
onTap: () {
|
onTap: () async {
|
||||||
|
if (await SharedPrefUtils.getToken() != null) {
|
||||||
Provider.of<ProductProvider>(context, listen: false)
|
Provider.of<ProductProvider>(context, listen: false)
|
||||||
.customerLogOut(context);
|
.customerLogOut(context);
|
||||||
|
} else {
|
||||||
|
context.push(MyRoutes.SIGNUP);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
margin: const EdgeInsets.only(
|
margin: const EdgeInsets.only(
|
||||||
@@ -251,18 +255,10 @@ class _ProfileScreenState extends State<ProfileScreen> {
|
|||||||
const SizedBox(
|
const SizedBox(
|
||||||
width: 10,
|
width: 10,
|
||||||
),
|
),
|
||||||
if (APPSTRING.isToken == null ||
|
|
||||||
APPSTRING.isToken == "") ...{
|
|
||||||
Text(
|
|
||||||
"login",
|
|
||||||
style: context.customMedium(Colors.white, 16),
|
|
||||||
),
|
|
||||||
} else ...{
|
|
||||||
Text(
|
Text(
|
||||||
"Logout",
|
"Logout",
|
||||||
style: context.customMedium(Colors.white, 16),
|
style: context.customMedium(Colors.white, 16),
|
||||||
),
|
),
|
||||||
}
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -399,6 +395,4 @@ class _ProfileScreenState extends State<ProfileScreen> {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user