Offers And Discounts Complete

offers_discounts
Aamir Muhammad 4 weeks ago
parent c8eaf9a209
commit 75a3578049

@ -15,7 +15,7 @@ import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart';
import 'package:hmg_patient_app_new/widgets/common_bottom_sheet.dart';
import 'package:hmg_patient_app_new/widgets/routes/custom_page_route.dart';
import 'package:provider/provider.dart';
import 'package:share_plus/share_plus.dart';
import 'package:share_plus/share_plus.dart' hide Share;
import 'package:easy_localization/easy_localization.dart';
import 'package:shimmer/shimmer.dart';
@ -141,34 +141,35 @@ class _OfferAndDiscountsFullScreenSwiperPageState extends State<OfferAndDiscount
);
}
// Build page with image background
return Stack(
children: [
// Blurred background image
Positioned.fill(
child: Utils.buildImgWithNetwork(
url: vm.promoImages[vm.currentPage],
fit: BoxFit.cover,
width: double.infinity,
height: double.infinity,
iconColor: AppColors.whiteColor,
errorBuilder: (context, error, stackTrace) {
return Container(color: const Color(0xFFADA6D0));
},
// Build page with image background - wrapped with GestureDetector for pause/resume on tap
return GestureDetector(
onTapDown: (_) => vm.pauseTimer(),
onTapUp: (_) => vm.resumeTimer(),
onTapCancel: () => vm.resumeTimer(),
behavior: HitTestBehavior.opaque, // Ensures the entire area is tappable
child: Stack(
children: [
// Blurred background image
Positioned.fill(
child: Utils.buildImgWithNetwork(
url: vm.promoImages[vm.currentPage],
fit: BoxFit.cover,
width: double.infinity,
height: double.infinity,
iconColor: AppColors.whiteColor,
errorBuilder: (context, error, stackTrace) {
return Container(color: const Color(0xFFADA6D0));
},
),
),
),
// Black shadow overlay
Positioned.fill(
child: Container(
color: Colors.black.withValues(alpha: 0.3),
// Black shadow overlay
Positioned.fill(
child: Container(
color: Colors.black.withValues(alpha: 0.3),
),
),
),
// Main content
GestureDetector(
onTapDown: (_) => vm.pauseTimer(),
onTapUp: (_) => vm.resumeTimer(),
onTapCancel: () => vm.resumeTimer(),
child: Stack(
// Main content
Stack(
children: [
Column(
children: [
@ -188,8 +189,8 @@ class _OfferAndDiscountsFullScreenSwiperPageState extends State<OfferAndDiscount
child: _buildCloseButton()),
],
),
),
],
],
),
);
},
),
@ -332,8 +333,19 @@ class _OfferAndDiscountsFullScreenSwiperPageState extends State<OfferAndDiscount
_buildIconButton(
svgIcon: AppAssets.share,
onTap: () async {
// ignore: deprecated_member_use
await Share.share(LocaleKeys.checkOutThisAmazingOffer.tr(context: context));
// Get the current image URL
final currentImageUrl = vm.promoImages.isNotEmpty ? vm.promoImages[vm.currentPage] : '';
// Get offer name for better context
final offerName = vm.offerDetails != null ? (appState.getLanguageID() == 1 ? vm.offerDetails!.nameAr : vm.offerDetails!.name) : '';
// Build share message
final shareMessage = offerName.isNotEmpty
? '${LocaleKeys.checkOutThisAmazingOffer.tr(context: context)}\n\n$offerName\n\n$currentImageUrl'
: '${LocaleKeys.checkOutThisAmazingOffer.tr(context: context)}\n\n$currentImageUrl';
// Share the message with image URL using SharePlus
await SharePlus.instance.share(ShareParams(text: shareMessage));
}),
],
),

Loading…
Cancel
Save