mirror of
https://github.com/block/buzz.git
synced 2026-11-25 10:42:26 +00:00
On iOS, a long draft in the message composer could freeze the app. In one case the main thread was blocked for 72 seconds. Flutter's stylus handwriting support (Scribble) is on by default in every iOS text field. After each frame whose text layout changed, it measures the field's text one character at a time, so iOS knows where each character sits on screen. Every measurement walks the paragraph's lines, so one pass costs time proportional to the square of the draft's length, and it runs again after every keystroke. Every sampled stack in the hang reports sits in `EditableTextState._updateSelectionRects` → `RenderEditable.getBoxesForSelection` → `getBoxesForRange`. iOS also uses those character positions for the keyboard trackpad's two-finger selection (hold Space, add a second finger, drag). So this keeps handwriting on for drafts up to 2,000 characters and turns it off past that, on iOS only, in the two fields where messages are written: the composer and the message edit sheet. Android never takes these measurements, so it keeps stylus handwriting at any length. The edit sheet rebuilds only when its draft crosses the cutoff, not on every keystroke. Whenever a draft crosses the cutoff, any open iPad Scribble writing gap is closed first, because Flutter ignores iOS closing it once handwriting is off. This holds even when the field no longer has focus, since iOS can close the input connection itself (for example on keyboard dismiss) without Flutter removing the gap. At 2,000 characters a pass should cost under a millisecond, extrapolating from the measurements below (cost grows with the square of the length). ### Validation One handwriting measurement pass in the running app (iPhone 17 Pro simulator, debug build), timed in-app with a draft of `the quick brown fox jumps over` lines: | Draft length | Before | After | | --- | --- | --- | | 23,250 chars | 100 ms | 0 ms | | 46,502 chars | 360 ms | 0 ms | | 93,000 chars | 1,376 ms | 0 ms | Before the fix, this cost was paid on every keystroke. Release builds on older phones run slower than the simulator on this Mac. - Added test: [iOS measures each character only of shorter drafts](https://github.com/block/buzz/blob/brow/mobile-text-layout-hang/mobile/test/features/channels/compose_bar_test.dart) checks that a short draft still sends iOS its character rectangles, a draft past the cutoff clears them (iOS would otherwise keep the shorter draft's), and shortening it again restores them. It also checks that a draft crossing the cutoff while the composer doesn't have the keyboard sends nothing, since iOS applies the clear to whichever field is focused. - Added test: [iOS closes a Scribble writing gap when a draft gets long](https://github.com/block/buzz/blob/brow/mobile-text-layout-hang/mobile/test/features/channels/compose_bar_test.dart) opens a writing gap, pushes the draft past the cutoff, then sends iOS's own close, and checks that no gap is left in the draft. - Added test: [Android starts stylus handwriting in a long draft](https://github.com/block/buzz/blob/brow/mobile-text-layout-hang/mobile/test/features/channels/compose_bar_test.dart) checks that a stylus tap still starts handwriting past the cutoff on Android. - Added test: [iOS closes a Scribble writing gap left after losing focus](https://github.com/block/buzz/blob/brow/mobile-text-layout-hang/mobile/test/features/channels/message_edit_sheet_test.dart) opens a writing gap in the edit sheet, has iOS close the input connection, then pushes the draft past the cutoff (as a late paste would) and checks that no gap is left. - Added test: [iOS turns stylus handwriting off only while the edit is long](https://github.com/block/buzz/blob/brow/mobile-text-layout-hang/mobile/test/features/channels/message_edit_sheet_test.dart) opens the edit sheet on a long message and shortens it. - Automated app run on the simulator, signed in to a test community: typed in the composer, used the edit menu (Select All, Paste), sent a message, then edited it in the edit sheet and saved. ### Regressions - In iOS drafts over 2,000 characters, the keyboard trackpad's two-finger selection and Apple Pencil handwriting stop working, and iOS may place its autocorrection highlight at the field's corner instead of over the word. Ordinary cursor movement with the trackpad, selection handles, the edit menu, dictation and typing are unaffected. - If a paste pushes a draft past the cutoff and undo brings back the exact earlier text, Flutter skips resending the unchanged rectangles, so iOS has none until the next edit or until the field scrolls (which a long round trip usually does). Flutter offers no public way to force the resend. - The channel description and create-agent Instructions fields can also hold long pastes and still pay this cost on iOS. They aren't in the hang reports, so they're left for a separate change. --------- Signed-off-by: Tom Brow <tomb@block.xyz> Co-authored-by: studio <dc2fc481343672df31a689840c09299972e704dac592e0da6f18486646a7ee3e@buzz.block.builderlab.xyz>
552 lines
19 KiB
Dart
552 lines
19 KiB
Dart
part of '../compose_bar.dart';
|
|
|
|
class _ComposeBarLayout extends HookWidget {
|
|
final GlobalKey surfaceKey;
|
|
final Widget? voiceNoteRecorder;
|
|
final bool keyboardToolbar;
|
|
final VoidCallback? onTextTap;
|
|
final List<_PendingAttachment> attachments;
|
|
final ValueChanged<int> onRemoveAttachment;
|
|
final String? uploadError;
|
|
final bool isExpanded;
|
|
final _MarkdownEditingController controller;
|
|
final FocusNode focusNode;
|
|
final EditableTextContextMenuBuilder contextMenuBuilder;
|
|
final ValueChanged<KeyboardInsertedContent> onContentInserted;
|
|
final VoidCallback onSend;
|
|
final KeyEventResult Function(FocusNode, KeyEvent) onKeyEvent;
|
|
final String resolvedHint;
|
|
final _AttachmentSurface attachmentSurface;
|
|
final ValueChanged<BuildContext> onAttachmentTap;
|
|
final VoidCallback onExpand;
|
|
final Animation<double> expansionAnimation;
|
|
final bool formattingOpen;
|
|
final VoidCallback onCloseFormatting;
|
|
final Duration motionDuration;
|
|
final Duration resizeDuration;
|
|
final void Function(String prefix, [String? suffix]) onFormat;
|
|
final VoidCallback onMention;
|
|
final VoidCallback onChannel;
|
|
final VoidCallback onEmoji;
|
|
final VoidCallback onVoiceNote;
|
|
final VoidCallback onOpenFormatting;
|
|
final bool canSend;
|
|
final bool hasPendingUploads;
|
|
final bool isSending;
|
|
final bool readOnly;
|
|
|
|
const _ComposeBarLayout({
|
|
required this.surfaceKey,
|
|
required this.voiceNoteRecorder,
|
|
this.keyboardToolbar = false,
|
|
this.onTextTap,
|
|
required this.attachments,
|
|
required this.onRemoveAttachment,
|
|
required this.uploadError,
|
|
required this.isExpanded,
|
|
required this.controller,
|
|
required this.focusNode,
|
|
required this.contextMenuBuilder,
|
|
required this.onContentInserted,
|
|
required this.onSend,
|
|
required this.onKeyEvent,
|
|
required this.resolvedHint,
|
|
required this.attachmentSurface,
|
|
required this.onAttachmentTap,
|
|
required this.onExpand,
|
|
required this.expansionAnimation,
|
|
required this.formattingOpen,
|
|
required this.onCloseFormatting,
|
|
required this.motionDuration,
|
|
required this.resizeDuration,
|
|
required this.onFormat,
|
|
required this.onMention,
|
|
required this.onChannel,
|
|
required this.onEmoji,
|
|
required this.onVoiceNote,
|
|
required this.onOpenFormatting,
|
|
required this.canSend,
|
|
required this.hasPendingUploads,
|
|
required this.isSending,
|
|
this.readOnly = false,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final recordingTransition = useAnimationController(
|
|
duration: motionDuration,
|
|
reverseDuration: MediaQuery.disableAnimationsOf(context)
|
|
? Duration.zero
|
|
: const Duration(milliseconds: 140),
|
|
initialValue: voiceNoteRecorder == null ? 0 : 1,
|
|
);
|
|
useEffect(() {
|
|
if (voiceNoteRecorder == null) {
|
|
recordingTransition.reverse();
|
|
} else {
|
|
recordingTransition.forward();
|
|
}
|
|
return null;
|
|
}, [voiceNoteRecorder != null, motionDuration]);
|
|
return _DragDownToDismissKeyboard(
|
|
child: _buildBar(context, recordingTransition),
|
|
);
|
|
}
|
|
|
|
Widget _buildBar(
|
|
BuildContext context,
|
|
Animation<double> recordingTransition,
|
|
) {
|
|
final trimmedDraft = controller.text.trim();
|
|
final collapsedText = trimmedDraft.isEmpty
|
|
? resolvedHint
|
|
: trimmedDraft.replaceAll(RegExp(r'\s+'), ' ');
|
|
final hasVoiceNoteAttachment = attachments.any(
|
|
(attachment) => attachment.kind == _PendingAttachmentKind.voiceNote,
|
|
);
|
|
final composerContent = Column(
|
|
key: ValueKey(
|
|
hasVoiceNoteAttachment
|
|
? 'composer-voice-note-preview-content'
|
|
: 'composer-standard-content',
|
|
),
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
if (attachments.isNotEmpty) ...[
|
|
_AttachmentStrip(
|
|
attachments: attachments,
|
|
onRemove: onRemoveAttachment,
|
|
),
|
|
const SizedBox(height: Grid.xxs),
|
|
],
|
|
if (uploadError case final error?) ...[
|
|
Align(
|
|
alignment: Alignment.centerLeft,
|
|
child: Text(
|
|
error,
|
|
style: context.textTheme.bodySmall?.copyWith(
|
|
color: context.colors.error,
|
|
),
|
|
),
|
|
),
|
|
const SizedBox(height: Grid.xxs),
|
|
],
|
|
// Keep the default state out of the focus system entirely so
|
|
// restored native focus cannot expand a newly opened channel.
|
|
if (isExpanded && keyboardToolbar)
|
|
ConstrainedBox(
|
|
constraints: const BoxConstraints(minHeight: 28),
|
|
child: Row(
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
children: [
|
|
Expanded(child: _buildTextField(context)),
|
|
_IosEmptyComposerActions(onEmoji: onEmoji, enabled: !readOnly),
|
|
],
|
|
),
|
|
)
|
|
else if (isExpanded)
|
|
resizeDuration == Duration.zero
|
|
? KeyedSubtree(
|
|
key: const ValueKey('composer-text-height-motion'),
|
|
child: _buildTextField(context),
|
|
)
|
|
: AnimatedSize(
|
|
key: const ValueKey('composer-text-height-motion'),
|
|
alignment: Alignment.topCenter,
|
|
duration: resizeDuration,
|
|
curve: Curves.easeOutCubic,
|
|
child: _buildTextField(context),
|
|
)
|
|
else
|
|
ConstrainedBox(
|
|
constraints: BoxConstraints(minHeight: keyboardToolbar ? 28 : 0),
|
|
child: Row(
|
|
children: [
|
|
if (!keyboardToolbar) ...[
|
|
_AttachmentTrigger(
|
|
surface: attachmentSurface,
|
|
formattingOpen: false,
|
|
onTap: onAttachmentTap,
|
|
),
|
|
const SizedBox(width: Grid.xxs),
|
|
],
|
|
Expanded(
|
|
child: Semantics(
|
|
button: true,
|
|
label: resolvedHint,
|
|
child: GestureDetector(
|
|
behavior: HitTestBehavior.opaque,
|
|
onTap: () => _runComposerAction(onExpand),
|
|
child: Padding(
|
|
padding: EdgeInsets.symmetric(
|
|
vertical: keyboardToolbar ? 0 : Grid.half,
|
|
horizontal: keyboardToolbar ? Grid.half : 0,
|
|
),
|
|
child: Align(
|
|
alignment: Alignment.centerLeft,
|
|
child: Text(
|
|
collapsedText,
|
|
maxLines: 1,
|
|
overflow: TextOverflow.ellipsis,
|
|
style: context.textTheme.bodyLarge?.copyWith(
|
|
color: trimmedDraft.isEmpty
|
|
? context.colors.onSurfaceVariant
|
|
: context.colors.onSurface,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
if (keyboardToolbar) ...[
|
|
_IosEmptyComposerActions(
|
|
onEmoji: onEmoji,
|
|
enabled: !readOnly,
|
|
),
|
|
] else ...[
|
|
const SizedBox(width: Grid.xxs),
|
|
_SendButton(
|
|
isDisabled: !canSend || hasPendingUploads,
|
|
isSending: isSending,
|
|
onTap: onSend,
|
|
),
|
|
],
|
|
],
|
|
),
|
|
),
|
|
if (!keyboardToolbar)
|
|
_ExpandedComposerActionsMotion(
|
|
animation: expansionAnimation,
|
|
isExpanded: isExpanded,
|
|
child: Column(
|
|
children: [
|
|
const SizedBox(height: Grid.xxs),
|
|
Row(
|
|
children: [
|
|
_AttachmentTrigger(
|
|
surface: attachmentSurface,
|
|
formattingOpen: formattingOpen,
|
|
onTap: (triggerContext) {
|
|
if (formattingOpen) {
|
|
onCloseFormatting();
|
|
} else {
|
|
onAttachmentTap(triggerContext);
|
|
}
|
|
},
|
|
),
|
|
const SizedBox(width: Grid.half),
|
|
Expanded(
|
|
child: AnimatedSwitcher(
|
|
duration: motionDuration,
|
|
switchInCurve: Curves.easeOutCubic,
|
|
switchOutCurve: Curves.easeInCubic,
|
|
layoutBuilder: (currentChild, previousChildren) =>
|
|
Stack(
|
|
alignment: Alignment.centerLeft,
|
|
children: [...previousChildren, ?currentChild],
|
|
),
|
|
child: formattingOpen
|
|
? _FormattingToolbar(onFormat: onFormat)
|
|
: Row(
|
|
key: const ValueKey('standard-actions'),
|
|
children: [
|
|
_ComposeAction(
|
|
icon: BuzzIcons.atSign,
|
|
onTap: onMention,
|
|
),
|
|
_ComposeAction(
|
|
icon: BuzzIcons.hash,
|
|
onTap: onChannel,
|
|
),
|
|
_ComposeAction(
|
|
icon: BuzzIcons.smilePlus,
|
|
onTap: onEmoji,
|
|
),
|
|
_ComposeAction(
|
|
icon: BuzzIcons.aLargeSmall,
|
|
onTap: onOpenFormatting,
|
|
),
|
|
const Spacer(),
|
|
_SendButton(
|
|
isDisabled: !canSend || hasPendingUploads,
|
|
isSending: isSending,
|
|
onTap: onSend,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
);
|
|
final contentMotionDuration = MediaQuery.disableAnimationsOf(context)
|
|
? Duration.zero
|
|
: const Duration(milliseconds: 140);
|
|
final content = ClipRect(
|
|
child: AnimatedSwitcher(
|
|
key: const ValueKey('composer-content-morph'),
|
|
duration: contentMotionDuration,
|
|
switchInCurve: Curves.easeOutCubic,
|
|
switchOutCurve: Curves.easeOutCubic,
|
|
layoutBuilder: (currentChild, previousChildren) => Stack(
|
|
alignment: Alignment.bottomCenter,
|
|
children: [...previousChildren, ?currentChild],
|
|
),
|
|
transitionBuilder: (child, animation) => FadeTransition(
|
|
opacity: animation,
|
|
child: SizeTransition(
|
|
sizeFactor: animation,
|
|
alignment: Alignment.bottomCenter,
|
|
child: child,
|
|
),
|
|
),
|
|
child: voiceNoteRecorder == null
|
|
? composerContent
|
|
: KeyedSubtree(
|
|
key: const ValueKey('composer-voice-note-content'),
|
|
child: voiceNoteRecorder!,
|
|
),
|
|
),
|
|
);
|
|
return AnimatedBuilder(
|
|
animation: Listenable.merge([expansionAnimation, recordingTransition]),
|
|
child: content,
|
|
builder: (context, child) {
|
|
final progress = expansionAnimation.value.clamp(0.0, 1.0).toDouble();
|
|
final usesCapsule =
|
|
(!isExpanded || controller.text.isEmpty) &&
|
|
attachments.isEmpty &&
|
|
uploadError == null;
|
|
final composerRadius =
|
|
defaultTargetPlatform == TargetPlatform.iOS && usesCapsule
|
|
? Radii.full
|
|
: Radii.dialog + Grid.quarter * (1 - progress);
|
|
final radius = BorderRadius.lerp(
|
|
BorderRadius.circular(composerRadius),
|
|
BorderRadius.circular(Radii.full),
|
|
Curves.easeInOutCubic.transform(recordingTransition.value),
|
|
)!;
|
|
final usesIosConcentricSurface =
|
|
defaultTargetPlatform == TargetPlatform.iOS;
|
|
final voiceNoteInsetProgress = hasVoiceNoteAttachment
|
|
? 1.0
|
|
: recordingTransition.value;
|
|
final composer = KeyedSubtree(
|
|
key: surfaceKey,
|
|
child: Container(
|
|
key: const ValueKey('composer-surface'),
|
|
decoration: BoxDecoration(
|
|
color: usesIosConcentricSurface
|
|
? Colors.transparent
|
|
: context.colors.surfaceContainerHighest,
|
|
borderRadius: radius,
|
|
border: Border.all(
|
|
color: Colors.black.withValues(alpha: 0.04),
|
|
width: 1,
|
|
),
|
|
),
|
|
padding: EdgeInsets.symmetric(
|
|
horizontal: Grid.xxs + Grid.half * voiceNoteInsetProgress,
|
|
vertical:
|
|
(usesIosConcentricSurface ? 5 : Grid.xxs) +
|
|
Grid.half * voiceNoteInsetProgress,
|
|
),
|
|
child: child,
|
|
),
|
|
);
|
|
if (!usesIosConcentricSurface) return composer;
|
|
final iosComposer = ConcentricSheetSurface(
|
|
key: const ValueKey('composer-ios-concentric-surface'),
|
|
animateGeometry: true,
|
|
enabled: true,
|
|
usesGlass: true,
|
|
capsule: usesCapsule,
|
|
color: context.colors.surfaceContainerHighest,
|
|
padding: EdgeInsets.zero,
|
|
providesSheetSurface: false,
|
|
minimumRadius: radius.topLeft.x,
|
|
contentClipRadius: radius.topLeft.x,
|
|
child: composer,
|
|
);
|
|
if (voiceNoteRecorder != null || recordingTransition.value > 0.001) {
|
|
return iosComposer;
|
|
}
|
|
return _IosComposerControls(
|
|
showSend:
|
|
controller.text.isNotEmpty ||
|
|
attachments.isNotEmpty ||
|
|
hasPendingUploads ||
|
|
isSending,
|
|
isSending: isSending,
|
|
canSend: canSend && !hasPendingUploads && !readOnly,
|
|
enabled: !readOnly,
|
|
onAttachments: onAttachmentTap,
|
|
attachmentSurface: attachmentSurface,
|
|
onSend: onSend,
|
|
onVoiceNote: onVoiceNote,
|
|
child: iosComposer,
|
|
);
|
|
},
|
|
);
|
|
}
|
|
|
|
Widget _buildTextField(BuildContext context) {
|
|
return Actions(
|
|
actions: {
|
|
UndoTextIntent: _ComposerHistoryAction<UndoTextIntent>(controller),
|
|
RedoTextIntent: _ComposerHistoryAction<RedoTextIntent>(controller),
|
|
},
|
|
child: Focus(
|
|
canRequestFocus: false,
|
|
skipTraversal: true,
|
|
onKeyEvent: onKeyEvent,
|
|
child: _buildEditableField(context),
|
|
),
|
|
);
|
|
}
|
|
|
|
Widget _buildEditableField(BuildContext context) {
|
|
return TextField(
|
|
onTap: onTextTap,
|
|
controller: controller,
|
|
focusNode: focusNode,
|
|
readOnly: readOnly,
|
|
inputFormatters: [_ComposerChipEditingFormatter(controller)],
|
|
keyboardType: TextInputType.multiline,
|
|
textInputAction: TextInputAction.newline,
|
|
contextMenuBuilder: contextMenuBuilder,
|
|
// Flutter's Cupertino magnifier rebuilds its overlay on every
|
|
// selection-handle update. Keep the iOS handles and native edit menu,
|
|
// but let the handles track the finger directly here.
|
|
magnifierConfiguration: defaultTargetPlatform == TargetPlatform.iOS
|
|
? TextMagnifierConfiguration.disabled
|
|
: null,
|
|
stylusHandwritingEnabled: stylusHandwritingEnabledFor(controller.text),
|
|
contentInsertionConfiguration: ContentInsertionConfiguration(
|
|
allowedMimeTypes: _pastedImageMimeTypes,
|
|
onContentInserted: onContentInserted,
|
|
),
|
|
minLines: 1,
|
|
maxLines: 5,
|
|
style: context.textTheme.bodyLarge,
|
|
decoration: InputDecoration(
|
|
hintText: resolvedHint,
|
|
hintMaxLines: 1,
|
|
hintStyle: context.textTheme.bodyLarge?.copyWith(
|
|
color: context.colors.onSurfaceVariant,
|
|
),
|
|
border: InputBorder.none,
|
|
enabledBorder: InputBorder.none,
|
|
focusedBorder: InputBorder.none,
|
|
contentPadding: EdgeInsets.symmetric(
|
|
horizontal: Grid.half,
|
|
vertical: keyboardToolbar ? 0 : Grid.half,
|
|
),
|
|
isDense: true,
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
class _ExpandedComposerActionsMotion extends StatelessWidget {
|
|
final Animation<double> animation;
|
|
final bool isExpanded;
|
|
final Widget child;
|
|
|
|
const _ExpandedComposerActionsMotion({
|
|
required this.animation,
|
|
required this.isExpanded,
|
|
required this.child,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return AnimatedBuilder(
|
|
animation: animation,
|
|
child: child,
|
|
builder: (context, child) {
|
|
final value = animation.value;
|
|
final progress = value.clamp(0.0, 1.0).toDouble();
|
|
return ClipRect(
|
|
child: Align(
|
|
alignment: Alignment.topCenter,
|
|
heightFactor: value,
|
|
child: IgnorePointer(
|
|
ignoring: !isExpanded,
|
|
child: Opacity(
|
|
opacity: progress,
|
|
child: Transform.translate(
|
|
offset: Offset(0, Grid.xxs * (1 - progress)),
|
|
child: child,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
},
|
|
);
|
|
}
|
|
}
|
|
|
|
/// Drag the compose bar downward to put the keyboard away.
|
|
///
|
|
/// Continues the gesture the message list starts: once your finger reaches the
|
|
/// composer, keep pulling down and the keyboard goes with it. Uses a raw
|
|
/// [Listener] rather than a `GestureDetector` on purpose — a gesture recognizer
|
|
/// here would enter the arena against the `TextField` and could steal taps,
|
|
/// caret placement, and selection drags. A [Listener] only observes.
|
|
class _DragDownToDismissKeyboard extends HookWidget {
|
|
final Widget child;
|
|
|
|
const _DragDownToDismissKeyboard({required this.child});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
// A ref, not state: pointer travel must not rebuild the composer, which
|
|
// would churn the TextField mid-gesture.
|
|
final downwardTravel = useRef(0.0);
|
|
final startedInEditable = useRef(false);
|
|
|
|
return Listener(
|
|
onPointerDown: (event) {
|
|
downwardTravel.value = 0;
|
|
final hitTest = HitTestResult();
|
|
RendererBinding.instance.hitTestInView(
|
|
hitTest,
|
|
event.position,
|
|
event.viewId,
|
|
);
|
|
startedInEditable.value = hitTest.path.any(
|
|
(entry) => entry.target is RenderEditable,
|
|
);
|
|
},
|
|
onPointerCancel: (_) {
|
|
downwardTravel.value = 0;
|
|
startedInEditable.value = false;
|
|
},
|
|
onPointerUp: (_) {
|
|
downwardTravel.value = 0;
|
|
startedInEditable.value = false;
|
|
},
|
|
onPointerMove: (event) {
|
|
if (startedInEditable.value) return;
|
|
final dy = event.delta.dy;
|
|
if (dy <= 0) {
|
|
downwardTravel.value = 0;
|
|
return;
|
|
}
|
|
downwardTravel.value += dy;
|
|
if (downwardTravel.value < keyboardDismissDragThreshold) return;
|
|
downwardTravel.value = 0;
|
|
dismissKeyboard(context);
|
|
},
|
|
child: child,
|
|
);
|
|
}
|
|
}
|