import 'package:flutter/material.dart';
import 'package:gap/gap.dart';
import 'package:pharmacy_mobile/widgets/button_widget.dart';
import 'package:pharmacy_mobile/widgets/text_widget.dart';

class ButtonWithProgressWidget extends StatelessWidget {
  final bool trigger;
  final String progressText;
  final String buttonText;
  final VoidCallback onPressed;

  const ButtonWithProgressWidget(
      {super.key,
      required this.trigger,
      required this.progressText,
      required this.buttonText,
      required this.onPressed});

  @override
  Widget build(BuildContext context) {
    if (trigger) {
      return Center(
          child: Column(
        children: [
          const CircularProgressIndicator(color: Color.fromRGBO(255, 255, 255, 1)),
          const Gap(16),
          TextWidget(
            text: progressText,
            size: 12,
          )
        ],
      ));
    } else {
      return ButtonWidget(text: buttonText, onPressed: onPressed);
    }
  }
}
