|
|
|
@ -43,6 +43,25 @@ Widget defaultEmbedBuilder( |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// We provide option menu only for mobile platform excluding base64 image |
|
|
|
|
return _menuOptionsForReadonlyImage(context, imageUrl, image); |
|
|
|
|
case 'video': |
|
|
|
|
final videoUrl = node.value.data; |
|
|
|
|
if (videoUrl.contains('youtube.com') || videoUrl.contains('youtu.be')) { |
|
|
|
|
return YoutubeVideoApp( |
|
|
|
|
videoUrl: videoUrl, context: context, readOnly: readOnly); |
|
|
|
|
} |
|
|
|
|
return VideoApp(videoUrl: videoUrl, context: context, readOnly: readOnly); |
|
|
|
|
default: |
|
|
|
|
throw UnimplementedError( |
|
|
|
|
'Embeddable type "${node.value.type}" is not supported by default ' |
|
|
|
|
'embed builder of QuillEditor. You must pass your own builder function ' |
|
|
|
|
'to embedBuilder property of QuillEditor or QuillField widgets.', |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
GestureDetector _menuOptionsForReadonlyImage( |
|
|
|
|
BuildContext context, String imageUrl, image) { |
|
|
|
|
return GestureDetector( |
|
|
|
|
onTap: () { |
|
|
|
|
showDialog( |
|
|
|
@ -51,8 +70,7 @@ Widget defaultEmbedBuilder( |
|
|
|
|
padding: const EdgeInsets.fromLTRB(50, 0, 50, 0), |
|
|
|
|
child: SimpleDialog( |
|
|
|
|
shape: const RoundedRectangleBorder( |
|
|
|
|
borderRadius: |
|
|
|
|
BorderRadius.all(Radius.circular(10))), |
|
|
|
|
borderRadius: BorderRadius.all(Radius.circular(10))), |
|
|
|
|
children: [ |
|
|
|
|
_SimpleDialogItem( |
|
|
|
|
icon: Icons.save, |
|
|
|
@ -73,28 +91,14 @@ Widget defaultEmbedBuilder( |
|
|
|
|
Navigator.push( |
|
|
|
|
context, |
|
|
|
|
MaterialPageRoute( |
|
|
|
|
builder: (context) => ImageTapWrapper( |
|
|
|
|
imageUrl: imageUrl))); |
|
|
|
|
builder: (context) => |
|
|
|
|
ImageTapWrapper(imageUrl: imageUrl))); |
|
|
|
|
}, |
|
|
|
|
) |
|
|
|
|
]), |
|
|
|
|
)); |
|
|
|
|
}, |
|
|
|
|
child: image); |
|
|
|
|
case 'video': |
|
|
|
|
final videoUrl = node.value.data; |
|
|
|
|
if (videoUrl.contains('youtube.com') || videoUrl.contains('youtu.be')) { |
|
|
|
|
return YoutubeVideoApp( |
|
|
|
|
videoUrl: videoUrl, context: context, readOnly: readOnly); |
|
|
|
|
} |
|
|
|
|
return VideoApp(videoUrl: videoUrl, context: context, readOnly: readOnly); |
|
|
|
|
default: |
|
|
|
|
throw UnimplementedError( |
|
|
|
|
'Embeddable type "${node.value.type}" is not supported by default ' |
|
|
|
|
'embed builder of QuillEditor. You must pass your own builder function ' |
|
|
|
|
'to embedBuilder property of QuillEditor or QuillField widgets.', |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
class _SimpleDialogItem extends StatelessWidget { |
|
|
|
|