can open the item menu on the right click for variables

This commit is contained in:
Clement
2024-10-05 23:10:29 -03:00
parent 4c3002c20b
commit f280e2c95a

View File

@ -48,76 +48,83 @@ class SidebarEnvironmentCard extends StatelessWidget {
bool isSelected = selectedId == id;
bool inEditMode = editRequestId == id;
String nm = getEnvironmentTitle(name);
return Tooltip(
message: nm,
triggerMode: TooltipTriggerMode.manual,
waitDuration: const Duration(seconds: 1),
child: Card(
shape: const RoundedRectangleBorder(
borderRadius: kBorderRadius8,
),
elevation: isSelected ? 1 : 0,
surfaceTintColor: isSelected ? surfaceTint : null,
color: isSelected && !isGlobal
? colorScheme.brightness == Brightness.dark
? colorVariant
: color
: color,
margin: EdgeInsets.zero,
child: InkWell(
borderRadius: kBorderRadius8,
hoverColor: colorVariant,
focusColor: colorVariant.withOpacity(0.5),
onTap: inEditMode ? null : onTap,
onSecondaryTap: onSecondaryTap,
child: Padding(
padding: EdgeInsets.only(
left: 6,
right: isSelected ? 6 : 10,
top: 5,
bottom: 5,
),
child: SizedBox(
height: 20,
child: Row(
children: [
kHSpacer4,
Expanded(
child: inEditMode
? TextFormField(
key: ValueKey("$id-name"),
initialValue: name,
focusNode: focusNode,
style: Theme.of(context).textTheme.bodyMedium,
onTapOutside: (_) {
onTapOutsideNameEditor?.call();
},
onFieldSubmitted: (value) {
onTapOutsideNameEditor?.call();
},
onChanged: onChangedNameEditor,
decoration: const InputDecoration(
isCollapsed: true,
contentPadding: EdgeInsets.zero,
border: InputBorder.none,
return GestureDetector(
onSecondaryTapUp: (isGlobal)
? null
: (TapUpDetails details) {
showItemCardMenu(context, details, onMenuSelected);
},
child: Tooltip(
message: nm,
triggerMode: TooltipTriggerMode.manual,
waitDuration: const Duration(seconds: 1),
child: Card(
shape: const RoundedRectangleBorder(
borderRadius: kBorderRadius8,
),
elevation: isSelected ? 1 : 0,
surfaceTintColor: isSelected ? surfaceTint : null,
color: isSelected && !isGlobal
? colorScheme.brightness == Brightness.dark
? colorVariant
: color
: color,
margin: EdgeInsets.zero,
child: InkWell(
borderRadius: kBorderRadius8,
hoverColor: colorVariant,
focusColor: colorVariant.withOpacity(0.5),
onTap: inEditMode ? null : onTap,
onSecondaryTap: onSecondaryTap,
child: Padding(
padding: EdgeInsets.only(
left: 6,
right: isSelected ? 6 : 10,
top: 5,
bottom: 5,
),
child: SizedBox(
height: 20,
child: Row(
children: [
kHSpacer4,
Expanded(
child: inEditMode
? TextFormField(
key: ValueKey("$id-name"),
initialValue: name,
focusNode: focusNode,
style: Theme.of(context).textTheme.bodyMedium,
onTapOutside: (_) {
onTapOutsideNameEditor?.call();
},
onFieldSubmitted: (value) {
onTapOutsideNameEditor?.call();
},
onChanged: onChangedNameEditor,
decoration: const InputDecoration(
isCollapsed: true,
contentPadding: EdgeInsets.zero,
border: InputBorder.none,
),
)
: Text(
nm,
softWrap: false,
overflow: TextOverflow.fade,
),
)
: Text(
nm,
softWrap: false,
overflow: TextOverflow.fade,
),
),
Visibility(
visible: isSelected && !inEditMode && !isGlobal,
child: SizedBox(
width: 28,
child: ItemCardMenu(
onSelected: onMenuSelected,
),
Visibility(
visible: isSelected && !inEditMode && !isGlobal,
child: SizedBox(
width: 28,
child: ItemCardMenu(
onSelected: onMenuSelected,
),
),
),
),
],
],
),
),
),
),