import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:test_sa/extensions/context_extension.dart';
import 'package:test_sa/extensions/int_extensions.dart';
import 'package:test_sa/extensions/string_extensions.dart';
import 'package:test_sa/extensions/text_extensions.dart';
import 'package:test_sa/extensions/widget_extensions.dart';
import 'package:test_sa/new_views/app_style/app_color.dart';
import 'package:test_sa/service_request_latest/request_detail_provider.dart';
import 'package:test_sa/service_request_latest/views/components/bottom_sheets/service_request_bottomsheet.dart';

class InitialVisitCard extends StatelessWidget {
  const InitialVisitCard({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Consumer<RequestDetailProvider>(builder: (context, RequestDetailProvider requestDetailProvider, snapshot) {
      return Container(
        decoration: BoxDecoration(
          borderRadius: BorderRadius.circular(14),
          color: AppColor.white10,
        ),
        padding: EdgeInsets.symmetric(horizontal: 12.toScreenWidth, vertical: 14.toScreenHeight),
        margin: EdgeInsets.only(top: 10.toScreenHeight),
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: [
            Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [
              Text(
                requestDetailProvider.needVisitHelperModel!.visitDate.toString().toInitialVisitCardFormat,
                textAlign: TextAlign.end,
                style: AppTextStyles.heading6.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.black10),
              ),
              "edit_icon".toSvgAsset(height: 21, width: 21).onPress(() {
                ServiceRequestBottomSheet.initialVisitBottomSheet(context: context);
              }),
            ]),
            2.height,
            context.translation.visitDateAndTime.bodyText2(context).custom(color: AppColor.neutral120),
            12.height,
            if (requestDetailProvider.needVisitHelperModel?.comment != null) ...[
              requestDetailProvider.needVisitHelperModel!.comment!.bodyText2(context).custom(color: AppColor.neutral120),
            ]
          ],
        ),
      );
    });
  }
}
