import 'package:betting/commom/utils/color_utils.dart';
import 'package:betting/commom/utils/textstyle.dart';
import 'package:betting/view/mobile/favourites_view/teams/switch_controller.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';

class BottomSheetWidget extends StatelessWidget {
  BottomSheetWidget({Key? key}) : super(key: key);
  final switchController = Get.find<SwitchController>();

  @override
  Widget build(BuildContext context) {
    return Container(
      padding: EdgeInsets.only(left: 10.w, right: 10.w),
      decoration: BoxDecoration(
          color: Colors.grey.shade800,
          borderRadius: const BorderRadius.only(
              topLeft: Radius.circular(15), topRight: Radius.circular(15))),
      height: Get.height * 0.4,
      width: Get.width,
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.center,
        children: [
          Container(
            width: 45,
            height: 5,
            margin: const EdgeInsets.only(top: 8, bottom: 10),
            decoration: const BoxDecoration(
              color: Colors.white,
              borderRadius: BorderRadius.all(
                Radius.circular(10),
              ),
            ),
          ),
          SizedBox(
            height: 10.h,
          ),
          Text(
            'Push Notifications',
            style: TextStyleUtils.sizeText16Weight700()!
                .copyWith(color: Colors.white),
          ),
          SizedBox(
            height: 8.h,
          ),
          Text(
              'Select the types of notification you would like to receive to Bayern Munich',
              style: TextStyleUtils.sizeText12Weight500()!
                  .copyWith(color: Colors.white),
              textAlign: TextAlign.center),
          Container(
            margin: const EdgeInsets.only(top: 10),
            padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 10),
            decoration: BoxDecoration(
              color: Colors.pinkAccent,
              borderRadius: BorderRadius.circular(8),
            ),
            child: Text(
                'Betting notifications are currently disable on this device. Tap here to open System Preferences',
                textAlign: TextAlign.left,
                style: TextStyleUtils.sizeText12Weight500()!
                    .copyWith(color: Colors.white)),
          ),
          const Spacer(),
          Row(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            children: [
              Row(
                children: [
                  const Icon(
                    Icons.sports_soccer,
                    color: Colors.white,
                    size: 22,
                  ),
                  const SizedBox(
                    width: 20,
                  ),
                  Column(
                    mainAxisAlignment: MainAxisAlignment.center,
                    crossAxisAlignment: CrossAxisAlignment.start,
                    children: [
                      Text(
                        'Match Alert',
                        style: TextStyleUtils.titleBold14Weigh500
                            .copyWith(color: Colors.white),
                      ),
                      Text(
                        'Get instant notification for Chelsea',
                        style: TextStyleUtils.sizeText12Weight400()!
                            .copyWith(color: Colors.white),
                      ),
                    ],
                  ),
                ],
              ),
              Transform.scale(
                scale: 0.6,
                child: Obx(
                      () => CupertinoSwitch(
                    value: switchController.isMatchAlert.value,
                    onChanged: (value) {
                      switchController.updateMatchAlert(value);
                    },
                    focusColor: Colors.white60,
                    activeColor: ColorUtils.PRIMARY_COLOR,
                  ),
                ),
              ),
            ],
          ),
          SizedBox(
            height: 8.h,
          ),
          Row(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            children: [
              Row(
                children: [
                  const Icon(
                    Icons.newspaper_outlined,
                    color: Colors.white,
                    size: 22,
                  ),
                  const SizedBox(
                    width: 20,
                  ),
                  Column(
                    mainAxisAlignment: MainAxisAlignment.center,
                    crossAxisAlignment: CrossAxisAlignment.start,
                    children: [
                      Text(
                        'Team News',
                        style: TextStyleUtils.titleBold14Weigh500
                            .copyWith(color: Colors.white),
                      ),
                      Text(
                        'Get the latest news Chelsea',
                        style: TextStyleUtils.sizeText12Weight400()!
                            .copyWith(color: Colors.white),
                      ),
                    ],
                  ),
                ],
              ),
              Transform.scale(
                scale: 0.6,
                child: Obx(
                      () => CupertinoSwitch(
                    value: switchController.isTeamNews.value,
                    onChanged: (value) {
                      switchController.updateTeamNews(value);
                    },
                    focusColor: Colors.white60,
                    activeColor: ColorUtils.PRIMARY_COLOR,
                  ),
                ),
              ),
            ],
          ),
          SizedBox(
            height: 12.h,
          ),
        SizedBox(
          width: double.infinity,
          child:   ElevatedButton(
            onPressed: () {
              Get.back();
            },
            style: ElevatedButton.styleFrom(
              backgroundColor: ColorUtils.PRIMARY_COLOR,
              shape: RoundedRectangleBorder(
                borderRadius: BorderRadius.circular(8),
              ),
            ),
            child: Text(
              'Done',
              style: TextStyleUtils.sizeText14Weight500()!
                  .copyWith(color: Colors.black87),
            ),
          ),
        )
        ],
      ),
    );
  }
}
