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

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

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

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

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