sideBarItem function
Widget
sideBarItem({
- required IconData icon,
- required String text,
- required double width,
- required double widthSwitch,
- required bool minimize,
- required double height,
- required Color hoverColor,
- required Color unselectedIconColor,
- required Color splashColor,
- required Color highlightColor,
- required Color unSelectedTextColor,
- required dynamic onTap(),
- required TextStyle textStyle,
Sidebar model Widget the we used it inside the ListView with inkwell to make each item clickable
Implementation
Widget sideBarItem({
required IconData icon,
required String text,
required double width,
required double widthSwitch,
required bool minimize,
required double height,
required Color hoverColor,
required Color unselectedIconColor,
required Color splashColor,
required Color highlightColor,
required Color unSelectedTextColor,
required Function() onTap,
required TextStyle textStyle,
}) {
return Material(
color: Colors.transparent,
borderRadius: BorderRadius.circular(12),
clipBehavior: Clip.antiAliasWithSaveLayer,
child: InkWell(
onTap: onTap,
hoverColor: hoverColor,
splashColor: splashColor,
highlightColor: highlightColor,
child: SizedBox(
height: height,
child: ListView(
padding: const EdgeInsets.all(12),
shrinkWrap: true,
clipBehavior: Clip.antiAliasWithSaveLayer,
scrollDirection: Axis.horizontal,
children: [
Icon(
icon,
color: unselectedIconColor,
),
if (width >= widthSwitch && !minimize)
Padding(
padding: const EdgeInsets.only(left: 12.0),
child: Text(
text,
overflow: TextOverflow.clip,
style: textStyle.copyWith(color: unSelectedTextColor),
textAlign: TextAlign.left,
),
),
],
),
),
),
);
}