import 'package:flutter/material.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:mitra_corporate/provider/surat_jalan_provider.dart';
import 'package:mitra_corporate/screen/surat_jalan/form_surat_jalan.dart';
import 'package:mitra_corporate/screen/surat_jalan/surat_jalan_confirmation.dart';

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

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

  // const DialogSuratJalan({super.key});

  @override
  Widget build(BuildContext context, WidgetRef ref) {
    final bacaSuratJalanProvider = ref.watch(suratJalanProvider);

    return Padding(
      padding: const EdgeInsets.symmetric(horizontal: 40),
      child: SimpleDialog(
          shape: const RoundedRectangleBorder(
              borderRadius: BorderRadius.all(Radius.circular(12))),
          children: [
            Padding(
              padding: EdgeInsets.fromLTRB(40, 20, 40, 20),
              child: Column(
                children: [
                  SizedBox(
                    width: Constant.getActualX(context: context, x: 1332),
                    height: Constant.getActualY(context: context, y: 62),
                    child: Text(
                        bacaSuratJalanProvider == 1
                            ? 'Pengiriman Order Baru'
                            : "Konfirmasi",
                        style: Constant.h2_600(context: context)
                            .copyWith(color: Constant.textBlack)),
                  ),
                  SizedBox(
                      height: Constant.getActualY(context: context, y: 10)),

                  ///
                  if (bacaSuratJalanProvider == 1) FormSuratJalan(),
                  if (bacaSuratJalanProvider == 2) SuratJalanConfirmation(),

                  ///
                ],
              ),
            ),
          ]),
    );
  }
}
