Skip to content

Commit

Permalink
fix: resolve ui state issue when trying to paste images from clipboard.
Browse files Browse the repository at this point in the history
  • Loading branch information
shuotwang committed Oct 21, 2022
1 parent b915c30 commit c00dd41
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,21 +36,24 @@ class AppTextSelectionControls extends CupertinoTextSelectionControls {
ClipboardStatusNotifier? clipboardStatus,
Offset? lastSecondaryTapDownPosition,
) {
clipboardStatus?.update();
final notifier = clipboardStatus != null
? ClipboardStatusNotifier(value: clipboardStatus.value)
: null;
return FutureBuilder<Uint8List?>(
future: _getClipboardImage(),
builder: (context, snapshot) {
if (snapshot.hasData && snapshot.data!.isNotEmpty) {
clipboardStatus?.value = ClipboardStatus.pasteable;
notifier?.value = ClipboardStatus.pasteable;
}

return super.buildToolbar(
context,
globalEditableRegion,
textLineHeight,
selectionMidpoint,
endpoints,
delegate,
clipboardStatus,
notifier,
lastSecondaryTapDownPosition);
});
}
Expand Down

0 comments on commit c00dd41

Please sign in to comment.