import 'package:flutter/material.dart';
import 'package:rasadyar_core/core.dart';

import 'logic.dart';

class DisplayInformationPage extends GetView<DisplayInformationLogic> {
  const DisplayInformationPage({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(
           AppColor.blueNormal,
            BlendMode.srcIn,
          ),
        ),
      ),*/

      body: Column(
        children: [
          Expanded(
            child: SingleChildScrollView(
              physics: BouncingScrollPhysics(),
              child: Column(
                spacing: 20,
                children: [
                  ratingbarWidget(),
                  markerDetailsWidget(),
                  accompanyingInspectorsWidget(),
                  accompanyingInspectorsWidget(),
                  violationWidget(),
                  violationWidget(),
                  SizedBox(height: 30,)
                ],
              ),
            
            
            ),
          ),



          Padding(
            padding: const EdgeInsets.fromLTRB(20, 4, 20, 25),
            child: Row(
              children: [
                Expanded(
                  child: RElevated(height: 40, text: 'ثبت', onPressed: () {}),
                ),
                SizedBox(width: 8),
                Expanded(
                  child: ROutlinedElevated(
                    height: 40,
                    text: 'انصراف',
                    onPressed: () {
                      Get.until((route) => route.isFirst);
                    },
                  ),
                ),
              ],
            ),
          ),
        ],
      ),
    );
  }

  Widget ratingbarWidget() {
    return Padding(
      padding: const EdgeInsets.fromLTRB(35, 35, 35,0),
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.center,
        children: [
          Row(
            children: [Text('به این صنف امتیاز دهید', style: AppFonts.yekan12)],
          ),

          SizedBox(height: 12),
          RatingBar.builder(
            initialRating: 3,
            minRating: 1,
            direction: Axis.horizontal,
            allowHalfRating: true,
            itemCount: 5,
            wrapAlignment: WrapAlignment.center,
            itemPadding: EdgeInsets.symmetric(horizontal: 4.0),
            itemBuilder: (context, _) => Icon(Icons.star, color: Colors.amber),
            onRatingUpdate: (rating) {},
          ),
        ],
      ),
    );
  }
}

Widget violationWidget() {
  return Container(
    margin: EdgeInsets.symmetric(horizontal: 35),
    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,
        ),
      ],
    ),
  );
}

Widget markerDetailsWidget() {
  return Container(
    clipBehavior: Clip.antiAlias,
    margin: EdgeInsets.symmetric(horizontal: 35, vertical: 10),
    padding: EdgeInsets.symmetric(horizontal: 20, vertical: 10),
    decoration: ShapeDecoration(
      color: Colors.white,
      shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
    ),
    child: Column(
      spacing: 15,
      children: [
        Row(
          mainAxisAlignment: MainAxisAlignment.center,
          spacing: 12,
          children: [
            Text(
              'ایجاد بازرسی',
              textAlign: TextAlign.center,
              style: AppFonts.yekan16.copyWith(color: AppColor.bgDark),
            ),
          ],
        ),
        Container(
          height: 32,
          clipBehavior: Clip.antiAlias,
          padding: EdgeInsets.symmetric(horizontal: 10, vertical: 4),
          decoration: ShapeDecoration(
            color: AppColor.blueLight,
            shape: RoundedRectangleBorder(
              side: BorderSide(width: 1, color: AppColor.blueLightHover),
            ),
          ),
          child: Row(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            children: [
              Text(
                'تاریخ بازرسی',
                textAlign: TextAlign.center,
                style: AppFonts.yekan14.copyWith(
                  color: AppColor.darkGreyDarkHover,
                ),
              ),
              Text(
                '1403/12/12',
                textAlign: TextAlign.center,
                style: AppFonts.yekan14.copyWith(
                  color: AppColor.darkGreyDarkHover,
                ),
              ),
            ],
          ),
        ),

        Row(
          mainAxisAlignment: MainAxisAlignment.spaceBetween,
          crossAxisAlignment: CrossAxisAlignment.center,
          children: [
            Text(
              'شماره همراه',
              textAlign: TextAlign.center,
              style: AppFonts.yekan14.copyWith(
                color: AppColor.darkGreyDarkHover,
              ),
            ),
            Text(
              '0326598653',
              textAlign: TextAlign.center,
              style: AppFonts.yekan14.copyWith(
                color: AppColor.darkGreyDarkHover,
              ),
            ),
          ],
        ),
        Row(
          mainAxisAlignment: MainAxisAlignment.spaceBetween,
          crossAxisAlignment: CrossAxisAlignment.center,

          children: [
            Text(
              'آخرین فعالیت',
              textAlign: TextAlign.center,
              style: AppFonts.yekan14.copyWith(
                color: AppColor.darkGreyDarkHover,
              ),
            ),

            Text(
              '1409/12/12',
              textAlign: TextAlign.center,
              style: AppFonts.yekan14.copyWith(
                color: AppColor.darkGreyDarkHover,
              ),
            ),
          ],
        ),
        Row(
          mainAxisAlignment: MainAxisAlignment.spaceBetween,
          crossAxisAlignment: CrossAxisAlignment.center,

          children: [
            Text(
              'موجودی',
              textAlign: TextAlign.center,
              style: AppFonts.yekan14.copyWith(
                color: AppColor.darkGreyDarkHover,
              ),
            ),
            Text(
              '5کیلوگرم',
              textAlign: TextAlign.center,
              style: AppFonts.yekan14.copyWith(
                color: AppColor.darkGreyDarkHover,
              ),
            ),
          ],
        ),

        ...List.generate(
          5,
          (index) => Row(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            crossAxisAlignment: CrossAxisAlignment.center,

            children: [
              Text(
                'فروش رفته',
                textAlign: TextAlign.center,
                style: AppFonts.yekan14.copyWith(
                  color: AppColor.darkGreyDarkHover,
                ),
              ),
              Text(
                '0 کیلوگرم',
                textAlign: TextAlign.center,
                style: AppFonts.yekan14.copyWith(
                  color: AppColor.darkGreyDarkHover,
                ),
              ),
            ],
          ),
        ),
      ],
    ),
  );
}

