This commit is contained in:
Hamza-Ayed
2024-07-15 11:37:06 +03:00
parent 65a8084c92
commit 4ffaa591fa
22 changed files with 739 additions and 42 deletions

View File

@@ -34,6 +34,7 @@ class HomeCaptain extends StatelessWidget {
Get.put(HomeCaptainController());
WidgetsBinding.instance.addPostFrameCallback((_) {
checkForUpdate(context);
_showFirstTimeOfferNotification(context);
});
return Scaffold(
appBar: AppBar(
@@ -276,7 +277,7 @@ class HomeCaptain extends StatelessWidget {
),
),
)
: SizedBox()
: const SizedBox()
// callPage(),
// Positioned(
@@ -297,35 +298,131 @@ class HomeCaptain extends StatelessWidget {
}
}
// class CameraContainer extends StatelessWidget {
// TextMLGoogleRecognizerController controller =
// Get.put(TextMLGoogleRecognizerController());
void _showFirstTimeOfferNotification(BuildContext context) {
bool isFirstTime = _checkIfFirstTime();
// CameraContainer({super.key});
// @override
// Widget build(BuildContext context) {
// return Stack(
// children: [
// // The camera preview
// SizedBox(
// height: Get.height * 0.3,
// width: Get.width * 0.9,
// child: CameraPreview(controller.imagePicker as CameraController),
// ),
if (isFirstTime) {
WidgetsBinding.instance.addPostFrameCallback((_) {
showDialog(
context: context,
builder: (BuildContext context) {
return Dialog(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20),
),
elevation: 0,
backgroundColor: Colors.transparent,
child: Container(
padding: const EdgeInsets.all(20),
decoration: BoxDecoration(
shape: BoxShape.rectangle,
color: Colors.white,
borderRadius: BorderRadius.circular(20),
boxShadow: const [
BoxShadow(
color: Colors.black26,
blurRadius: 10.0,
offset: Offset(0.0, 10.0),
),
],
),
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Text(
'Welcome Offer!'.tr,
style: const TextStyle(
fontSize: 24,
fontWeight: FontWeight.w700,
),
),
const SizedBox(height: 15),
Text(
'As a new driver, you\'re eligible for a special offer!'.tr,
textAlign: TextAlign.center,
style: const TextStyle(fontSize: 16),
),
const SizedBox(height: 20),
Stack(
children: <Widget>[
Container(
padding: const EdgeInsets.all(10),
decoration: BoxDecoration(
color: Colors.green,
borderRadius: BorderRadius.circular(15),
),
child: Text(
'3000 LE'.tr,
style: const TextStyle(
color: Colors.white,
fontSize: 25,
fontWeight: FontWeight.bold,
),
),
),
Positioned(
right: -10,
top: -10,
child: Container(
padding: const EdgeInsets.all(5),
decoration: const BoxDecoration(
color: Colors.red,
shape: BoxShape.circle,
),
child: const Icon(
Icons.attach_money,
color: Colors.white,
size: 20,
),
),
),
],
),
const SizedBox(height: 20),
Text(
'for your first registration!'.tr,
style: const TextStyle(fontSize: 16),
),
const SizedBox(height: 20),
ElevatedButton(
style: ElevatedButton.styleFrom(
backgroundColor: Colors.green,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(30),
),
),
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 20, vertical: 10),
child: Text(
"Get it Now!".tr,
style:
const TextStyle(fontSize: 18, color: Colors.white),
),
),
onPressed: () {
Navigator.of(context).pop();
_markAsNotFirstTime();
},
),
],
),
),
);
},
);
});
}
}
// // The lines on the side of the name and national number
// const Positioned(
// bottom: 0,
// left: 0,
// right: 0,
// child: Column(
// children: [
// Text('Name'),
// Text('National Number'),
// ],
// ),
// ),
// ],
// );
// }
// }
bool _checkIfFirstTime() {
if (box.read(BoxName.isFirstTime) == null) {
return true;
} else {
return false;
}
}
void _markAsNotFirstTime() {
box.write(BoxName.isFirstTime, true);
}