2505 have to click on other options multiple times for the click to go through after selecting an incorrect choice in it (#2516)
* chore: prevent overlays from blocking IT choices * chore: prevent IGC card from interfering with buttons below it
This commit is contained in:
parent
9015edb5c1
commit
327160c2a7
6 changed files with 60 additions and 37 deletions
|
|
@ -14,6 +14,7 @@ import 'package:fluffychat/pangea/choreographer/models/pangea_match_model.dart';
|
|||
import 'package:fluffychat/pangea/choreographer/repo/igc_repo.dart';
|
||||
import 'package:fluffychat/pangea/choreographer/widgets/igc/span_card.dart';
|
||||
import 'package:fluffychat/pangea/events/event_wrappers/pangea_message_event.dart';
|
||||
import 'package:fluffychat/widgets/matrix.dart';
|
||||
import '../../common/utils/error_handler.dart';
|
||||
import '../../common/utils/overlay.dart';
|
||||
import '../models/span_card_model.dart';
|
||||
|
|
@ -243,6 +244,7 @@ class IgcController {
|
|||
}
|
||||
|
||||
choreographer.chatController.inputFocus.unfocus();
|
||||
MatrixState.pAnyState.closeAllOverlays(RegExp(r'span_card_overlay_\d+'));
|
||||
OverlayUtil.showPositionedCard(
|
||||
overlayKey: "span_card_overlay_$firstMatchIndex",
|
||||
context: context,
|
||||
|
|
@ -267,6 +269,7 @@ class IgcController {
|
|||
maxWidth: 350,
|
||||
transformTargetId: choreographer.inputTransformTargetKey,
|
||||
onDismiss: () => choreographer.setState(),
|
||||
ignorePointer: true,
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ import 'package:fluffychat/pangea/choreographer/controllers/error_service.dart';
|
|||
import 'package:fluffychat/pangea/choreographer/enums/edit_type.dart';
|
||||
import 'package:fluffychat/pangea/common/utils/error_handler.dart';
|
||||
import 'package:fluffychat/pangea/events/models/pangea_token_model.dart';
|
||||
import 'package:fluffychat/widgets/matrix.dart';
|
||||
import '../models/custom_input_translation_model.dart';
|
||||
import '../models/it_response_model.dart';
|
||||
import '../models/it_step.dart';
|
||||
|
|
@ -41,6 +42,8 @@ class ITController {
|
|||
void clear() {
|
||||
_isOpen = false;
|
||||
_willOpen = false;
|
||||
MatrixState.pAnyState.closeOverlay("it_feedback_card");
|
||||
|
||||
showChoiceFeedback = false;
|
||||
_isEditingSourceText = false;
|
||||
dismissed = false;
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import 'package:fluffychat/pangea/choreographer/models/igc_text_data_model.dart'
|
|||
import 'package:fluffychat/pangea/choreographer/widgets/igc/paywall_card.dart';
|
||||
import 'package:fluffychat/pangea/choreographer/widgets/igc/span_card.dart';
|
||||
import 'package:fluffychat/pangea/subscription/controllers/subscription_controller.dart';
|
||||
import 'package:fluffychat/widgets/matrix.dart';
|
||||
import '../../../common/utils/overlay.dart';
|
||||
import '../../controllers/choreographer.dart';
|
||||
import '../../enums/edit_type.dart';
|
||||
|
|
@ -119,6 +120,7 @@ class PangeaTextController extends TextEditingController {
|
|||
: null;
|
||||
|
||||
if (cardToShow != null) {
|
||||
MatrixState.pAnyState.closeAllOverlays(RegExp(r'span_card_overlay_\d+'));
|
||||
OverlayUtil.showPositionedCard(
|
||||
overlayKey: matchIndex != -1 ? "span_card_overlay_$matchIndex" : null,
|
||||
context: context,
|
||||
|
|
@ -130,6 +132,7 @@ class PangeaTextController extends TextEditingController {
|
|||
cardToShow: cardToShow,
|
||||
transformTargetId: choreographer.inputTransformTargetKey,
|
||||
onDismiss: () => choreographer.setState(),
|
||||
ignorePointer: true,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ import 'package:fluffychat/pangea/common/utils/error_handler.dart';
|
|||
import 'package:fluffychat/pangea/instructions/instructions_enum.dart';
|
||||
import 'package:fluffychat/pangea/instructions/instructions_inline_tooltip.dart';
|
||||
import 'package:fluffychat/pangea/learning_settings/pages/settings_learning.dart';
|
||||
import 'package:fluffychat/widgets/matrix.dart';
|
||||
import '../../common/utils/overlay.dart';
|
||||
import '../controllers/it_feedback_controller.dart';
|
||||
import '../models/it_response_model.dart';
|
||||
|
|
@ -334,6 +335,7 @@ class ITChoices extends StatelessWidget {
|
|||
}
|
||||
|
||||
controller.choreographer.chatController.inputFocus.unfocus();
|
||||
MatrixState.pAnyState.closeOverlay("it_feedback_card");
|
||||
OverlayUtil.showPositionedCard(
|
||||
context: context,
|
||||
cardToShow: choiceFeedback == null
|
||||
|
|
@ -370,10 +372,13 @@ class ITChoices extends StatelessWidget {
|
|||
borderColor: borderColor,
|
||||
transformTargetId: controller.choreographer.itBarTransformTargetKey,
|
||||
isScrollable: choiceFeedback == null,
|
||||
overlayKey: "it_feedback_card",
|
||||
ignorePointer: true,
|
||||
);
|
||||
}
|
||||
|
||||
void selectContinuance(int index, BuildContext context) {
|
||||
MatrixState.pAnyState.closeOverlay("it_feedback_card");
|
||||
final Continuance continuance =
|
||||
controller.currentITStep!.continuances[index];
|
||||
if (continuance.level == 1) {
|
||||
|
|
|
|||
|
|
@ -82,8 +82,15 @@ class PangeaAnyState {
|
|||
}
|
||||
}
|
||||
|
||||
void closeAllOverlays() {
|
||||
final shouldRemove = entries.where((element) => element.canPop).toList();
|
||||
void closeAllOverlays([RegExp? regex]) {
|
||||
List<OverlayListEntry> shouldRemove =
|
||||
entries.where((element) => element.canPop).toList();
|
||||
if (regex != null) {
|
||||
shouldRemove = shouldRemove
|
||||
.where((element) => element.key != null)
|
||||
.where((element) => regex.hasMatch(element.key!))
|
||||
.toList();
|
||||
}
|
||||
if (shouldRemove.isEmpty) return;
|
||||
for (int i = 0; i < shouldRemove.length; i++) {
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -45,46 +45,46 @@ class OverlayUtil {
|
|||
builder: (context) => AnimatedContainer(
|
||||
duration: FluffyThemes.animationDuration,
|
||||
curve: FluffyThemes.animationCurve,
|
||||
child: IgnorePointer(
|
||||
ignoring: ignorePointer,
|
||||
child: Stack(
|
||||
children: [
|
||||
if (backDropToDismiss)
|
||||
TransparentBackdrop(
|
||||
child: Stack(
|
||||
children: [
|
||||
if (backDropToDismiss)
|
||||
IgnorePointer(
|
||||
ignoring: ignorePointer,
|
||||
child: TransparentBackdrop(
|
||||
backgroundColor: backgroundColor,
|
||||
onDismiss: onDismiss,
|
||||
blurBackground: blurBackground,
|
||||
),
|
||||
Positioned(
|
||||
top: (position == OverlayPositionEnum.centered ||
|
||||
position == OverlayPositionEnum.top)
|
||||
? 0
|
||||
: null,
|
||||
right: (position == OverlayPositionEnum.centered ||
|
||||
position == OverlayPositionEnum.top)
|
||||
? 0
|
||||
: null,
|
||||
left: (position == OverlayPositionEnum.centered ||
|
||||
position == OverlayPositionEnum.top)
|
||||
? 0
|
||||
: null,
|
||||
bottom: (position == OverlayPositionEnum.centered) ? 0 : null,
|
||||
child: (position != OverlayPositionEnum.transform)
|
||||
? child
|
||||
: CompositedTransformFollower(
|
||||
targetAnchor: targetAnchor ?? Alignment.topCenter,
|
||||
followerAnchor:
|
||||
followerAnchor ?? Alignment.bottomCenter,
|
||||
link: MatrixState.pAnyState
|
||||
.layerLinkAndKey(transformTargetId)
|
||||
.link,
|
||||
showWhenUnlinked: false,
|
||||
offset: offset ?? Offset.zero,
|
||||
child: child,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Positioned(
|
||||
top: (position == OverlayPositionEnum.centered ||
|
||||
position == OverlayPositionEnum.top)
|
||||
? 0
|
||||
: null,
|
||||
right: (position == OverlayPositionEnum.centered ||
|
||||
position == OverlayPositionEnum.top)
|
||||
? 0
|
||||
: null,
|
||||
left: (position == OverlayPositionEnum.centered ||
|
||||
position == OverlayPositionEnum.top)
|
||||
? 0
|
||||
: null,
|
||||
bottom: (position == OverlayPositionEnum.centered) ? 0 : null,
|
||||
child: (position != OverlayPositionEnum.transform)
|
||||
? child
|
||||
: CompositedTransformFollower(
|
||||
targetAnchor: targetAnchor ?? Alignment.topCenter,
|
||||
followerAnchor:
|
||||
followerAnchor ?? Alignment.bottomCenter,
|
||||
link: MatrixState.pAnyState
|
||||
.layerLinkAndKey(transformTargetId)
|
||||
.link,
|
||||
showWhenUnlinked: false,
|
||||
offset: offset ?? Offset.zero,
|
||||
child: child,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
|
|
@ -118,6 +118,7 @@ class OverlayUtil {
|
|||
bool isScrollable = true,
|
||||
bool addBorder = true,
|
||||
VoidCallback? onDismiss,
|
||||
bool ignorePointer = false,
|
||||
}) {
|
||||
try {
|
||||
final LayerLinkAndKey layerLinkAndKey =
|
||||
|
|
@ -194,6 +195,7 @@ class OverlayUtil {
|
|||
followerAnchor:
|
||||
hasTopOverflow ? Alignment.topCenter : Alignment.bottomCenter,
|
||||
onDismiss: onDismiss,
|
||||
ignorePointer: ignorePointer,
|
||||
);
|
||||
} catch (err, stack) {
|
||||
debugger(when: kDebugMode);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue