import 'package:chat/configs/app_colors.dart';
import 'package:flutter/material.dart';

class ActionButton extends StatelessWidget {
  final String text;
  final Color color;
  final VoidCallback? onTap;
  final bool hasTop;
  final bool hasBottom;
  const ActionButton(
    this.text, {
    this.color = AppColors.primary,
    this.onTap,
    this.hasTop = false,
    this.hasBottom = false,
    Key? key,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      behavior: HitTestBehavior.opaque,
      onTap: () {
        onTap?.call();
      },
      child: Column(
        children: [
          if (hasTop)
            const Divider(
              height: 0,
              color: AppColors.border,
            ),
          Container(
            color: AppColors.white,
            child: Padding(
              padding: const EdgeInsets.all(14.0),
              child: Center(
                child: Text(
                  text,
                  style: TextStyle(
                    fontSize: 16,
                    fontWeight: FontWeight.w500,
                    color: color,
                  ),
                ),
              ),
            ),
          ),
          if (hasBottom)
            const Divider(
              height: 0,
              color: AppColors.border,
            ),
        ],
      ),
    );
  }
}
