import 'package:comwell_key_app/presentation/screens/pregistration/cubit/preregistration_cubit.dart';
import 'package:comwell_key_app/themes/light_theme.dart';
import 'package:flutter/material.dart';

class PreregBottomButton extends StatelessWidget {
  final bool loading;
  final PreregistrationCubit cubit;
  final String buttonText;
  const PreregBottomButton({super.key, required this.loading, required this.cubit, required this.buttonText});

  @override
  Widget build(BuildContext context) {
    return Builder(builder: (context) {
      if (loading) return const SizedBox();
      return Column(
        mainAxisSize: MainAxisSize.min,
        children: [
          Row(
            children: [
              Expanded(
                child: Padding(
                  padding: const EdgeInsets.fromLTRB(16.0, 16.0, 16.0, 40.0),
                  child: ElevatedButton(
                    onPressed: cubit.canContinue
                        ? () => cubit.onContinueClicked(context)
                        : null,
                    style: ElevatedButton.styleFrom(
                        backgroundColor: sandColor,
                        foregroundColor: Colors.white),
                    child: Padding(
                      padding: const EdgeInsets.symmetric(vertical: 16.0),
                      child: Text(buttonText),
                    ),
                  ),
                ),
              ),
            ],
          ),
        ],
      );
    });
  }
}