import 'package:flutter/material.dart';
import 'package:rasadyar_chicken/presentation/utils/nested_keys_utils.dart';
import 'package:rasadyar_chicken/presentation/widget/base_page/view.dart';
import 'package:rasadyar_core/core.dart';

import 'logic.dart';

class PoultryActionPage extends GetView<PoultryActionLogic> {
  PoultryActionPage({super.key});

  @override
  Widget build(BuildContext context) {
    return ChickenBasePage(isBase: true, hasNews: true, hasNotification: true, child: gridWidget());
  }

  Widget gridWidget() {
    return ObxValue((data) {
      return GridView.builder(
        physics: BouncingScrollPhysics(),
        padding: EdgeInsets.symmetric(vertical: 18.h, horizontal: 32.w),
        gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
          crossAxisCount: 2,
          mainAxisSpacing: 24.h,
          crossAxisSpacing: 24.w,
        ),
        itemCount: data.length,
        hitTestBehavior: HitTestBehavior.opaque,
        itemBuilder: (BuildContext context, int index) {
          var item = data[index];
          return GlassMorphismCardIcon(
            title: item.title,
            vecIcon: item.icon,
            onTap: () async {

              Get.toNamed(item.route, id: poultryFirstKey);
            },
          );
        },
      );
    }, controller.items);
  }
}
