import 'package:didvan/config/theme_data.dart';
import 'package:didvan/views/widgets/didvan/text.dart';
import 'package:flutter/material.dart';

class DidvanRadialButton extends StatelessWidget {
  final String title;
  final VoidCallback onSelected;
  final bool value;
  final double? fontSize;
  final String? fontFamily;
  const DidvanRadialButton({
    Key? key,
    required this.title,
    required this.onSelected,
    required this.value,
    this.fontFamily,
    this.fontSize,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      onTap: value ? null : onSelected,
      child: Container(
        color: Colors.transparent,
        child: Row(
          children: [
            Container(
              padding: const EdgeInsets.all(4),
              height: 24,
              width: 24,
              decoration: BoxDecoration(
                shape: BoxShape.circle,
                border: Border.all(
                  color: value
                      ? Theme.of(context).colorScheme.secondary
                      : Theme.of(context).colorScheme.text,
                ),
              ),
              child: Container(
                width: double.infinity,
                height: double.infinity,
                decoration: BoxDecoration(
                  color: value
                      ? Theme.of(context).colorScheme.secondary
                      : Colors.transparent,
                  shape: BoxShape.circle,
                ),
              ),
            ),
            const SizedBox(width: 8),
            DidvanText(
              title,
              style: Theme.of(context).textTheme.bodyMedium!.copyWith(
                    fontFamily: fontFamily,
                  ),
              fontSize: fontSize,
            ),
          ],
        ),
      ),
    );
  }
}
