Upgrade to 3.9.9

pull/652/head
X Code 3 years ago
parent 076eaf75b5
commit ac933e07fb
  1. 3
      CHANGELOG.md
  2. 21
      lib/src/widgets/embeds/default_embed_builder.dart
  3. 29
      lib/src/widgets/embeds/image.dart
  4. 2
      pubspec.yaml

@ -1,3 +1,6 @@
# [3.9.9]
* iOS: Save image whose filename does not end with image file extension.
# [3.9.8] # [3.9.8]
* Added Urdu translation. * Added Urdu translation.

@ -162,26 +162,7 @@ Widget _menuOptionsForReadonlyImage(
color: Colors.greenAccent, color: Colors.greenAccent,
text: 'Save'.i18n, text: 'Save'.i18n,
onPressed: () { onPressed: () {
const List<String> imageFormats = [ imageUrl = appendFileExtensionToImageUrl(imageUrl);
'.jpeg',
'.png',
'.jpg',
'.gif',
'.webp',
'.tif',
'.heic'
];
List endsWithFormats = imageFormats.where((imageFormat) => imageUrl.toLowerCase().endsWith(imageFormat)).toList();
if (endsWithFormats.length == 0) {
for(int i = 0; i < imageFormats.length; i++) {
if (imageUrl.toLowerCase().contains(imageFormats[i])) {
imageUrl += imageFormats[i];
break;
}
}
}
GallerySaver.saveImage(imageUrl).then((_) { GallerySaver.saveImage(imageUrl).then((_) {
ScaffoldMessenger.of(context) ScaffoldMessenger.of(context)
.showSnackBar(SnackBar(content: Text('Saved'.i18n))); .showSnackBar(SnackBar(content: Text('Saved'.i18n)));

@ -12,6 +12,16 @@ import '../../models/documents/nodes/leaf.dart';
import '../../models/documents/style.dart'; import '../../models/documents/style.dart';
import '../controller.dart'; import '../controller.dart';
const List<String> imageFileExtensions = [
'.jpeg',
'.png',
'.jpg',
'.gif',
'.webp',
'.tif',
'.heic'
];
bool isImageBase64(String imageUrl) { bool isImageBase64(String imageUrl) {
return !imageUrl.startsWith('http') && isBase64(imageUrl); return !imageUrl.startsWith('http') && isBase64(imageUrl);
} }
@ -64,6 +74,25 @@ String standardizeImageUrl(String url) {
return url; return url;
} }
/// This is a bug of Gallery Saver Package.
/// It can not save image that's filename does not end with it's file extension
/// like below.
// "https://firebasestorage.googleapis.com/v0/b/eventat-4ba96.appspot.com/o/2019-Metrology-Events.jpg?alt=media&token=bfc47032-5173-4b3f-86bb-9659f46b362a"
/// If imageUrl does not end with it's file extension,
/// file extension is added to image url for saving.
String appendFileExtensionToImageUrl(String url) {
final endsWithImageFileExtension = imageFileExtensions
.firstWhere((s) => url.toLowerCase().endsWith(s), orElse: () => '');
if (endsWithImageFileExtension.isNotEmpty) {
return url;
}
final imageFileExtension = imageFileExtensions
.firstWhere((s) => url.toLowerCase().contains(s), orElse: () => '');
return url + imageFileExtension;
}
class ImageTapWrapper extends StatelessWidget { class ImageTapWrapper extends StatelessWidget {
const ImageTapWrapper({ const ImageTapWrapper({
required this.imageUrl, required this.imageUrl,

@ -1,6 +1,6 @@
name: flutter_quill name: flutter_quill
description: A rich text editor supporting mobile and web (Demo App @ bulletjournal.us) description: A rich text editor supporting mobile and web (Demo App @ bulletjournal.us)
version: 3.9.8 version: 3.9.9
#author: bulletjournal #author: bulletjournal
homepage: https://bulletjournal.us/home/index.html homepage: https://bulletjournal.us/home/index.html
repository: https://github.com/singerdmx/flutter-quill repository: https://github.com/singerdmx/flutter-quill

Loading…
Cancel
Save