Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hoverIconTheme property not working #69

Open
eugustavorosa opened this issue May 14, 2024 · 3 comments
Open

hoverIconTheme property not working #69

eugustavorosa opened this issue May 14, 2024 · 3 comments

Comments

@eugustavorosa
Copy link

eugustavorosa commented May 14, 2024

Describe the bug
When I set an IconThemeData to the property hoverIconTheme it does not work and it renders the selectedIconTheme instead. The other hover properties work normally (hoverColor and hoverTextStyle).

To Reproduce
Code for my example:

import 'package:ceu/gabriel_ceu.dart';
import 'package:flutter/material.dart';
import 'package:sidebarx/sidebarx.dart';

class CeuSideBar extends StatelessWidget {
  final List<SidebarXItem> items;

  const CeuSideBar({
    required this.items,
    super.key,
  });

  @override
  Widget build(BuildContext context) {
    final theme = Theme.of(context);

  return SidebarX(
    controller: SidebarXController(selectedIndex: 0, extended: true),
    footerItems: const [
      SidebarXItem(
        icon: Icons.logout,
        label: 'Sair',
      )
    ],
    theme: SidebarXTheme(
      decoration: BoxDecoration(color: theme.colorScheme.surface),
      hoverColor: theme.colorScheme.onPrimaryContainer.withOpacity(0.12),
      selectedTextStyle: theme.textTheme.bodyLarge?.copyWith(
        color: theme.colorScheme.onPrimaryContainer,
      ),
      hoverTextStyle: theme.textTheme.bodyLarge,
      textStyle: theme.textTheme.bodyLarge,
      hoverIconTheme:
          IconThemeData(color: theme.colorScheme.onSurface, size: 24),
      iconTheme: IconThemeData(color: theme.colorScheme.onSurface, size: 24),
      selectedIconTheme: IconThemeData(
          color: theme.colorScheme.onPrimaryContainer, size: 24),
      itemDecoration: BoxDecoration(
        borderRadius: CeuRadius.extraSmallRadius4,
        border: Border.all(color: theme.colorScheme.surface),
      ),
      selectedItemDecoration: BoxDecoration(
        borderRadius: CeuRadius.extraSmallRadius4,
        color: theme.colorScheme.primaryContainer,
      ),
      itemTextPadding: const EdgeInsets.only(left: 10),
      selectedItemTextPadding: const EdgeInsets.only(left: 10),
      itemMargin: const EdgeInsets.symmetric(horizontal: 12, vertical: 4),
      selectedItemMargin:
          const EdgeInsets.symmetric(horizontal: 12, vertical: 4),
    ),
    extendedTheme: const SidebarXTheme(
      width: 360,
      itemMargin: EdgeInsets.only(left: 24, right: 59, top: 4, bottom: 4),
      selectedItemMargin:
          EdgeInsets.only(left: 24, right: 59, top: 4, bottom: 4),
    ),
    headerBuilder: (context, extended) {
      return extended
          ? Container(
              alignment: Alignment.centerLeft,
              padding: const EdgeInsets.only(left: 24),
              height: 100,
              child: Image.asset(
                'assets/images/gabriel_logotype.png',
                package: 'ceu',
              ),
            )
          : SizedBox(
              height: 100,
              child: Image.asset(
                'assets/images/gabriel_logomark.png',
                package: 'ceu',
              ),
            );
    },
    items: items,
  );
 }
}
@Paroca72
Copy link

In the source code this line is not correct:

      hoverIconTheme: selectedIconTheme ??
          theme.iconTheme.copyWith(color: theme.primaryColor),

I think should be hoverIconTheme instead selectedIconTheme

Thanks

@starlitya
Copy link

+1. Please help to check it, thanks!

@theRightHooprod
Copy link

theRightHooprod commented Sep 4, 2024

Hi 👋!

Had the same issue.... Try to use selectedIconTheme instead of selectedHoverColor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants