import 'package:flutter/material.dart';
import 'package:syncrow_web/pages/device_managment/shared/toggle_widget.dart';
import 'package:syncrow_web/utils/color_manager.dart';

class NotificationDialog extends StatefulWidget {
  const NotificationDialog({super.key});

  @override
  State<NotificationDialog> createState() => _NotificationDialogState();
}

class _NotificationDialogState extends State<NotificationDialog> {
  bool isLowBatteryNotificationEnabled = true;
  bool isClosingRemindersEnabled = true;
  bool isDoorAlarmEnabled = true;

  @override
  Widget build(BuildContext context) {
    return Dialog(
      backgroundColor: Colors.white,
      insetPadding: const EdgeInsets.all(20),
      shape: RoundedRectangleBorder(
        borderRadius: BorderRadius.circular(20),
      ),
      child: SizedBox(
        width: 660,
        child: SingleChildScrollView(
          child: Padding(
            padding: const EdgeInsets.all(20.0),
            child: Column(
              crossAxisAlignment: CrossAxisAlignment.start,
              children: [
                Row(
                  mainAxisAlignment: MainAxisAlignment.spaceBetween,
                  children: [
                    const SizedBox(),
                    Text(
                      'Notification Settings',
                      style: TextStyle(
                        fontWeight: FontWeight.bold,
                        fontSize: 22,
                        color: ColorsManager.dialogBlueTitle,
                      ),
                    ),
                    Container(
                      width: 25,
                      decoration: BoxDecoration(
                        color: Colors.transparent,
                        shape: BoxShape.circle,
                        border: Border.all(
                          color: Colors.grey,
                          width: 1.0,
                        ),
                      ),
                      child: IconButton(
                        padding: EdgeInsets.all(1),
                        icon: const Icon(
                          Icons.close,
                          color: Colors.grey,
                          size: 18,
                        ),
                        onPressed: () {
                          Navigator.of(context).pop();
                        },
                      ),
                    ),
                  ],
                ),
                const SizedBox(height: 20),
                Row(
                  mainAxisAlignment: MainAxisAlignment.spaceEvenly,
                  children: [
                    SizedBox(
                      width: 170,
                      height: 135,
                      child: ToggleWidget(
                        value: isLowBatteryNotificationEnabled,
                        code: 'notification',
                        deviceId: '',
                        label: 'Low Battery',
                        onChange: (v) {
                          setState(() {
                            isLowBatteryNotificationEnabled = v;
                          });
                        },
                        icon: '-1',
                      ),
                    ),
                    SizedBox(
                      width: 170,
                      height: 135,
                      child: ToggleWidget(
                        value: isClosingRemindersEnabled,
                        code: 'notification',
                        deviceId: '',
                        label: 'Closing\nReminders',
                        onChange: (v) {
                          setState(() {
                            isClosingRemindersEnabled = v;
                          });
                        },
                        icon: '-1',
                      ),
                    ),
                    SizedBox(
                      width: 170,
                      height: 135,
                      child: ToggleWidget(
                        value: isDoorAlarmEnabled,
                        code: 'notification',
                        deviceId: '',
                        label: 'Door Alarm',
                        onChange: (v) {
                          setState(() {
                            isDoorAlarmEnabled = v;
                          });
                        },
                        icon: '-1',
                      ),
                    ),
                  ],
                ),
              ],
            ),
          ),
        ),
      ),
    );
  }
}
