INFRA: Set Up Project.
This commit is contained in:
@@ -0,0 +1,198 @@
|
||||
import 'package:customer/constant/constant.dart';
|
||||
import 'package:customer/controllers/category_restaurant_controller.dart';
|
||||
import 'package:customer/models/vendor_model.dart';
|
||||
import 'package:customer/themes/app_them_data.dart';
|
||||
import 'package:customer/themes/responsive.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:get/get.dart';
|
||||
import '../../../controllers/theme_controller.dart';
|
||||
import '../../../widget/restaurant_image_view.dart';
|
||||
import '../restaurant_details_screen/restaurant_details_screen.dart';
|
||||
|
||||
class CategoryRestaurantScreen extends StatelessWidget {
|
||||
const CategoryRestaurantScreen({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final themeController = Get.find<ThemeController>();
|
||||
final isDark = themeController.isDark.value;
|
||||
return GetX(
|
||||
init: CategoryRestaurantController(),
|
||||
builder: (controller) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(backgroundColor: isDark ? AppThemeData.surfaceDark : AppThemeData.surface, centerTitle: false, titleSpacing: 0),
|
||||
body:
|
||||
controller.isLoading.value
|
||||
? Constant.loader()
|
||||
: controller.allNearestRestaurant.isEmpty
|
||||
? Constant.showEmptyView(message: "No Restaurant found".tr)
|
||||
: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
child: ListView.builder(
|
||||
shrinkWrap: true,
|
||||
itemCount: controller.allNearestRestaurant.length,
|
||||
itemBuilder: (context, index) {
|
||||
VendorModel vendorModel = controller.allNearestRestaurant[index];
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
Get.to(const RestaurantDetailsScreen(), arguments: {"vendorModel": vendorModel});
|
||||
},
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(bottom: 20),
|
||||
child: Container(
|
||||
decoration: ShapeDecoration(color: isDark ? AppThemeData.grey900 : AppThemeData.grey50, shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(16))),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Stack(
|
||||
children: [
|
||||
ClipRRect(
|
||||
borderRadius: const BorderRadius.only(topLeft: Radius.circular(16), topRight: Radius.circular(16)),
|
||||
child: Stack(
|
||||
children: [
|
||||
RestaurantImageView(vendorModel: vendorModel),
|
||||
Container(
|
||||
height: Responsive.height(20, context),
|
||||
width: Responsive.width(100, context),
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
begin: const Alignment(-0.00, -1.00),
|
||||
end: const Alignment(0, 1),
|
||||
colors: [Colors.black.withOpacity(0), const Color(0xFF111827)],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Transform.translate(
|
||||
offset: Offset(Responsive.width(-3, context), Responsive.height(17.5, context)),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
Visibility(
|
||||
visible: (vendorModel.isSelfDelivery == true && Constant.isSelfDeliveryFeature == true),
|
||||
child: Row(
|
||||
children: [
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 7),
|
||||
decoration: BoxDecoration(
|
||||
color: AppThemeData.success300,
|
||||
borderRadius: BorderRadius.circular(120), // Optional
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
SvgPicture.asset("assets/icons/ic_free_delivery.svg"),
|
||||
const SizedBox(width: 5),
|
||||
Text(
|
||||
"Free Delivery".tr,
|
||||
style: TextStyle(fontSize: 14, color: AppThemeData.success600, fontFamily: AppThemeData.semiBold, fontWeight: FontWeight.w600),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
decoration: ShapeDecoration(
|
||||
color: isDark ? AppThemeData.primary600 : AppThemeData.primary50,
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(120)),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 7),
|
||||
child: Row(
|
||||
children: [
|
||||
SvgPicture.asset("assets/icons/ic_star.svg", colorFilter: ColorFilter.mode(AppThemeData.primary300, BlendMode.srcIn)),
|
||||
const SizedBox(width: 5),
|
||||
Text(
|
||||
"${Constant.calculateReview(reviewCount: vendorModel.reviewsCount!.toStringAsFixed(0), reviewSum: vendorModel.reviewsSum.toString())} (${vendorModel.reviewsCount!.toStringAsFixed(0)})",
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: isDark ? AppThemeData.primary300 : AppThemeData.primary300,
|
||||
fontFamily: AppThemeData.semiBold,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
Container(
|
||||
decoration: ShapeDecoration(
|
||||
color: isDark ? AppThemeData.ecommerce600 : AppThemeData.ecommerce50,
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(120)),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 7),
|
||||
child: Row(
|
||||
children: [
|
||||
SvgPicture.asset("assets/icons/ic_map_distance.svg", colorFilter: ColorFilter.mode(AppThemeData.ecommerce300, BlendMode.srcIn)),
|
||||
const SizedBox(width: 5),
|
||||
Text(
|
||||
"${Constant.getDistance(lat1: vendorModel.latitude.toString(), lng1: vendorModel.longitude.toString(), lat2: Constant.selectedLocation.location!.latitude.toString(), lng2: Constant.selectedLocation.location!.longitude.toString())} ${Constant.distanceType}",
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: isDark ? AppThemeData.ecommerce300 : AppThemeData.ecommerce300,
|
||||
fontFamily: AppThemeData.semiBold,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 15),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
vendorModel.title.toString(),
|
||||
textAlign: TextAlign.start,
|
||||
maxLines: 1,
|
||||
style: TextStyle(
|
||||
fontSize: 18,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
fontFamily: AppThemeData.semiBold,
|
||||
color: isDark ? AppThemeData.grey50 : AppThemeData.grey900,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
vendorModel.location.toString(),
|
||||
textAlign: TextAlign.start,
|
||||
maxLines: 1,
|
||||
style: TextStyle(
|
||||
overflow: TextOverflow.ellipsis,
|
||||
fontFamily: AppThemeData.medium,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: isDark ? AppThemeData.grey400 : AppThemeData.grey400,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,320 @@
|
||||
import 'package:customer/constant/constant.dart';
|
||||
import 'package:customer/controllers/discount_restaurant_list_controller.dart';
|
||||
import 'package:customer/models/coupon_model.dart';
|
||||
import 'package:customer/models/vendor_model.dart';
|
||||
import 'package:customer/themes/app_them_data.dart';
|
||||
import 'package:customer/themes/responsive.dart';
|
||||
import 'package:customer/utils/network_image_widget.dart';
|
||||
import 'package:dotted_border/dotted_border.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:get/get.dart';
|
||||
import '../../../controllers/theme_controller.dart';
|
||||
import '../restaurant_details_screen/restaurant_details_screen.dart';
|
||||
|
||||
class DiscountRestaurantListScreen extends StatelessWidget {
|
||||
const DiscountRestaurantListScreen({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final themeController = Get.find<ThemeController>();
|
||||
final isDark = themeController.isDark.value;
|
||||
return GetX(
|
||||
init: DiscountRestaurantListController(),
|
||||
builder: (controller) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
backgroundColor: isDark ? AppThemeData.surfaceDark : AppThemeData.surface,
|
||||
centerTitle: false,
|
||||
titleSpacing: 0,
|
||||
title: Text(
|
||||
controller.title.value,
|
||||
textAlign: TextAlign.start,
|
||||
style: TextStyle(fontFamily: AppThemeData.medium, fontSize: 16, color: isDark ? AppThemeData.grey50 : AppThemeData.grey900),
|
||||
),
|
||||
),
|
||||
body:
|
||||
controller.isLoading.value
|
||||
? Constant.loader()
|
||||
: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
child: ListView.builder(
|
||||
shrinkWrap: true,
|
||||
itemCount: controller.vendorList.length,
|
||||
itemBuilder: (context, index) {
|
||||
VendorModel vendorModel = controller.vendorList[index];
|
||||
CouponModel offerModel = controller.couponList[index];
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
Get.to(RestaurantDetailsScreen(), arguments: {"vendorModel": vendorModel});
|
||||
},
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(bottom: 20),
|
||||
child: Container(
|
||||
decoration: ShapeDecoration(color: isDark ? AppThemeData.grey900 : AppThemeData.grey50, shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(16))),
|
||||
child: Row(
|
||||
children: [
|
||||
ClipRRect(
|
||||
borderRadius: const BorderRadius.only(topLeft: Radius.circular(16), bottomLeft: Radius.circular(16)),
|
||||
child: Stack(
|
||||
children: [
|
||||
NetworkImageWidget(imageUrl: vendorModel.photo.toString(), fit: BoxFit.cover, height: Responsive.height(16, context), width: Responsive.width(28, context)),
|
||||
Container(
|
||||
height: Responsive.height(16, context),
|
||||
width: Responsive.width(28, context),
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(begin: const Alignment(-0.00, -1.00), end: const Alignment(0, 1), colors: [Colors.black.withOpacity(0), const Color(0xFF111827)]),
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
top: 10,
|
||||
left: 10,
|
||||
child: Container(
|
||||
decoration: ShapeDecoration(
|
||||
color: isDark ? AppThemeData.ecommerce300 : AppThemeData.ecommerce300,
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(120)),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 4),
|
||||
child: Text(
|
||||
"${offerModel.discountType == "Fix Price" ? Constant.currencyModel!.symbol : ""}${offerModel.discount}${offerModel.discountType == "Percentage" ? "% off".toUpperCase().tr : " off".toUpperCase().tr}",
|
||||
textAlign: TextAlign.start,
|
||||
maxLines: 1,
|
||||
style: TextStyle(overflow: TextOverflow.ellipsis, fontFamily: AppThemeData.semiBold, color: isDark ? AppThemeData.grey50 : AppThemeData.grey50),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
vendorModel.title.toString(),
|
||||
textAlign: TextAlign.start,
|
||||
maxLines: 1,
|
||||
style: TextStyle(
|
||||
fontSize: 18,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
fontFamily: AppThemeData.semiBold,
|
||||
color: isDark ? AppThemeData.grey50 : AppThemeData.grey900,
|
||||
),
|
||||
),
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
SvgPicture.asset("assets/icons/ic_star.svg", colorFilter: ColorFilter.mode(AppThemeData.primary300, BlendMode.srcIn)),
|
||||
const SizedBox(width: 5),
|
||||
Text(
|
||||
"${Constant.calculateReview(reviewCount: vendorModel.reviewsCount!.toStringAsFixed(0), reviewSum: vendorModel.reviewsSum.toString())} (${vendorModel.reviewsCount!.toStringAsFixed(0)})",
|
||||
style: TextStyle(color: isDark ? AppThemeData.primary300 : AppThemeData.primary300, fontFamily: AppThemeData.semiBold, fontWeight: FontWeight.w600),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 5),
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Icon(Icons.location_on, size: 18, color: isDark ? AppThemeData.grey300 : AppThemeData.grey600),
|
||||
const SizedBox(width: 5),
|
||||
Expanded(
|
||||
child: Text(
|
||||
vendorModel.location.toString(),
|
||||
style: TextStyle(
|
||||
fontFamily: AppThemeData.medium,
|
||||
fontWeight: FontWeight.w500,
|
||||
fontSize: 12,
|
||||
color: isDark ? AppThemeData.grey400 : AppThemeData.grey400,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 5),
|
||||
Container(
|
||||
color: isDark ? AppThemeData.primary600 : AppThemeData.primary50,
|
||||
child: DottedBorder(
|
||||
options: RoundedRectDottedBorderOptions(
|
||||
radius: const Radius.circular(6),
|
||||
color: isDark ? AppThemeData.primary300 : AppThemeData.primary300,
|
||||
strokeWidth: 1,
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 2),
|
||||
child: Text(
|
||||
"${offerModel.code}",
|
||||
textAlign: TextAlign.start,
|
||||
style: TextStyle(fontFamily: AppThemeData.semiBold, fontSize: 16, color: isDark ? AppThemeData.primary300 : AppThemeData.primary300),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
// vhhv(){
|
||||
// return Column(
|
||||
// crossAxisAlignment: CrossAxisAlignment.start,
|
||||
// children: [
|
||||
// Stack(
|
||||
// children: [
|
||||
// ClipRRect(
|
||||
// borderRadius: const BorderRadius.only(topLeft: Radius.circular(16),topRight: Radius.circular(16)),
|
||||
// child: Stack(
|
||||
// children: [
|
||||
// RestaurantImageView(
|
||||
// vendorModel: vendorModel,
|
||||
// ),
|
||||
// Container(
|
||||
// height: Responsive.height(20, context),
|
||||
// width: Responsive.width(100, context),
|
||||
// decoration: BoxDecoration(
|
||||
// gradient: LinearGradient(
|
||||
// begin: const Alignment(-0.00, -1.00),
|
||||
// end: const Alignment(0, 1),
|
||||
// colors: [Colors.black.withOpacity(0), const Color(0xFF111827)],
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// Transform.translate(
|
||||
// offset: Offset(Responsive.width(-3, context), Responsive.height(17.5, context)),
|
||||
// child: Row(
|
||||
// mainAxisAlignment: MainAxisAlignment.end,
|
||||
// crossAxisAlignment: CrossAxisAlignment.end,
|
||||
// children: [
|
||||
// Container(
|
||||
// decoration: ShapeDecoration(
|
||||
// color: isDark ? AppThemeData.primary600 : AppThemeData.primary50,
|
||||
// shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(120)),
|
||||
// ),
|
||||
// child: Padding(
|
||||
// padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
|
||||
// child: Row(
|
||||
// children: [
|
||||
// SvgPicture.asset(
|
||||
// "assets/icons/ic_star.svg",
|
||||
// colorFilter: ColorFilter.mode(AppThemeData.primary300, BlendMode.srcIn),
|
||||
// ),
|
||||
// const SizedBox(
|
||||
// width: 5,
|
||||
// ),
|
||||
// Text(
|
||||
// "${Constant.calculateReview(reviewCount: vendorModel.reviewsCount!.toStringAsFixed(0), reviewSum: vendorModel.reviewsSum.toString())} (${vendorModel.reviewsCount!.toStringAsFixed(0)})",
|
||||
// style: TextStyle(
|
||||
// color: isDark ? AppThemeData.primary300 : AppThemeData.primary300,
|
||||
// fontFamily: AppThemeData.semiBold,
|
||||
// fontWeight: FontWeight.w600,
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// const SizedBox(
|
||||
// width: 10,
|
||||
// ),
|
||||
// Container(
|
||||
// decoration: ShapeDecoration(
|
||||
// color: isDark ? AppThemeData.ecommerce600 : AppThemeData.ecommerce50,
|
||||
// shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(120)),
|
||||
// ),
|
||||
// child: Padding(
|
||||
// padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
|
||||
// child: Row(
|
||||
// children: [
|
||||
// SvgPicture.asset(
|
||||
// "assets/icons/ic_map_distance.svg",
|
||||
// colorFilter: const ColorFilter.mode(AppThemeData.ecommerce300, BlendMode.srcIn),
|
||||
// ),
|
||||
// const SizedBox(
|
||||
// width: 5,
|
||||
// ),
|
||||
// Text(
|
||||
// "${Constant.getDistance(
|
||||
// lat1: vendorModel.latitude.toString(),
|
||||
// lng1: vendorModel.longitude.toString(),
|
||||
// lat2: Constant.selectedLocation.location!.latitude.toString(),
|
||||
// lng2: Constant.selectedLocation.location!.longitude.toString(),
|
||||
// )} ${Constant.distanceType}",
|
||||
// style: TextStyle(
|
||||
// color: isDark ? AppThemeData.ecommerce300 : AppThemeData.ecommerce300,
|
||||
// fontFamily: AppThemeData.semiBold,
|
||||
// fontWeight: FontWeight.w600,
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// )
|
||||
// ],
|
||||
// ),
|
||||
// const SizedBox(
|
||||
// height: 15,
|
||||
// ),
|
||||
// Padding(
|
||||
// padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
// child: Column(
|
||||
// crossAxisAlignment: CrossAxisAlignment.start,
|
||||
// children: [
|
||||
// Text(
|
||||
// vendorModel.title.toString(),
|
||||
// textAlign: TextAlign.start,
|
||||
// maxLines: 1,
|
||||
// style: TextStyle(
|
||||
// fontSize: 18,
|
||||
// overflow: TextOverflow.ellipsis,
|
||||
// fontFamily: AppThemeData.semiBold,
|
||||
// color: isDark ? AppThemeData.grey50 : AppThemeData.grey900,
|
||||
// ),
|
||||
// ),
|
||||
// Text(
|
||||
// vendorModel.location.toString(),
|
||||
// textAlign: TextAlign.start,
|
||||
// maxLines: 1,
|
||||
// style: TextStyle(
|
||||
// overflow: TextOverflow.ellipsis,
|
||||
// fontFamily: AppThemeData.medium,
|
||||
// fontWeight: FontWeight.w500,
|
||||
// color: isDark ? AppThemeData.grey400 : AppThemeData.grey400,
|
||||
// ),
|
||||
// )
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// const SizedBox(
|
||||
// height: 10,
|
||||
// ),
|
||||
// ],
|
||||
// );
|
||||
// }
|
||||
}
|
||||
2042
lib/screen_ui/multi_vendor_service/home_screen/home_screen.dart
Normal file
2042
lib/screen_ui/multi_vendor_service/home_screen/home_screen.dart
Normal file
File diff suppressed because it is too large
Load Diff
1074
lib/screen_ui/multi_vendor_service/home_screen/home_screen_two.dart
Normal file
1074
lib/screen_ui/multi_vendor_service/home_screen/home_screen_two.dart
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,229 @@
|
||||
import 'package:customer/constant/constant.dart';
|
||||
import 'package:customer/controllers/restaurant_list_controller.dart';
|
||||
import 'package:customer/models/favourite_model.dart';
|
||||
import 'package:customer/models/vendor_model.dart';
|
||||
import 'package:customer/themes/app_them_data.dart';
|
||||
import 'package:customer/themes/responsive.dart';
|
||||
import '../../../controllers/theme_controller.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../../service/fire_store_utils.dart';
|
||||
import '../../../widget/restaurant_image_view.dart';
|
||||
import '../restaurant_details_screen/restaurant_details_screen.dart';
|
||||
|
||||
class RestaurantListScreen extends StatelessWidget {
|
||||
const RestaurantListScreen({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final themeController = Get.find<ThemeController>();
|
||||
final isDark = themeController.isDark.value;
|
||||
return GetX(
|
||||
init: RestaurantListController(),
|
||||
builder: (controller) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
backgroundColor: isDark ? AppThemeData.surfaceDark : AppThemeData.surface,
|
||||
centerTitle: false,
|
||||
titleSpacing: 0,
|
||||
title: Text(
|
||||
controller.title.value,
|
||||
textAlign: TextAlign.start,
|
||||
style: TextStyle(fontFamily: AppThemeData.medium, fontSize: 16, color: isDark ? AppThemeData.grey50 : AppThemeData.grey900),
|
||||
),
|
||||
),
|
||||
body:
|
||||
controller.isLoading.value
|
||||
? Constant.loader()
|
||||
: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
child: ListView.builder(
|
||||
shrinkWrap: true,
|
||||
itemCount: controller.vendorSearchList.length,
|
||||
itemBuilder: (context, index) {
|
||||
VendorModel vendorModel = controller.vendorSearchList[index];
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
Get.to(const RestaurantDetailsScreen(), arguments: {"vendorModel": vendorModel})?.then((v) {
|
||||
controller.getFavouriteRestaurant();
|
||||
});
|
||||
},
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(bottom: 20),
|
||||
child: Container(
|
||||
decoration: ShapeDecoration(color: isDark ? AppThemeData.grey900 : AppThemeData.grey50, shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(16))),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Stack(
|
||||
children: [
|
||||
ClipRRect(
|
||||
borderRadius: const BorderRadius.only(topLeft: Radius.circular(16), topRight: Radius.circular(16)),
|
||||
child: Stack(
|
||||
children: [
|
||||
RestaurantImageView(vendorModel: vendorModel),
|
||||
Container(
|
||||
height: Responsive.height(20, context),
|
||||
width: Responsive.width(100, context),
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
begin: const Alignment(-0.00, -1.00),
|
||||
end: const Alignment(0, 1),
|
||||
colors: [Colors.black.withOpacity(0), const Color(0xFF111827)],
|
||||
),
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
right: 10,
|
||||
top: 10,
|
||||
child: InkWell(
|
||||
onTap: () async {
|
||||
if (controller.favouriteList.where((p0) => p0.restaurantId == vendorModel.id).isNotEmpty) {
|
||||
FavouriteModel favouriteModel = FavouriteModel(restaurantId: vendorModel.id, userId: FireStoreUtils.getCurrentUid());
|
||||
controller.favouriteList.removeWhere((item) => item.restaurantId == vendorModel.id);
|
||||
await FireStoreUtils.removeFavouriteRestaurant(favouriteModel);
|
||||
} else {
|
||||
FavouriteModel favouriteModel = FavouriteModel(restaurantId: vendorModel.id, userId: FireStoreUtils.getCurrentUid());
|
||||
controller.favouriteList.add(favouriteModel);
|
||||
await FireStoreUtils.setFavouriteRestaurant(favouriteModel);
|
||||
}
|
||||
},
|
||||
child: Obx(
|
||||
() =>
|
||||
controller.favouriteList.where((p0) => p0.restaurantId == vendorModel.id).isNotEmpty
|
||||
? SvgPicture.asset("assets/icons/ic_like_fill.svg")
|
||||
: SvgPicture.asset("assets/icons/ic_like.svg"),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Transform.translate(
|
||||
offset: Offset(Responsive.width(-3, context), Responsive.height(17.5, context)),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
Visibility(
|
||||
visible: (vendorModel.isSelfDelivery == true && Constant.isSelfDeliveryFeature == true),
|
||||
child: Row(
|
||||
children: [
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 7),
|
||||
decoration: BoxDecoration(
|
||||
color: AppThemeData.success300,
|
||||
borderRadius: BorderRadius.circular(120), // Optional
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
SvgPicture.asset("assets/icons/ic_free_delivery.svg"),
|
||||
const SizedBox(width: 5),
|
||||
Text(
|
||||
"Free Delivery".tr,
|
||||
style: TextStyle(fontSize: 14, color: AppThemeData.carRent600, fontFamily: AppThemeData.semiBold, fontWeight: FontWeight.w600),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 7),
|
||||
decoration: ShapeDecoration(
|
||||
color: isDark ? AppThemeData.primary600 : AppThemeData.primary50,
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(120)),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
SvgPicture.asset("assets/icons/ic_star.svg", colorFilter: ColorFilter.mode(AppThemeData.primary300, BlendMode.srcIn)),
|
||||
const SizedBox(width: 5),
|
||||
Text(
|
||||
"${Constant.calculateReview(reviewCount: vendorModel.reviewsCount!.toStringAsFixed(0), reviewSum: vendorModel.reviewsSum.toString())} (${vendorModel.reviewsCount!.toStringAsFixed(0)})",
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: isDark ? AppThemeData.primary300 : AppThemeData.primary300,
|
||||
fontFamily: AppThemeData.semiBold,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 7),
|
||||
decoration: ShapeDecoration(
|
||||
color: isDark ? AppThemeData.ecommerce600 : AppThemeData.ecommerce50,
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(120)),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
SvgPicture.asset("assets/icons/ic_map_distance.svg", colorFilter: ColorFilter.mode(AppThemeData.ecommerce300, BlendMode.srcIn)),
|
||||
const SizedBox(width: 5),
|
||||
Text(
|
||||
"${Constant.getDistance(lat1: vendorModel.latitude.toString(), lng1: vendorModel.longitude.toString(), lat2: Constant.selectedLocation.location!.latitude.toString(), lng2: Constant.selectedLocation.location!.longitude.toString())} ${Constant.distanceType}",
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: isDark ? AppThemeData.ecommerce300 : AppThemeData.ecommerce300,
|
||||
fontFamily: AppThemeData.semiBold,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 15),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
vendorModel.title.toString(),
|
||||
textAlign: TextAlign.start,
|
||||
maxLines: 1,
|
||||
style: TextStyle(
|
||||
fontSize: 18,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
fontFamily: AppThemeData.semiBold,
|
||||
color: isDark ? AppThemeData.grey50 : AppThemeData.grey900,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
vendorModel.location.toString(),
|
||||
textAlign: TextAlign.start,
|
||||
maxLines: 1,
|
||||
style: TextStyle(
|
||||
overflow: TextOverflow.ellipsis,
|
||||
fontFamily: AppThemeData.medium,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: isDark ? AppThemeData.grey400 : AppThemeData.grey400,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
171
lib/screen_ui/multi_vendor_service/home_screen/story_view.dart
Normal file
171
lib/screen_ui/multi_vendor_service/home_screen/story_view.dart
Normal file
@@ -0,0 +1,171 @@
|
||||
import 'package:customer/constant/constant.dart';
|
||||
import 'package:customer/models/story_model.dart';
|
||||
import 'package:customer/models/vendor_model.dart';
|
||||
import 'package:customer/themes/app_them_data.dart';
|
||||
import 'package:customer/utils/network_image_widget.dart';
|
||||
import 'package:customer/widget/story_view/controller/story_controller.dart';
|
||||
import 'package:customer/widget/story_view/utils.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:get/get.dart';
|
||||
import '../../../service/fire_store_utils.dart';
|
||||
import '../../../widget/story_view/widgets/story_view.dart';
|
||||
import '../restaurant_details_screen/restaurant_details_screen.dart';
|
||||
|
||||
// ignore: must_be_immutable
|
||||
class MoreStories extends StatefulWidget {
|
||||
final List<StoryModel> storyList;
|
||||
int index;
|
||||
|
||||
MoreStories({super.key, required this.index, required this.storyList});
|
||||
|
||||
@override
|
||||
MoreStoriesState createState() => MoreStoriesState();
|
||||
}
|
||||
|
||||
class MoreStoriesState extends State<MoreStories> {
|
||||
StoryController storyController = StoryController();
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
storyController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
body: GestureDetector(
|
||||
onHorizontalDragEnd: (details) {
|
||||
// Swipe to next story
|
||||
if (details.primaryVelocity != null && details.primaryVelocity! < 0) {
|
||||
if (widget.index < widget.storyList.length - 1) {
|
||||
setState(() {
|
||||
storyController.dispose();
|
||||
storyController = StoryController();
|
||||
});
|
||||
setState(() {
|
||||
widget.index++;
|
||||
});
|
||||
} else {
|
||||
Navigator.pop(context);
|
||||
}
|
||||
}
|
||||
|
||||
// Swipe to previous story
|
||||
if (details.primaryVelocity != null && details.primaryVelocity! > 0) {
|
||||
if (widget.index > 0) {
|
||||
setState(() {
|
||||
storyController.dispose();
|
||||
storyController = StoryController();
|
||||
});
|
||||
setState(() {
|
||||
widget.index--;
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
child: Stack(
|
||||
children: [
|
||||
StoryView(
|
||||
key: ValueKey(widget.index),
|
||||
storyItems:
|
||||
List.generate(widget.storyList[widget.index].videoUrl.length, (i) {
|
||||
return StoryItem.pageVideo(widget.storyList[widget.index].videoUrl[i], controller: storyController);
|
||||
}).toList(),
|
||||
onComplete: () {
|
||||
debugPrint("--------->");
|
||||
debugPrint(widget.storyList.length.toString());
|
||||
debugPrint(widget.index.toString());
|
||||
if (widget.storyList.length - 1 != widget.index) {
|
||||
setState(() {
|
||||
widget.index = widget.index + 1;
|
||||
});
|
||||
} else {
|
||||
Navigator.pop(context);
|
||||
}
|
||||
},
|
||||
progressPosition: ProgressPosition.top,
|
||||
repeat: true,
|
||||
controller: storyController,
|
||||
onVerticalSwipeComplete: (direction) {
|
||||
if (direction == Direction.down) {
|
||||
Navigator.pop(context);
|
||||
}
|
||||
},
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(top: MediaQuery.of(context).viewPadding.top + 30, left: 16, right: 16),
|
||||
child: FutureBuilder(
|
||||
future: FireStoreUtils.getVendorById(widget.storyList[widget.index].vendorID.toString()),
|
||||
builder: (context, snapshot) {
|
||||
if (snapshot.connectionState == ConnectionState.waiting) {
|
||||
return SizedBox();
|
||||
} else {
|
||||
if (snapshot.hasError) {
|
||||
return Center(child: Text('${"Error".tr}: ${snapshot.error}'));
|
||||
return Center(child: Text('Error: ${snapshot.error}'));
|
||||
} else if (snapshot.data == null) {
|
||||
return const SizedBox();
|
||||
} else {
|
||||
VendorModel vendorModel = snapshot.data!;
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
Get.to(const RestaurantDetailsScreen(), arguments: {"vendorModel": vendorModel});
|
||||
},
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
ClipOval(child: NetworkImageWidget(imageUrl: vendorModel.photo.toString(), width: 50, height: 50, fit: BoxFit.cover)),
|
||||
const SizedBox(width: 10),
|
||||
Expanded(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
vendorModel.title.toString(),
|
||||
textAlign: TextAlign.center,
|
||||
maxLines: 1,
|
||||
style: const TextStyle(color: Colors.white, fontSize: 16, overflow: TextOverflow.ellipsis, fontWeight: FontWeight.w700),
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
SvgPicture.asset("assets/icons/ic_star.svg"),
|
||||
const SizedBox(width: 5),
|
||||
Text(
|
||||
"${Constant.calculateReview(reviewCount: vendorModel.reviewsCount.toString(), reviewSum: vendorModel.reviewsSum.toString())} ${'reviews'.tr}",
|
||||
textAlign: TextAlign.center,
|
||||
maxLines: 1,
|
||||
style: const TextStyle(color: AppThemeData.warning300, fontSize: 12, overflow: TextOverflow.ellipsis, fontWeight: FontWeight.w700),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
InkWell(
|
||||
onTap: () async {
|
||||
Get.back();
|
||||
},
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(10.0),
|
||||
decoration: BoxDecoration(borderRadius: BorderRadius.circular(30), color: Colors.grey),
|
||||
child: SvgPicture.asset("assets/icons/ic_close.svg", colorFilter: ColorFilter.mode(AppThemeData.grey800, BlendMode.srcIn)),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
import 'package:customer/constant/constant.dart';
|
||||
import 'package:customer/controllers/view_all_category_controller.dart';
|
||||
import 'package:customer/models/vendor_category_model.dart';
|
||||
import 'package:customer/themes/app_them_data.dart';
|
||||
import 'package:customer/utils/network_image_widget.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../../controllers/theme_controller.dart';
|
||||
import 'category_restaurant_screen.dart';
|
||||
|
||||
class ViewAllCategoryScreen extends StatelessWidget {
|
||||
const ViewAllCategoryScreen({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final themeController = Get.find<ThemeController>();
|
||||
final isDark = themeController.isDark.value;
|
||||
return GetX(
|
||||
init: ViewAllCategoryController(),
|
||||
builder: (controller) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
backgroundColor: isDark ? AppThemeData.surfaceDark : AppThemeData.surface,
|
||||
centerTitle: false,
|
||||
titleSpacing: 0,
|
||||
title: Text("Categories".tr, style: TextStyle(fontSize: 16, color: isDark ? AppThemeData.grey50 : AppThemeData.grey900, fontFamily: AppThemeData.medium, fontWeight: FontWeight.w500)),
|
||||
),
|
||||
body:
|
||||
controller.isLoading.value
|
||||
? Constant.loader()
|
||||
: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
child: GridView.builder(
|
||||
padding: EdgeInsets.zero,
|
||||
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 4, childAspectRatio: 3.5 / 6, crossAxisSpacing: 6),
|
||||
itemCount: controller.vendorCategoryModel.length,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
shrinkWrap: true,
|
||||
itemBuilder: (context, index) {
|
||||
VendorCategoryModel vendorCategoryModel = controller.vendorCategoryModel[index];
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
Get.to(const CategoryRestaurantScreen(), arguments: {"vendorCategoryModel": vendorCategoryModel, "dineIn": false});
|
||||
},
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 4, vertical: 6),
|
||||
child: Container(
|
||||
decoration: ShapeDecoration(
|
||||
color: isDark ? AppThemeData.grey900 : AppThemeData.grey50,
|
||||
shape: RoundedRectangleBorder(
|
||||
side: BorderSide(width: 1, strokeAlign: BorderSide.strokeAlignOutside, color: isDark ? AppThemeData.grey800 : AppThemeData.grey100),
|
||||
borderRadius: BorderRadius.circular(100),
|
||||
),
|
||||
),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(width: 60, height: 60, child: ClipOval(child: NetworkImageWidget(imageUrl: vendorCategoryModel.photo.toString(), fit: BoxFit.cover))),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 10),
|
||||
child: Text(
|
||||
'${vendorCategoryModel.title}',
|
||||
textAlign: TextAlign.center,
|
||||
maxLines: 2,
|
||||
style: AppThemeData.mediumTextStyle(color: isDark ? AppThemeData.grey50 : AppThemeData.grey900, fontSize: 12),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user