import 'package:flutter/material.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:mitra_corporate/model/registration_model.dart';
import 'package:mitra_corporate/provider/registrasi_provider.dart';

import '../../app/constant.dart';

class RegistrasiSukses extends HookConsumerWidget {
  const RegistrasiSukses({
    super.key,
  });

  @override
  Widget build(BuildContext context, WidgetRef ref) {
    final orderNumber = ref.watch(orderNumberProvider);
    return Column(
      children: [
        SizedBox(
          // color: Colors.green,
          width: Constant.getActualX(context: context, x: 500),
          height: Constant.getActualY(context: context, y: 500),
          child: Image.asset(
            'images/order_success.png',
            fit: BoxFit.contain,
          ),
        ),
        SizedBox(
          height: Constant.getActualY(context: context, y: 20),
        ),
        Text('Registrastion Success',
            style: Constant.h3_400(context: context)
                .copyWith(color: Constant.textBlack)),
        SizedBox(
          height: Constant.getActualY(context: context, y: 48),
        ),
        SelectableText('Order Number : $orderNumber',
            style: Constant.h3_400(context: context)
                .copyWith(color: Constant.textBlack)),
        SizedBox(
          height: Constant.getActualY(context: context, y: 48),
        ),
        SizedBox(
          height: Constant.getActualY(context: context, y: 48),
          child: OutlinedButton(
              style: OutlinedButton.styleFrom(
                  backgroundColor: Colors.white,
                  side: BorderSide(color: Constant.primaryRed, width: 1),
                  shape: RoundedRectangleBorder(
                      borderRadius: BorderRadius.circular(8))),
              onPressed: () {
                Navigator.pop(context);
                ref.read(registrasiProvider.notifier).state = 0;
                ref.read(idTipePeriksaStateProvider.notifier).state = 1;
                ref.read(registrationDataProvider.notifier).state =
                    RegistrationModel();
                ref.read(selectedTestProvider.notifier).state =
                    List.empty(growable: true);
                ref.read(tempTestListProvider.notifier).state =
                    List.empty(growable: true);
                ref.read(selectedPacketProvider.notifier).state =
                    List.empty(growable: true);
              },
              child: Text('Kembali ke Dashboard',
                  style: Constant.body3_600(context: context)
                      .copyWith(color: Constant.primaryRed))),
        ),
      ],
    );
  }
}
