import 'package:flutter/material.dart';
import 'package:rasadyar_core/core.dart';
import 'package:rasadyar_core/presentation/widget/buttons/fab.dart';
import 'package:rasadyar_inspection/presentation/routes/app_routes.dart';

import 'logic.dart';

class AddMobileInspectorPage extends GetView<AddMobileInspectorLogic> {
  const AddMobileInspectorPage({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: AppColor.bgLight,
      appBar: RAppBar(
        title: 'افزودن بازرس همراه',
        leading: Assets.vec.messageAddSvg.svg(
          width: 16,
          height: 16,
          colorFilter: ColorFilter.mode(
            Colors.white,
            BlendMode.srcIn,
          ),
        ),
        additionalActions: [
          RFab.smallAdd(onPressed: () => controller.countInspector.value++),
        ],
      ),
      body: Column(
        children: [
          Expanded(
            child: ObxValue((data) {
              return ListView.separated(
                padding: const EdgeInsets.fromLTRB(25, 10, 25, 0),
                itemBuilder: (context, index) => mobileInspectorWidget(),
                separatorBuilder: (context, index) => SizedBox(height: 15),
                itemCount: data.value,
              );
            }, controller.countInspector),
          ),

          Padding(
            padding: const EdgeInsets.fromLTRB(20, 4, 20, 25),
            child: RElevated(
              text: 'مرحله بعد',
              onPressed: () {
                Get.toNamed(InspectionRoutes.inspectionRegistrationOfViolation);
              },
              height: 40,
              isFullWidth: true,
              backgroundColor: AppColor.greenNormal,
              textStyle: AppFonts.yekan16.copyWith(color: Colors.white),
            ),
          ),
        ],
      ),
    );
  }


}
Container mobileInspectorWidget() {
  return Container(
    padding: EdgeInsets.symmetric(horizontal: 12, vertical: 16),
    decoration: BoxDecoration(
      borderRadius: BorderRadius.circular(8),
      border: Border.all(width: 0.7, color: AppColor.bgDark),
    ),
    child: Column(
      spacing: 16,
      children: [
        RTextField(
          controller: TextEditingController(),
          label: 'نام و نام خانوادگی',
          filled: true,
          filledColor: AppColor.whiteLight,
          padding: EdgeInsets.zero,
        ),
        RTextField(
          controller: TextEditingController(),
          label: 'شماره مجوز',
          filled: true,
          filledColor: AppColor.whiteLight,
          padding: EdgeInsets.zero,
        ),
        RTextField(
          controller: TextEditingController(),
          label: 'شماره ثبت',
          filled: true,
          filledColor: AppColor.whiteLight,
          padding: EdgeInsets.zero,
        ),
        RTextField(
          controller: TextEditingController(),
          label: 'کد اقتصادی',
          filled: true,
          filledColor: AppColor.whiteLight,
          padding: EdgeInsets.zero,
        ),

        Padding(
          padding: const EdgeInsets.symmetric(vertical: 12),
          child: SizedBox(
            height: 40,
            child: Row(
              spacing: 16,
              children: [
                Expanded(
                  child: RElevated(
                    text: 'ثبت',
                    textStyle: AppFonts.yekan16.copyWith(color: Colors.white),
                    onPressed: () {},
                  ),
                ),
                Expanded(
                  child: ROutlinedElevated(
                    text: 'انصراف',
                    textStyle: AppFonts.yekan16,
                    onPressed: () {},
                  ),
                ),
              ],
            ),
          ),
        ),
      ],
    ),
  );
}