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

import 'logic.dart';

class RegistrationOfViolationPage extends GetView<RegistrationOfViolationLogic> {
  const RegistrationOfViolationPage({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.countViolation.value++)],
      ),*/
      body: Padding(
        padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 10),
        child: Column(
          children: [
            Expanded(
              child: ObxValue((data) {
                return ListView.separated(
                  itemBuilder: (context, index) => violationWidget22(),
                  separatorBuilder: (context, index) => SizedBox(height: 15),
                  itemCount: data.value,
                );
              }, controller.countViolation),
            ),

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

Container violationWidget22() {
  return Container(
    padding: EdgeInsets.symmetric(horizontal: 8, vertical: 12),
    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,
        ),
        RTextField(
          controller: TextEditingController(),
          label: 'توضیحات تخلف',
          filled: true,
          filledColor: AppColor.whiteLight,
          maxLines: 3,
          minLines: 3,
        ),
        RTextField(
          controller: TextEditingController(),
          label: 'عنوان تخلف',
          filled: true,
          filledColor: AppColor.whiteLight,
        ),
        RTextField(
          controller: TextEditingController(),
          label: 'عنوان تخلف',
          filled: true,
          filledColor: AppColor.whiteLight,
        ),
        RTextField(
          controller: TextEditingController(),
          label: 'توضیحات تخلف',
          filled: true,
          filledColor: AppColor.whiteLight,
          maxLines: 3,
          minLines: 3,
        ),

        SizedBox(
          height: 40,
          child: Row(
            spacing: 16,
            children: [
              Expanded(
                child: RElevated(text: 'ثبت', onPressed: () {}),
              ),
              Expanded(
                child: ROutlinedElevated(text: 'انصراف', onPressed: () {}),
              ),
            ],
          ),
        ),
      ],
    ),
  );
}
