Add base64 support in image import (#41)

pull/51/head
Rishi Raj Singh 4 years ago committed by GitHub
parent ae8f1a396b
commit fe01f66b61
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      app/android/settings_aar.gradle
  2. 11
      app/pubspec.lock
  3. 15
      lib/widgets/editor.dart
  4. 9
      pubspec.lock
  5. 2
      pubspec.yaml

@ -145,7 +145,7 @@ packages:
path: ".."
relative: true
source: path
version: "0.3.2"
version: "0.3.3"
flutter_test:
dependency: "direct dev"
description: flutter
@ -321,7 +321,7 @@ packages:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.0"
version: "1.8.1"
stack_trace:
dependency: transitive
description:
@ -343,6 +343,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
string_validator:
dependency: transitive
description:
name: string_validator
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.4"
term_glyph:
dependency: transitive
description:

@ -1,3 +1,4 @@
import 'dart:convert';
import 'dart:io' as io;
import 'dart:math' as math;
@ -19,6 +20,7 @@ import 'package:flutter_quill/widgets/image.dart';
import 'package:flutter_quill/widgets/raw_editor.dart';
import 'package:flutter_quill/widgets/responsive_widget.dart';
import 'package:flutter_quill/widgets/text_selection.dart';
import 'package:string_validator/string_validator.dart';
import 'package:universal_html/prefer_universal/html.dart' as html;
import 'package:url_launcher/url_launcher.dart';
@ -407,9 +409,16 @@ class _QuillEditorSelectionGestureDetectorBuilder
getEditor().context,
MaterialPageRoute(
builder: (context) => ImageTapWrapper(
imageProvider: imageUrl.startsWith('http')
? NetworkImage(imageUrl)
: FileImage(io.File(blockEmbed.data))),
imageProvider: imageUrl.startsWith('http')
? NetworkImage(imageUrl)
: (isBase64(imageUrl))
? Image.memory(
base64.decode(imageUrl),
)
: FileImage(
io.File(blockEmbed.data),
),
),
),
);
}

@ -244,7 +244,7 @@ packages:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.0"
version: "1.8.1"
stack_trace:
dependency: transitive
description:
@ -266,6 +266,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
string_validator:
dependency: "direct main"
description:
name: string_validator
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.4"
term_glyph:
dependency: transitive
description:

@ -22,8 +22,10 @@ dependencies:
photo_view: ^0.10.3
universal_html: ^1.2.1
file_picker: ^2.1.6
string_validator: ^0.1.4
flutter_keyboard_visibility: ^4.0.4
dev_dependencies:
flutter_test:
sdk: flutter

Loading…
Cancel
Save