import 'package:flutter/material.dart';
import 'package:get/get.dart';

import '../../../constant/box_name.dart';
import '../../../constant/colors.dart';
import '../../../controller/home/map_passenger_controller.dart';
import '../../../main.dart';

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

  @override
  Widget build(BuildContext context) {
    return GetBuilder<MapPassengerController>(
        builder: (controller) => Positioned(
              top: 30,
              left: box.read(BoxName.lang) != 'ar' ? 5 : null,
              right: box.read(BoxName.lang) == 'ar' ? 5 : null,
              child: Container(
                decoration: BoxDecoration(
                    shape: BoxShape.circle,
                    color: AppColor.secondaryColor,
                    border: Border.all(color: AppColor.accentColor)),
                child: AnimatedCrossFade(
                  sizeCurve: Curves.bounceOut,
                  duration: const Duration(
                      milliseconds: 300), // Adjust the duration as needed
                  crossFadeState: controller.heightMenuBool
                      ? CrossFadeState.showFirst
                      : CrossFadeState.showSecond,
                  firstChild: IconButton(
                    onPressed: () {
                      controller.getDrawerMenu();
                    },
                    icon: const Icon(
                      Icons.close,
                      color: AppColor.primaryColor,
                    ),
                  ),
                  secondChild: IconButton(
                    onPressed: () {
                      controller.getDrawerMenu();
                    },
                    icon: const Icon(
                      Icons.menu,
                      color: AppColor.accentColor,
                    ),
                  ),
                ),
              ),
            ));
  }
}
