import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:geolocator/geolocator.dart'; import 'package:proxibuy/core/config/app_colors.dart'; import 'package:proxibuy/core/gen/assets.gen.dart'; Future showGPSDialog(BuildContext context) async { bool isLocationEnabled = await Geolocator.isLocationServiceEnabled(); if (!isLocationEnabled) { await showDialog( context: context, barrierDismissible: false, builder: (BuildContext context) { return Dialog( shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(15)), elevation: 10, backgroundColor: Colors.white, child: Stack( clipBehavior: Clip.none, alignment: Alignment.topCenter, children: [ Padding( padding: const EdgeInsets.only( top: 40, left: 20, right: 20, bottom: 20), child: Column( mainAxisSize: MainAxisSize.min, children: [ const SizedBox(height: 10), const Padding( padding: EdgeInsets.all(15.0), child: Text( "فعالسازی موقعیت مکانی (GPS)", style: TextStyle( fontSize: 16, fontWeight: FontWeight.bold, ), ), ), const SizedBox(height: 5), const Text( "برای اینکه بتونیم تخفیف‌های اطرافت رو سریع بهت اطلاع بدیم، اجازه بده به موقعیت مکانیت دسترسی داشته باشیم.", style: TextStyle( color: AppColors.hint, fontSize: 16, ), textAlign: TextAlign.start, ), const SizedBox(height: 20), Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ GestureDetector( onTap: () => Navigator.of(context).pop(), child: Text("الان نه",style: TextStyle(color: AppColors.primary,fontWeight: FontWeight.bold),), ), ElevatedButton( style: ElevatedButton.styleFrom( backgroundColor: AppColors.primary, foregroundColor: Colors.white, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(8), side: const BorderSide(color: AppColors.border), ), padding: const EdgeInsets.symmetric( horizontal: 45, vertical: 7), ), onPressed: () async { await Geolocator.openLocationSettings(); Navigator.of(context).pop(); }, child: const Text( "فعالسازی", style: TextStyle(color: Colors.white), ), ), ], ), ], ), ), Positioned( top: -40, child: Container( decoration: BoxDecoration( shape: BoxShape.circle, boxShadow: [ BoxShadow( color: Colors.black.withOpacity(0.3), blurRadius: 8, offset: const Offset(0, 4), ), ], ), child: CircleAvatar( backgroundColor: Colors.white, radius: 40, child: Padding( padding: const EdgeInsets.all(12.0), child: SvgPicture.asset(Assets.icons.globalSearch.path), ), ), ), ), ], ), ); }, ); } }