fix: move onTap call up a level in widget tree (#5359)
This commit is contained in:
parent
9a39493236
commit
ad22bea271
1 changed files with 115 additions and 109 deletions
|
|
@ -49,129 +49,135 @@ class NaviRailItem extends StatelessWidget {
|
|||
// Pangea#
|
||||
final icon = isSelected ? selectedIcon ?? this.icon : this.icon;
|
||||
final unreadBadgeFilter = this.unreadBadgeFilter;
|
||||
return HoverBuilder(
|
||||
builder: (context, hovered) {
|
||||
// #Pangea
|
||||
// return SizedBox(
|
||||
// height: 72,
|
||||
return Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
SizedBox(
|
||||
height: width - (isColumnMode ? 16.0 : 12.0),
|
||||
width: width,
|
||||
// width: FluffyThemes.navRailWidth,
|
||||
// Pangea#
|
||||
child: Stack(
|
||||
children: [
|
||||
Positioned(
|
||||
top: 8,
|
||||
bottom: 8,
|
||||
left: 0,
|
||||
child: AnimatedContainer(
|
||||
width: isSelected
|
||||
? FluffyThemes.isColumnMode(context)
|
||||
? 8
|
||||
: 4
|
||||
: 0,
|
||||
duration: FluffyThemes.animationDuration,
|
||||
curve: FluffyThemes.animationCurve,
|
||||
decoration: BoxDecoration(
|
||||
color: theme.colorScheme.primary,
|
||||
borderRadius: const BorderRadius.only(
|
||||
topRight: Radius.circular(90),
|
||||
bottomRight: Radius.circular(90),
|
||||
// #Pangea
|
||||
// return HoverBuilder(
|
||||
return GestureDetector(
|
||||
onTap: onTap,
|
||||
child: HoverBuilder(
|
||||
// Pangea#
|
||||
builder: (context, hovered) {
|
||||
// #Pangea
|
||||
// return SizedBox(
|
||||
// height: 72,
|
||||
return Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
SizedBox(
|
||||
height: width - (isColumnMode ? 16.0 : 12.0),
|
||||
width: width,
|
||||
// width: FluffyThemes.navRailWidth,
|
||||
// Pangea#
|
||||
child: Stack(
|
||||
children: [
|
||||
Positioned(
|
||||
top: 8,
|
||||
bottom: 8,
|
||||
left: 0,
|
||||
child: AnimatedContainer(
|
||||
width: isSelected
|
||||
? FluffyThemes.isColumnMode(context)
|
||||
? 8
|
||||
: 4
|
||||
: 0,
|
||||
duration: FluffyThemes.animationDuration,
|
||||
curve: FluffyThemes.animationCurve,
|
||||
decoration: BoxDecoration(
|
||||
color: theme.colorScheme.primary,
|
||||
borderRadius: const BorderRadius.only(
|
||||
topRight: Radius.circular(90),
|
||||
bottomRight: Radius.circular(90),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Center(
|
||||
child: AnimatedScale(
|
||||
scale: hovered ? 1.1 : 1.0,
|
||||
duration: FluffyThemes.animationDuration,
|
||||
curve: FluffyThemes.animationCurve,
|
||||
// #Pangea
|
||||
// child: Material(
|
||||
// borderRadius: borderRadius,
|
||||
// color: isSelected
|
||||
// ? theme.colorScheme.primaryContainer
|
||||
// : theme.colorScheme.surfaceContainerHigh,
|
||||
child: UnreadRoomsBadge(
|
||||
filter: unreadBadgeFilter ?? (_) => false,
|
||||
badgePosition: BadgePosition.topEnd(
|
||||
top: 1,
|
||||
end: isColumnMode ? 8 : 4,
|
||||
),
|
||||
child: Container(
|
||||
alignment: Alignment.center,
|
||||
decoration: BoxDecoration(
|
||||
color: backgroundColor ??
|
||||
(isSelected
|
||||
? theme.colorScheme.primaryContainer
|
||||
: theme.colorScheme.surfaceContainerHigh),
|
||||
borderRadius: borderRadius,
|
||||
Center(
|
||||
child: AnimatedScale(
|
||||
scale: hovered ? 1.1 : 1.0,
|
||||
duration: FluffyThemes.animationDuration,
|
||||
curve: FluffyThemes.animationCurve,
|
||||
// #Pangea
|
||||
// child: Material(
|
||||
// borderRadius: borderRadius,
|
||||
// color: isSelected
|
||||
// ? theme.colorScheme.primaryContainer
|
||||
// : theme.colorScheme.surfaceContainerHigh,
|
||||
child: UnreadRoomsBadge(
|
||||
filter: unreadBadgeFilter ?? (_) => false,
|
||||
badgePosition: BadgePosition.topEnd(
|
||||
top: 1,
|
||||
end: isColumnMode ? 8 : 4,
|
||||
),
|
||||
margin: EdgeInsets.symmetric(
|
||||
horizontal: isColumnMode ? 16.0 : 12.0,
|
||||
vertical: isColumnMode ? 8.0 : 6.0,
|
||||
),
|
||||
child: TooltipVisibility(
|
||||
visible: !expanded,
|
||||
// Pangea#
|
||||
child: Tooltip(
|
||||
message: toolTip,
|
||||
child: InkWell(
|
||||
borderRadius: borderRadius,
|
||||
onTap: onTap,
|
||||
// #Pangea
|
||||
child: icon,
|
||||
// child: unreadBadgeFilter == null
|
||||
// ? icon
|
||||
// : UnreadRoomsBadge(
|
||||
// filter: unreadBadgeFilter,
|
||||
// badgePosition: BadgePosition.topEnd(
|
||||
// top: -12,
|
||||
// end: -8,
|
||||
// ),
|
||||
// child: icon,
|
||||
// ),
|
||||
// Pangea#
|
||||
child: Container(
|
||||
alignment: Alignment.center,
|
||||
decoration: BoxDecoration(
|
||||
color: backgroundColor ??
|
||||
(isSelected
|
||||
? theme.colorScheme.primaryContainer
|
||||
: theme.colorScheme.surfaceContainerHigh),
|
||||
borderRadius: borderRadius,
|
||||
),
|
||||
margin: EdgeInsets.symmetric(
|
||||
horizontal: isColumnMode ? 16.0 : 12.0,
|
||||
vertical: isColumnMode ? 8.0 : 6.0,
|
||||
),
|
||||
child: TooltipVisibility(
|
||||
visible: !expanded,
|
||||
// Pangea#
|
||||
child: Tooltip(
|
||||
message: toolTip,
|
||||
child: InkWell(
|
||||
borderRadius: borderRadius,
|
||||
// #Pangea
|
||||
// onTap: onTap,
|
||||
child: icon,
|
||||
// child: unreadBadgeFilter == null
|
||||
// ? icon
|
||||
// : UnreadRoomsBadge(
|
||||
// filter: unreadBadgeFilter,
|
||||
// badgePosition: BadgePosition.topEnd(
|
||||
// top: -12,
|
||||
// end: -8,
|
||||
// ),
|
||||
// child: icon,
|
||||
// ),
|
||||
// Pangea#
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
if (expanded)
|
||||
Flexible(
|
||||
child: Container(
|
||||
height: width - (isColumnMode ? 16.0 : 12.0),
|
||||
padding: const EdgeInsets.only(right: 16.0),
|
||||
child: ListTile(
|
||||
title: Text(
|
||||
toolTip,
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: theme.textTheme.bodyMedium,
|
||||
),
|
||||
onTap: onTap,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(16.0),
|
||||
),
|
||||
contentPadding: const EdgeInsets.symmetric(
|
||||
horizontal: 8.0,
|
||||
vertical: 0.0,
|
||||
if (expanded)
|
||||
Flexible(
|
||||
child: Container(
|
||||
height: width - (isColumnMode ? 16.0 : 12.0),
|
||||
padding: const EdgeInsets.only(right: 16.0),
|
||||
child: ListTile(
|
||||
title: Text(
|
||||
toolTip,
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: theme.textTheme.bodyMedium,
|
||||
),
|
||||
onTap: onTap,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(16.0),
|
||||
),
|
||||
contentPadding: const EdgeInsets.symmetric(
|
||||
horizontal: 8.0,
|
||||
vertical: 0.0,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue