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( 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, ), ), ), ); } }