Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/src/side_menu.dart
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ class SideMenu extends StatefulWidget {
return SideMenuItemWithGlobal(
global: global,
title: data.title,
titleFlex: data.titleFlex,
onTap: data.onTap,
icon: data.icon,
iconWidget: data.iconWidget,
Expand Down
5 changes: 5 additions & 0 deletions lib/src/side_menu_item.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ class SideMenuItem {
/// Title text
final String? title;

/// Title flex for expanding
final int titleFlex;

/// A function that will be called when tap on [SideMenuItem] corresponding
/// to this [SideMenuItem]
final void Function(int index, SideMenuController sideMenuController)? onTap;
Expand Down Expand Up @@ -41,9 +44,11 @@ class SideMenuItem {
/// Create custom sideMenuItem widget with builder
final Widget Function(BuildContext context, SideMenuDisplayMode displayMode)?
builder;

const SideMenuItem({
this.onTap,
this.title,
this.titleFlex = 1,
this.icon,
this.iconWidget,
this.badgeContent,
Expand Down
5 changes: 5 additions & 0 deletions lib/src/side_menu_item_with_global.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class SideMenuItemWithGlobal extends StatefulWidget {
required this.global,
this.onTap,
this.title,
this.titleFlex = 1,
this.icon,
this.iconWidget,
this.badgeContent,
Expand All @@ -40,6 +41,9 @@ class SideMenuItemWithGlobal extends StatefulWidget {
/// Title text
final String? title;

/// Title flex for expanding
final int titleFlex;

/// A Icon to display before [title]
final Icon? icon;

Expand Down Expand Up @@ -268,6 +272,7 @@ class _SideMenuItemState extends State<SideMenuItemWithGlobal> {
SizedBox(width: widget.global.style.itemInnerSpacing),
if (value == SideMenuDisplayMode.open) ...[
Expanded(
flex: widget.titleFlex,
// Expanded will allow the text to take up all available space
child: Text(
widget.title ?? '',
Expand Down