Widget accompanyingInspectorsWidget() {
  return Container(
    clipBehavior: Clip.antiAlias,
    margin: EdgeInsets.symmetric(horizontal: 35),
    padding: EdgeInsets.symmetric(horizontal: 20, vertical: 10),
    decoration: ShapeDecoration(
      color: Colors.white,
      shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
    ),
    child: Column(
      spacing: 15,
      children: [
        Row(
          mainAxisAlignment: MainAxisAlignment.center,
          spacing: 12,
          children: [
            Text(
              'بازرس همراه',
              textAlign: TextAlign.center,
              style: AppFonts.yekan16.copyWith(color: AppColor.bgDark),
            ),
          ],
        ),
        Row(
          mainAxisAlignment: MainAxisAlignment.spaceBetween,
          crossAxisAlignment: CrossAxisAlignment.center,
          children: [
            Text(
              'نام و نام خانوادگی',
              textAlign: TextAlign.center,
              style: AppFonts.yekan14.copyWith(
                color: AppColor.darkGreyDarkHover,
              ),
            ),
            Text(
              'آیدا گل محمدی',
              textAlign: TextAlign.center,
              style: AppFonts.yekan14.copyWith(
                color: AppColor.darkGreyDarkHover,
              ),
            ),
          ],
        ),
        Row(
          mainAxisAlignment: MainAxisAlignment.spaceBetween,
          children: [
            Text(
              'تاریخ بازرسی',
              textAlign: TextAlign.center,
              style: AppFonts.yekan14.copyWith(
                color: AppColor.darkGreyDarkHover,
              ),
            ),
            Text(
              '1403/12/12',
              textAlign: TextAlign.center,
              style: AppFonts.yekan14.copyWith(
                color: AppColor.darkGreyDarkHover,
              ),
            ),
          ],
        ),

        Row(
          mainAxisAlignment: MainAxisAlignment.spaceBetween,
          crossAxisAlignment: CrossAxisAlignment.center,
          children: [
            Text(
              'شماره همراه',
              textAlign: TextAlign.center,
              style: AppFonts.yekan14.copyWith(
                color: AppColor.darkGreyDarkHover,
              ),
            ),
            Text(
              '0326598653',
              textAlign: TextAlign.center,
              style: AppFonts.yekan14.copyWith(
                color: AppColor.darkGreyDarkHover,
              ),
            ),
          ],
        ),
        Row(
          mainAxisAlignment: MainAxisAlignment.spaceBetween,
          crossAxisAlignment: CrossAxisAlignment.center,

          children: [
            Text(
              'آخرین فعالیت',
              textAlign: TextAlign.center,
              style: AppFonts.yekan14.copyWith(
                color: AppColor.darkGreyDarkHover,
              ),
            ),

            Text(
              '1409/12/12',
              textAlign: TextAlign.center,
              style: AppFonts.yekan14.copyWith(
                color: AppColor.darkGreyDarkHover,
              ),
            ),
          ],
        ),
        Row(
          mainAxisAlignment: MainAxisAlignment.spaceBetween,
          crossAxisAlignment: CrossAxisAlignment.center,

          children: [
            Text(
              'موجودی',
              textAlign: TextAlign.center,
              style: AppFonts.yekan14.copyWith(
                color: AppColor.darkGreyDarkHover,
              ),
            ),
            Text(
              '5کیلوگرم',
              textAlign: TextAlign.center,
              style: AppFonts.yekan14.copyWith(
                color: AppColor.darkGreyDarkHover,
              ),
            ),
          ],
        ),
      ],
    ),
  );
}
