From 9ac35562de51d6528061dfd99ced5a60af616cf8 Mon Sep 17 00:00:00 2001 From: singerdmx Date: Tue, 15 Dec 2020 19:40:04 -0800 Subject: [PATCH] Add attribute class --- lib/models/documents/attribute.dart | 28 ++++++++++++++++++++++++++++ pubspec.lock | 4 ++-- pubspec.yaml | 2 ++ 3 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 lib/models/documents/attribute.dart diff --git a/lib/models/documents/attribute.dart b/lib/models/documents/attribute.dart new file mode 100644 index 00000000..5351ae77 --- /dev/null +++ b/lib/models/documents/attribute.dart @@ -0,0 +1,28 @@ +enum AttributeScope { + INLINE, // refer to https://quilljs.com/docs/formats/#inline + BLOCK, // refer to https://quilljs.com/docs/formats/#block + EMBEDS, // refer to https://quilljs.com/docs/formats/#embeds +} + +class Attribute { + final String key; + final AttributeScope scope; + + Attribute(this.key, this.scope); +} + +class BoldAttribute extends Attribute { + BoldAttribute() : super('bold', AttributeScope.INLINE); +} + +class ItalicAttribute extends Attribute { + ItalicAttribute() : super('italic', AttributeScope.INLINE); +} + +class UnderlineAttribute extends Attribute { + UnderlineAttribute() : super('underline', AttributeScope.INLINE); +} + +class StrikeThroughAttribute extends Attribute { + StrikeThroughAttribute() : super('strike', AttributeScope.INLINE); +} diff --git a/pubspec.lock b/pubspec.lock index 35d1060d..e38e158f 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -37,7 +37,7 @@ packages: source: hosted version: "1.1.0-nullsafety.1" collection: - dependency: transitive + dependency: "direct main" description: name: collection url: "https://pub.dartlang.org" @@ -89,7 +89,7 @@ packages: source: hosted version: "2.0.0" quiver_hashcode: - dependency: transitive + dependency: "direct main" description: name: quiver_hashcode url: "https://pub.dartlang.org" diff --git a/pubspec.yaml b/pubspec.yaml index 3110f34b..bbded11c 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -13,6 +13,8 @@ dependencies: flutter: sdk: flutter quill_delta: ^2.0.0 + quiver_hashcode: ^2.0.0 + collection: ^1.14.13 dev_dependencies: flutter_test: