parent
f6e6a18a30
commit
9f84109951
31 changed files with 2017 additions and 18 deletions
@ -0,0 +1,29 @@ |
|||||||
|
# Miscellaneous |
||||||
|
*.class |
||||||
|
*.log |
||||||
|
*.pyc |
||||||
|
*.swp |
||||||
|
.DS_Store |
||||||
|
.atom/ |
||||||
|
.buildlog/ |
||||||
|
.history |
||||||
|
.svn/ |
||||||
|
migrate_working_dir/ |
||||||
|
|
||||||
|
# IntelliJ related |
||||||
|
*.iml |
||||||
|
*.ipr |
||||||
|
*.iws |
||||||
|
.idea/ |
||||||
|
|
||||||
|
# The .vscode folder contains launch configuration and tasks you configure in |
||||||
|
# VS Code which you may wish to be included in version control, so this line |
||||||
|
# is commented out by default. |
||||||
|
#.vscode/ |
||||||
|
|
||||||
|
# Flutter/Dart/Pub related |
||||||
|
# Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock. |
||||||
|
/pubspec.lock |
||||||
|
**/doc/api/ |
||||||
|
.dart_tool/ |
||||||
|
build/ |
@ -0,0 +1,10 @@ |
|||||||
|
# This file tracks properties of this Flutter project. |
||||||
|
# Used by Flutter tool to assess capabilities and perform upgrades etc. |
||||||
|
# |
||||||
|
# This file should be version controlled and should not be manually edited. |
||||||
|
|
||||||
|
version: |
||||||
|
revision: "78666c8dc57e9f7548ca9f8dd0740fbf0c658dc9" |
||||||
|
channel: "stable" |
||||||
|
|
||||||
|
project_type: package |
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,21 @@ |
|||||||
|
MIT License |
||||||
|
|
||||||
|
Copyright (c) 2023 Flutter Quill Team |
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy |
||||||
|
of this software and associated documentation files (the "Software"), to deal |
||||||
|
in the Software without restriction, including without limitation the rights |
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
||||||
|
copies of the Software, and to permit persons to whom the Software is |
||||||
|
furnished to do so, subject to the following conditions: |
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all |
||||||
|
copies or substantial portions of the Software. |
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
||||||
|
SOFTWARE. |
@ -0,0 +1,34 @@ |
|||||||
|
# Flutter Quill Pdf |
||||||
|
A extension for [flutter_quill](https://pub.dev/packages/flutter_quill) package to add support for dealing with conversion to Pdf |
||||||
|
|
||||||
|
It uses [quill_html_converter](https://pub.dev/packages/quill_html_converter) package to convert the the delta to Html and [htmltopdfwidgets](https://pub.dev/packages/htmltopdfwidgets) to convert the Html to Pdf |
||||||
|
|
||||||
|
This library is **experimental** and the support might be dropped at anytime. |
||||||
|
|
||||||
|
## Features |
||||||
|
|
||||||
|
```markdown |
||||||
|
- Easy to use |
||||||
|
- Support Flutter Quill package |
||||||
|
``` |
||||||
|
|
||||||
|
## Getting started |
||||||
|
|
||||||
|
```yaml |
||||||
|
dependencies: |
||||||
|
quill_pdf_converter: ^<latest-version-here> |
||||||
|
``` |
||||||
|
|
||||||
|
## Usage |
||||||
|
|
||||||
|
First, you need to [setup](../README.md#usage) the `flutter_quill` first |
||||||
|
|
||||||
|
Then you can simply convert to PDF |
||||||
|
|
||||||
|
```dart |
||||||
|
import 'package:quill_pdf_converter/quill_pdf_converter.dart'; |
||||||
|
|
||||||
|
// Convert Delta to Pdf |
||||||
|
final pdfWidgets = _controller.document.toDelta().toPdf(); |
||||||
|
|
||||||
|
``` |
@ -0,0 +1,36 @@ |
|||||||
|
include: package:flutter_lints/flutter.yaml |
||||||
|
|
||||||
|
analyzer: |
||||||
|
errors: |
||||||
|
undefined_prefixed_name: ignore |
||||||
|
unsafe_html: ignore |
||||||
|
linter: |
||||||
|
rules: |
||||||
|
always_declare_return_types: true |
||||||
|
always_put_required_named_parameters_first: true |
||||||
|
annotate_overrides: true |
||||||
|
avoid_empty_else: true |
||||||
|
avoid_escaping_inner_quotes: true |
||||||
|
avoid_print: true |
||||||
|
avoid_redundant_argument_values: true |
||||||
|
avoid_types_on_closure_parameters: true |
||||||
|
avoid_void_async: true |
||||||
|
cascade_invocations: true |
||||||
|
directives_ordering: true |
||||||
|
omit_local_variable_types: true |
||||||
|
prefer_const_constructors: true |
||||||
|
prefer_const_constructors_in_immutables: true |
||||||
|
prefer_const_declarations: true |
||||||
|
prefer_final_fields: true |
||||||
|
prefer_final_in_for_each: true |
||||||
|
prefer_final_locals: true |
||||||
|
prefer_initializing_formals: true |
||||||
|
prefer_int_literals: true |
||||||
|
prefer_interpolation_to_compose_strings: true |
||||||
|
prefer_relative_imports: true |
||||||
|
prefer_single_quotes: true |
||||||
|
sort_constructors_first: true |
||||||
|
sort_unnamed_constructors_first: true |
||||||
|
unnecessary_lambdas: true |
||||||
|
unnecessary_parenthesis: true |
||||||
|
unnecessary_string_interpolations: true |
@ -0,0 +1,20 @@ |
|||||||
|
library quill_pdf_converter; |
||||||
|
|
||||||
|
import 'package:dart_quill_delta/dart_quill_delta.dart'; |
||||||
|
import 'package:htmltopdfwidgets/htmltopdfwidgets.dart'; |
||||||
|
import 'package:pdf/widgets.dart' as pw; |
||||||
|
import 'package:quill_html_converter/quill_html_converter.dart'; |
||||||
|
|
||||||
|
/// Extension on [Delta] to add extra functions for converting to Pdf |
||||||
|
extension DeltaPdfExt on Delta { |
||||||
|
/// First convert to Html then to Pdf |
||||||
|
Future<List<pw.Widget>> toPdf() async { |
||||||
|
final html = toHtml(); |
||||||
|
return HTMLToPdf().convert( |
||||||
|
html, |
||||||
|
fontFallback: [ |
||||||
|
pw.Font.symbol(), |
||||||
|
], |
||||||
|
); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,33 @@ |
|||||||
|
name: quill_pdf_converter |
||||||
|
description: A extension for flutter_quill package to add support for dealing with conversion to pdf |
||||||
|
version: 9.1.0 |
||||||
|
homepage: https://github.com/singerdmx/flutter-quill/tree/master/quill_pdf_converter/ |
||||||
|
repository: https://github.com/singerdmx/flutter-quill/tree/master/quill_pdf_converter/ |
||||||
|
issue_tracker: https://github.com/singerdmx/flutter-quill/issues/ |
||||||
|
documentation: https://github.com/singerdmx/flutter-quill/tree/master/quill_pdf_converter/ |
||||||
|
|
||||||
|
topics: |
||||||
|
- ui |
||||||
|
- widgets |
||||||
|
- widget |
||||||
|
- rich-text-editor |
||||||
|
- quill |
||||||
|
|
||||||
|
environment: |
||||||
|
sdk: '>=3.2.3 <4.0.0' |
||||||
|
flutter: ">=1.17.0" |
||||||
|
|
||||||
|
dependencies: |
||||||
|
flutter: |
||||||
|
sdk: flutter |
||||||
|
dart_quill_delta: ^0.0.1 |
||||||
|
quill_html_converter: ^9.1.0 |
||||||
|
pdf: ^3.10.7 |
||||||
|
htmltopdfwidgets: ^0.0.9+2 |
||||||
|
|
||||||
|
dev_dependencies: |
||||||
|
flutter_test: |
||||||
|
sdk: flutter |
||||||
|
flutter_lints: ^3.0.1 |
||||||
|
|
||||||
|
flutter: |
@ -0,0 +1,5 @@ |
|||||||
|
dependency_overrides: |
||||||
|
dart_quill_delta: |
||||||
|
path: ../dart_quill_delta |
||||||
|
quill_html_converter: |
||||||
|
path: ../quill_html_converter |
@ -0,0 +1,7 @@ |
|||||||
|
import 'package:flutter_test/flutter_test.dart'; |
||||||
|
|
||||||
|
void main() { |
||||||
|
test('No tests for now', () { |
||||||
|
expect(true, true); |
||||||
|
}); |
||||||
|
} |
@ -1,5 +1,7 @@ |
|||||||
#!/usr/bin/env bash |
#!/usr/bin/env bash |
||||||
flutter pub get |
flutter pub get |
||||||
|
(cd dart_quill_delta && flutter pub get) |
||||||
(cd flutter_quill_extensions && flutter pub get) |
(cd flutter_quill_extensions && flutter pub get) |
||||||
(cd flutter_quill_test && flutter pub get) |
(cd flutter_quill_test && flutter pub get) |
||||||
(cd quill_html_converter && flutter pub get) |
(cd quill_html_converter && flutter pub get) |
||||||
|
(cd quill_pdf_converter && flutter pub get) |
||||||
|
Loading…
Reference in new issue