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,34 +141,35 @@ 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(
children: [ onTapDown: (_) => vm.pauseTimer(),
// Blurred background image onTapUp: (_) => vm.resumeTimer(),
Positioned.fill( onTapCancel: () => vm.resumeTimer(),
child: Utils.buildImgWithNetwork( behavior: HitTestBehavior.opaque, // Ensures the entire area is tappable
url: vm.promoImages[vm.currentPage], child: Stack(
fit: BoxFit.cover, children: [
width: double.infinity, // Blurred background image
height: double.infinity, Positioned.fill(
iconColor: AppColors.whiteColor, child: Utils.buildImgWithNetwork(
errorBuilder: (context, error, stackTrace) { url: vm.promoImages[vm.currentPage],
return Container(color: const Color(0xFFADA6D0)); 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
// Black shadow overlay Positioned.fill(
Positioned.fill( child: Container(
child: Container( color: Colors.black.withValues(alpha: 0.3),
color: Colors.black.withValues(alpha: 0.3), ),
), ),
), // Main content
// Main content Stack(
GestureDetector(
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