Skip to content

hoverIconTheme property not working #69

@eugustavorosa

Description

@eugustavorosa

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,
  );
 }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions