feat: Paste image from clipboard on desktop/web
This commit is contained in:
parent
cc230c2222
commit
aea906f801
11 changed files with 56 additions and 1 deletions
|
|
@ -14,6 +14,7 @@ import 'package:go_router/go_router.dart';
|
|||
import 'package:image_picker/image_picker.dart';
|
||||
import 'package:matrix/matrix.dart';
|
||||
import 'package:scroll_to_index/scroll_to_index.dart';
|
||||
import 'package:pasteboard/pasteboard.dart';
|
||||
|
||||
import 'package:fluffychat/config/setting_keys.dart';
|
||||
import 'package:fluffychat/config/themes.dart';
|
||||
|
|
@ -643,6 +644,11 @@ class ChatController extends State<ChatPageWithRoom>
|
|||
);
|
||||
}
|
||||
|
||||
Future<void> sendImageFromClipBoardAction() async {
|
||||
final image = await Pasteboard.image;
|
||||
await sendImageFromClipBoard(image);
|
||||
}
|
||||
|
||||
Future<void> sendImageFromClipBoard(Uint8List? image) async {
|
||||
if (image == null) return;
|
||||
await showAdaptiveDialog(
|
||||
|
|
@ -1219,6 +1225,9 @@ class ChatController extends State<ChatPageWithRoom>
|
|||
case AddPopupMenuActions.location:
|
||||
sendLocationAction();
|
||||
return;
|
||||
case AddPopupMenuActions.pasteImage:
|
||||
sendImageFromClipBoardAction();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1421,4 +1430,5 @@ enum AddPopupMenuActions {
|
|||
photoCamera,
|
||||
videoCamera,
|
||||
location,
|
||||
pasteImage,
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue