import 'package:flutter/material.dart';
import 'package:test_sa/extensions/context_extension.dart';
import 'package:test_sa/extensions/int_extensions.dart';
import 'package:test_sa/extensions/text_extensions.dart';
import 'package:test_sa/new_views/app_style/app_color.dart';
import 'package:test_sa/new_views/pages/new_gas_refill_request_page.dart';
import 'package:test_sa/service_request_latest/views/nurse/create_new_request_view.dart';
import 'package:test_sa/views/pages/device_transfer/request_device_transfer.dart';

class CreateRequestTypeBottomSheet extends StatelessWidget {
  const CreateRequestTypeBottomSheet({super.key});

  @override
  Widget build(BuildContext context) {
//TODO replace all the icons with new icons...
    return Container(
      padding: const EdgeInsets.all(16.0),
      child: Column(
        mainAxisSize: MainAxisSize.min,
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          context.translation.selectWorkOrder.heading4(context),
          16.height,
          GridView(
            padding: EdgeInsets.all(0),
            shrinkWrap: true,
            physics: const NeverScrollableScrollPhysics(),
            gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 3, childAspectRatio: 1, crossAxisSpacing: 16, mainAxisSpacing: 16),
            children: <Widget>[
              listCard(
                context: context,
                icon: 'add_icon',
                label: context.translation.correctiveMaintenance,
                onTap: () {
                  Navigator.pushReplacementNamed(context, CreateNewRequest.id);
                },
              ),
              listCard(
                context: context,
                icon: 'add_icon',
                label: context.translation.gasRefill,
                onTap: () {
                  //NewGasRefillRequestPage.routeName)
                  Navigator.pushReplacementNamed(context, NewGasRefillRequestPage.routeName);
                },
              ),
              listCard(
                context: context,
                icon: 'add_icon',
                label: context.translation.deviceTransfer,
                onTap: () async {
                  Navigator.pushReplacementNamed(context, RequestDeviceTransfer.id);
                },
              ),
            ],
          ),
          16.height,
        ],
      ),
    );
    return const Placeholder();
  }

  Widget listCard({required String icon, required String label, required VoidCallback onTap, required BuildContext context}) {
    return GestureDetector(
      onTap: onTap,
      child: Container(
        constraints: BoxConstraints(minWidth: 111.toScreenWidth, minHeight: 111.toScreenHeight),
        padding: EdgeInsets.symmetric(horizontal: 12.toScreenWidth, vertical: 12.toScreenHeight),
        decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), border: Border.all(width: 1, color: AppColor.white70)),
        child: Column(
          mainAxisSize: MainAxisSize.min,
          crossAxisAlignment: CrossAxisAlignment.start,
          mainAxisAlignment: MainAxisAlignment.spaceBetween,
          children: [
            const Icon(
              Icons.add_circle,
              color: AppColor.neutral120,
              size: 32,
            ),
            //24.height,
            label.bodyText2(context).custom(color: AppColor.black20),
          ],
        ),
      ),
    );
  }
}
