This commit is contained in:
Ashita Prasad
2024-10-21 05:03:06 +05:30
parent cbf4a508b4
commit 121c103763
2 changed files with 78 additions and 77 deletions

View File

@ -223,6 +223,9 @@ class RequestItem extends ConsumerWidget {
ref.read(selectedIdStateProvider.notifier).state = id;
kHomeScaffoldKey.currentState?.closeDrawer();
},
onSecondaryTap: () {
ref.read(selectedIdStateProvider.notifier).state = id;
},
// onDoubleTap: () {
// ref.read(selectedIdStateProvider.notifier).state = id;
// ref.read(selectedIdEditStateProvider.notifier).state = id;

View File

@ -49,86 +49,84 @@ class SidebarRequestCard extends StatelessWidget {
String nm = (name != null && name!.trim().isNotEmpty)
? name!
: getRequestTitleFromUrl(url);
return GestureDetector(
onSecondaryTapUp: (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
? Theme.of(context).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,
// onDoubleTap: inEditMode ? null : onDoubleTap,
onSecondaryTap: onSecondaryTap,
child: Padding(
padding: EdgeInsets.only(
left: 6,
right: isSelected ? 6 : 10,
top: 5,
bottom: 5,
),
child: SizedBox(
height: 20,
child: Row(
children: [
MethodBox(method: method),
kHSpacer4,
Expanded(
child: inEditMode
? TextFormField(
key: ValueKey("$id-name"),
initialValue: name,
// controller: controller,
focusNode: focusNode,
//autofocus: true,
style: Theme.of(context).textTheme.bodyMedium,
onTapOutside: (_) {
onTapOutsideNameEditor?.call();
//FocusScope.of(context).unfocus();
},
onFieldSubmitted: (value) {
onTapOutsideNameEditor?.call();
},
onChanged: onChangedNameEditor,
decoration: const InputDecoration(
isCollapsed: true,
contentPadding: EdgeInsets.zero,
border: InputBorder.none,
),
)
: Text(
nm,
softWrap: false,
overflow: TextOverflow.fade,
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
? Theme.of(context).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,
// onDoubleTap: inEditMode ? null : onDoubleTap,
onSecondaryTapUp: (details) {
onSecondaryTap?.call();
showItemCardMenu(context, details, onMenuSelected);
},
child: Padding(
padding: EdgeInsets.only(
left: 6,
right: isSelected ? 6 : 10,
top: 5,
bottom: 5,
),
child: SizedBox(
height: 20,
child: Row(
children: [
MethodBox(method: method),
kHSpacer4,
Expanded(
child: inEditMode
? TextFormField(
key: ValueKey("$id-name"),
initialValue: name,
// controller: controller,
focusNode: focusNode,
//autofocus: true,
style: Theme.of(context).textTheme.bodyMedium,
onTapOutside: (_) {
onTapOutsideNameEditor?.call();
//FocusScope.of(context).unfocus();
},
onFieldSubmitted: (value) {
onTapOutsideNameEditor?.call();
},
onChanged: onChangedNameEditor,
decoration: const InputDecoration(
isCollapsed: true,
contentPadding: EdgeInsets.zero,
border: InputBorder.none,
),
),
Visibility(
visible: isSelected && !inEditMode,
child: SizedBox(
width: 28,
child: ItemCardMenu(
onSelected: onMenuSelected,
),
)
: Text(
nm,
softWrap: false,
overflow: TextOverflow.fade,
),
),
Visibility(
visible: isSelected && !inEditMode,
child: SizedBox(
width: 28,
child: ItemCardMenu(
onSelected: onMenuSelected,
),
),
],
),
),
],
),
),
),