From f6572d31272f01521bed416ec4e5f16d5806dc08 Mon Sep 17 00:00:00 2001 From: ggurdin Date: Tue, 25 Jun 2024 09:25:46 -0400 Subject: [PATCH] on igc button long press, show user language dialog --- .../widgets/start_igc_button.dart | 111 +++++++++--------- 1 file changed, 58 insertions(+), 53 deletions(-) diff --git a/lib/pangea/choreographer/widgets/start_igc_button.dart b/lib/pangea/choreographer/widgets/start_igc_button.dart index ceb5af193..49e4b078d 100644 --- a/lib/pangea/choreographer/widgets/start_igc_button.dart +++ b/lib/pangea/choreographer/widgets/start_igc_button.dart @@ -5,6 +5,7 @@ import 'package:fluffychat/config/app_config.dart'; import 'package:fluffychat/pangea/choreographer/controllers/choreographer.dart'; import 'package:fluffychat/pangea/constants/colors.dart'; import 'package:fluffychat/pangea/controllers/subscription_controller.dart'; +import 'package:fluffychat/pangea/widgets/user_settings/p_language_dialog.dart'; import 'package:flutter/material.dart'; import 'package:flutter_gen/gen_l10n/l10n.dart'; @@ -77,61 +78,65 @@ class StartIGCButtonState extends State return SizedBox( height: 50, width: 50, - child: FloatingActionButton( - tooltip: assistanceState.tooltip( - L10n.of(context)!, - ), - backgroundColor: Theme.of(context).scaffoldBackgroundColor, - disabledElevation: 0, - shape: const CircleBorder(), - onPressed: () { - if (assistanceState != AssistanceState.complete) { - widget.controller.choreographer - .getLanguageHelp( - false, - true, - ) - .then((_) { - if (widget.controller.choreographer.igc.igcTextData != null && - widget.controller.choreographer.igc.igcTextData!.matches - .isNotEmpty) { - widget.controller.choreographer.igc.showFirstMatch(context); - } - }); - } - }, - child: Stack( - alignment: Alignment.center, - children: [ - _controller != null - ? RotationTransition( - turns: Tween(begin: 0.0, end: math.pi * 2) - .animate(_controller!), - child: icon, - ) - : icon, - Container( - width: 26, - height: 26, - decoration: BoxDecoration( - shape: BoxShape.circle, + child: InkWell( + customBorder: const CircleBorder(), + onLongPress: () => pLanguageDialog(context, () {}), + child: FloatingActionButton( + tooltip: assistanceState.tooltip( + L10n.of(context)!, + ), + backgroundColor: Theme.of(context).scaffoldBackgroundColor, + disabledElevation: 0, + shape: const CircleBorder(), + onPressed: () { + if (assistanceState != AssistanceState.complete) { + widget.controller.choreographer + .getLanguageHelp( + false, + true, + ) + .then((_) { + if (widget.controller.choreographer.igc.igcTextData != null && + widget.controller.choreographer.igc.igcTextData!.matches + .isNotEmpty) { + widget.controller.choreographer.igc.showFirstMatch(context); + } + }); + } + }, + child: Stack( + alignment: Alignment.center, + children: [ + _controller != null + ? RotationTransition( + turns: Tween(begin: 0.0, end: math.pi * 2) + .animate(_controller!), + child: icon, + ) + : icon, + Container( + width: 26, + height: 26, + decoration: BoxDecoration( + shape: BoxShape.circle, + color: Theme.of(context).scaffoldBackgroundColor, + ), + ), + Container( + width: 20, + height: 20, + decoration: BoxDecoration( + shape: BoxShape.circle, + color: assistanceState.stateColor(context), + ), + ), + Icon( + size: 16, + Icons.check, color: Theme.of(context).scaffoldBackgroundColor, ), - ), - Container( - width: 20, - height: 20, - decoration: BoxDecoration( - shape: BoxShape.circle, - color: assistanceState.stateColor(context), - ), - ), - Icon( - size: 16, - Icons.check, - color: Theme.of(context).scaffoldBackgroundColor, - ), - ], + ], + ), ), ), );