import 'package:flutter/material.dart';
import 'package:guru_utils/feedback/feedback_manager.dart';
import 'package:guru_widgets/theme/guru_theme.dart';

class CircleButton extends StatelessWidget {
  final double radius;
  final Color? backgroundColor;
  final VoidCallback? onTapCallback;
  final Widget? content;

  const CircleButton(
      {Key? key, required this.radius, this.backgroundColor, this.onTapCallback, this.content})
      : super(key: key);

  @override
  Widget build(BuildContext context) {
    final guruTheme = GuruTheme.of(context);
    return Material(
      child: Ink(
        width: radius * 2,
        height: radius * 2,
        decoration: BoxDecoration(
            borderRadius: BorderRadius.circular(radius),
            color: backgroundColor ?? Colors.transparent),
        child: InkWell(
          customBorder: const CircleBorder(),
          onTap: () {
            if (guruTheme.feedbackCapabilities.canPerform()) {
              FeedbackManager.instance.perform(FeedbackOccasion.clickButton);
            }
            onTapCallback?.call();
          },
          child: Center(
            child: content,
          ),
        ),
      ),
    );
  }
}
