import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/BrandViewModel.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart';
import 'package:flutter/material.dart';

import '../../product-brands.dart';
import '../manufacturerItem.dart';
import 'ViewAllHomeWidget.dart';

class ShopByBrandWidget extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return BaseView<BrandViewModel>(
        onModelReady: (model) => model.getTopManufacturerList(),
        allowAny: true,
        builder: (_, model, wi) => NetworkBaseView(
          isLocalLoader: true,
          baseViewModel: model,
          child: Container(
            child: Column(
              children: [
                ViewAllHomeWidget(
                    TranslationBase.of(context).shopByBrands,
                    ProductBrandsPage()),
                Container(
                  height: 100,
                  child: ListView.builder(
                    itemBuilder: (ctx, i) =>
                        ManufacturerItem(model.manufacturerList[i]),
                    scrollDirection: Axis.horizontal,
                    itemCount: model.manufacturerList.length,
                  ),
                ),
              ],
            ),
          ),
        ));
  }
}