
import '../../../../../../food_delivery_client.dart';

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

  @override
  Widget build(BuildContext context) {
    return BlocBuilder<BrowseBloc, BrowseState>(
      builder: (context, state) {
        if (state.topCategorySt.isLoaded()) {
          return WTopCategoriesBody();
        }
        return WTopCategoriesSkeletonizer();
      },
    );
  }
}

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

  @override
  Widget build(BuildContext context) {
    return Column(
      crossAxisAlignment: CrossAxisAlignment.start,
      children: [
        Text(
          context.loc.topCategories,
          style: AppTextStyles.size24Medium.copyWith(height: 36 / 24),
        ),
        11.verticalSpace,
        GridView.builder(
          itemCount: 6,
          shrinkWrap: true,
          padding: EdgeInsets.zero,
          physics: const NeverScrollableScrollPhysics(),
          gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
            crossAxisCount: 2,
            mainAxisSpacing: 15,
            crossAxisSpacing: 10,
            mainAxisExtent: 175,
          ),
          itemBuilder: (context, index) {
            return WBrowseItem();
          },
        ),
      ],
    );
  }
}

