272 lines
10 KiB
Dart
Executable File
272 lines
10 KiB
Dart
Executable File
import 'package:sefer_driver/constant/colors.dart';
|
|
import 'package:sefer_driver/constant/style.dart';
|
|
import 'package:sefer_driver/controller/home/captin/help/maintain_center_controller.dart';
|
|
import 'package:sefer_driver/views/widgets/elevated_btn.dart';
|
|
import 'package:sefer_driver/views/widgets/my_scafold.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:get/get.dart';
|
|
|
|
// class MaintainCenterPage extends StatelessWidget {
|
|
// MaintainCenterPage({super.key});
|
|
// MaintainCenterController maintainCenterController =
|
|
// Get.put(MaintainCenterController());
|
|
|
|
// @override
|
|
// Widget build(BuildContext context) {
|
|
// return MyScafolld(
|
|
// title: "Maintenance Center".tr,
|
|
// body: [
|
|
// GetBuilder<MaintainCenterController>(
|
|
// builder: (maintainCenterController) {
|
|
// return Padding(
|
|
// padding: const EdgeInsets.all(8.0),
|
|
// child: Column(
|
|
// children: [
|
|
// Text(
|
|
// "When you complete 600 trips, you will be eligible to receive offers for maintenance of your car."
|
|
// .tr),
|
|
// const SizedBox(
|
|
// height: 10,
|
|
// ),
|
|
// Row(
|
|
// mainAxisAlignment: MainAxisAlignment.spaceAround,
|
|
// children: [
|
|
// MyElevatedButton(
|
|
// title: "Show My Trip Count".tr,
|
|
// onPressed: () async {
|
|
// maintainCenterController.getTripCountByCaptain();
|
|
// }),
|
|
// _buildPriceAvatar(
|
|
// maintainCenterController.tripCount['count'] == null
|
|
// ? '0'
|
|
// : maintainCenterController.tripCount['count']
|
|
// .toString())
|
|
// ],
|
|
// ),
|
|
// const SizedBox(
|
|
// height: 10,
|
|
// ),
|
|
// Container(
|
|
// decoration: AppStyle.boxDecoration,
|
|
// child: Padding(
|
|
// padding: const EdgeInsets.all(14),
|
|
// child: Text(
|
|
// "We have maintenance offers for your car. You can use them after completing 600 trips to get a 20% discount on car repairs. Enjoy using our SEFER app and be part of our SEFER family."
|
|
// .tr,
|
|
// style: AppStyle.title,
|
|
// ),
|
|
// ),
|
|
// ),
|
|
// const SizedBox(
|
|
// height: 10,
|
|
// ),
|
|
// MyElevatedButton(
|
|
// title: 'Show maintenance center near my location'.tr,
|
|
// onPressed: () {
|
|
// if (maintainCenterController.tripCount['count'] > 600) {
|
|
// } else {
|
|
// Get.snackbar("You should complete 600 trips".tr, '',
|
|
// backgroundColor: AppColor.yellowColor);
|
|
// }
|
|
// })
|
|
// ],
|
|
// ),
|
|
// );
|
|
// })
|
|
// ],
|
|
// isleading: true);
|
|
// }
|
|
|
|
// Widget _buildPriceAvatar(String count) {
|
|
// return Container(
|
|
// width: 80,
|
|
// height: 80,
|
|
// decoration: BoxDecoration(
|
|
// shape: BoxShape.circle,
|
|
// gradient: const RadialGradient(
|
|
// colors: [Color(0xFF4CAF50), Color(0xFF2E7D32)],
|
|
// center: Alignment.center,
|
|
// radius: 0.8,
|
|
// ),
|
|
// boxShadow: [
|
|
// BoxShadow(
|
|
// color: Colors.black.withOpacity(0.2),
|
|
// blurRadius: 8,
|
|
// offset: const Offset(0, 4),
|
|
// ),
|
|
// ],
|
|
// ),
|
|
// child: Center(
|
|
// child: Text(
|
|
// count,
|
|
// style: const TextStyle(
|
|
// fontSize: 22,
|
|
// fontWeight: FontWeight.bold,
|
|
// color: Colors.white,
|
|
// ),
|
|
// ),
|
|
// ),
|
|
// );
|
|
// }
|
|
// }
|
|
|
|
class MaintainCenterPage extends StatelessWidget {
|
|
MaintainCenterPage({super.key});
|
|
final MaintainCenterController maintainCenterController =
|
|
Get.put(MaintainCenterController());
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return MyScafolld(
|
|
title: "Maintenance Center".tr,
|
|
body: [
|
|
GetBuilder<MaintainCenterController>(
|
|
builder: (controller) {
|
|
return Padding(
|
|
padding: const EdgeInsets.all(16.0),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
// Introduction Text with better styling
|
|
Text(
|
|
"When you complete 600 trips, you will be eligible to receive offers for maintenance of your car."
|
|
.tr,
|
|
style: Theme.of(context).textTheme.titleMedium!.copyWith(
|
|
color: Colors.grey[700],
|
|
height: 1.4,
|
|
),
|
|
),
|
|
const SizedBox(height: 20),
|
|
|
|
// Trip Count Section in a Card
|
|
Card(
|
|
elevation: 4,
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.circular(12),
|
|
),
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(16.0),
|
|
child: Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
Expanded(
|
|
child: MyElevatedButton(
|
|
title: "Show My Trip Count".tr,
|
|
onPressed: () async {
|
|
controller.getTripCountByCaptain();
|
|
},
|
|
),
|
|
),
|
|
const SizedBox(width: 16),
|
|
_buildPriceAvatar(
|
|
controller.tripCount['count'] == null
|
|
? '0'
|
|
: controller.tripCount['count'].toString(),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
const SizedBox(height: 20),
|
|
|
|
// Maintenance Offer Information in a Card
|
|
Card(
|
|
elevation: 4,
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.circular(12),
|
|
),
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(16.0),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text(
|
|
"Maintenance Offer".tr,
|
|
style: Theme.of(context).textTheme.titleLarge,
|
|
),
|
|
const SizedBox(height: 8),
|
|
Text(
|
|
"We have maintenance offers for your car. You can use them after completing 600 trips to get a 20% discount on car repairs. Enjoy using our SEFER app and be part of our SEFER family."
|
|
.tr,
|
|
style: Theme.of(context)
|
|
.textTheme
|
|
.bodyMedium!
|
|
.copyWith(
|
|
color: Colors.grey[800],
|
|
height: 1.5,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
const SizedBox(height: 20),
|
|
|
|
// Show Maintenance Center Button
|
|
SizedBox(
|
|
width: double.infinity,
|
|
child: MyElevatedButton(
|
|
title: 'Show maintenance center near my location'.tr,
|
|
onPressed: () {
|
|
if (controller.tripCount['count'] != null &&
|
|
controller.tripCount['count'] >= 600) {
|
|
// Implement navigation or action to show maintenance centers
|
|
// For now, let's print a message
|
|
print("Navigating to maintenance centers...");
|
|
} else {
|
|
Get.snackbar(
|
|
"Ineligible for Offer".tr,
|
|
"You should complete 500 trips to unlock this feature."
|
|
.tr,
|
|
backgroundColor: AppColor.yellowColor,
|
|
colorText: Colors.black,
|
|
snackPosition: SnackPosition.BOTTOM,
|
|
);
|
|
}
|
|
},
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
},
|
|
),
|
|
],
|
|
isleading: true,
|
|
);
|
|
}
|
|
|
|
Widget _buildPriceAvatar(String count) {
|
|
return Container(
|
|
width: 70, // Slightly reduced size
|
|
height: 70,
|
|
decoration: BoxDecoration(
|
|
shape: BoxShape.circle,
|
|
gradient: const LinearGradient(
|
|
// Changed to LinearGradient
|
|
colors: [Color(0xFF4CAF50), Color(0xFF2E7D32)],
|
|
begin: Alignment.topLeft,
|
|
end: Alignment.bottomRight,
|
|
),
|
|
boxShadow: [
|
|
BoxShadow(
|
|
color: Colors.black.withOpacity(0.15), // Reduced opacity
|
|
blurRadius: 6, // Slightly reduced blur
|
|
offset: const Offset(0, 3),
|
|
),
|
|
],
|
|
),
|
|
child: Center(
|
|
child: Text(
|
|
count,
|
|
style: const TextStyle(
|
|
fontSize: 20, // Slightly reduced size
|
|
fontWeight: FontWeight.bold,
|
|
color: Colors.white,
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|