jb3rndt / PersistentBottomNavBarV2

A highly customizable persistent bottom navigation bar for Flutter
https://pub.dev/packages/persistent_bottom_nav_bar_v2
BSD 3-Clause "New" or "Revised" License
49 stars 54 forks source link

Incorrect Icon size when using ImageIcon on simple style #91

Closed Kuroketsu closed 1 year ago

Kuroketsu commented 1 year ago

Describe the bug When I use ImageIcon on simple style, the icon rendered is very small

To Reproduce Steps to reproduce the behavior:

  1. add persistent_bottom_nav_bar_v2: ^4.2.6 to pubscpec
  2. use simple style

    class MyApp extends StatelessWidget {
    const MyApp({Key key}) : super(key: key);
    
    @override
    Widget build(BuildContext context) {
    return PersistentTabView(
        context,
        controller: _controller,
        screens: _buildScreens(),
        items: _navBarsItems(),
        confineInSafeArea: true,
        backgroundColor: Colors.white, // Default is Colors.white.
        handleAndroidBackButtonPress: true, // Default is true.
        resizeToAvoidBottomInset: true, // This needs to be true if you want to move up the screen when keyboard appears. Default is true.
        stateManagement: true, // Default is true.
        hideNavigationBarWhenKeyboardShows: true, // Recommended to set 'resizeToAvoidBottomInset' as true while using this argument. Default is true.
        decoration: NavBarDecoration(
          borderRadius: BorderRadius.circular(10.0),
          colorBehindNavBar: Colors.white,
        ),
        popAllScreensOnTapOfSelectedTab: true,
        popActionScreens: PopActionScreensType.all,
        itemAnimationProperties: ItemAnimationProperties( // Navigation Bar's items animation properties.
          duration: Duration(milliseconds: 200),
          curve: Curves.ease,
        ),
        screenTransitionAnimation: ScreenTransitionAnimation( // Screen transition animation on change of selected tab.
          animateTabTransition: true,
          curve: Curves.ease,
          duration: Duration(milliseconds: 200),
        ),
        navBarStyle: NavBarStyle.simple, // Choose the nav bar style with this property.
    );
    }
    }
  3. use ImageIcon on icon param
    PersistentBottomNavBarItem _buildNavBarItem(Widget icon, String title, bool hasNotif){
    return PersistentBottomNavBarItem(
      icon: ImageIcon(
        AssetImage(Assets.images.icHome.path),
        color: GlobalUtils.hexToColor(activeNavColor),
      ),
      inactiveIcon: ImageIcon(
        AssetImage(Assets.images.icHome.path),
        color: GlobalUtils.hexToColor(inactiveNavColor),
      ),
      title: title,
      textStyle: GoogleFonts.openSans(
        fontSize: 12
      ),
      activeColorPrimary: GlobalUtils.hexToColor(activeNavColor),
      inactiveColorPrimary: GlobalUtils.hexToColor(inactiveNavColor),
    );

Expected behavior Icon rendered should be same size as when using regular Icon

Desktop (please complete the following information):

Smartphone (please complete the following information):

Additional Context when I use style 3 or 6 it's rendering correctly, but I need the simple style related issue: #20

jb3rndt commented 1 year ago

Yes, I probably have overseen it in this style. Its fixed in Version 4.2.8.