Offers And Discounts Complete

offers_discounts
Aamir Muhammad 1 month 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/common_bottom_sheet.dart';
import 'package:hmg_patient_app_new/widgets/routes/custom_page_route.dart'; import 'package:hmg_patient_app_new/widgets/routes/custom_page_route.dart';
import 'package:provider/provider.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:easy_localization/easy_localization.dart';
import 'package:shimmer/shimmer.dart'; import 'package:shimmer/shimmer.dart';
@ -141,8 +141,13 @@ class _OfferAndDiscountsFullScreenSwiperPageState extends State<OfferAndDiscount
); );
} }
// Build page with image background // Build page with image background - wrapped with GestureDetector for pause/resume on tap
return Stack( return GestureDetector(
onTapDown: (_) => vm.pauseTimer(),
onTapUp: (_) => vm.resumeTimer(),
onTapCancel: () => vm.resumeTimer(),
behavior: HitTestBehavior.opaque, // Ensures the entire area is tappable
child: Stack(
children: [ children: [
// Blurred background image // Blurred background image
Positioned.fill( Positioned.fill(
@ -164,11 +169,7 @@ class _OfferAndDiscountsFullScreenSwiperPageState extends State<OfferAndDiscount
), ),
), ),
// Main content // Main content
GestureDetector( Stack(
onTapDown: (_) => vm.pauseTimer(),
onTapUp: (_) => vm.resumeTimer(),
onTapCancel: () => vm.resumeTimer(),
child: Stack(
children: [ children: [
Column( Column(
children: [ children: [
@ -188,8 +189,8 @@ class _OfferAndDiscountsFullScreenSwiperPageState extends State<OfferAndDiscount
child: _buildCloseButton()), child: _buildCloseButton()),
], ],
), ),
),
], ],
),
); );
}, },
), ),
@ -332,8 +333,19 @@ class _OfferAndDiscountsFullScreenSwiperPageState extends State<OfferAndDiscount
_buildIconButton( _buildIconButton(
svgIcon: AppAssets.share, svgIcon: AppAssets.share,
onTap: () async { onTap: () async {
// ignore: deprecated_member_use // Get the current image URL
await Share.share(LocaleKeys.checkOutThisAmazingOffer.tr(context: context)); 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