import 'package:sefer_driver/constant/box_name.dart';
import 'package:sefer_driver/main.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:sefer_driver/constant/style.dart';
import 'package:sefer_driver/views/widgets/my_scafold.dart';

import '../../../constant/colors.dart';

class TaarifPage extends StatelessWidget {
  const TaarifPage({super.key});

  @override
  Widget build(BuildContext context) {
    return MyScafolld(isleading: true, title: 'Tariffs'.tr, body: [
      Padding(
        padding: const EdgeInsets.symmetric(horizontal: 4),
        child: ListView(
          // mainAxisAlignment: MainAxisAlignment.start,
          // crossAxisAlignment: CrossAxisAlignment.stretch,
          clipBehavior: Clip.hardEdge,
          children: [
            _buildTariffItem(
                context,
                'Minimum fare'.tr,
                box.read(BoxName.countryCode) == 'Jordan'
                    ? '1 ${'JOD'.tr}'
                    : '20 ${'LE'.tr}'),
            _buildTariffItem(
                context,
                'Maximum fare'.tr,
                box.read(BoxName.countryCode) == 'Jordan'
                    ? '200 ${'JOD'.tr}'
                    : '15000 ${'LE'.tr}'),
            _buildTariffItem(
                context,
                'Flag-down fee'.tr,
                box.read(BoxName.countryCode) == 'Jordan'
                    ? '0.47 ${'JOD'.tr}'
                    : '15 ${'LE'.tr}'),
            _buildTariffItem(
                context,
                'Rate'.tr,
                box.read(BoxName.countryCode) == 'Jordan'
                    ? '0.05 ${'JOD'.tr}/min and 0.21 ${'JOD'.tr}/km'
                    : '1 ${'LE'.tr}/min and 4 ${'LE'.tr}/km'),
            Padding(
              padding: const EdgeInsets.symmetric(vertical: 8.0),
              child: Text('Including Tax'.tr,
                  style: AppStyle.subtitle
                      .copyWith(color: Theme.of(context).hintColor)),
            ),
            const SizedBox(height: 10),
            Text('BookingFee'.tr, style: AppStyle.headTitle2),
            const SizedBox(height: 10),
            Text('10%', style: AppStyle.title),
            const SizedBox(height: 20),
            Text('Morning'.tr, style: AppStyle.headTitle2),
            const SizedBox(height: 10),
            Text(
                'from 07:30 till 10:30 (Thursday, Friday, Saturday, Monday)'.tr,
                style: AppStyle.title),
            const SizedBox(height: 20),
            Text('Evening'.tr, style: AppStyle.headTitle2),
            const SizedBox(height: 10),
            Text(
                'from 12:00 till 15:00 (Thursday, Friday, Saturday, Monday)'.tr,
                style: AppStyle.title),
            const SizedBox(height: 20),
            Text('Night'.tr, style: AppStyle.headTitle2),
            const SizedBox(height: 10),
            Text('from 23:59 till 05:30'.tr, style: AppStyle.title),
          ],
        ),
      ),
    ]);
  }

  Widget _buildTariffItem(BuildContext context, String label, String value) {
    return Padding(
      padding: const EdgeInsets.symmetric(vertical: 12.0),
      child: Row(
        mainAxisAlignment: MainAxisAlignment.spaceBetween,
        children: [
          Expanded(
            child: Text(label, style: AppStyle.title),
          ),
          Text(value,
              style: AppStyle.title.copyWith(
                  fontWeight: FontWeight.bold, color: AppColor.primaryColor)),
        ],
      ),
    );
  }
}
