import 'package:flutter/material.dart';
import 'package:test_sa/views/app_style/sizing.dart';class AButton extends StatelessWidget {
  final String text;
  final Color? color; // Nullable
  final EdgeInsets? padding; // Nullable
  final TextStyle? textStyle; // Nullable
  final VoidCallback? onPressed; // Nullable

  const AButton({
    Key? key,this.color,
    required this.text,
    this.padding,
    this.onPressed,
    this.textStyle,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return SizedBox(
      width: MediaQuery.of(context).size.width,
      child: ElevatedButton(
        style: ElevatedButton.styleFrom(
          elevation: 0,
          backgroundColor: color,
          padding: padding ?? const EdgeInsets.symmetric(vertical: 12),
          shape: RoundedRectangleBorder(
              borderRadius: BorderRadius.circular(AppStyle.getBorderRadius(context))),
        ),
        onPressed: onPressed,
        child: Text(
          text,
          style: textStyle,
          textScaleFactor: AppStyle.getScaleFactor(context),
        ),
      ),
    );
  }
}