import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:tanami_app/core/styles/app_color.dart';
import 'package:tanami_app/shared/components/text_widget.dart';

class ButtonWidget {
  //Text Button
  Widget textBtn({
    required Widget text,
    required VoidCallback function,
  }) {
    return TextButton(
      onPressed: function,
      child: text,
    );
  }

  //Elevated Button
  Widget textBorderBtn({
    required String text,
    required Color clr,
    Color? txtClr,
    Color? borderClr,
    required VoidCallback function,
  }) {
    return GestureDetector(
      onTap: function,
      child: Container(
        margin: const EdgeInsets.symmetric(
          horizontal: 16,
        ),
        width: 1.sw,
        height: 56.h,
        decoration: BoxDecoration(
          borderRadius: BorderRadius.circular(30),
          color: clr,
          border: Border.all(
            width: 1,
            color: borderClr!,
          ),
        ),
        child: Center(
          child: TextWidget().text14W700(
            text,
            clr: txtClr ?? AppColor.plainBlack,
            textDecoration: TextDecoration.underline,
          ),
        ),
      ),
    );
  }

//Elevated Button
  Widget elevatedBtn({
    required String text,
    required Color clr,
    Color? txtClr,
    required VoidCallback function,
  }) {
    return ElevatedButton(
      onPressed: function,
      style: ElevatedButton.styleFrom(
        backgroundColor: clr,
      ),
      child: TextWidget().text14W700(
        text,
        clr: txtClr ?? AppColor.plainWhite,
      ),
    );
  }
}
