import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:tanami_app/features/register/presentation/bloc/register_bloc.dart';

import '../../../../core/styles/app_color.dart';
import '../../../countrySelection/presentation/bloc/choose_country_bloc.dart';
import 'register_layout.dart';

class RegisterScreen extends StatelessWidget {
  const RegisterScreen({super.key});

  @override
  Widget build(BuildContext context) {
    final radioBloc = context.read<RadioBloc>();
    return WillPopScope(
      onWillPop: () async {
        radioBloc.resetSelection();
        return true; // Allow the pop to happen
      },
      child: Scaffold(
        backgroundColor: AppColor.plainWhite,
        resizeToAvoidBottomInset: true,
        body: MultiBlocProvider(
          providers: [
            BlocProvider(
              // Create an instance of the OnboardingBloc
              create: (context) => RegisterBloc(),
            ),
          ],
          child: const RegisterLayout(),
        ),
      ),
    );
  }
}
