import 'package:diplomaticquarterapp/d_q_icons_icons.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:flutter/material.dart';

import 'bottom_nav_pharmacy_home_item.dart';
import 'bottom_nav_pharmacy_item.dart';

class BottomNavPharmacyBar extends StatefulWidget {
  final ValueChanged<int> changeIndex;

  BottomNavPharmacyBar({Key key, this.changeIndex, this.index}) : super(key: key);
  int index = 0;

  @override
  _BottomNavPharmacyBarState createState() => _BottomNavPharmacyBarState();
}

class _BottomNavPharmacyBarState extends State<BottomNavPharmacyBar> {
  _changeIndex(int index) {
    widget.changeIndex(index);
  }

  @override
  Widget build(BuildContext context) {
    return BottomAppBar(
      elevation: 4,
      shape: CircularNotchedRectangle(),
      color: Colors.white,
      child: Padding(
        padding: EdgeInsets.symmetric(horizontal: 18),
        child: Row(
          mainAxisSize: MainAxisSize.max,
          mainAxisAlignment: MainAxisAlignment.spaceAround,
          children: [
            BottomNavHomeItem(
              icon: Icons.image,
              activeIcon: Icons.image,
              changeIndex: _changeIndex,
              index: widget.index,
              currentIndex: 0,
              title: TranslationBase.of(context).Alhabibapp,
            ),
            BottomNavPharmacyItem(
              icon: DQIcons.categories_menu_icon,
              activeIcon: DQIcons.categories_menu_icon,
              changeIndex: _changeIndex,
              index: widget.index,
              currentIndex: 1,
              title: TranslationBase.of(context).categorise,
            ),
            BottomNavPharmacyItem(icon: Icons.home, activeIcon: Icons.home, changeIndex: _changeIndex, index: widget.index, currentIndex: 0, isHome: true, title: TranslationBase.of(context).home),
            BottomNavPharmacyItem(
              icon: DQIcons.user_menu_icon,
              activeIcon: DQIcons.user_menu_icon,
              changeIndex: _changeIndex,
              index: widget.index,
              currentIndex: 2,
              title: TranslationBase.of(context).myAccount,
            ),
            BottomNavPharmacyItem(
                icon: DQIcons.cart_menu_icon, activeIcon: DQIcons.cart_menu_icon, changeIndex: _changeIndex, index: widget.index, currentIndex: 3, title: TranslationBase.of(context).cart)
          ],
        ),
      ),
    );
  }
}
