BASE: Update Icons & Name Of The App.
This commit is contained in:
@@ -9,8 +9,7 @@ import 'package:customer/utils/network_image_widget.dart';
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import 'package:get/get.dart' hide Trans;
|
||||
import '../../../controllers/theme_controller.dart';
|
||||
import '../../../service/fire_store_utils.dart';
|
||||
import '../../../themes/show_toast_dialog.dart';
|
||||
@@ -30,20 +29,27 @@ class AllAdvertisementScreen extends StatelessWidget {
|
||||
builder: (controller) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
backgroundColor: isDark ? AppThemeData.surfaceDark : AppThemeData.surface,
|
||||
backgroundColor:
|
||||
isDark ? AppThemeData.surfaceDark : AppThemeData.surface,
|
||||
centerTitle: false,
|
||||
titleSpacing: 0,
|
||||
title: Text(
|
||||
"Highlights for you".tr(),
|
||||
textAlign: TextAlign.start,
|
||||
style: TextStyle(fontFamily: AppThemeData.medium, fontSize: 16, color: isDark ? AppThemeData.grey50 : AppThemeData.grey900),
|
||||
style: TextStyle(
|
||||
fontFamily: AppThemeData.medium,
|
||||
fontSize: 16,
|
||||
color: isDark ? AppThemeData.grey50 : AppThemeData.grey900,
|
||||
),
|
||||
),
|
||||
),
|
||||
body:
|
||||
controller.isLoading.value
|
||||
? Constant.loader()
|
||||
: controller.advertisementList.isEmpty
|
||||
? Constant.showEmptyView(message: "Highlights for you not found.".tr())
|
||||
? Constant.showEmptyView(
|
||||
message: "Highlights for you not found.".tr(),
|
||||
)
|
||||
: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
child: ListView.builder(
|
||||
@@ -51,7 +57,10 @@ class AllAdvertisementScreen extends StatelessWidget {
|
||||
itemCount: controller.advertisementList.length,
|
||||
padding: EdgeInsets.all(0),
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return AdvertisementCard(controller: controller, model: controller.advertisementList[index]);
|
||||
return AdvertisementCard(
|
||||
controller: controller,
|
||||
model: controller.advertisementList[index],
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
@@ -65,7 +74,11 @@ class AdvertisementCard extends StatelessWidget {
|
||||
final AdvertisementModel model;
|
||||
final AdvertisementListController controller;
|
||||
|
||||
const AdvertisementCard({super.key, required this.controller, required this.model});
|
||||
const AdvertisementCard({
|
||||
super.key,
|
||||
required this.controller,
|
||||
required this.model,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -74,9 +87,14 @@ class AdvertisementCard extends StatelessWidget {
|
||||
return InkWell(
|
||||
onTap: () async {
|
||||
ShowToastDialog.showLoader("Please wait...".tr());
|
||||
VendorModel? vendorModel = await FireStoreUtils.getVendorById(model.vendorId!);
|
||||
VendorModel? vendorModel = await FireStoreUtils.getVendorById(
|
||||
model.vendorId!,
|
||||
);
|
||||
ShowToastDialog.closeLoader();
|
||||
Get.to(const RestaurantDetailsScreen(), arguments: {"vendorModel": vendorModel});
|
||||
Get.to(
|
||||
const RestaurantDetailsScreen(),
|
||||
arguments: {"vendorModel": vendorModel},
|
||||
);
|
||||
},
|
||||
child: Container(
|
||||
margin: EdgeInsets.only(bottom: 16),
|
||||
@@ -84,7 +102,14 @@ class AdvertisementCard extends StatelessWidget {
|
||||
decoration: BoxDecoration(
|
||||
color: isDark ? AppThemeData.info600 : AppThemeData.surface,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
boxShadow: [BoxShadow(color: Colors.black.withOpacity(0.1), blurRadius: isDark ? 6 : 2, spreadRadius: 0, offset: Offset(0, isDark ? 3 : 1))],
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.black.withOpacity(0.1),
|
||||
blurRadius: isDark ? 6 : 2,
|
||||
spreadRadius: 0,
|
||||
offset: Offset(0, isDark ? 3 : 1),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
@@ -93,18 +118,32 @@ class AdvertisementCard extends StatelessWidget {
|
||||
children: [
|
||||
model.type == 'restaurant_promotion'
|
||||
? ClipRRect(
|
||||
borderRadius: BorderRadius.vertical(top: Radius.circular(16)),
|
||||
child: NetworkImageWidget(imageUrl: model.coverImage ?? '', height: 150, width: double.infinity, fit: BoxFit.cover),
|
||||
borderRadius: BorderRadius.vertical(
|
||||
top: Radius.circular(16),
|
||||
),
|
||||
child: NetworkImageWidget(
|
||||
imageUrl: model.coverImage ?? '',
|
||||
height: 150,
|
||||
width: double.infinity,
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
)
|
||||
: VideoAdvWidget(url: model.video ?? '', height: 150, width: double.infinity),
|
||||
if (model.type != 'video_promotion' && model.vendorId != null && (model.showRating == true || model.showReview == true))
|
||||
: VideoAdvWidget(
|
||||
url: model.video ?? '',
|
||||
height: 150,
|
||||
width: double.infinity,
|
||||
),
|
||||
if (model.type != 'video_promotion' &&
|
||||
model.vendorId != null &&
|
||||
(model.showRating == true || model.showReview == true))
|
||||
Positioned(
|
||||
bottom: 8,
|
||||
right: 8,
|
||||
child: FutureBuilder(
|
||||
future: FireStoreUtils.getVendorById(model.vendorId!),
|
||||
builder: (context, snapshot) {
|
||||
if (snapshot.connectionState == ConnectionState.waiting) {
|
||||
if (snapshot.connectionState ==
|
||||
ConnectionState.waiting) {
|
||||
return const SizedBox();
|
||||
} else {
|
||||
if (snapshot.hasError) {
|
||||
@@ -114,16 +153,42 @@ class AdvertisementCard extends StatelessWidget {
|
||||
} else {
|
||||
VendorModel vendorModel = snapshot.data!;
|
||||
return Container(
|
||||
decoration: ShapeDecoration(color: isDark ? AppThemeData.primary600 : AppThemeData.primary50, shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(120))),
|
||||
decoration: ShapeDecoration(
|
||||
color:
|
||||
isDark
|
||||
? AppThemeData.primary600
|
||||
: AppThemeData.primary50,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(120),
|
||||
),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 12,
|
||||
vertical: 8,
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
if (model.showRating == true) SvgPicture.asset("assets/icons/ic_star.svg", colorFilter: ColorFilter.mode(AppThemeData.primary300, BlendMode.srcIn)),
|
||||
if (model.showRating == true) const SizedBox(width: 5),
|
||||
if (model.showRating == true)
|
||||
SvgPicture.asset(
|
||||
"assets/icons/ic_star.svg",
|
||||
colorFilter: ColorFilter.mode(
|
||||
AppThemeData.primary300,
|
||||
BlendMode.srcIn,
|
||||
),
|
||||
),
|
||||
if (model.showRating == true)
|
||||
const SizedBox(width: 5),
|
||||
Text(
|
||||
"${model.showRating == true ? Constant.calculateReview(reviewCount: vendorModel.reviewsCount!.toStringAsFixed(0), reviewSum: vendorModel.reviewsSum.toString()) : ''}${model.showRating == true && model.showReview == true ? ' ' : ''}${model.showReview == true ? '(${vendorModel.reviewsCount!.toStringAsFixed(0)})' : ''}",
|
||||
style: TextStyle(color: isDark ? AppThemeData.primary300 : AppThemeData.primary300, fontFamily: AppThemeData.semiBold, fontWeight: FontWeight.w600),
|
||||
style: TextStyle(
|
||||
color:
|
||||
isDark
|
||||
? AppThemeData.primary300
|
||||
: AppThemeData.primary300,
|
||||
fontFamily: AppThemeData.semiBold,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -142,7 +207,15 @@ class AdvertisementCard extends StatelessWidget {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
if (model.type == 'restaurant_promotion')
|
||||
ClipRRect(borderRadius: BorderRadius.circular(30), child: NetworkImageWidget(imageUrl: model.profileImage ?? '', height: 50, width: 50, fit: BoxFit.cover)),
|
||||
ClipRRect(
|
||||
borderRadius: BorderRadius.circular(30),
|
||||
child: NetworkImageWidget(
|
||||
imageUrl: model.profileImage ?? '',
|
||||
height: 50,
|
||||
width: 50,
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: Column(
|
||||
@@ -150,12 +223,26 @@ class AdvertisementCard extends StatelessWidget {
|
||||
children: [
|
||||
Text(
|
||||
model.title ?? '',
|
||||
style: TextStyle(color: isDark ? AppThemeData.grey50 : AppThemeData.grey900, fontSize: 16, fontWeight: FontWeight.bold),
|
||||
style: TextStyle(
|
||||
color:
|
||||
isDark
|
||||
? AppThemeData.grey50
|
||||
: AppThemeData.grey900,
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
Text(
|
||||
model.description ?? '',
|
||||
style: TextStyle(fontSize: 14, fontFamily: AppThemeData.medium, color: isDark ? AppThemeData.grey400 : AppThemeData.grey600),
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
fontFamily: AppThemeData.medium,
|
||||
color:
|
||||
isDark
|
||||
? AppThemeData.grey400
|
||||
: AppThemeData.grey600,
|
||||
),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
maxLines: 2,
|
||||
),
|
||||
@@ -166,25 +253,74 @@ class AdvertisementCard extends StatelessWidget {
|
||||
? Obx(
|
||||
() => IconButton(
|
||||
icon:
|
||||
controller.favouriteList.where((p0) => p0.restaurantId == model.vendorId).isNotEmpty
|
||||
? SvgPicture.asset("assets/icons/ic_like_fill.svg")
|
||||
: SvgPicture.asset("assets/icons/ic_like.svg", colorFilter: ColorFilter.mode(isDark ? AppThemeData.grey400 : AppThemeData.grey600, BlendMode.srcIn)),
|
||||
controller.favouriteList
|
||||
.where(
|
||||
(p0) =>
|
||||
p0.restaurantId == model.vendorId,
|
||||
)
|
||||
.isNotEmpty
|
||||
? SvgPicture.asset(
|
||||
"assets/icons/ic_like_fill.svg",
|
||||
)
|
||||
: SvgPicture.asset(
|
||||
"assets/icons/ic_like.svg",
|
||||
colorFilter: ColorFilter.mode(
|
||||
isDark
|
||||
? AppThemeData.grey400
|
||||
: AppThemeData.grey600,
|
||||
BlendMode.srcIn,
|
||||
),
|
||||
),
|
||||
onPressed: () async {
|
||||
if (controller.favouriteList.where((p0) => p0.restaurantId == model.vendorId).isNotEmpty) {
|
||||
FavouriteModel favouriteModel = FavouriteModel(restaurantId: model.vendorId, userId: FireStoreUtils.getCurrentUid());
|
||||
controller.favouriteList.removeWhere((item) => item.restaurantId == model.vendorId);
|
||||
await FireStoreUtils.removeFavouriteRestaurant(favouriteModel);
|
||||
if (controller.favouriteList
|
||||
.where(
|
||||
(p0) => p0.restaurantId == model.vendorId,
|
||||
)
|
||||
.isNotEmpty) {
|
||||
FavouriteModel favouriteModel = FavouriteModel(
|
||||
restaurantId: model.vendorId,
|
||||
userId: FireStoreUtils.getCurrentUid(),
|
||||
);
|
||||
controller.favouriteList.removeWhere(
|
||||
(item) => item.restaurantId == model.vendorId,
|
||||
);
|
||||
await FireStoreUtils.removeFavouriteRestaurant(
|
||||
favouriteModel,
|
||||
);
|
||||
} else {
|
||||
FavouriteModel favouriteModel = FavouriteModel(restaurantId: model.vendorId, userId: FireStoreUtils.getCurrentUid());
|
||||
FavouriteModel favouriteModel = FavouriteModel(
|
||||
restaurantId: model.vendorId,
|
||||
userId: FireStoreUtils.getCurrentUid(),
|
||||
);
|
||||
controller.favouriteList.add(favouriteModel);
|
||||
await FireStoreUtils.setFavouriteRestaurant(favouriteModel);
|
||||
await FireStoreUtils.setFavouriteRestaurant(
|
||||
favouriteModel,
|
||||
);
|
||||
}
|
||||
},
|
||||
),
|
||||
)
|
||||
: Container(
|
||||
decoration: ShapeDecoration(color: isDark ? AppThemeData.primary600 : AppThemeData.primary50, shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(5))),
|
||||
child: Padding(padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 4), child: Icon(Icons.arrow_forward, size: 20, color: AppThemeData.primary300)),
|
||||
decoration: ShapeDecoration(
|
||||
color:
|
||||
isDark
|
||||
? AppThemeData.primary600
|
||||
: AppThemeData.primary50,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(5),
|
||||
),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 10,
|
||||
vertical: 4,
|
||||
),
|
||||
child: Icon(
|
||||
Icons.arrow_forward,
|
||||
size: 20,
|
||||
color: AppThemeData.primary300,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user