@@ -9,6 +9,7 @@ import 'package:tsdm_client/routes/screen_paths.dart';
99import 'package:tsdm_client/shared/models/models.dart' ;
1010import 'package:tsdm_client/shared/providers/storage_provider/storage_provider.dart' ;
1111import 'package:tsdm_client/utils/show_dialog.dart' ;
12+ import 'package:tsdm_client/widgets/adaptive_ink_response.dart' ;
1213
1314/// Actions in popup menu.
1415enum _MenuAction {
@@ -39,7 +40,14 @@ class FastReplyTemplateCard extends StatefulWidget {
3940class _FastReplyTemplateCardState extends State <FastReplyTemplateCard > {
4041 late FastReplyTemplateModel replyTemplate;
4142
42- Future <void > openMenu (TapUpDetails details) async {
43+ Future <void > openMenu (TapPosition tapPosition) async {
44+ // Get the position where the tap occurred.
45+ RelativeRect ? position;
46+ position = RelativeRect .fromRect (
47+ tapPosition.globalPosition & Size .zero, // Rect from the tap position
48+ Offset .zero & MediaQuery .of (context).size, // Bounding box for the menu
49+ );
50+
4351 final tr = context.t.fastReplyTemplate;
4452 final overlay = Overlay .of (context).context.findRenderObject () as RenderBox ? ;
4553 if (overlay == null ) {
@@ -48,7 +56,7 @@ class _FastReplyTemplateCardState extends State<FastReplyTemplateCard> {
4856
4957 final action = await showMenu <_MenuAction >(
5058 context: context,
51- position: RelativeRect . fromRect (details.globalPosition & const Size ( 40 , 40 ), Offset .zero & overlay.size) ,
59+ position: position ,
5260 items: [
5361 PopupMenuItem (value: _MenuAction .edit, child: Text (tr.edit)),
5462 PopupMenuItem (
@@ -109,8 +117,8 @@ class _FastReplyTemplateCardState extends State<FastReplyTemplateCard> {
109117 return Card (
110118 clipBehavior: Clip .hardEdge,
111119 margin: EdgeInsets .zero,
112- child: InkWell (
113- onTapUp : ! widget.allowEdit ? (_) => popBack () : openMenu,
120+ child: AdaptiveInkResponse (
121+ onAdaptiveContextTap : ! widget.allowEdit ? (_) => popBack () : openMenu,
114122 child: Padding (
115123 padding: edgeInsetsL12T12R12B12,
116124 child: Column (
0 commit comments