mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-11-30 10:12:50 +03:00
fix: try without media kit
This commit is contained in:
parent
d73e388d01
commit
8f9ae134df
@ -1,7 +1,6 @@
|
||||
import 'dart:async';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:appflowy_editor_plugins/appflowy_editor_plugins.dart';
|
||||
import 'package:flutter/gestures.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
@ -37,8 +36,6 @@ extension AppFlowyTestBase on WidgetTester {
|
||||
AuthenticatorType? cloudType,
|
||||
String? email,
|
||||
}) async {
|
||||
VideoBlockKit.ensureInitialized();
|
||||
|
||||
if (Platform.isLinux || Platform.isWindows || Platform.isMacOS) {
|
||||
// Set the window size
|
||||
await binding.setSurfaceSize(windowSize);
|
||||
|
@ -1,12 +1,9 @@
|
||||
import 'package:scaled_app/scaled_app.dart';
|
||||
|
||||
import 'package:appflowy_editor_plugins/appflowy_editor_plugins.dart';
|
||||
|
||||
import 'startup/startup.dart';
|
||||
|
||||
Future<void> main() async {
|
||||
ScaledWidgetsFlutterBinding.ensureInitialized(scaleFactor: (_) => 1.0);
|
||||
VideoBlockKit.ensureInitialized();
|
||||
|
||||
await runAppFlowy();
|
||||
}
|
||||
|
@ -1,3 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
import 'package:appflowy/generated/locale_keys.g.dart';
|
||||
import 'package:appflowy/mobile/application/page_style/document_page_style_bloc.dart';
|
||||
import 'package:appflowy/plugins/document/presentation/editor_page.dart';
|
||||
@ -5,15 +8,11 @@ import 'package:appflowy/plugins/document/presentation/editor_plugins/actions/mo
|
||||
import 'package:appflowy/plugins/document/presentation/editor_plugins/code_block/code_block_copy_button.dart';
|
||||
import 'package:appflowy/plugins/document/presentation/editor_plugins/image/custom_image_block_component.dart';
|
||||
import 'package:appflowy/plugins/document/presentation/editor_plugins/plugins.dart';
|
||||
import 'package:appflowy/plugins/document/presentation/editor_plugins/video/video_menu.dart';
|
||||
import 'package:appflowy/plugins/document/presentation/editor_plugins/video/video_placeholder.dart';
|
||||
import 'package:appflowy/plugins/document/presentation/editor_style.dart';
|
||||
import 'package:appflowy_editor/appflowy_editor.dart';
|
||||
import 'package:appflowy_editor_plugins/appflowy_editor_plugins.dart';
|
||||
import 'package:easy_localization/easy_localization.dart' hide TextDirection;
|
||||
import 'package:flowy_infra/theme_extension.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
|
||||
Map<String, BlockComponentBuilder> getEditorBuilderMap({
|
||||
@ -231,16 +230,6 @@ Map<String, BlockComponentBuilder> getEditorBuilderMap({
|
||||
errorBlockComponentBuilderKey: ErrorBlockComponentBuilder(
|
||||
configuration: configuration,
|
||||
),
|
||||
VideoBlockKeys.type: VideoBlockComponentBuilder(
|
||||
configuration: configuration,
|
||||
showMenu: true,
|
||||
menuBuilder: (node, state) => Positioned(
|
||||
top: 10,
|
||||
right: 10,
|
||||
child: VideoMenu(node: node, state: state),
|
||||
),
|
||||
placeholderBuilder: (node) => VideoPlaceholder(node: node),
|
||||
),
|
||||
};
|
||||
|
||||
final builders = {
|
||||
|
@ -412,7 +412,6 @@ class _AppFlowyEditorPageState extends State<AppFlowyEditorPage> {
|
||||
emojiMenuItem,
|
||||
autoGeneratorMenuItem,
|
||||
dateMenuItem,
|
||||
videoBlockItem(LocaleKeys.document_plugins_video_label.tr()),
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -197,15 +197,6 @@ class _AddBlockMenu extends StatelessWidget {
|
||||
},
|
||||
),
|
||||
|
||||
// video
|
||||
TypeOptionMenuItemValue(
|
||||
value: VideoBlockKeys.type,
|
||||
backgroundColor: colorMap[VideoBlockKeys.type]!,
|
||||
text: LocaleKeys.document_plugins_video_label.tr(),
|
||||
icon: FlowySvgs.m_add_block_video_s,
|
||||
onTap: (_, __) => _insertBlock(videoBlockNode()),
|
||||
),
|
||||
|
||||
// date
|
||||
TypeOptionMenuItemValue(
|
||||
value: ParagraphBlockKeys.type,
|
||||
@ -296,7 +287,6 @@ class _AddBlockMenu extends StatelessWidget {
|
||||
NumberedListBlockKeys.type: const Color(0xFFA35F94),
|
||||
ToggleListBlockKeys.type: const Color(0xFFA35F94),
|
||||
ImageBlockKeys.type: const Color(0xFFBAAC74),
|
||||
VideoBlockKeys.type: const Color(0xFFBAAC74),
|
||||
MentionBlockKeys.type: const Color(0xFF40AAB8),
|
||||
DividerBlockKeys.type: const Color(0xFF4BB299),
|
||||
CalloutBlockKeys.type: const Color(0xFF66599B),
|
||||
@ -313,7 +303,6 @@ class _AddBlockMenu extends StatelessWidget {
|
||||
NumberedListBlockKeys.type: const Color(0xFFFFB9EF),
|
||||
ToggleListBlockKeys.type: const Color(0xFFFFB9EF),
|
||||
ImageBlockKeys.type: const Color(0xFFFDEDA7),
|
||||
VideoBlockKeys.type: const Color(0xFFFDEDA7),
|
||||
MentionBlockKeys.type: const Color(0xFF91EAF5),
|
||||
DividerBlockKeys.type: const Color(0xFF98F4CD),
|
||||
CalloutBlockKeys.type: const Color(0xFFCABDFF),
|
||||
|
@ -1,102 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:appflowy/generated/locale_keys.g.dart';
|
||||
import 'package:appflowy/shared/patterns/common_patterns.dart';
|
||||
import 'package:appflowy_editor/appflowy_editor.dart' hide ColorOption;
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flowy_infra_ui/flowy_infra_ui.dart';
|
||||
|
||||
class UploadVideoMenu extends StatefulWidget {
|
||||
const UploadVideoMenu({
|
||||
super.key,
|
||||
required this.onUrlSubmitted,
|
||||
this.onSelectedColor,
|
||||
});
|
||||
|
||||
final void Function(String url) onUrlSubmitted;
|
||||
final void Function(String color)? onSelectedColor;
|
||||
|
||||
@override
|
||||
State<UploadVideoMenu> createState() => _UploadVideoMenuState();
|
||||
}
|
||||
|
||||
class _UploadVideoMenuState extends State<UploadVideoMenu> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final constraints =
|
||||
PlatformExtension.isMobile ? const BoxConstraints(minHeight: 92) : null;
|
||||
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
constraints: constraints,
|
||||
child: _EmbedUrl(onSubmit: widget.onUrlSubmitted),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _EmbedUrl extends StatefulWidget {
|
||||
const _EmbedUrl({required this.onSubmit});
|
||||
|
||||
final void Function(String url) onSubmit;
|
||||
|
||||
@override
|
||||
State<_EmbedUrl> createState() => _EmbedUrlState();
|
||||
}
|
||||
|
||||
class _EmbedUrlState extends State<_EmbedUrl> {
|
||||
bool isUrlValid = true;
|
||||
bool isYouTubeError = false;
|
||||
String inputText = '';
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
FlowyTextField(
|
||||
hintText: LocaleKeys.document_plugins_video_placeholder.tr(),
|
||||
onChanged: (value) => inputText = value,
|
||||
onEditingComplete: submit,
|
||||
),
|
||||
if (!isUrlValid) ...[
|
||||
const VSpace(8),
|
||||
FlowyText(
|
||||
isYouTubeError
|
||||
? LocaleKeys.document_plugins_video_invalidVideoUrlYouTube.tr()
|
||||
: LocaleKeys.document_plugins_video_invalidVideoUrl.tr(),
|
||||
color: Theme.of(context).colorScheme.error,
|
||||
),
|
||||
],
|
||||
const VSpace(8),
|
||||
FlowyText(
|
||||
LocaleKeys.document_plugins_video_supportedFormats.tr(),
|
||||
color: Theme.of(context).hintColor,
|
||||
),
|
||||
const VSpace(8),
|
||||
SizedBox(
|
||||
width: 160,
|
||||
child: FlowyButton(
|
||||
showDefaultBoxDecorationOnMobile: true,
|
||||
margin: const EdgeInsets.all(8.0),
|
||||
text: FlowyText(
|
||||
LocaleKeys.document_plugins_video_insertVideo.tr(),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
onTap: submit,
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
void submit() {
|
||||
if (checkUrlValidity(inputText)) {
|
||||
return widget.onSubmit(inputText);
|
||||
}
|
||||
|
||||
isYouTubeError = youtubeUrlRegex.hasMatch(inputText);
|
||||
setState(() => isUrlValid = false);
|
||||
}
|
||||
|
||||
bool checkUrlValidity(String url) => videoUrlRegex.hasMatch(url);
|
||||
}
|
@ -1,314 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
import 'package:appflowy/generated/flowy_svgs.g.dart';
|
||||
import 'package:appflowy/generated/locale_keys.g.dart';
|
||||
import 'package:appflowy/mobile/presentation/bottom_sheet/bottom_sheet_block_action_widget.dart';
|
||||
import 'package:appflowy/mobile/presentation/bottom_sheet/show_mobile_bottom_sheet.dart';
|
||||
import 'package:appflowy/mobile/presentation/widgets/flowy_option_tile.dart';
|
||||
import 'package:appflowy/plugins/document/presentation/editor_plugins/align_toolbar_item/align_toolbar_item.dart';
|
||||
import 'package:appflowy/plugins/document/presentation/editor_plugins/block_menu/block_menu_button.dart';
|
||||
import 'package:appflowy/plugins/document/presentation/editor_plugins/copy_and_paste/clipboard_service.dart';
|
||||
import 'package:appflowy/plugins/document/presentation/editor_plugins/plugins.dart';
|
||||
import 'package:appflowy/startup/startup.dart';
|
||||
import 'package:appflowy/workspace/presentation/home/toast.dart';
|
||||
import 'package:appflowy_editor/appflowy_editor.dart';
|
||||
import 'package:appflowy_editor_plugins/appflowy_editor_plugins.dart';
|
||||
import 'package:appflowy_popover/appflowy_popover.dart';
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flowy_infra_ui/flowy_infra_ui.dart';
|
||||
import 'package:flowy_infra_ui/widget/ignore_parent_gesture.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class VideoMenu extends StatefulWidget {
|
||||
const VideoMenu({
|
||||
super.key,
|
||||
required this.node,
|
||||
required this.state,
|
||||
});
|
||||
|
||||
final Node node;
|
||||
final VideoBlockComponentState state;
|
||||
|
||||
@override
|
||||
State<VideoMenu> createState() => _VideoMenuState();
|
||||
}
|
||||
|
||||
class _VideoMenuState extends State<VideoMenu> {
|
||||
late final String? url = widget.node.attributes[VideoBlockKeys.url];
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
return Container(
|
||||
height: 32,
|
||||
decoration: BoxDecoration(
|
||||
color: theme.cardColor,
|
||||
borderRadius: BorderRadius.circular(4.0),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
blurRadius: 5,
|
||||
spreadRadius: 1,
|
||||
color: Colors.black.withOpacity(0.1),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: PlatformExtension.isMobile
|
||||
? MenuBlockButton(
|
||||
tooltip: LocaleKeys.button_edit.tr(),
|
||||
iconData: FlowySvgs.more_s,
|
||||
onTap: showMobileMenu,
|
||||
)
|
||||
: Row(
|
||||
children: [
|
||||
const HSpace(4),
|
||||
MenuBlockButton(
|
||||
tooltip: LocaleKeys.editor_copyLink.tr(),
|
||||
iconData: FlowySvgs.copy_s,
|
||||
onTap: copyVideoLink,
|
||||
),
|
||||
const HSpace(4),
|
||||
_VideoAlignButton(
|
||||
node: widget.node,
|
||||
state: widget.state,
|
||||
),
|
||||
const _Divider(),
|
||||
MenuBlockButton(
|
||||
tooltip: LocaleKeys.button_delete.tr(),
|
||||
iconData: FlowySvgs.delete_s,
|
||||
onTap: deleteVideo,
|
||||
),
|
||||
const HSpace(4),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void copyVideoLink() {
|
||||
if (url != null) {
|
||||
Clipboard.setData(ClipboardData(text: url!));
|
||||
showSnackBarMessage(
|
||||
context,
|
||||
LocaleKeys.document_plugins_video_copiedToPasteBoard.tr(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
void showMobileMenu() {
|
||||
final editorState = context.read<EditorState>()
|
||||
..updateSelectionWithReason(null, extraInfo: {});
|
||||
final src = widget.node.attributes[VideoBlockKeys.url];
|
||||
showMobileBottomSheet(
|
||||
context,
|
||||
showHeader: true,
|
||||
showCloseButton: true,
|
||||
showDragHandle: true,
|
||||
title: LocaleKeys.document_plugins_action.tr(),
|
||||
builder: (context) {
|
||||
return BlockActionBottomSheet(
|
||||
extendActionWidgets: [
|
||||
FlowyOptionTile.text(
|
||||
showTopBorder: false,
|
||||
text: LocaleKeys.editor_copyLink.tr(),
|
||||
leftIcon: const FlowySvg(
|
||||
FlowySvgs.m_field_copy_s,
|
||||
),
|
||||
onTap: () async {
|
||||
context.pop();
|
||||
showSnackBarMessage(
|
||||
context,
|
||||
LocaleKeys.document_plugins_video_copiedToPasteBoard.tr(),
|
||||
);
|
||||
await getIt<ClipboardService>().setPlainText(src);
|
||||
},
|
||||
),
|
||||
],
|
||||
onAction: (action) async {
|
||||
context.pop();
|
||||
|
||||
final transaction = editorState.transaction;
|
||||
switch (action) {
|
||||
case BlockActionBottomSheetType.delete:
|
||||
transaction.deleteNode(widget.node);
|
||||
break;
|
||||
case BlockActionBottomSheetType.duplicate:
|
||||
transaction.insertNode(
|
||||
widget.node.path.next,
|
||||
widget.node.copyWith(),
|
||||
);
|
||||
break;
|
||||
case BlockActionBottomSheetType.insertAbove:
|
||||
case BlockActionBottomSheetType.insertBelow:
|
||||
final path = action == BlockActionBottomSheetType.insertAbove
|
||||
? widget.node.path
|
||||
: widget.node.path.next;
|
||||
transaction
|
||||
..insertNode(path, paragraphNode())
|
||||
..afterSelection = Selection.collapsed(Position(path: path));
|
||||
break;
|
||||
default:
|
||||
}
|
||||
|
||||
if (transaction.operations.isNotEmpty) {
|
||||
await editorState.apply(transaction);
|
||||
}
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> deleteVideo() async {
|
||||
final node = widget.node;
|
||||
final editorState = context.read<EditorState>();
|
||||
final transaction = editorState.transaction;
|
||||
transaction.deleteNode(node);
|
||||
transaction.afterSelection = null;
|
||||
await editorState.apply(transaction);
|
||||
}
|
||||
}
|
||||
|
||||
class _VideoAlignButton extends StatefulWidget {
|
||||
const _VideoAlignButton({
|
||||
required this.node,
|
||||
required this.state,
|
||||
});
|
||||
|
||||
final Node node;
|
||||
final VideoBlockComponentState state;
|
||||
|
||||
@override
|
||||
State<_VideoAlignButton> createState() => _VideoAlignButtonState();
|
||||
}
|
||||
|
||||
const interceptorKey = 'video-align';
|
||||
|
||||
class _VideoAlignButtonState extends State<_VideoAlignButton> {
|
||||
final gestureInterceptor = SelectionGestureInterceptor(
|
||||
key: interceptorKey,
|
||||
canTap: (_) => false,
|
||||
);
|
||||
|
||||
String get align =>
|
||||
widget.node.attributes[VideoBlockKeys.alignment] ?? centerAlignmentKey;
|
||||
final popoverController = PopoverController();
|
||||
late final EditorState editorState;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
editorState = context.read<EditorState>();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
allowMenuClose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return IgnoreParentGestureWidget(
|
||||
child: AppFlowyPopover(
|
||||
onClose: allowMenuClose,
|
||||
controller: popoverController,
|
||||
windowPadding: const EdgeInsets.all(0),
|
||||
margin: const EdgeInsets.all(0),
|
||||
direction: PopoverDirection.bottomWithCenterAligned,
|
||||
offset: const Offset(0, 10),
|
||||
child: MenuBlockButton(
|
||||
tooltip: LocaleKeys.document_plugins_optionAction_align.tr(),
|
||||
iconData: iconFor(align),
|
||||
),
|
||||
popupBuilder: (_) {
|
||||
preventMenuClose();
|
||||
return _AlignButtons(onAlignChanged: onAlignChanged);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void onAlignChanged(String align) {
|
||||
popoverController.close();
|
||||
|
||||
final transaction = editorState.transaction;
|
||||
transaction.updateNode(widget.node, {VideoBlockKeys.alignment: align});
|
||||
editorState.apply(transaction);
|
||||
|
||||
allowMenuClose();
|
||||
}
|
||||
|
||||
void preventMenuClose() {
|
||||
widget.state.preventClose = true;
|
||||
editorState.service.selectionService
|
||||
.registerGestureInterceptor(gestureInterceptor);
|
||||
}
|
||||
|
||||
void allowMenuClose() {
|
||||
widget.state.preventClose = false;
|
||||
editorState.service.selectionService
|
||||
.unregisterGestureInterceptor(interceptorKey);
|
||||
}
|
||||
|
||||
FlowySvgData iconFor(String alignment) {
|
||||
switch (alignment) {
|
||||
case leftAlignmentKey:
|
||||
return FlowySvgs.align_left_s;
|
||||
case rightAlignmentKey:
|
||||
return FlowySvgs.align_right_s;
|
||||
case centerAlignmentKey:
|
||||
default:
|
||||
return FlowySvgs.align_center_s;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class _AlignButtons extends StatelessWidget {
|
||||
const _AlignButtons({required this.onAlignChanged});
|
||||
|
||||
final Function(String align) onAlignChanged;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SizedBox(
|
||||
height: 32,
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
const HSpace(4),
|
||||
MenuBlockButton(
|
||||
tooltip: LocaleKeys.document_plugins_optionAction_left,
|
||||
iconData: FlowySvgs.align_left_s,
|
||||
onTap: () => onAlignChanged(leftAlignmentKey),
|
||||
),
|
||||
const _Divider(),
|
||||
MenuBlockButton(
|
||||
tooltip: LocaleKeys.document_plugins_optionAction_center,
|
||||
iconData: FlowySvgs.align_center_s,
|
||||
onTap: () => onAlignChanged(centerAlignmentKey),
|
||||
),
|
||||
const _Divider(),
|
||||
MenuBlockButton(
|
||||
tooltip: LocaleKeys.document_plugins_optionAction_right,
|
||||
iconData: FlowySvgs.align_right_s,
|
||||
onTap: () => onAlignChanged(rightAlignmentKey),
|
||||
),
|
||||
const HSpace(4),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _Divider extends StatelessWidget {
|
||||
const _Divider();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(8),
|
||||
child: Container(width: 1, color: Colors.grey),
|
||||
);
|
||||
}
|
||||
}
|
@ -1,136 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:appflowy/generated/locale_keys.g.dart';
|
||||
import 'package:appflowy/mobile/presentation/bottom_sheet/bottom_sheet.dart';
|
||||
import 'package:appflowy/plugins/document/application/prelude.dart';
|
||||
import 'package:appflowy/plugins/document/presentation/editor_plugins/actions/mobile_block_action_buttons.dart';
|
||||
import 'package:appflowy/plugins/document/presentation/editor_plugins/video/upload_video_menu.dart';
|
||||
import 'package:appflowy/workspace/presentation/home/toast.dart';
|
||||
import 'package:appflowy_editor/appflowy_editor.dart' hide Log, UploadImageMenu;
|
||||
import 'package:appflowy_editor_plugins/appflowy_editor_plugins.dart';
|
||||
import 'package:appflowy_popover/appflowy_popover.dart';
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flowy_infra_ui/flowy_infra_ui.dart';
|
||||
import 'package:flowy_infra_ui/style_widget/hover.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:string_validator/string_validator.dart';
|
||||
|
||||
class VideoPlaceholder extends StatefulWidget {
|
||||
const VideoPlaceholder({super.key, required this.node});
|
||||
|
||||
final Node node;
|
||||
|
||||
@override
|
||||
State<VideoPlaceholder> createState() => VideoPlaceholderState();
|
||||
}
|
||||
|
||||
class VideoPlaceholderState extends State<VideoPlaceholder> {
|
||||
final controller = PopoverController();
|
||||
final documentService = DocumentService();
|
||||
late final editorState = context.read<EditorState>();
|
||||
|
||||
bool showLoading = false;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final Widget child = DecoratedBox(
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).colorScheme.surfaceContainerHighest,
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
),
|
||||
child: FlowyHover(
|
||||
style: HoverStyle(borderRadius: BorderRadius.circular(4)),
|
||||
child: SizedBox(
|
||||
height: 52,
|
||||
child: Row(
|
||||
children: [
|
||||
const HSpace(10),
|
||||
const Icon(Icons.featured_video_outlined, size: 24),
|
||||
const HSpace(10),
|
||||
FlowyText(LocaleKeys.document_plugins_video_emptyLabel.tr()),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
if (PlatformExtension.isDesktopOrWeb) {
|
||||
return AppFlowyPopover(
|
||||
controller: controller,
|
||||
direction: PopoverDirection.bottomWithCenterAligned,
|
||||
constraints: const BoxConstraints(
|
||||
maxWidth: 540,
|
||||
maxHeight: 360,
|
||||
minHeight: 80,
|
||||
),
|
||||
clickHandler: PopoverClickHandler.gestureDetector,
|
||||
popupBuilder: (_) => UploadVideoMenu(
|
||||
onUrlSubmitted: (url) {
|
||||
controller.close();
|
||||
WidgetsBinding.instance.addPostFrameCallback(
|
||||
(_) async => updateSrc(url),
|
||||
);
|
||||
},
|
||||
),
|
||||
child: child,
|
||||
);
|
||||
} else {
|
||||
return MobileBlockActionButtons(
|
||||
node: widget.node,
|
||||
editorState: editorState,
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
editorState.updateSelectionWithReason(null, extraInfo: {});
|
||||
showUploadVideoMenu();
|
||||
},
|
||||
child: child,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
void showUploadVideoMenu() {
|
||||
if (PlatformExtension.isDesktopOrWeb) {
|
||||
controller.show();
|
||||
} else {
|
||||
showMobileBottomSheet(
|
||||
context,
|
||||
title: LocaleKeys.document_plugins_video_label.tr(),
|
||||
showHeader: true,
|
||||
showCloseButton: true,
|
||||
showDragHandle: true,
|
||||
builder: (context) => Container(
|
||||
margin: const EdgeInsets.only(top: 12.0),
|
||||
constraints: const BoxConstraints(
|
||||
maxHeight: 340,
|
||||
minHeight: 80,
|
||||
),
|
||||
child: UploadVideoMenu(
|
||||
onUrlSubmitted: (url) async {
|
||||
context.pop();
|
||||
await updateSrc(url);
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> updateSrc(String url) async {
|
||||
if (url.isEmpty || !isURL(url)) {
|
||||
// show error
|
||||
showSnackBarMessage(
|
||||
context,
|
||||
LocaleKeys.document_imageBlock_error_invalidImage.tr(),
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
final transaction = editorState.transaction;
|
||||
transaction.updateNode(widget.node, {
|
||||
VideoBlockKeys.url: url,
|
||||
});
|
||||
await editorState.apply(transaction);
|
||||
}
|
||||
}
|
@ -61,10 +61,11 @@ packages:
|
||||
appflowy_editor_plugins:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: appflowy_editor_plugins
|
||||
sha256: "46c899acc22245798e5beed255852455d9d85c3fae8b275ef4db257810b1c59d"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
path: "packages/appflowy_editor_plugins"
|
||||
ref: "87af520732deae1138c12a4c33a62ae56b2aa81f"
|
||||
resolved-ref: "87af520732deae1138c12a4c33a62ae56b2aa81f"
|
||||
url: "https://github.com/AppFlowy-IO/AppFlowy-plugins.git"
|
||||
source: git
|
||||
version: "0.0.6"
|
||||
appflowy_popover:
|
||||
dependency: "direct main"
|
||||
@ -940,14 +941,6 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "4.0.2"
|
||||
image:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: image
|
||||
sha256: "4c68bfd5ae83e700b5204c1e74451e7bf3cf750e6843c6e158289cf56bda018e"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "4.1.7"
|
||||
image_gallery_saver:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@ -1225,78 +1218,6 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.8.0"
|
||||
media_kit:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: media_kit
|
||||
sha256: "3289062540e3b8b9746e5c50d95bd78a9289826b7227e253dff806d002b9e67a"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.1.10+1"
|
||||
media_kit_libs_android_video:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: media_kit_libs_android_video
|
||||
sha256: "9dd8012572e4aff47516e55f2597998f0a378e3d588d0fad0ca1f11a53ae090c"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.3.6"
|
||||
media_kit_libs_ios_video:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: media_kit_libs_ios_video
|
||||
sha256: b5382994eb37a4564c368386c154ad70ba0cc78dacdd3fb0cd9f30db6d837991
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.1.4"
|
||||
media_kit_libs_linux:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: media_kit_libs_linux
|
||||
sha256: e186891c31daa6bedab4d74dcdb4e8adfccc7d786bfed6ad81fe24a3b3010310
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.1.3"
|
||||
media_kit_libs_macos_video:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: media_kit_libs_macos_video
|
||||
sha256: f26aa1452b665df288e360393758f84b911f70ffb3878032e1aabba23aa1032d
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.1.4"
|
||||
media_kit_libs_video:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: media_kit_libs_video
|
||||
sha256: "3688e0c31482074578652bf038ce6301a5d21e1eda6b54fc3117ffeb4bdba067"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.0.4"
|
||||
media_kit_libs_windows_video:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: media_kit_libs_windows_video
|
||||
sha256: "7bace5f35d9afcc7f9b5cdadb7541d2191a66bb3fc71bfa11c1395b3360f6122"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.0.9"
|
||||
media_kit_native_event_loop:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: media_kit_native_event_loop
|
||||
sha256: a605cf185499d14d58935b8784955a92a4bf0ff4e19a23de3d17a9106303930e
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.0.8"
|
||||
media_kit_video:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: media_kit_video
|
||||
sha256: c048d11a19e379aebbe810647636e3fc6d18374637e2ae12def4ff8a4b99a882
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.2.4"
|
||||
meta:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -1689,14 +1610,6 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.27.7"
|
||||
safe_local_storage:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: safe_local_storage
|
||||
sha256: ede4eb6cb7d88a116b3d3bf1df70790b9e2038bc37cb19112e381217c74d9440
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.0.2"
|
||||
scaled_app:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@ -1705,54 +1618,6 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.3.0"
|
||||
screen_brightness:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: screen_brightness
|
||||
sha256: ed8da4a4511e79422fc1aa88138e920e4008cd312b72cdaa15ccb426c0faaedd
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.2.2+1"
|
||||
screen_brightness_android:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: screen_brightness_android
|
||||
sha256: "3df10961e3a9e968a5e076fe27e7f4741fa8a1d3950bdeb48cf121ed529d0caf"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.1.0+2"
|
||||
screen_brightness_ios:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: screen_brightness_ios
|
||||
sha256: "99adc3ca5490b8294284aad5fcc87f061ad685050e03cf45d3d018fe398fd9a2"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.1.0"
|
||||
screen_brightness_macos:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: screen_brightness_macos
|
||||
sha256: "64b34e7e3f4900d7687c8e8fb514246845a73ecec05ab53483ed025bd4a899fd"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.1.0+1"
|
||||
screen_brightness_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: screen_brightness_platform_interface
|
||||
sha256: b211d07f0c96637a15fb06f6168617e18030d5d74ad03795dd8547a52717c171
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.1.0"
|
||||
screen_brightness_windows:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: screen_brightness_windows
|
||||
sha256: "9261bf33d0fc2707d8cf16339ce25768100a65e70af0fcabaf032fc12408ba86"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.1.3"
|
||||
screen_retriever:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -2216,14 +2081,6 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.2.0"
|
||||
uri_parser:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: uri_parser
|
||||
sha256: "6543c9fd86d2862fac55d800a43e67c0dcd1a41677cb69c2f8edfe73bbcf1835"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.0.2"
|
||||
url_launcher:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@ -2361,30 +2218,6 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "14.2.1"
|
||||
volume_controller:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: volume_controller
|
||||
sha256: "189bdc7a554f476b412e4c8b2f474562b09d74bc458c23667356bce3ca1d48c9"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.0.7"
|
||||
wakelock_plus:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: wakelock_plus
|
||||
sha256: "104d94837bb28c735894dcd592877e990149c380e6358b00c04398ca1426eed4"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.2.1"
|
||||
wakelock_plus_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: wakelock_plus_platform_interface
|
||||
sha256: "422d1cdbb448079a8a62a5a770b69baa489f8f7ca21aef47800c726d404f9d16"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.2.1"
|
||||
watcher:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -47,10 +47,8 @@ dependencies:
|
||||
ref: 8a6434ae3d02624b614a010af80f775db11bf22e
|
||||
appflowy_result:
|
||||
path: packages/appflowy_result
|
||||
appflowy_editor_plugins: ^0.0.6
|
||||
|
||||
appflowy_editor_plugins:
|
||||
appflowy_editor:
|
||||
|
||||
appflowy_popover:
|
||||
path: packages/appflowy_popover
|
||||
|
||||
@ -185,6 +183,12 @@ dependency_overrides:
|
||||
url: https://github.com/AppFlowy-IO/appflowy-editor.git
|
||||
ref: "0c79b870586f4bc5c23b61b327c51fe6a8856b47"
|
||||
|
||||
appflowy_editor_plugins:
|
||||
git:
|
||||
url: https://github.com/AppFlowy-IO/AppFlowy-plugins.git
|
||||
path: "packages/appflowy_editor_plugins"
|
||||
ref: "87af520732deae1138c12a4c33a62ae56b2aa81f"
|
||||
|
||||
sheet:
|
||||
git:
|
||||
url: https://github.com/jamesblasco/modal_bottom_sheet
|
||||
|
Loading…
Reference in New Issue
Block a user